本文整理汇总了Java中org.eclipse.cdt.core.settings.model.ICConfigurationDescription类的典型用法代码示例。如果您正苦于以下问题:Java ICConfigurationDescription类的具体用法?Java ICConfigurationDescription怎么用?Java ICConfigurationDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICConfigurationDescription类属于org.eclipse.cdt.core.settings.model包,在下文中一共展示了ICConfigurationDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modifyProjectEnvironmentVariables
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的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: createMarker
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的package包/类
/**
* Creates a problem marker.
*
* @param fileName
* the file where the problem has occurred
* @param epm
* @param lineNo
* the line number of the problem
* @param severity
* the severity of the problem, see {@link IMarkerGenerator} for
* acceptable severity values
* @param varName
* the name of the variable involved in the error or {@code null} if
* unknown
*/
private void createMarker(String fileName, ErrorParserManager epm,
String lineNo, int severity, String varName) {
int lineNumber = Integer.parseInt(lineNo);
// cmake reports the file relative to source entry
final IProject project = epm.getProject();
IConfiguration cfg = ManagedBuildManager.getBuildInfo(project, true)
.getDefaultConfiguration();
ICConfigurationDescription cfgDes = ManagedBuildManager
.getDescriptionForConfiguration(cfg);
ICSourceEntry[] srcEntriesR = cfgDes.getResolvedSourceEntries();
ICSourceEntry[] srcEntries = cfg.getSourceEntries();
srcEntries = CDataUtil.resolveEntries(srcEntries, cfgDes);
IPath srcPath = srcEntries[0].getFullPath(); // project-relative path!
IPath filePath = srcPath.append(fileName);
IFile file2 = project.getFile(filePath);
IFile file = epm.findFileName(filePath.toString());
this.markerInfo = new ProblemMarkerInfo(file2, lineNumber, null, severity,
varName);
markerInfo.setType(CMAKE_PROBLEM_MARKER_ID);
}
示例3: performApply
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的package包/类
/**
* Invoked when project configuration changes??
*
* @see org.eclipse.cdt.ui.newui.AbstractCPropertyTab#performApply(org.eclipse.cdt.core.settings.model.ICResourceDescription,
* org.eclipse.cdt.core.settings.model.ICResourceDescription)
*/
@Override
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
// make sure the displayed values get applied
// AFAICS, src is always == getResDesc(). so saveToModel() effectively
// stores to src
saveToModel();
ICConfigurationDescription srcCfg = src.getConfiguration();
ICConfigurationDescription dstCfg = dst.getConfiguration();
if (srcCfg instanceof ICMultiConfigDescription) {
ICConfigurationDescription[] srcCfgs = (ICConfigurationDescription[]) ((ICMultiConfigDescription) srcCfg)
.getItems();
ICConfigurationDescription[] dstCfgs = (ICConfigurationDescription[]) ((ICMultiConfigDescription) dstCfg)
.getItems();
for (int i = 0; i < srcCfgs.length; i++) {
applyConfig(srcCfgs[i], dstCfgs[i]);
}
} else {
applyConfig(srcCfg, dstCfg);
}
}
示例4: applyConfig
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的package包/类
/**
* @param srcCfg
* @param dstCfg
*/
private static void applyConfig(ICConfigurationDescription srcCfg, ICConfigurationDescription dstCfg) {
final ConfigurationManager configMgr = ConfigurationManager.getInstance();
try {
CMakePreferences srcPrefs = configMgr.getOrLoad(srcCfg);
CMakePreferences dstPrefs = configMgr.getOrCreate(dstCfg);
if (srcPrefs != dstPrefs) {
dstPrefs.setDebugTryCompile(srcPrefs.isDebugTryCompile());
dstPrefs.setDebugOutput(srcPrefs.isDebugOutput());
dstPrefs.setTrace(srcPrefs.isTrace());
dstPrefs.setWarnNoDev(srcPrefs.isWarnNoDev());
dstPrefs.setWarnUnitialized(srcPrefs.isWarnUnitialized());
dstPrefs.setWarnUnused(srcPrefs.isWarnUnused());
dstPrefs.setCacheFile(srcPrefs.getCacheFile());
}
} catch (CoreException ex) {
log.log(new Status(IStatus.ERROR, CdtPlugin.PLUGIN_ID, null, ex));
}
}
示例5: configSelectionChanged
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的package包/类
@Override
protected void configSelectionChanged(ICResourceDescription lastConfig, ICResourceDescription newConfig) {
// nothing to save here: defines & undefines are modified by the widget
// listeners directly
// if (lastConfig != null) {
// saveToModel();
// }
if (newConfig == null)
return;
if (page.isMultiCfg()) {
setAllVisible(false, null);
} else {
setAllVisible(true, null);
ICConfigurationDescription cfgd = newConfig.getConfiguration();
final ConfigurationManager configMgr = ConfigurationManager.getInstance();
try {
CMakePreferences prefs = configMgr.getOrLoad(cfgd);
updateDisplay(prefs);
} catch (CoreException ex) {
log.log(new Status(IStatus.ERROR, CdtPlugin.PLUGIN_ID, null, ex));
}
}
}
示例6: performOK
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的package包/类
@Override
protected void performOK() {
final ICResourceDescription resDesc = getResDesc();
if (resDesc == null)
return;
final ICConfigurationDescription cfgd= resDesc.getConfiguration();
if(cfgd instanceof ICMultiConfigDescription){
// this tab does not support editing of multiple configurations
return;
}
try {
// NB: defines & undefines are modified by the widget listeners directly
CMakePreferences prefs = ConfigurationManager.getInstance().get(cfgd);
// save as project settings..
ICStorageElement storage = cfgd.getStorage(
CMakePreferences.CFG_STORAGE_ID, true);
prefs.saveToStorage(storage);
} catch (CoreException ex) {
log.log(new Status(IStatus.ERROR, CdtPlugin.PLUGIN_ID, null, ex));
}
}
示例7: performOK
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的package包/类
@Override
protected void performOK() {
final ICResourceDescription resDesc = getResDesc();
if (resDesc == null)
return;
ICConfigurationDescription cfgd= resDesc.getConfiguration();
if(cfgd instanceof ICMultiConfigDescription){
// this tab does not support editing of multiple configurations
return;
}
saveToModel();
try {
// save as project settings..
ICStorageElement storage = cfgd.getStorage(
CMakePreferences.CFG_STORAGE_ID, true);
prefs.saveToStorage(storage);
} catch (CoreException ex) {
log.log(new Status(IStatus.ERROR, CdtPlugin.PLUGIN_ID, null, ex));
}
}
示例8: getMakefileName
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的package包/类
@Override
public String getMakefileName() {
// load project properties..
final ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(config);
CMakePreferences prefs;
try {
prefs = ConfigurationManager.getInstance().getOrLoad(cfgd);
} catch (CoreException ex) {
// Auto-generated catch block
ex.printStackTrace();
return "Makefile"; // default
}
AbstractOsPreferences osPrefs = AbstractOsPreferences.extractOsPreferences(prefs);
// file generated by cmake
return osPrefs.getGenerator().getMakefileName();
}
示例9: setIncludePaths
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的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();
}
}
示例10: buildAllConfigurations
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的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();
}
}
}
示例11: updateCdtBuildPaths
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的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;
}
示例12: createConfiguration
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的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;
}
示例13: createBuildConfigurations
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的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);
}
示例14: configSelectionChanged
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的package包/类
@Override
protected void configSelectionChanged(ICResourceDescription lastConfig, ICResourceDescription newConfig) {
if (lastConfig != null) {
saveToModel();
}
if (newConfig == null)
return;
ICConfigurationDescription cfgd = newConfig.getConfiguration();
final ConfigurationManager configMgr = ConfigurationManager.getInstance();
try {
if (cfgd instanceof ICMultiConfigDescription) {
// we are editing multiple configurations...
ICConfigurationDescription[] cfgs = (ICConfigurationDescription[]) ((ICMultiConfigDescription) cfgd).getItems();
prefs = new CMakePreferences[cfgs.length];
for (int i = 0; i < cfgs.length; i++) {
prefs[i] = configMgr.getOrLoad(cfgs[i]);
}
} else {
// we are editing a single configuration...
prefs = new CMakePreferences[1];
prefs[0] = configMgr.getOrLoad(cfgd);
}
} catch (CoreException ex) {
log.log(new Status(IStatus.ERROR, CdtPlugin.PLUGIN_ID, null, ex));
}
updateDisplay();
}
示例15: performApply
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; //导入依赖的package包/类
/**
* Invoked when project configuration changes?? At least when apply button is
* pressed.
*
* @see org.eclipse.cdt.ui.newui.AbstractCPropertyTab#performApply(org.eclipse.cdt.core.settings.model.ICResourceDescription,
* org.eclipse.cdt.core.settings.model.ICResourceDescription)
*/
@Override
protected void performApply(ICResourceDescription src,
ICResourceDescription dst) {
ICConfigurationDescription srcCfg = src.getConfiguration();
ICConfigurationDescription dstCfg = dst.getConfiguration();
final ConfigurationManager configMgr = ConfigurationManager.getInstance();
try {
CMakePreferences srcPrefs = configMgr.getOrLoad(srcCfg);
CMakePreferences dstPrefs = configMgr.getOrCreate(dstCfg);
if (srcPrefs != dstPrefs) {
final List<CmakeDefine> defines = dstPrefs.getDefines();
defines.clear();
for (CmakeDefine def : srcPrefs.getDefines()) {
defines.add(def.clone());
}
final List<CmakeUnDefine> undefines = dstPrefs.getUndefines();
undefines.clear();
for (CmakeUnDefine undef : srcPrefs.getUndefines()) {
undefines.add(undef.clone());
}
}
} catch (CoreException ex) {
log.log(new Status(IStatus.ERROR, CdtPlugin.PLUGIN_ID, null, ex));
}
}