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


Java CoreModel类代码示例

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


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

示例1: generate

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的package包/类
/**
 * @see org.eclipse.tools.templates.freemarker.FMProjectGenerator#generate(java.util.Map,
 *      org.eclipse.core.runtime.IProgressMonitor)
 */
@Override
public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
	model.put("statechartName", this.statechartName); //$NON-NLS-1$
	model.put("srcFolder", this.srcFolderName); //$NON-NLS-1$
	model.put("srcGenFolder", this.srcGenFolderName); //$NON-NLS-1$
	model.put("timer", this.timer.getId()); //$NON-NLS-1$
	model.put("cyclePeriod", Integer.toString(this.cyclePeriod)); //$NON-NLS-1$

	final SubMonitor subMonitor = SubMonitor.convert(monitor, 100);

	super.generate(model, subMonitor.split(70));

	final IProject project = getProject();
	CoreModel.getDefault().create(project).setRawPathEntries(
			new IPathEntry[] { CoreModel.newSourceEntry(project.getFullPath()) }, subMonitor.split(10));

	createDiagram(subMonitor.split(20));
}
 
开发者ID:wendehals,项目名称:arduino_sct_tools,代码行数:23,代码来源:ArduinoSCTProjectGenerator.java

示例2: modifyProjectEnvironmentVariables

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的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

示例3: setIncludePaths

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的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

示例4: ConfigureProjectNature

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的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

示例5: buildAllConfigurations

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的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

示例6: updateBuildPaths

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的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

示例7: ToolchainSettings

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的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

示例8: doSetupProject

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的package包/类
private void doSetupProject(IProject project, IProgressMonitor monitor) throws CoreException, IOException {
	CommandBuilder builder = new CommandBuilder();
	appendEclipseProjectSetup(builder);
	appendArchitectureVariables(builder, ProjectSettingsAccessor.retrieveToolchain(project));
	appendBuildTypeVariables(builder, ProjectSettingsAccessor.retrieveBuildType(project));
	builder.append(Activator.getCmakeArgs());
	builder.execute(project);
	project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
	// now relink symbolic links
	copyProjectFiles(project);
	
	ICProject cproject = CoreModel.getDefault().create(project);
	CCorePlugin.getIndexManager().reindex(cproject);
}
 
开发者ID:USESystemEngineeringBV,项目名称:cmake-eclipse-helper,代码行数:15,代码来源:CMakeLauncher.java

示例9: doChangeArchitecture

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的package包/类
private void doChangeArchitecture(IProject project, String architecture, IProgressMonitor monitor) throws CoreException, IOException {
	CommandBuilder builder = new CommandBuilder();
	appendEclipseProjectSetup(builder);
	appendArchitectureVariables(builder, architecture);
	appendBuildTypeVariables(builder, ProjectSettingsAccessor.retrieveBuildType(project));
	builder.execute(project);
	project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
	copyProjectFiles(project, architecture);
	ProjectSettingsAccessor.removeAbsoluteProjectPath(project);

	ICProject cproject = CoreModel.getDefault().create(project);
	CCorePlugin.getIndexManager().reindex(cproject);
}
 
开发者ID:USESystemEngineeringBV,项目名称:cmake-eclipse-helper,代码行数:14,代码来源:CMakeLauncher.java

示例10: isCDTProject

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的package包/类
public static boolean isCDTProject(IProject p){
    return CoreModel.getDefault().getProjectDescription(p, true)!=null;
}
 
开发者ID:Ericsson,项目名称:CodeCheckerEclipsePlugin,代码行数:4,代码来源:CcConfiguration.java

示例11: configure

import org.eclipse.cdt.core.model.CoreModel; //导入依赖的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


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