当前位置: 首页>>代码示例>>Java>>正文


Java ICProjectDescription类代码示例

本文整理汇总了Java中org.eclipse.cdt.core.settings.model.ICProjectDescription的典型用法代码示例。如果您正苦于以下问题:Java ICProjectDescription类的具体用法?Java ICProjectDescription怎么用?Java ICProjectDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ICProjectDescription类属于org.eclipse.cdt.core.settings.model包,在下文中一共展示了ICProjectDescription类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: modifyProjectEnvironmentVariables

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
public void modifyProjectEnvironmentVariables(final Map<String, String> environmentAdd) {
    if (project!=null){
        IContributedEnvironment ice = CCorePlugin.getDefault().getBuildEnvironmentManager()
                .getContributedEnvironment();
        //we assume that the project is CDT
        ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(project, true); 
        ICConfigurationDescription cfgd = prjd.getActiveConfiguration();
        for(String key : environmentAdd.keySet()) {
            if(key.equals("PATH")) {
                ice.addVariable(key, environmentAdd.get(key), IEnvironmentVariable.ENVVAR_PREPEND,"", cfgd);
            } else {
                ice.addVariable(key, environmentAdd.get(key), IEnvironmentVariable.ENVVAR_REPLACE,"", cfgd);
            }
        }
        try {
            CoreModel.getDefault().setProjectDescription(project, prjd);
        } catch (CoreException e) {
            Logger.log(IStatus.ERROR, "" + e);
            Logger.log(IStatus.INFO, "" + e.getStackTrace());
        }
    }
}
 
开发者ID:Ericsson,项目名称:CodeCheckerEclipsePlugin,代码行数:23,代码来源:CcConfiguration.java

示例2: setIncludePaths

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
public static void setIncludePaths(IProject project, List<String> includePaths) {
	configureIndexerToIncludeAllReferencedHeaders(project);
	
	ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project);
	ICLanguageSettingEntry[] entries = IncludePathString2ICLanguageSettingEntryArray(includePaths);
	
	// Set include paths for all configurations in the CDT project
	for(ICConfigurationDescription confDesc : projectDescription.getConfigurations()) {
		IConfiguration configuration = ManagedBuildManager.getConfigurationForDescription(confDesc);
		CConfigurationData Cconfigdata = configuration.getConfigurationData();
        CFolderData rootFolderData = Cconfigdata.getRootFolderData();
        CLanguageData[] languageDatas = rootFolderData.getLanguageDatas();
        
        for(CLanguageData languageData : languageDatas) {
        	languageData.setEntries(ICLanguageSettingEntry.INCLUDE_PATH, entries);
        }
	}
	
	try {
		CoreModel.getDefault().setProjectDescription(project, projectDescription);
	} catch (CoreException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:ffmmjj,项目名称:uefi_edk2_wizards_plugin,代码行数:26,代码来源:ProjectSettingsManager.java

示例3: ConfigureProjectNature

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
private static void ConfigureProjectNature(IProject project) throws CoreException {
	// Set up build information
	ICProjectDescriptionManager pdMgr = CoreModel.getDefault().getProjectDescriptionManager();
	ICProjectDescription cProjDesc = pdMgr.createProjectDescription(project, false);
	ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
	ManagedProject mProj = new ManagedProject(cProjDesc);
	info.setManagedProject(mProj);

	CfgHolder cfgHolder = new CfgHolder(null, null);
	String s = "0";
	Configuration config = new Configuration(mProj, (ToolChain)null, ManagedBuildManager.calculateChildId(s, null), cfgHolder.getName());
	IBuilder builder = config.getEditableBuilder();
	builder.setManagedBuildOn(false);
	CConfigurationData data = config.getConfigurationData();
	cProjDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);

	pdMgr.setProjectDescription(project, cProjDesc);
}
 
开发者ID:ffmmjj,项目名称:uefi_edk2_wizards_plugin,代码行数:19,代码来源:ExistingEdk2ModuleProjectCreator.java

