本文整理汇总了Java中org.eclipse.cdt.core.CCorePlugin类的典型用法代码示例。如果您正苦于以下问题:Java CCorePlugin类的具体用法?Java CCorePlugin怎么用?Java CCorePlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CCorePlugin类属于org.eclipse.cdt.core包,在下文中一共展示了CCorePlugin类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modifyProjectEnvironmentVariables
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的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());
}
}
}
示例2: appendAbstractOsPreferences
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的package包/类
/**
* Appends arguments common to all OS preferences. The first argument in the
* list will be replaced by the cmake command from the specified preferences,
* if given.
*
* @param args
* the list to append cmake-arguments to.
* @param prefs
* the generic OS preferences to convert and append.
* @throws CoreException
* if unable to resolve the value of one or more variables
*/
private void appendAbstractOsPreferences(List<String> args, final AbstractOsPreferences prefs)
throws CoreException {
// replace cmake command, if given
if (!prefs.getUseDefaultCommand()){
ICdtVariableManager varManager = CCorePlugin.getDefault().getCdtVariableManager();
String cmd = varManager.resolveValue(prefs.getCommand(), "<undefined variable here, but CDT does not allow"
+ " to pass it unexpanded; thus its name is lost>"
, null,
ManagedBuildManager.getDescriptionForConfiguration(config));
args.set(0, cmd);
}
args.add("-G");
final CmakeGenerator generator = prefs.getGenerator();
args.add(generator.getCmakeName());
appendDefines(args, prefs.getDefines());
appendUndefines(args, prefs.getUndefines());
}
示例3: createEDK2ProjectFromExistingModule
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的package包/类
public static void createEDK2ProjectFromExistingModule(Edk2Module module, IProgressMonitor monitor) throws CoreException {
IProject newProjectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(module.getName());
IProjectDescription projDesc;
newProjectHandle.create(monitor);
newProjectHandle.open(monitor);
projDesc = ResourcesPlugin.getWorkspace().newProjectDescription(newProjectHandle.getName());
IPath newProjectPath = newProjectHandle.getLocation();
projDesc.setLocation(newProjectPath);
newProjectHandle.setPersistentProperty(new QualifiedName("Uefi_EDK2_Wizards", "EDK2_WORKSPACE"), module.getWorkspacePath());
newProjectHandle.setPersistentProperty(new QualifiedName("Uefi_EDK2_Wizards", "MODULE_ROOT_PATH"), new Path(module.getElementPath()).removeLastSegments(1).toString());
monitor.beginTask("Adding C nature to project", 25);
CCorePlugin.getDefault().createCDTProject(projDesc, newProjectHandle, null);
ExistingEdk2ModuleProjectCreator.ConfigureProjectNature(newProjectHandle);
monitor.beginTask("Creating project structure", 45);
ProjectStructureUpdater.UpdateProjectStructureFromModule(newProjectHandle, module);
monitor.beginTask("Parsing include paths", 65);
ProjectStructureUpdater.updateIncludePaths(newProjectHandle, module);
monitor.beginTask("Saving EDK2 project properties", 95);
ProjectStructureUpdater.setResourceChangeListeners(newProjectHandle);
}
示例4: computeIndex
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的package包/类
private void computeIndex(ICProject cproject) {
Activator.log(IStatus.INFO, "Indexing source files");
IIndexManager imanager = CCorePlugin.getIndexManager();
imanager.setIndexerId(cproject, "org.eclipse.cdt.core.fastIndexer");
imanager.reindex(cproject);
imanager.joinIndexer(IIndexManager.FOREVER, Constants.NULL_PROGRESS_MONITOR );
try {
this.index = imanager.getIndex(cproject);
} catch (CoreException e) {
e.printStackTrace();
}
}
示例5: initialize
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的package包/类
@Override
public void initialize(IProject project) {
try {
CCorePlugin.getDefault().createCDTProject(project.getDescription(), project, null);
project.open(null);
} catch (CoreException e) {
WPILibCPPPlugin.logError("Error intializing FRC C++ project.", e);
}
}
示例6: finalize
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的package包/类
@Override
public void finalize(IProject project) throws CoreException {
WPILibCPPPlugin.getDefault().updateVariables(project);
// Freshen the index because otherwise it's red and angry
ICElement[] projects = {CCorePlugin.getDefault().getCoreModel().create(project)};
CCorePlugin.getIndexManager().update(projects, IIndexManager.UPDATE_ALL | IIndexManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT);
}
示例7: appendDefines
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的package包/类
/**
* Appends arguments for the specified cmake defines. Performs substitutions
* on variables found in a value of each define.
*
* @param args
* the list to append cmake-arguments to.
* @param defines
* the cmake defines to convert and append.
* @throws CoreException
* if unable to resolve the value of one or more variables
*/
private void appendDefines(List<String> args, final List<CmakeDefine> defines) throws CoreException {
final ICdtVariableManager mngr = CCorePlugin.getDefault().getCdtVariableManager();
final ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(config);
for (CmakeDefine def : defines) {
final StringBuilder sb = new StringBuilder("-D");
sb.append(def.getName());
sb.append(':').append(def.getType().getCmakeArg());
sb.append('=');
String expanded = mngr.resolveValue(def.getValue(), "", "", cfgd);
sb.append(expanded);
args.add(sb.toString());
}
}
示例8: doSetupProject
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的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);
}
示例9: doChangeArchitecture
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的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);
}
示例10: expandVariables
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的package包/类
private static String expandVariables(String pathStr, ICConfigurationDescription cfgDescription) {
try {
ICdtVariableManager varManager = CCorePlugin.getDefault().getCdtVariableManager();
pathStr = varManager.resolveValue(pathStr, "", null, cfgDescription); //$NON-NLS-1$
} catch (Exception e) {
// Swallow exceptions but also log them
CCorePlugin.log(e);
}
return pathStr;
}
示例11: waitUntilFileIsIndexed
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的package包/类
/**
* Waits until the given file is indexed. Fails if this does not happen within the
* given time.
*
* @param file
* @param maxmillis
* @throws Exception
* @since 4.0
*/
public static void waitUntilFileIsIndexed(IIndex index, IFile file, int maxmillis) throws Exception {
long fileTimestamp = file.getLocalTimeStamp();
IIndexFileLocation indexFileLocation = IndexLocationFactory.getWorkspaceIFL(file);
long endTime = System.currentTimeMillis() + maxmillis;
int timeLeft = maxmillis;
while (timeLeft >= 0) {
Assert.assertTrue(CCorePlugin.getIndexManager().joinIndexer(timeLeft, new NullProgressMonitor()));
index.acquireReadLock();
try {
IIndexFile[] files = index.getFiles(ILinkage.CPP_LINKAGE_ID, indexFileLocation);
if (files.length > 0 && areAllFilesNotOlderThan(files, fileTimestamp)) {
Assert.assertTrue(CCorePlugin.getIndexManager().joinIndexer(timeLeft, new NullProgressMonitor()));
return;
}
files = index.getFiles(ILinkage.C_LINKAGE_ID, indexFileLocation);
if (files.length > 0 && areAllFilesNotOlderThan(files, fileTimestamp)) {
Assert.assertTrue(CCorePlugin.getIndexManager().joinIndexer(timeLeft, new NullProgressMonitor()));
return;
}
} finally {
index.releaseReadLock();
}
Thread.sleep(50);
timeLeft = (int) (endTime - System.currentTimeMillis());
}
Assert.fail("Indexing of " + file.getFullPath() + " did not complete in " + maxmillis / 1000. + " sec");
}
示例12: setOptions
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的package包/类
@Override
public void setOptions(Map<String, ?> options) {
if (options != null) {
this.options = options;
} else {
this.options = CCorePlugin.getOptions();
}
}
示例13: setupProject
import org.eclipse.cdt.core.CCorePlugin; //导入依赖的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);
}