示例4: buildAllConfigurations

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
protected void buildAllConfigurations(final IProject project) {
	final ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(project, false);
	if (prjd != null) {
		final ICConfigurationDescription[] cfgDescriptions = prjd.getConfigurations();
		if (cfgDescriptions != null && cfgDescriptions.length > 0) {
			final IConfiguration[] cfgs = new IConfiguration[cfgDescriptions.length];
			for (int i=0; i < cfgDescriptions.length; ++i) {
				cfgs[i] = ManagedBuildManager.getConfigurationForDescription(cfgDescriptions[i]);
			}
			final Job job = new Job("Building all configurations") {

				@Override
				protected IStatus run(IProgressMonitor monitor) {
					try {
						ManagedBuildManager.buildConfigurations(cfgs, monitor);
					} catch (CoreException e) {
						return e.getStatus();
					}
					return Status.OK_STATUS;
				}
			};
			job.schedule();
			waitForJobs();
		}
	}		
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:27,代码来源:AbstractTestBuild.java

示例5: updateBuildPaths

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
private void updateBuildPaths(IProject project, IProgressMonitor monitor) throws CoreException {
	final IMavenProjectFacade facade = projectManager.getProject(project);
	if (facade != null) {
		final ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
		final ICProjectDescription des = mngr.getProjectDescription(project, true);
		if (des != null) {
			boolean changed = false;
			logger.debug("updateBuildPaths: project=" + project.getName());
			final ConfiguratorContext context = new ConfiguratorContext(MavenPlugin.getMaven(), projectManager);
			List<NarExecution> narExecutions = MavenUtils.buildCompileNarExecutions(context, facade, monitor);
			narExecutions.addAll(MavenUtils.buildTestCompileNarExecutions(context, facade, monitor));
			for (NarExecution narSettings : narExecutions) {
				if (!narSettings.isSkip()) {
					final String os = narSettings.getOS();
					final String linkerName = narSettings.getLinkerName();
					final AbstractSettingsSynchroniser synchro = SynchroniserFactory.getSettingsSynchroniser(os, linkerName);
					changed = updateCdtBuildPaths(des, synchro, narSettings);
				}
			}
			if (changed) {
				mngr.setProjectDescription(project, des);
			}
		}
	}
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:26,代码来源:BuildPathManager.java

示例6: updateCdtBuildPaths

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
private boolean updateCdtBuildPaths(final ICProjectDescription des, final SettingsSynchroniser synchro, final NarExecution narSettings)
		throws CoreException {
	boolean changed = false;
	for (NarBuildArtifact artifactSettings : narSettings.getArtifactSettings()) {
		final String configName = artifactSettings.getConfigName();
		final ICConfigurationDescription cfg = des.getConfigurationByName(configName);
		if (cfg != null) {
			logger.debug("updateBuildPaths: updating config " + configName);
			synchro.pathsOnlySync(cfg, artifactSettings);
			changed = true;
		} else {
			logger.debug("updateBuildPaths: could not find config " + configName);
		}
	}
	return changed;
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:17,代码来源:BuildPathManager.java

示例7: createConfiguration

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
private IConfiguration createConfiguration(IConfiguration cfg, IManagedProject proj, ICProjectDescription des) throws WriteAccessException, CoreException {
	String id = ManagedBuildManager.calculateChildId(cfg.getId(), null);
	// CProjectDescriptionManager.getInstance();
	Configuration config = new Configuration((ManagedProject) proj, (Configuration) cfg, id, false, true);
	CConfigurationData data = config.getConfigurationData();
	ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
	config.setConfigurationDescription(cfgDes);
	config.exportArtifactInfo();

	// Force internal builder
	IBuilder internalBuilder = ManagedBuildManager.getInternalBuilder();
	config.changeBuilder(internalBuilder, internalBuilder.getId(), internalBuilder.getName());

	// IBuilder bld = config.getEditableBuilder();
	// if (bld != null) { bld.setManagedBuildOn(true); }

	config.setName(cfg.getName());
	config.setArtifactName(proj.getDefaultArtifactName());

	return config;
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:22,代码来源:CProjectConfigurator.java

示例8: createBuildConfigurations

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
/**
 * @param cprojDesc
 * @return 
 */
private ICConfigurationDescription createBuildConfigurations(ICProjectDescription cprojDesc) throws CoreException {

	ManagedProject managedProject = new ManagedProject(cprojDesc);
	String configId = ManagedBuildManager.calculateChildId(CMAKE_TOOLCHAIN_ID, null);
	IToolChain cmakeToolChain = ManagedBuildManager.getExtensionToolChain(CMAKE_TOOLCHAIN_ID);
	org.eclipse.cdt.managedbuilder.internal.core.Configuration newConfig = new org.eclipse.cdt.managedbuilder.internal.core.Configuration(
			managedProject, (ToolChain) cmakeToolChain, configId, "debug");
	IToolChain newToolChain = newConfig.getToolChain();

	switch (Platform.getOS()) 
	{
		case "win32": {
			newConfig.getEditableBuilder().setCommand("mingw32-make.exe");
			break;
		}
		default: {
			newConfig.getEditableBuilder().setCommand("make");
			break;
		}
	}

	
	CConfigurationData data = newConfig.getConfigurationData();
	return cprojDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
}
 
开发者ID:rungemar,项目名称:cmake4cdt,代码行数:30,代码来源:CMakeProjectGenerator.java

示例9: configure

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
@Override
public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {

	final ConfiguratorContext context = new ConfiguratorContext(maven, projectManager);

	IProject project = request.getProject();

	monitor.setTaskName(Messages.CProjectConfigurator_task_name + project.getName());

	logger.info("configure");

	ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();

	// Set the first created configuration as active.
	boolean setActive = true;
	final IMavenProjectFacade facade = request.getMavenProjectFacade();
	List<NarExecution> narExecutions = MavenUtils.buildCompileNarExecutions(context, facade, monitor);
	narExecutions.addAll(MavenUtils.buildTestCompileNarExecutions(context, facade, monitor));
	for (NarExecution narSettings : narExecutions) {
		if (!narSettings.isSkip()) {
			final String os = narSettings.getOS();
			final String linkerName = narSettings.getLinkerName();
			final AbstractSettingsSynchroniser synchro = SynchroniserFactory.getSettingsSynchroniser(os, linkerName);
			final String toolchain = synchro.getToolchain();
			for (NarBuildArtifact artifactSettings : narSettings.getArtifactSettings()) {
				final String configName = artifactSettings.getConfigName();
				final String cdtArtefactType = CdtUtils.convertArtefactType(artifactSettings.getType());
				IToolChain tc = getToolChain(toolchain, cdtArtefactType);
				ICProjectDescription desc = getCdtProject(project, tc, cdtArtefactType, monitor);
				ICConfigurationDescription cfg = getCdtMavenConfig(project, desc, tc, cdtArtefactType, configName, setActive, monitor);
				setActive = false;
				synchro.fullSync(cfg, artifactSettings);
				mngr.setProjectDescription(project, desc);
			}
		}
	}

	AbstractProjectConfigurator jConfig = LifecycleMappingFactory.createProjectConfigurator(JAVA_CONFIGURATOR_ID);
	jConfig.configure(request, monitor);

	// ensure CDT builder is after the Maven one
	boolean changed = false;
	IProjectDescription description = project.getDescription();
	ICommand cdtBuilder = null;
	ICommand mavenBuilder = null;
	ArrayList<ICommand> newSpec = new ArrayList<ICommand>();
	for (ICommand command : description.getBuildSpec()) {
		if (ManagedCProjectNature.getBuilderID().equals(command.getBuilderName()) && mavenBuilder == null) {
			cdtBuilder = command;
		} else {
			newSpec.add(command);
		}
		if (IMavenConstants.BUILDER_ID.equals(command.getBuilderName())) {
			mavenBuilder = command;
			if (cdtBuilder != null) {
				newSpec.add(cdtBuilder);
				changed = true;
			}
		}
	}
	if (changed) {
		description.setBuildSpec(newSpec.toArray(new ICommand[newSpec.size()]));
		project.setDescription(description, monitor);
	}
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:66,代码来源:CProjectConfigurator.java

示例10: ToolchainSettings

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
public ToolchainSettings(IProject project) throws IllegalStateException {
	languageSettings = new LinkedList<ICLanguageSetting>();
	this.project = project;

	ICProjectDescription projectDescription = CoreModel.getDefault()
			.getProjectDescription(project);
	if (projectDescription == null) {
		throw new IllegalStateException("No valid CDT project given!");
	}

	activeConfiguration = projectDescription.getActiveConfiguration(); // or
																		// another
																		// config
	if (activeConfiguration == null) {
		throw new IllegalStateException(
				"No valid active configuration found!");
	}
	ICFolderDescription folderDescription = activeConfiguration
			.getRootFolderDescription(); // or use
	// getResourceDescription(IResource),
	// or pick one from
	// getFolderDescriptions()
	ICLanguageSetting[] allLanguageSettings = folderDescription
			.getLanguageSettings();

	// fetch the include settings from the first tool which supports c
	for (ICLanguageSetting languageSetting : allLanguageSettings) {
		String extensions[] = languageSetting.getSourceExtensions();
		for (String extension : extensions) {
			if (EXTENSION_CPP.equalsIgnoreCase(extension)) { //$NON-NLS-1$
				languageSettings.add(languageSetting);
			}
		}
	}

	root = ResourcesPlugin.getWorkspace().getRoot();
}
 
开发者ID:kwin,项目名称:cppcheclipse,代码行数:38,代码来源:ToolchainSettings.java

示例11: getCdtMavenConfig

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
private ICConfigurationDescription getCdtMavenConfig(IProject project, ICProjectDescription des, IToolChain tc, String artefactType, String name,
		boolean setActive, IProgressMonitor monitor) throws CoreException {
	IManagedProject mProj = ManagedBuildManager.getBuildInfo(project).getManagedProject();
	ICConfigurationDescription mavenCfg = des.getConfigurationByName(name);
	if (mavenCfg == null) {
		List<IConfiguration> cfgs = getCfgs(tc, artefactType);

		if (cfgs.isEmpty()) {
			throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Cannot find any configurations"));
		}
		monitor.worked(10);
		monitor.worked(10);
		// cfgs = CfgHolder.unique(cfgs);
		// cfgs = CfgHolder.reorder(cfgs);

		IConfiguration cfgRelease = null;
		IConfiguration cfgFirst = null;

		int work = 50 / cfgs.size();

		for (IConfiguration cfg : cfgs) {
			IBuildProperty b = cfg.getBuildProperties().getProperty(ManagedBuildManager.BUILD_TYPE_PROPERTY_ID);
			if (cfgRelease == null && b != null && b.getValue() != null && ManagedBuildManager.BUILD_TYPE_PROPERTY_RELEASE.equals(b.getValue().getId())) {
				cfgRelease = cfg;
			}
			if (cfgFirst == null) {
				cfgFirst = cfg;
			}
			monitor.worked(work);
		}
		if (cfgFirst != null) {
			if (cfgRelease != null) {
				cfgFirst = cfgRelease;
			}
			MavenNarPlugin.getDefault().log("Creating configuration " + name);
			IConfiguration newCfg = createConfiguration(cfgFirst, mProj, des);
			newCfg.setName(name);
			newCfg.setDescription("m2e generated configuration");
			mavenCfg = ManagedBuildManager.getDescriptionForConfiguration(newCfg);
		}
	}
	if (mavenCfg != null) {
		if (setActive) {
			des.setActiveConfiguration(mavenCfg);
		}
		return mavenCfg;
	} else {
		throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Cannot find any configurations"));
	}
	// mngr.setProjectDescription(project, des);
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:52,代码来源:CProjectConfigurator.java

示例12: setupProject

import org.eclipse.cdt.core.settings.model.ICProjectDescription; //导入依赖的package包/类
/**
 * @param monitor
 */
public void setupProject(IProgressMonitor monitor) throws CoreException {
	// Add CMake nature
	IProjectDescription projDesc = project.getDescription();
	boolean cmakeNatureAlreadyThere = false;
	String[] oldIds = projDesc.getNatureIds();

	for(int i=0; i < oldIds.length; i++) {
		if(oldIds[i].equals(CMakeProjectNature.CMAKE_NATURE_ID)) {
			cmakeNatureAlreadyThere = true;
		}
	}
	if(!cmakeNatureAlreadyThere) {
		String[] newIds = new String[oldIds.length + 1];
		System.arraycopy(oldIds, 0, newIds, 0, oldIds.length);
		newIds[newIds.length - 1] = CMakeProjectNature.CMAKE_NATURE_ID;
		projDesc.setNatureIds(newIds);
		project.setDescription(projDesc, monitor);
	}

	// create the CDT natures and build setup
	CCorePlugin.getDefault().createCDTProject(projDesc, project, monitor);
	CCorePlugin.getDefault().convertProjectFromCtoCC(project, monitor);
	
	ICProjectDescription cprojDesc = CCorePlugin.getDefault().createProjectDescription(project, false);
	ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
	ManagedProject mProj = new ManagedProject(cprojDesc);
	info.setManagedProject(mProj);

	createBuildConfigurations(cprojDesc);

	// Add CMake builder
	projDesc = project.getDescription();
	ICommand[] oldBuilders = projDesc.getBuildSpec();

	boolean genMakeBilderAlreadyThere = false;
	boolean cmakeBuilderAlreadyThere = false;
	int additionalBuilders = 2;
	for(int i=0; i < oldBuilders.length; i++) {
		if(oldBuilders[i].getBuilderName().equals(CMAKE_BUILDER_ID)) {
			cmakeBuilderAlreadyThere = true;
			additionalBuilders--;
		}
		if(oldBuilders[i].getBuilderName().equals(GEN_MAKE_BUILDER_ID)) {
			genMakeBilderAlreadyThere = true;
			additionalBuilders--;
		}
	}
	if(additionalBuilders < 0) {
		additionalBuilders = 0;
	}

	ICommand[] newBuilders = new ICommand[oldBuilders.length + additionalBuilders];
	
	if(!cmakeBuilderAlreadyThere) {
		ICommand cmakeBuilder = projDesc.newCommand();
		cmakeBuilder.setBuilderName(CMAKE_BUILDER_ID);
		cmakeBuilder.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true);
		cmakeBuilder.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, true);
		cmakeBuilder.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true);
		newBuilders[0] = cmakeBuilder;
	}
	
	if(!genMakeBilderAlreadyThere) {
		ICommand makeBuilder = projDesc.newCommand();
		makeBuilder.setBuilderName(GEN_MAKE_BUILDER_ID);
		makeBuilder.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true);
		makeBuilder.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, true);
		makeBuilder.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true);
		newBuilders[1] = makeBuilder;
	}		
	System.arraycopy(oldBuilders, 0, newBuilders, additionalBuilders, oldBuilders.length);
	
	projDesc.setBuildSpec(newBuilders);
	project.setDescription(projDesc, monitor);		

	CCorePlugin.getDefault().setProjectDescription(project, cprojDesc, true, monitor);
}
 
开发者ID:rungemar,项目名称:cmake4cdt,代码行数:81,代码来源:CMakeProjectGenerator.java


注:本文中的org.eclipse.cdt.core.settings.model.ICProjectDescription类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。