mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
@Override annotations and other cleanup
This commit is contained in:
parent
6fcb52fe97
commit
0b6b6c8b99
30 changed files with 537 additions and 438 deletions
|
@ -25,7 +25,7 @@ public class Activator extends Plugin {
|
||||||
private static Activator fInstance;
|
private static Activator fInstance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Activator() {
|
public Activator() {
|
||||||
super();
|
super();
|
||||||
|
@ -33,18 +33,18 @@ public class Activator extends Plugin {
|
||||||
fInstance = this;
|
fInstance = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(String e) {
|
public static void log(String e) {
|
||||||
log(createStatus(e));
|
log(createStatus(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(Throwable e) {
|
public static void log(Throwable e) {
|
||||||
log("Error", e); //$NON-NLS-1$
|
log("Error", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(String message, Throwable e) {
|
public static void log(String message, Throwable e) {
|
||||||
Throwable nestedException;
|
Throwable nestedException;
|
||||||
if (e instanceof CModelException
|
if (e instanceof CModelException
|
||||||
&& (nestedException = ((CModelException)e).getException()) != null) {
|
&& (nestedException = ((CModelException)e).getException()) != null) {
|
||||||
e = nestedException;
|
e = nestedException;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class Activator extends Plugin {
|
||||||
public static IStatus createStatus(String msg, Throwable e) {
|
public static IStatus createStatus(String msg, Throwable e) {
|
||||||
return new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, msg, e);
|
return new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, msg, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(IStatus status) {
|
public static void log(IStatus status) {
|
||||||
getDefault().getLog().log(status);
|
getDefault().getLog().log(status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.BuildOutputProvider;
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.BuildOutputProvider;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||||
import org.eclipse.cdt.make.xlc.core.activator.Activator;
|
import org.eclipse.cdt.make.xlc.core.activator.Activator;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -33,7 +33,7 @@ import org.eclipse.core.runtime.content.IContentTypeManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author crecoskie
|
* @author crecoskie
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsoleParser {
|
public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsoleParser {
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns array of additional compiler commands to look for
|
* Returns array of additional compiler commands to look for
|
||||||
*
|
*
|
||||||
* @return String[]
|
* @return String[]
|
||||||
*/
|
*/
|
||||||
protected String[] computeCompilerCommands() {
|
protected String[] computeCompilerCommands() {
|
||||||
|
@ -103,11 +103,12 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine
|
* org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine
|
||||||
* (java.lang.String)
|
* (java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean processLine(String line) {
|
public boolean processLine(String line) {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
int lineBreakPos = line.length() - 1;
|
int lineBreakPos = line.length() - 1;
|
||||||
|
@ -183,16 +184,17 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#shutdown
|
* org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#shutdown
|
||||||
* ()
|
* ()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
if (getUtility() != null) {
|
if (getUtility() != null) {
|
||||||
getUtility().reportProblems();
|
getUtility().reportProblems();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fCollector != null && fCollector instanceof IScannerInfoCollector2) {
|
if(fCollector != null && fCollector instanceof IScannerInfoCollector2) {
|
||||||
IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
|
IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
|
||||||
try {
|
try {
|
||||||
|
@ -211,7 +213,7 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol
|
||||||
* back-quotes a backslash escapes white-spaces, all quotes, the backslash,
|
* back-quotes a backslash escapes white-spaces, all quotes, the backslash,
|
||||||
* '&' and '|'. A backslash used for escaping is removed. Quotes other than
|
* '&' and '|'. A backslash used for escaping is removed. Quotes other than
|
||||||
* the back-quote plus '&&', '||', ';' are removed, also.
|
* the back-quote plus '&&', '||', ';' are removed, also.
|
||||||
*
|
*
|
||||||
* @param line
|
* @param line
|
||||||
* to tokenize
|
* to tokenize
|
||||||
* @return array of commands
|
* @return array of commands
|
||||||
|
@ -365,6 +367,7 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
|
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
|
||||||
IMarkerGenerator markerGenerator) {
|
IMarkerGenerator markerGenerator) {
|
||||||
fProject = project;
|
fProject = project;
|
||||||
|
|
|
@ -52,7 +52,6 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector;
|
|
||||||
import org.eclipse.cdt.make.xlc.core.activator.Activator;
|
import org.eclipse.cdt.make.xlc.core.activator.Activator;
|
||||||
import org.eclipse.cdt.make.xlc.core.messages.Messages;
|
import org.eclipse.cdt.make.xlc.core.messages.Messages;
|
||||||
import org.eclipse.cdt.make.xlc.core.scannerconfig.util.XLCCommandDSC;
|
import org.eclipse.cdt.make.xlc.core.scannerconfig.util.XLCCommandDSC;
|
||||||
|
@ -89,12 +88,12 @@ import org.w3c.dom.NodeList;
|
||||||
public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, IManagedScannerInfoCollector {
|
public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, IManagedScannerInfoCollector {
|
||||||
|
|
||||||
protected class ScannerConfigUpdateJob extends Job {
|
protected class ScannerConfigUpdateJob extends Job {
|
||||||
|
|
||||||
private InfoContext fContext;
|
private InfoContext fContext;
|
||||||
private IDiscoveredPathInfo fPathInfo;
|
private IDiscoveredPathInfo fPathInfo;
|
||||||
private boolean fIsDefaultContext;
|
private boolean fIsDefaultContext;
|
||||||
private List<IResource> fChangedResources;
|
private List<IResource> fChangedResources;
|
||||||
|
|
||||||
public ScannerConfigUpdateJob(InfoContext context, IDiscoveredPathInfo pathInfo, boolean isDefaultContext, List<IResource> changedResources) {
|
public ScannerConfigUpdateJob(InfoContext context, IDiscoveredPathInfo pathInfo, boolean isDefaultContext, List<IResource> changedResources) {
|
||||||
super(Messages.getString("PerFileXLCScannerInfoCollector.0")); //$NON-NLS-1$);
|
super(Messages.getString("PerFileXLCScannerInfoCollector.0")); //$NON-NLS-1$);
|
||||||
fContext = context;
|
fContext = context;
|
||||||
|
@ -106,24 +105,24 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// get the scanner info profile ID
|
// get the scanner info profile ID
|
||||||
|
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||||
IConfiguration config = info.getDefaultConfiguration();
|
IConfiguration config = info.getDefaultConfiguration();
|
||||||
|
|
||||||
String profileID = config.getToolChain().getScannerConfigDiscoveryProfileId();
|
String profileID = config.getToolChain().getScannerConfigDiscoveryProfileId();
|
||||||
IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager();
|
IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager();
|
||||||
|
|
||||||
if(manager instanceof DiscoveredPathManager) {
|
if(manager instanceof DiscoveredPathManager) {
|
||||||
((DiscoveredPathManager)manager).updateDiscoveredInfo(fContext, fPathInfo, fIsDefaultContext, fChangedResources, profileID);
|
((DiscoveredPathManager)manager).updateDiscoveredInfo(fContext, fPathInfo, fIsDefaultContext, fChangedResources, profileID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reload project description to hopefully get the data to take
|
// reload project description to hopefully get the data to take
|
||||||
ICProjectDescriptionManager descriptionManager = CoreModel.getDefault().getProjectDescriptionManager();
|
ICProjectDescriptionManager descriptionManager = CoreModel.getDefault().getProjectDescriptionManager();
|
||||||
ICProjectDescription cProjectDescription = descriptionManager.getProjectDescription(project, true /* writable */);
|
ICProjectDescription cProjectDescription = descriptionManager.getProjectDescription(project, true /* writable */);
|
||||||
ICConfigurationDescription configDes = cProjectDescription.getActiveConfiguration();
|
ICConfigurationDescription configDes = cProjectDescription.getActiveConfiguration();
|
||||||
|
|
||||||
IToolChain toolchain = config.getToolChain();
|
IToolChain toolchain = config.getToolChain();
|
||||||
for(ITool tool : toolchain.getTools()) {
|
for(ITool tool : toolchain.getTools()) {
|
||||||
for(IInputType inputType : tool.getInputTypes()) {
|
for(IInputType inputType : tool.getInputTypes()) {
|
||||||
|
@ -132,14 +131,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
for(IResource resource : fChangedResources) {
|
for(IResource resource : fChangedResources) {
|
||||||
// get language settings for the resource
|
// get language settings for the resource
|
||||||
ICLanguageSetting langSetting = configDes.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
|
ICLanguageSetting langSetting = configDes.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
|
||||||
|
|
||||||
if(langSetting == null) {
|
if(langSetting == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get content type IDs for the setting
|
// get content type IDs for the setting
|
||||||
String[] contentTypeIDs = langSetting.getSourceContentTypeIds();
|
String[] contentTypeIDs = langSetting.getSourceContentTypeIds();
|
||||||
|
|
||||||
// if the setting doesn't handle our content type ID, then go to the next resource
|
// if the setting doesn't handle our content type ID, then go to the next resource
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for(String id : contentTypeIDs) {
|
for(String id : contentTypeIDs) {
|
||||||
|
@ -148,23 +147,23 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found) {
|
if(!found) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update all the scanner config entries on the setting
|
// update all the scanner config entries on the setting
|
||||||
updateIncludeSettings(langSetting);
|
updateIncludeSettings(langSetting);
|
||||||
updateMacroSettings(langSetting);
|
updateMacroSettings(langSetting);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
descriptionManager.setProjectDescription(project, cProjectDescription, true /* force */, monitor);
|
descriptionManager.setProjectDescription(project, cProjectDescription, true /* force */, monitor);
|
||||||
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
return Activator.createStatus(Messages.getString("PerFileXLCScannerInfoCollector.1")); //$NON-NLS-1$
|
return Activator.createStatus(Messages.getString("PerFileXLCScannerInfoCollector.1")); //$NON-NLS-1$
|
||||||
|
@ -178,22 +177,22 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
for(ICLanguageSettingEntry entry : entries) {
|
for(ICLanguageSettingEntry entry : entries) {
|
||||||
newEntries.add(entry);
|
newEntries.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean entriesChanged = false;
|
boolean entriesChanged = false;
|
||||||
|
|
||||||
// look for settings corresponding to each path we discovered
|
// look for settings corresponding to each path we discovered
|
||||||
Map<String, String> discSymbols = fPathInfo.getSymbols();
|
Map<String, String> discSymbols = fPathInfo.getSymbols();
|
||||||
for (String symbol : discSymbols.keySet()) {
|
for (String symbol : discSymbols.keySet()) {
|
||||||
boolean symbolFound = false;
|
boolean symbolFound = false;
|
||||||
|
|
||||||
for (ICLanguageSettingEntry entry : entries) {
|
for (ICLanguageSettingEntry entry : entries) {
|
||||||
if (((CMacroEntry) entry).getName().equals(symbol)) {
|
if (((CMacroEntry) entry).getName().equals(symbol)) {
|
||||||
symbolFound = true; // it's already there, so don't set it
|
symbolFound = true; // it's already there, so don't set it
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we didn't find the path, add it
|
// if we didn't find the path, add it
|
||||||
if(!symbolFound) {
|
if(!symbolFound) {
|
||||||
entriesChanged = true;
|
entriesChanged = true;
|
||||||
|
@ -201,13 +200,13 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
newEntries.add(newEntry);
|
newEntries.add(newEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we changed the entries, then set the new ones
|
// if we changed the entries, then set the new ones
|
||||||
if(entriesChanged) {
|
if(entriesChanged) {
|
||||||
langSetting.setSettingEntries(ICSettingEntry.MACRO, newEntries.toArray(new ICLanguageSettingEntry[0]));
|
langSetting.setSettingEntries(ICSettingEntry.MACRO, newEntries.toArray(new ICLanguageSettingEntry[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return entriesChanged;
|
return entriesChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean updateIncludeSettings(ICLanguageSetting langSetting) {
|
private boolean updateIncludeSettings(ICLanguageSetting langSetting) {
|
||||||
|
@ -216,22 +215,22 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
for(ICLanguageSettingEntry entry : entries) {
|
for(ICLanguageSettingEntry entry : entries) {
|
||||||
newEntries.add(entry);
|
newEntries.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean entriesChanged = false;
|
boolean entriesChanged = false;
|
||||||
|
|
||||||
// look for settings corresponding to each path we discovered
|
// look for settings corresponding to each path we discovered
|
||||||
IPath[] discPaths = fPathInfo.getIncludePaths();
|
IPath[] discPaths = fPathInfo.getIncludePaths();
|
||||||
for (IPath path : discPaths) {
|
for (IPath path : discPaths) {
|
||||||
boolean pathFound = false;
|
boolean pathFound = false;
|
||||||
|
|
||||||
for (ICLanguageSettingEntry entry : entries) {
|
for (ICLanguageSettingEntry entry : entries) {
|
||||||
if (((CIncludePathEntry) entry).getLocation().equals(path)) {
|
if (((CIncludePathEntry) entry).getLocation().equals(path)) {
|
||||||
pathFound = true; // it's already there, so don't set it
|
pathFound = true; // it's already there, so don't set it
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we didn't find the path, add it
|
// if we didn't find the path, add it
|
||||||
if(!pathFound) {
|
if(!pathFound) {
|
||||||
entriesChanged = true;
|
entriesChanged = true;
|
||||||
|
@ -239,20 +238,20 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
newEntries.add(newEntry);
|
newEntries.add(newEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we changed the entries, then set the new ones
|
// if we changed the entries, then set the new ones
|
||||||
if(entriesChanged) {
|
if(entriesChanged) {
|
||||||
langSetting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, newEntries.toArray(new ICLanguageSettingEntry[0]));
|
langSetting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, newEntries.toArray(new ICLanguageSettingEntry[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return entriesChanged;
|
return entriesChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class MergedPerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
|
protected class MergedPerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
|
||||||
private IDiscoveredPathInfo fInfo1;
|
private IDiscoveredPathInfo fInfo1;
|
||||||
private IPerFileDiscoveredPathInfo2 fInfo2;
|
private IPerFileDiscoveredPathInfo2 fInfo2;
|
||||||
|
|
||||||
public MergedPerFileDiscoveredPathInfo(IDiscoveredPathInfo info1, IPerFileDiscoveredPathInfo2 info2) {
|
public MergedPerFileDiscoveredPathInfo(IDiscoveredPathInfo info1, IPerFileDiscoveredPathInfo2 info2) {
|
||||||
fInfo1 = info1;
|
fInfo1 = info1;
|
||||||
fInfo2 = info2;
|
fInfo2 = info2;
|
||||||
|
@ -262,12 +261,13 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
if(fInfo1 instanceof IPerFileDiscoveredPathInfo2) {
|
if(fInfo1 instanceof IPerFileDiscoveredPathInfo2) {
|
||||||
return (IPerFileDiscoveredPathInfo2) fInfo1;
|
return (IPerFileDiscoveredPathInfo2) fInfo1;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<IResource, PathInfo> getPathInfoMap() {
|
public Map<IResource, PathInfo> getPathInfoMap() {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
|
IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
|
||||||
|
@ -287,6 +287,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IPath[] getIncludeFiles(IPath path) {
|
public IPath[] getIncludeFiles(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
|
IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
|
||||||
|
@ -308,6 +309,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IPath[] getIncludePaths(IPath path) {
|
public IPath[] getIncludePaths(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
|
|
||||||
|
@ -339,6 +341,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IPath[] getMacroFiles(IPath path) {
|
public IPath[] getMacroFiles(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
Set<IPath> pathSet = new HashSet<IPath>();
|
Set<IPath> pathSet = new HashSet<IPath>();
|
||||||
|
@ -360,6 +363,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IPath[] getQuoteIncludePaths(IPath path) {
|
public IPath[] getQuoteIncludePaths(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
|
|
||||||
|
@ -382,13 +386,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<String, String> getSymbols(IPath path) {
|
public Map<String, String> getSymbols(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
|
|
||||||
Map<String, String> symbols = new HashMap<String, String>();
|
Map<String, String> symbols = new HashMap<String, String>();
|
||||||
|
|
||||||
// add project level settings
|
// add project level settings
|
||||||
Map<String, String> projectSymbols = (Map<String, String>) fInfo1.getSymbols();
|
Map<String, String> projectSymbols = fInfo1.getSymbols();
|
||||||
for (String symbol : projectSymbols.keySet()) {
|
for (String symbol : projectSymbols.keySet()) {
|
||||||
symbols.put(symbol, projectSymbols.get(symbol));
|
symbols.put(symbol, projectSymbols.get(symbol));
|
||||||
}
|
}
|
||||||
|
@ -409,6 +414,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isEmpty(IPath path) {
|
public boolean isEmpty(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
boolean info1empty = false;
|
boolean info1empty = false;
|
||||||
|
@ -424,40 +430,45 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IPath[] getIncludePaths() {
|
public IPath[] getIncludePaths() {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
return fInfo1.getIncludePaths();
|
return fInfo1.getIncludePaths();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IProject getProject() {
|
public IProject getProject() {
|
||||||
return fInfo1.getProject();
|
return fInfo1.getProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IDiscoveredScannerInfoSerializable getSerializable() {
|
public IDiscoveredScannerInfoSerializable getSerializable() {
|
||||||
return fInfo2.getSerializable();
|
return fInfo2.getSerializable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<String, String> getSymbols() {
|
public Map<String, String> getSymbols() {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
return fInfo1.getSymbols();
|
return fInfo1.getSymbols();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Per file DPI object
|
* Per file DPI object
|
||||||
*
|
*
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
|
protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
|
||||||
*/
|
*/
|
||||||
public IPath[] getIncludeFiles(IPath path) {
|
@Override
|
||||||
|
public IPath[] getIncludeFiles(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
|
|
||||||
Set<IPath> pathSet = new LinkedHashSet<IPath>();
|
Set<IPath> pathSet = new LinkedHashSet<IPath>();
|
||||||
// get the command
|
// get the command
|
||||||
CCommandDSC cmd = getCommand(path);
|
CCommandDSC cmd = getCommand(path);
|
||||||
|
@ -473,7 +484,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
for(IPath path2 : psi.includeFiles) {
|
for(IPath path2 : psi.includeFiles) {
|
||||||
pathSet.add(path2);
|
pathSet.add(path2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pathSet.toArray(new IPath[0]);
|
return pathSet.toArray(new IPath[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,7 +492,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths()
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths()
|
||||||
*/
|
*/
|
||||||
public IPath[] getIncludePaths() {
|
@Override
|
||||||
|
public IPath[] getIncludePaths() {
|
||||||
final IPath[] includepaths;
|
final IPath[] includepaths;
|
||||||
final IPath[] quotepaths;
|
final IPath[] quotepaths;
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
|
@ -504,7 +516,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
|
||||||
*/
|
*/
|
||||||
public IPath[] getIncludePaths(IPath path) {
|
@Override
|
||||||
|
public IPath[] getIncludePaths(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
Set<IPath> pathSet = new LinkedHashSet<IPath>();
|
Set<IPath> pathSet = new LinkedHashSet<IPath>();
|
||||||
// get the command
|
// get the command
|
||||||
|
@ -521,7 +534,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
for(IPath path2 : psi.includePaths) {
|
for(IPath path2 : psi.includePaths) {
|
||||||
pathSet.add(path2);
|
pathSet.add(path2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pathSet.toArray(new IPath[0]);
|
return pathSet.toArray(new IPath[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,7 +542,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
|
||||||
*/
|
*/
|
||||||
public IPath[] getMacroFiles(IPath path) {
|
@Override
|
||||||
|
public IPath[] getMacroFiles(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
Set<IPath> pathSet = new LinkedHashSet<IPath>();
|
Set<IPath> pathSet = new LinkedHashSet<IPath>();
|
||||||
// get the command
|
// get the command
|
||||||
|
@ -546,12 +560,13 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
for(IPath path2 : psi.macrosFiles) {
|
for(IPath path2 : psi.macrosFiles) {
|
||||||
pathSet.add(path2);
|
pathSet.add(path2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pathSet.toArray(new IPath[0]);
|
return pathSet.toArray(new IPath[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<IResource, PathInfo> getPathInfoMap() {
|
@Override
|
||||||
|
public Map<IResource, PathInfo> getPathInfoMap() {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
//TODO: do we need to cache this?
|
//TODO: do we need to cache this?
|
||||||
return calculatePathInfoMap();
|
return calculatePathInfoMap();
|
||||||
|
@ -561,14 +576,16 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
|
||||||
*/
|
*/
|
||||||
public IProject getProject() {
|
@Override
|
||||||
|
public IProject getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getQuoteIncludePaths(org.eclipse.core.runtime.IPath)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getQuoteIncludePaths(org.eclipse.core.runtime.IPath)
|
||||||
*/
|
*/
|
||||||
public IPath[] getQuoteIncludePaths(IPath path) {
|
@Override
|
||||||
|
public IPath[] getQuoteIncludePaths(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
Set<IPath> pathSet = new LinkedHashSet<IPath>();
|
Set<IPath> pathSet = new LinkedHashSet<IPath>();
|
||||||
// get the command
|
// get the command
|
||||||
|
@ -585,7 +602,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
for(IPath path2 : psi.quoteIncludePaths) {
|
for(IPath path2 : psi.quoteIncludePaths) {
|
||||||
pathSet.add(path2);
|
pathSet.add(path2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pathSet.toArray(new IPath[0]);
|
return pathSet.toArray(new IPath[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,7 +610,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getSerializable()
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getSerializable()
|
||||||
*/
|
*/
|
||||||
public IDiscoveredScannerInfoSerializable getSerializable() {
|
@Override
|
||||||
|
public IDiscoveredScannerInfoSerializable getSerializable() {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
return sid;
|
return sid;
|
||||||
}
|
}
|
||||||
|
@ -602,7 +620,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols()
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols()
|
||||||
*/
|
*/
|
||||||
public Map<String, String> getSymbols() {
|
@Override
|
||||||
|
public Map<String, String> getSymbols() {
|
||||||
// return new HashMap();
|
// return new HashMap();
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
return getAllSymbols();
|
return getAllSymbols();
|
||||||
|
@ -611,10 +630,11 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @seeorg.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.
|
* @seeorg.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.
|
||||||
* IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath)
|
* IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Map<String, String> getSymbols(IPath path) {
|
public Map<String, String> getSymbols(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
Map<String, String> definedSymbols = new HashMap<String, String>();
|
Map<String, String> definedSymbols = new HashMap<String, String>();
|
||||||
|
@ -650,6 +670,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isEmpty(IPath path) {
|
public boolean isEmpty(IPath path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
boolean rc = true;
|
boolean rc = true;
|
||||||
|
@ -690,7 +711,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
public static final String INCLUDE_PATH = "includePath"; //$NON-NLS-1$
|
public static final String INCLUDE_PATH = "includePath"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String NAME = "name"; //$NON-NLS-1$
|
private static final String NAME = "name"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String PATH = "path"; //$NON-NLS-1$
|
public static final String PATH = "path"; //$NON-NLS-1$
|
||||||
private static final String PROJECT = "project"; //$NON-NLS-1$
|
private static final String PROJECT = "project"; //$NON-NLS-1$
|
||||||
public static final String REMOVED = "removed"; //$NON-NLS-1$
|
public static final String REMOVED = "removed"; //$NON-NLS-1$
|
||||||
|
@ -698,7 +719,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
public final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
|
public final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
|
||||||
public final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
|
public final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
|
||||||
public final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
|
public final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
|
||||||
|
|
||||||
public ScannerInfoData() {
|
public ScannerInfoData() {
|
||||||
commandIdCommandMap = new LinkedHashMap<Integer, CCommandDSC>(); // [commandId, command]
|
commandIdCommandMap = new LinkedHashMap<Integer, CCommandDSC>(); // [commandId, command]
|
||||||
fileToCommandIdMap = new HashMap<IFile, Integer>(); // [file, commandId]
|
fileToCommandIdMap = new HashMap<IFile, Integer>(); // [file, commandId]
|
||||||
|
@ -708,21 +729,22 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element)
|
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element)
|
||||||
*/
|
*/
|
||||||
public void deserialize(Element collectorElem) {
|
@Override
|
||||||
|
public void deserialize(Element collectorElem) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
|
|
||||||
for (Node child = collectorElem.getFirstChild(); child != null; child = child.getNextSibling()) {
|
for (Node child = collectorElem.getFirstChild(); child != null; child = child.getNextSibling()) {
|
||||||
if(child.getNodeName().equals(PROJECT)) {
|
if(child.getNodeName().equals(PROJECT)) {
|
||||||
Element projectElement = (Element) child;
|
Element projectElement = (Element) child;
|
||||||
String projectName = projectElement.getAttribute(NAME);
|
String projectName = projectElement.getAttribute(NAME);
|
||||||
|
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
||||||
|
|
||||||
Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
|
Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
|
||||||
|
|
||||||
List<String> includes = new LinkedList<String>();
|
List<String> includes = new LinkedList<String>();
|
||||||
List<String> symbols = new LinkedList<String>();
|
List<String> symbols = new LinkedList<String>();
|
||||||
|
|
||||||
// iterate over children
|
// iterate over children
|
||||||
for(Node projectChild = projectElement.getFirstChild(); projectChild != null; projectChild = projectChild.getNextSibling()) {
|
for(Node projectChild = projectElement.getFirstChild(); projectChild != null; projectChild = projectChild.getNextSibling()) {
|
||||||
if(projectChild.getNodeName().equals(INCLUDE_PATH)) {
|
if(projectChild.getNodeName().equals(INCLUDE_PATH)) {
|
||||||
|
@ -735,21 +757,21 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
else if(projectChild.getNodeName().equals(DEFINED_SYMBOL)) {
|
else if(projectChild.getNodeName().equals(DEFINED_SYMBOL)) {
|
||||||
Element childElem = (Element) projectChild;
|
Element childElem = (Element) projectChild;
|
||||||
String symbol = childElem.getAttribute(SYMBOL);
|
String symbol = childElem.getAttribute(SYMBOL);
|
||||||
|
|
||||||
if(symbol != null) {
|
if(symbol != null) {
|
||||||
symbols.add(symbol);
|
symbols.add(symbol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add loaded scanner info to project settings for this collector
|
// add loaded scanner info to project settings for this collector
|
||||||
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
|
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
|
||||||
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
|
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
|
||||||
fProjectSettingsMap.put(project, scannerInfo);
|
fProjectSettingsMap.put(project, scannerInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (child.getNodeName().equals(CC_ELEM)) {
|
else if (child.getNodeName().equals(CC_ELEM)) {
|
||||||
Element cmdElem = (Element) child;
|
Element cmdElem = (Element) child;
|
||||||
boolean cppFileType = cmdElem.getAttribute(FILE_TYPE_ATTR).equals("c++"); //$NON-NLS-1$
|
boolean cppFileType = cmdElem.getAttribute(FILE_TYPE_ATTR).equals("c++"); //$NON-NLS-1$
|
||||||
XLCCommandDSC command = new XLCCommandDSC(cppFileType, project);
|
XLCCommandDSC command = new XLCCommandDSC(cppFileType, project);
|
||||||
|
@ -777,27 +799,29 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId()
|
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId()
|
||||||
*/
|
*/
|
||||||
public String getCollectorId() {
|
@Override
|
||||||
|
public String getCollectorId() {
|
||||||
return COLLECTOR_ID;
|
return COLLECTOR_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#serialize(org.w3c.dom.Element)
|
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#serialize(org.w3c.dom.Element)
|
||||||
*/
|
*/
|
||||||
public void serialize(Element collectorElem) {
|
@Override
|
||||||
|
public void serialize(Element collectorElem) {
|
||||||
try {
|
try {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
Document doc = collectorElem.getOwnerDocument();
|
Document doc = collectorElem.getOwnerDocument();
|
||||||
|
|
||||||
// serialize project level info
|
// serialize project level info
|
||||||
for (IProject project : fProjectSettingsMap.keySet()) {
|
for (IProject project : fProjectSettingsMap.keySet()) {
|
||||||
// create a project node
|
// create a project node
|
||||||
Element projectElement = doc.createElement(PROJECT);
|
Element projectElement = doc.createElement(PROJECT);
|
||||||
projectElement.setAttribute(NAME, project.getName());
|
projectElement.setAttribute(NAME, project.getName());
|
||||||
|
|
||||||
Map<ScannerInfoTypes, List<String>> scannerInfo = (Map<ScannerInfoTypes, List<String>>) fProjectSettingsMap.get(project);
|
Map<ScannerInfoTypes, List<String>> scannerInfo = (Map<ScannerInfoTypes, List<String>>) fProjectSettingsMap.get(project);
|
||||||
|
|
||||||
List<String> includes = scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
|
List<String> includes = scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
|
||||||
for(String include : includes) {
|
for(String include : includes) {
|
||||||
Element pathElement = doc.createElement(INCLUDE_PATH);
|
Element pathElement = doc.createElement(INCLUDE_PATH);
|
||||||
pathElement.setAttribute(PATH, include);
|
pathElement.setAttribute(PATH, include);
|
||||||
|
@ -808,10 +832,10 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
pathElement.setAttribute(REMOVED, "false"); //$NON-NLS-1$
|
pathElement.setAttribute(REMOVED, "false"); //$NON-NLS-1$
|
||||||
projectElement.appendChild(pathElement);
|
projectElement.appendChild(pathElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now do the same for the symbols
|
// Now do the same for the symbols
|
||||||
List<String> symbols = scannerInfo.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
List<String> symbols = scannerInfo.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||||
|
|
||||||
for(String symbol : symbols) {
|
for(String symbol : symbols) {
|
||||||
Element symbolElement = doc.createElement(DEFINED_SYMBOL);
|
Element symbolElement = doc.createElement(DEFINED_SYMBOL);
|
||||||
symbolElement.setAttribute(SYMBOL, symbol);
|
symbolElement.setAttribute(SYMBOL, symbol);
|
||||||
|
@ -819,36 +843,36 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
collectorElem.appendChild(projectElement);
|
collectorElem.appendChild(projectElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// serialize file level info
|
// serialize file level info
|
||||||
List<Integer> commandIds = new ArrayList<Integer>(commandIdCommandMap.keySet());
|
List<Integer> commandIds = new ArrayList<Integer>(commandIdCommandMap.keySet());
|
||||||
Collections.sort(commandIds);
|
Collections.sort(commandIds);
|
||||||
for (Iterator<Integer> i = commandIds.iterator(); i.hasNext(); ) {
|
for (Iterator<Integer> i = commandIds.iterator(); i.hasNext(); ) {
|
||||||
Integer commandId = i.next();
|
Integer commandId = i.next();
|
||||||
CCommandDSC command = commandIdCommandMap.get(commandId);
|
CCommandDSC command = commandIdCommandMap.get(commandId);
|
||||||
|
|
||||||
Element cmdElem = doc.createElement(CC_ELEM);
|
Element cmdElem = doc.createElement(CC_ELEM);
|
||||||
collectorElem.appendChild(cmdElem);
|
collectorElem.appendChild(cmdElem);
|
||||||
cmdElem.setAttribute(ID_ATTR, commandId.toString());
|
cmdElem.setAttribute(ID_ATTR, commandId.toString());
|
||||||
cmdElem.setAttribute(FILE_TYPE_ATTR, command.appliesToCPPFileType() ? "c++" : "c"); //$NON-NLS-1$ //$NON-NLS-2$
|
cmdElem.setAttribute(FILE_TYPE_ATTR, command.appliesToCPPFileType() ? "c++" : "c"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// write command and scanner info
|
// write command and scanner info
|
||||||
command.serialize(cmdElem);
|
command.serialize(cmdElem);
|
||||||
// write files command applies to
|
// write files command applies to
|
||||||
Element filesElem = doc.createElement(APPLIES_TO_ATTR);
|
Element filesElem = doc.createElement(APPLIES_TO_ATTR);
|
||||||
cmdElem.appendChild(filesElem);
|
cmdElem.appendChild(filesElem);
|
||||||
Set<IFile> files = commandIdToFilesMap.get(commandId);
|
Set<IFile> files = commandIdToFilesMap.get(commandId);
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (Iterator<IFile> j = files.iterator(); j.hasNext(); ) {
|
for (Iterator<IFile> j = files.iterator(); j.hasNext(); ) {
|
||||||
Element fileElem = doc.createElement(FILE_ELEM);
|
Element fileElem = doc.createElement(FILE_ELEM);
|
||||||
IFile file = j.next();
|
IFile file = j.next();
|
||||||
IPath path = file.getProjectRelativePath();
|
IPath path = file.getProjectRelativePath();
|
||||||
fileElem.setAttribute(PATH_ATTR, path.toString());
|
fileElem.setAttribute(PATH_ATTR, path.toString());
|
||||||
filesElem.appendChild(fileElem);
|
filesElem.appendChild(fileElem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(Throwable e) {
|
catch(Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -856,7 +880,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$
|
protected static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$
|
||||||
|
|
||||||
protected static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$
|
protected static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$
|
||||||
|
@ -872,15 +896,15 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
protected static final int INCLUDE_FILE = 3;
|
protected static final int INCLUDE_FILE = 3;
|
||||||
|
|
||||||
protected static final int INCLUDE_PATH = 1;
|
protected static final int INCLUDE_PATH = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected static final int MACROS_FILE = 4;
|
protected static final int MACROS_FILE = 4;
|
||||||
|
|
||||||
protected static final String PATH_ATTR = "path"; //$NON-NLS-1$
|
protected static final String PATH_ATTR = "path"; //$NON-NLS-1$
|
||||||
|
|
||||||
protected static final int QUOTE_INCLUDE_PATH = 2;
|
protected static final int QUOTE_INCLUDE_PATH = 2;
|
||||||
|
|
||||||
protected static PathInfo createFilePathInfo(CCommandDSC cmd){
|
protected static PathInfo createFilePathInfo(CCommandDSC cmd){
|
||||||
IPath[] includes = stringListToPathArray(cmd.getIncludes());
|
IPath[] includes = stringListToPathArray(cmd.getIncludes());
|
||||||
IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes());
|
IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes());
|
||||||
|
@ -894,7 +918,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
String value = ScannerConfigUtil.getSymbolValue(symbol);
|
String value = ScannerConfigUtil.getSymbolValue(symbol);
|
||||||
definedSymbols.put(key, value);
|
definedSymbols.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles);
|
return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -914,12 +938,12 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
protected int commandIdCounter = 0;
|
protected int commandIdCounter = 0;
|
||||||
protected InfoContext context;
|
protected InfoContext context;
|
||||||
|
|
||||||
/** monitor for data access */
|
/** monitor for data access */
|
||||||
protected final Object fLock = new Object();
|
protected final Object fLock = new Object();
|
||||||
|
|
||||||
private Map<IProject, Map<?, ?>> fProjectSettingsMap = new HashMap<IProject, Map<?, ?>>();
|
private Map<IProject, Map<?, ?>> fProjectSettingsMap = new HashMap<IProject, Map<?, ?>>();
|
||||||
|
|
||||||
protected final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
|
protected final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
|
||||||
protected IProject project;
|
protected IProject project;
|
||||||
protected ProjectScannerInfo psi = null; // sum of all scanner info
|
protected ProjectScannerInfo psi = null; // sum of all scanner info
|
||||||
|
@ -927,22 +951,22 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
// protected List siChangedForFileList; // list of files for which scanner info has changed
|
// protected List siChangedForFileList; // list of files for which scanner info has changed
|
||||||
protected final Map<IResource, Integer> siChangedForFileMap; // (file, comandId) map for deltas
|
protected final Map<IResource, Integer> siChangedForFileMap; // (file, comandId) map for deltas
|
||||||
protected ScannerInfoData sid; // scanner info data
|
protected ScannerInfoData sid; // scanner info data
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public PerFileXLCScannerInfoCollector() {
|
public PerFileXLCScannerInfoCollector() {
|
||||||
sid = new ScannerInfoData();
|
sid = new ScannerInfoData();
|
||||||
|
|
||||||
// siChangedForFileList = new ArrayList();
|
// siChangedForFileList = new ArrayList();
|
||||||
siChangedForFileMap = new HashMap<IResource, Integer>();
|
siChangedForFileMap = new HashMap<IResource, Integer>();
|
||||||
siChangedForCommandIdList = new ArrayList<Integer>();
|
siChangedForCommandIdList = new ArrayList<Integer>();
|
||||||
|
|
||||||
freeCommandIdPool = new TreeSet<Integer>();
|
freeCommandIdPool = new TreeSet<Integer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param file
|
* @param file
|
||||||
* @param object
|
* @param object
|
||||||
*/
|
*/
|
||||||
protected void addCompilerCommand(IFile file, CCommandDSC cmd) {
|
protected void addCompilerCommand(IFile file, CCommandDSC cmd) {
|
||||||
|
@ -967,7 +991,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
generateFileDelta(file, cmd);
|
generateFileDelta(file, cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param commandId
|
* @param commandId
|
||||||
* @param scannerInfo
|
* @param scannerInfo
|
||||||
|
@ -991,14 +1015,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type
|
* @param type
|
||||||
* @param object
|
* @param object
|
||||||
*/
|
*/
|
||||||
protected void addScannerInfo(ScannerInfoTypes type, List delta) {
|
protected void addScannerInfo(ScannerInfoTypes type, List delta) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param file
|
* @param file
|
||||||
|
@ -1049,7 +1073,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
generateProjectScannerInfo();
|
generateProjectScannerInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Map<IResource, PathInfo> calculatePathInfoMap() {
|
protected Map<IResource, PathInfo> calculatePathInfoMap() {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
|
@ -1083,7 +1107,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void contributeToScannerConfig(Object resource, Map scannerInfo) {
|
public void contributeToScannerConfig(Object resource, Map scannerInfo) {
|
||||||
// check the resource
|
// check the resource
|
||||||
String errorMessage = null;
|
String errorMessage = null;
|
||||||
|
@ -1096,7 +1121,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((resource instanceof IFile)) {
|
if ((resource instanceof IFile)) {
|
||||||
|
|
||||||
if (((IFile) resource).getProject() == null) {
|
if (((IFile) resource).getProject() == null) {
|
||||||
|
@ -1125,24 +1150,25 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(resource instanceof IProject) {
|
else if(resource instanceof IProject) {
|
||||||
// save to project level settings
|
// save to project level settings
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
fProjectSettingsMap.put(((IProject) resource), scannerInfo);
|
fProjectSettingsMap.put(((IProject) resource), scannerInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else { // error
|
else { // error
|
||||||
TraceUtil.outputError("PerFileSICollector.contributeToScannerConfig : ", "Not a project or file."); //$NON-NLS-1$ //$NON-NLS-2$
|
TraceUtil.outputError("PerFileSICollector.contributeToScannerConfig : ", "Not a project or file."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
|
||||||
*/
|
*/
|
||||||
public IDiscoveredPathInfo createPathInfoObject() {
|
@Override
|
||||||
|
public IDiscoveredPathInfo createPathInfoObject() {
|
||||||
return new PerFileDiscoveredPathInfo();
|
return new PerFileDiscoveredPathInfo();
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -1151,11 +1177,11 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
public void deleteAll(IResource resource) {
|
public void deleteAll(IResource resource) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
if (resource instanceof IProject) {
|
if (resource instanceof IProject) {
|
||||||
fProjectSettingsMap.remove(((IProject) resource));
|
fProjectSettingsMap.remove(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
|
||||||
*/
|
*/
|
||||||
|
@ -1171,10 +1197,10 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
// siChangedForFileList.add(path);
|
// siChangedForFileList.add(path);
|
||||||
siChangedForFileMap.put(file, null);
|
siChangedForFileMap.put(file, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
sid = new ScannerInfoData();
|
sid = new ScannerInfoData();
|
||||||
psi = null;
|
psi = null;
|
||||||
|
|
||||||
commandIdCounter = 0;
|
commandIdCounter = 0;
|
||||||
freeCommandIdPool.clear();
|
freeCommandIdPool.clear();
|
||||||
}
|
}
|
||||||
|
@ -1183,7 +1209,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
||||||
* deleteAllPaths(org.eclipse.core.resources.IResource)
|
* deleteAllPaths(org.eclipse.core.resources.IResource)
|
||||||
|
@ -1191,14 +1217,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
public void deleteAllPaths(IResource resource) {
|
public void deleteAllPaths(IResource resource) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
if (resource instanceof IProject && fProjectSettingsMap != null) {
|
if (resource instanceof IProject && fProjectSettingsMap != null) {
|
||||||
fProjectSettingsMap.remove(((IProject) resource));
|
fProjectSettingsMap.remove(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
||||||
* deleteAllSymbols(org.eclipse.core.resources.IResource)
|
* deleteAllSymbols(org.eclipse.core.resources.IResource)
|
||||||
|
@ -1206,14 +1232,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
public void deleteAllSymbols(IResource resource) {
|
public void deleteAllSymbols(IResource resource) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
if (resource instanceof IProject && fProjectSettingsMap != null) {
|
if (resource instanceof IProject && fProjectSettingsMap != null) {
|
||||||
fProjectSettingsMap.remove(((IProject) resource));
|
fProjectSettingsMap.remove(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
||||||
* deletePath(org.eclipse.core.resources.IResource, java.lang.String)
|
* deletePath(org.eclipse.core.resources.IResource, java.lang.String)
|
||||||
|
@ -1221,14 +1247,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
public void deletePath(IResource resource, String path) {
|
public void deletePath(IResource resource, String path) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
if (resource instanceof IProject && fProjectSettingsMap != null) {
|
if (resource instanceof IProject && fProjectSettingsMap != null) {
|
||||||
fProjectSettingsMap.remove(((IProject) resource));
|
fProjectSettingsMap.remove(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
||||||
* deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
|
* deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
|
||||||
|
@ -1236,7 +1262,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
public void deleteSymbol(IResource resource, String symbol) {
|
public void deleteSymbol(IResource resource, String symbol) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
if (resource instanceof IProject && fProjectSettingsMap != null) {
|
if (resource instanceof IProject && fProjectSettingsMap != null) {
|
||||||
fProjectSettingsMap.remove(((IProject) resource));
|
fProjectSettingsMap.remove(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1309,7 +1335,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
* <li><code>QUOTE_INCLUDE_PATH</code>
|
* <li><code>QUOTE_INCLUDE_PATH</code>
|
||||||
* <li><code>INCLUDE_FILE</code>
|
* <li><code>INCLUDE_FILE</code>
|
||||||
* <li><code>MACROS_FILE</code>
|
* <li><code>MACROS_FILE</code>
|
||||||
*
|
*
|
||||||
* @return list of IPath(s).
|
* @return list of IPath(s).
|
||||||
*/
|
*/
|
||||||
protected IPath[] getAllIncludePaths1(int type) {
|
protected IPath[] getAllIncludePaths1(int type) {
|
||||||
|
@ -1354,7 +1380,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
* org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
|
||||||
* getAllSymbols()
|
* getAllSymbols()
|
||||||
|
@ -1386,7 +1412,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
return symbols;
|
return symbols;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -1413,14 +1439,15 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
|
||||||
*/
|
*/
|
||||||
public List<CCommandDSC> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
@Override
|
||||||
|
public List<CCommandDSC> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||||
|
|
||||||
List<CCommandDSC> rv = new ArrayList<CCommandDSC>();
|
List<CCommandDSC> rv = new ArrayList<CCommandDSC>();
|
||||||
// check the resource
|
// check the resource
|
||||||
String errorMessage = null;
|
String errorMessage = null;
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
errorMessage = "resource is null";//$NON-NLS-1$
|
errorMessage = "resource is null";//$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else if (!(resource instanceof IResource)) {
|
else if (!(resource instanceof IResource)) {
|
||||||
errorMessage = "resource is not an IResource";//$NON-NLS-1$
|
errorMessage = "resource is not an IResource";//$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -1430,7 +1457,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
else if (((IResource) resource).getProject() != project) {
|
else if (((IResource) resource).getProject() != project) {
|
||||||
errorMessage = "wrong project";//$NON-NLS-1$
|
errorMessage = "wrong project";//$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
|
TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -1509,15 +1536,17 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getDefinedSymbols()
|
* @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getDefinedSymbols()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Map getDefinedSymbols() {
|
public Map getDefinedSymbols() {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
return getAllSymbols();
|
return getAllSymbols();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getIncludePaths()
|
* @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getIncludePaths()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<String> getIncludePaths() {
|
public List<String> getIncludePaths() {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
List<String> pathStrings = new LinkedList<String>();
|
List<String> pathStrings = new LinkedList<String>();
|
||||||
|
@ -1532,7 +1561,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
return pathStrings;
|
return pathStrings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected InfoContext getInfoContext() {
|
protected InfoContext getInfoContext() {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
@ -1571,7 +1600,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInfoContext(InfoContext context) {
|
@Override
|
||||||
|
public void setInfoContext(InfoContext context) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
this.project = context.getProject();
|
this.project = context.getProject();
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
@ -1588,13 +1618,15 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
|
||||||
*/
|
*/
|
||||||
public void setProject(IProject project) {
|
@Override
|
||||||
|
public void setProject(IProject project) {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
setInfoContext(new InfoContext(project));
|
setInfoContext(new InfoContext(project));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException {
|
@Override
|
||||||
|
public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException {
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
|
@ -1609,10 +1641,10 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
siChangedForFileMap.clear();
|
siChangedForFileMap.clear();
|
||||||
}
|
}
|
||||||
siChangedForCommandIdList.clear();
|
siChangedForCommandIdList.clear();
|
||||||
|
|
||||||
// add in any projects that got project level info (from the specs provider)
|
// add in any projects that got project level info (from the specs provider)
|
||||||
changedResources.addAll(fProjectSettingsMap.keySet());
|
changedResources.addAll(fProjectSettingsMap.keySet());
|
||||||
|
|
||||||
monitor.worked(50);
|
monitor.worked(50);
|
||||||
if (!changedResources.isEmpty()) {
|
if (!changedResources.isEmpty()) {
|
||||||
// update outside monitor scope
|
// update outside monitor scope
|
||||||
|
@ -1626,7 +1658,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PerFileDiscoveredPathInfo perFilePathInfo = new PerFileDiscoveredPathInfo();
|
PerFileDiscoveredPathInfo perFilePathInfo = new PerFileDiscoveredPathInfo();
|
||||||
|
|
||||||
// merge them
|
// merge them
|
||||||
if (!(pathInfo instanceof IPerFileDiscoveredPathInfo)) {
|
if (!(pathInfo instanceof IPerFileDiscoveredPathInfo)) {
|
||||||
pathInfo = new MergedPerFileDiscoveredPathInfo(pathInfo, perFilePathInfo);
|
pathInfo = new MergedPerFileDiscoveredPathInfo(pathInfo, perFilePathInfo);
|
||||||
|
@ -1635,32 +1667,32 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
pathInfo = perFilePathInfo;
|
pathInfo = perFilePathInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Job job = new ScannerConfigUpdateJob(context, pathInfo, context.isDefaultContext(), changedResources);
|
Job job = new ScannerConfigUpdateJob(context, pathInfo, context.isDefaultContext(), changedResources);
|
||||||
ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
job.setRule(rule);
|
job.setRule(rule);
|
||||||
job.schedule();
|
job.schedule();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// } finally {
|
// } finally {
|
||||||
// manager.endRule(rule);
|
// manager.endRule(rule);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
monitor.worked(50);
|
monitor.worked(50);
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -87,7 +87,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
private IProject project;
|
private IProject project;
|
||||||
|
|
||||||
private int workingDirsN = 0;
|
private int workingDirsN = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For tracking the location of files being compiled
|
* For tracking the location of files being compiled
|
||||||
*/
|
*/
|
||||||
|
@ -102,10 +102,10 @@ public class XLCBuildOutputParserUtility {
|
||||||
if (workingDirectory != null) {
|
if (workingDirectory != null) {
|
||||||
pushDirectory(workingDirectory);
|
pushDirectory(workingDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public XLCBuildOutputParserUtility(IProject project, IPath workingDirectory,
|
public XLCBuildOutputParserUtility(IProject project, IPath workingDirectory,
|
||||||
IMarkerGenerator markerGenerator) {
|
IMarkerGenerator markerGenerator) {
|
||||||
|
@ -136,7 +136,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
if (compiledFileList.contains(longFileName))
|
if (compiledFileList.contains(longFileName))
|
||||||
return;
|
return;
|
||||||
compiledFileList.add(longFileName);
|
compiledFileList.add(longFileName);
|
||||||
|
|
||||||
String workingDir = getWorkingDirectory().toString();
|
String workingDir = getWorkingDirectory().toString();
|
||||||
List directoryCommandList = (List) directoryCommandListMap.get(workingDir);
|
List directoryCommandList = (List) directoryCommandListMap.get(workingDir);
|
||||||
if (directoryCommandList == null) {
|
if (directoryCommandList == null) {
|
||||||
|
@ -219,7 +219,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void generateReport() {
|
void generateReport() {
|
||||||
TraceUtil.metricsTrace("Stats for directory ", //$NON-NLS-1$
|
TraceUtil.metricsTrace("Stats for directory ", //$NON-NLS-1$
|
||||||
|
@ -227,7 +227,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
directoryCommandListMap);
|
directoryCommandListMap);
|
||||||
TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN); //$NON-NLS-1$
|
TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filePath : String
|
* @param filePath : String
|
||||||
* @return filePath : IPath - not <code>null</code>
|
* @return filePath : IPath - not <code>null</code>
|
||||||
|
@ -239,7 +239,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
}
|
}
|
||||||
else if (filePath.startsWith("\\") || //$NON-NLS-1$
|
else if (filePath.startsWith("\\") || //$NON-NLS-1$
|
||||||
(!filePath.startsWith(".") && //$NON-NLS-1$
|
(!filePath.startsWith(".") && //$NON-NLS-1$
|
||||||
filePath.length() > 2 && filePath.charAt(1) == ':' &&
|
filePath.length() > 2 && filePath.charAt(1) == ':' &&
|
||||||
(filePath.charAt(2) == '\\' || filePath.charAt(2) == '/'))) {
|
(filePath.charAt(2) == '\\' || filePath.charAt(2) == '/'))) {
|
||||||
// absolute path
|
// absolute path
|
||||||
pFilePath = new Path(filePath);
|
pFilePath = new Path(filePath);
|
||||||
|
@ -268,7 +268,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
public IPath getBaseDirectory() {
|
public IPath getBaseDirectory() {
|
||||||
return fBaseDirectory;
|
return fBaseDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all CCommandDSC collected so far.
|
* Returns all CCommandDSC collected so far.
|
||||||
* Currently this list is not filled, so it will always return an empty list.
|
* Currently this list is not filled, so it will always return an empty list.
|
||||||
|
@ -277,7 +277,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
public List getCCommandDSCList() {
|
public List getCCommandDSCList() {
|
||||||
return new ArrayList(commandsList2);
|
return new ArrayList(commandsList2);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getDirectoryLevel() {
|
protected int getDirectoryLevel() {
|
||||||
return fDirectoryStack.size();
|
return fDirectoryStack.size();
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
/**
|
/**
|
||||||
* @param genericLine
|
* @param genericLine
|
||||||
* @param cppFileType
|
* @param cppFileType
|
||||||
* @return CCommandDSC compile command description
|
* @return CCommandDSC compile command description
|
||||||
*/
|
*/
|
||||||
public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) {
|
public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) {
|
||||||
ArrayList dirafter = new ArrayList();
|
ArrayList dirafter = new ArrayList();
|
||||||
|
@ -327,7 +327,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
token.equals("-fno-signed-char") || //$NON-NLS-1$
|
token.equals("-fno-signed-char") || //$NON-NLS-1$
|
||||||
token.equals("-fsigned-char") || //$NON-NLS-1$
|
token.equals("-fsigned-char") || //$NON-NLS-1$
|
||||||
token.startsWith("-fabi-version=") //$NON-NLS-1$
|
token.startsWith("-fabi-version=") //$NON-NLS-1$
|
||||||
) {
|
) {
|
||||||
command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), token));
|
command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), token));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
|
for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
|
||||||
option = (String)iter.next();
|
option = (String)iter.next();
|
||||||
KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option);
|
KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option);
|
||||||
command.addSCOption(pair);
|
command.addSCOption(pair);
|
||||||
}
|
}
|
||||||
includes = new ArrayList();
|
includes = new ArrayList();
|
||||||
// -I- has no parameter
|
// -I- has no parameter
|
||||||
|
@ -356,17 +356,17 @@ public class XLCBuildOutputParserUtility {
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option.length() > 0 && (
|
if (option.length() > 0 && (
|
||||||
optionKind.equals(SCDOptionsEnum.INCLUDE) ||
|
optionKind.equals(SCDOptionsEnum.INCLUDE) ||
|
||||||
optionKind.equals(SCDOptionsEnum.INCLUDE_FILE) ||
|
optionKind.equals(SCDOptionsEnum.INCLUDE_FILE) ||
|
||||||
optionKind.equals(SCDOptionsEnum.IMACROS_FILE) ||
|
optionKind.equals(SCDOptionsEnum.IMACROS_FILE) ||
|
||||||
optionKind.equals(SCDOptionsEnum.IDIRAFTER) ||
|
optionKind.equals(SCDOptionsEnum.IDIRAFTER) ||
|
||||||
optionKind.equals(SCDOptionsEnum.ISYSTEM) ||
|
optionKind.equals(SCDOptionsEnum.ISYSTEM) ||
|
||||||
optionKind.equals(SCDOptionsEnum.IQUOTE) )) {
|
optionKind.equals(SCDOptionsEnum.IQUOTE) )) {
|
||||||
option = (getAbsolutePath(option)).toString();
|
option = (getAbsolutePath(option)).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionKind.equals(SCDOptionsEnum.IDIRAFTER)) {
|
if (optionKind.equals(SCDOptionsEnum.IDIRAFTER)) {
|
||||||
KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
|
KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
|
||||||
dirafter.add(pair);
|
dirafter.add(pair);
|
||||||
|
@ -391,10 +391,10 @@ public class XLCBuildOutputParserUtility {
|
||||||
for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
|
for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
|
||||||
option = (String)iter.next();
|
option = (String)iter.next();
|
||||||
KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
|
KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
|
||||||
command.addSCOption(pair);
|
command.addSCOption(pair);
|
||||||
}
|
}
|
||||||
for (Iterator iter=dirafter.iterator(); iter.hasNext(); ) {
|
for (Iterator iter=dirafter.iterator(); iter.hasNext(); ) {
|
||||||
command.addSCOption((KVStringPair)iter.next());
|
command.addSCOption((KVStringPair)iter.next());
|
||||||
}
|
}
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
@ -470,11 +470,11 @@ public class XLCBuildOutputParserUtility {
|
||||||
fDefaultMacroDefinitionValue= val;
|
fDefaultMacroDefinitionValue= val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultMacroDefinitionValue() {
|
public String getDefaultMacroDefinitionValue() {
|
||||||
return fDefaultMacroDefinitionValue;
|
return fDefaultMacroDefinitionValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String normalizePath(String path) {
|
public String normalizePath(String path) {
|
||||||
int column = path.indexOf(':');
|
int column = path.indexOf(':');
|
||||||
if (column > 0) {
|
if (column > 0) {
|
||||||
|
@ -534,12 +534,12 @@ public class XLCBuildOutputParserUtility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newBuf.append(buf.substring(scp, len));
|
newBuf.append(buf.substring(scp, len));
|
||||||
|
|
||||||
IPath orgPath = new Path(newBuf.toString());
|
IPath orgPath = new Path(newBuf.toString());
|
||||||
return orgPath.toString();
|
return orgPath.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the console line parsers to find a file with a given name.
|
* Called by the console line parsers to find a file with a given name.
|
||||||
* @param fileName
|
* @param fileName
|
||||||
|
@ -554,7 +554,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
// If there is a conflict then try all files in the project.
|
// If there is a conflict then try all files in the project.
|
||||||
if (isConflictingName(fileName)) {
|
if (isConflictingName(fileName)) {
|
||||||
file = null;
|
file = null;
|
||||||
|
|
||||||
// Create a problem marker
|
// Create a problem marker
|
||||||
final String error = MakeMessages.getString("ConsoleParser.Ambiguous_Filepath_Error_Message"); //$NON-NLS-1$
|
final String error = MakeMessages.getString("ConsoleParser.Ambiguous_Filepath_Error_Message"); //$NON-NLS-1$
|
||||||
TraceUtil.outputError(error, fileName);
|
TraceUtil.outputError(error, fileName);
|
||||||
|
@ -564,7 +564,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
}
|
}
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filePath
|
* @param filePath
|
||||||
* @return
|
* @return
|
||||||
|
@ -611,7 +611,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
*/
|
*/
|
||||||
protected IFile findFileName(String fileName) {
|
protected IFile findFileName(String fileName) {
|
||||||
IPath path = new Path(fileName);
|
IPath path = new Path(fileName);
|
||||||
return (IFile) fFilesInProject.get(path.lastSegment());
|
return fFilesInProject.get(path.lastSegment());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IFile findFileInWorkspace(IPath path) {
|
protected IFile findFileInWorkspace(IPath path) {
|
||||||
|
@ -672,7 +672,7 @@ public class XLCBuildOutputParserUtility {
|
||||||
if (!cwd.isAbsolute()) {
|
if (!cwd.isAbsolute()) {
|
||||||
cwd = getBaseDirectory().append(cwd);
|
cwd = getBaseDirectory().append(cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPath filePath = new Path(fileName);
|
IPath filePath = new Path(fileName);
|
||||||
if (!filePath.isAbsolute()) {
|
if (!filePath.isAbsolute()) {
|
||||||
// check if the cwd is the right one
|
// check if the cwd is the right one
|
||||||
|
@ -686,11 +686,11 @@ public class XLCBuildOutputParserUtility {
|
||||||
// probably multiple choices for cwd, hopeless
|
// probably multiple choices for cwd, hopeless
|
||||||
final String error = MakeMessages.getString("ConsoleParser.Working_Directory_Error_Message"); //$NON-NLS-1$
|
final String error = MakeMessages.getString("ConsoleParser.Working_Directory_Error_Message"); //$NON-NLS-1$
|
||||||
TraceUtil.outputError(error, fileName);
|
TraceUtil.outputError(error, fileName);
|
||||||
generateMarker(file, -1, error, IMarkerGenerator.SEVERITY_WARNING, fileName);
|
generateMarker(file, -1, error, IMarkerGenerator.SEVERITY_WARNING, fileName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// remove common segments at the end
|
// remove common segments at the end
|
||||||
IPath tPath = new Path(fileName);
|
IPath tPath = new Path(fileName);
|
||||||
if (fileName.startsWith(".")) { //$NON-NLS-1$
|
if (fileName.startsWith(".")) { //$NON-NLS-1$
|
||||||
tPath = tPath.removeFirstSegments(1);
|
tPath = tPath.removeFirstSegments(1);
|
||||||
|
@ -703,14 +703,14 @@ public class XLCBuildOutputParserUtility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPath candidatePath = cwd.append(includePath);
|
IPath candidatePath = cwd.append(includePath);
|
||||||
File dir = candidatePath.toFile();
|
File dir = candidatePath.toFile();
|
||||||
include = candidatePath.toString();
|
include = candidatePath.toString();
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
final String error = MakeMessages.getString("ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$
|
final String error = MakeMessages.getString("ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$
|
||||||
TraceUtil.outputError(error, include);
|
TraceUtil.outputError(error, include);
|
||||||
// generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, fileName);
|
// generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO VMIR for now add unresolved paths as well
|
// TODO VMIR for now add unresolved paths as well
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser {
|
||||||
@Override
|
@Override
|
||||||
protected boolean processCommand(String[] tokens) {
|
protected boolean processCommand(String[] tokens) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// GCC C/C++ compiler invocation
|
// GCC C/C++ compiler invocation
|
||||||
int compilerInvocationIndex = findCompilerInvocation(tokens);
|
int compilerInvocationIndex = findCompilerInvocation(tokens);
|
||||||
if (compilerInvocationIndex < 0) {
|
if (compilerInvocationIndex < 0) {
|
||||||
|
@ -47,7 +47,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser {
|
||||||
int extensionsIndex = -1;
|
int extensionsIndex = -1;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
String filePath = null;
|
String filePath = null;
|
||||||
|
|
||||||
// check for automake format first
|
// check for automake format first
|
||||||
// e.g. line will start with
|
// e.g. line will start with
|
||||||
// source='/some/path/source.cpp'
|
// source='/some/path/source.cpp'
|
||||||
|
@ -63,7 +63,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
for (int i = compilerInvocationIndex + 1; i < tokens.length; i++) {
|
for (int i = compilerInvocationIndex + 1; i < tokens.length; i++) {
|
||||||
String token = tokens[i];
|
String token = tokens[i];
|
||||||
|
@ -79,7 +79,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
TraceUtil.outputTrace("Error identifying file name :1", tokens, TraceUtil.EOL); //$NON-NLS-1$
|
TraceUtil.outputTrace("Error identifying file name :1", tokens, TraceUtil.EOL); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
|
@ -150,12 +150,12 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser {
|
||||||
// cmdList.add(cmd);
|
// cmdList.add(cmd);
|
||||||
Map<ScannerInfoTypes, List<?>> sc = new HashMap<ScannerInfoTypes, List<?>>();
|
Map<ScannerInfoTypes, List<?>> sc = new HashMap<ScannerInfoTypes, List<?>>();
|
||||||
// sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
|
// sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
|
||||||
|
|
||||||
|
|
||||||
// put in empty info for the other types
|
// put in empty info for the other types
|
||||||
sc.put(ScannerInfoTypes.INCLUDE_PATHS, new LinkedList<String>());
|
sc.put(ScannerInfoTypes.INCLUDE_PATHS, new LinkedList<String>());
|
||||||
sc.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, new LinkedList<String>());
|
sc.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, new LinkedList<String>());
|
||||||
|
|
||||||
getCollector().contributeToScannerConfig(getProject(), sc);
|
getCollector().contributeToScannerConfig(getProject(), sc);
|
||||||
if (fCollector != null && fCollector instanceof IScannerInfoCollector2) {
|
if (fCollector != null && fCollector instanceof IScannerInfoCollector2) {
|
||||||
IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
|
IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
|
||||||
|
@ -166,12 +166,12 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(Throwable e) {
|
catch(Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -190,7 +190,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser {
|
||||||
int equalsIndex = string.indexOf('=');
|
int equalsIndex = string.indexOf('=');
|
||||||
if(equalsIndex != -1 && equalsIndex < string.length())
|
if(equalsIndex != -1 && equalsIndex < string.length())
|
||||||
return string.substring(equalsIndex+1);
|
return string.substring(equalsIndex+1);
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class XLCPerProjectBuildOutputParser extends
|
public class XLCPerProjectBuildOutputParser extends
|
||||||
AbstractXLCBuildOutputParser {
|
AbstractXLCBuildOutputParser {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.xlc.core.scannerconfig.AbstractXLCBuildOutputParser#processCommand(java.lang.String[])
|
* @see org.eclipse.cdt.make.xlc.core.scannerconfig.AbstractXLCBuildOutputParser#processCommand(java.lang.String[])
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +41,7 @@ public class XLCPerProjectBuildOutputParser extends
|
||||||
if (compilerInvocationIdx<0) {
|
if (compilerInvocationIdx<0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compilerInvocationIdx+1 >= tokens.length) {
|
if (compilerInvocationIdx+1 >= tokens.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -102,14 +102,14 @@ public class XLCPerProjectBuildOutputParser extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (fileName == null) {
|
else if (fileName == null) {
|
||||||
int extIndex = token.lastIndexOf('.');
|
int extIndex = token.lastIndexOf('.');
|
||||||
String extension=null;
|
String extension=null;
|
||||||
|
|
||||||
if(extIndex != -1)
|
if(extIndex != -1)
|
||||||
extension = token.substring(extIndex);
|
extension = token.substring(extIndex);
|
||||||
|
|
||||||
List<String> extensions = getFileExtensionsList();
|
List<String> extensions = getFileExtensionsList();
|
||||||
if(extension != null && extensions.contains(extension))
|
if(extension != null && extensions.contains(extension))
|
||||||
fileName = token;
|
fileName = token;
|
||||||
|
@ -120,7 +120,7 @@ public class XLCPerProjectBuildOutputParser extends
|
||||||
return false; // return when no file was given (analogous to GCCPerFileBOPConsoleParser)
|
return false; // return when no file was given (analogous to GCCPerFileBOPConsoleParser)
|
||||||
}
|
}
|
||||||
|
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
IFile file = null;
|
IFile file = null;
|
||||||
List<String> translatedIncludes = includes;
|
List<String> translatedIncludes = includes;
|
||||||
if (includes.size() > 0) {
|
if (includes.size() > 0) {
|
||||||
|
@ -139,7 +139,7 @@ public class XLCPerProjectBuildOutputParser extends
|
||||||
line.append(tokens[j]);
|
line.append(tokens[j]);
|
||||||
line.append(' ');
|
line.append(' ');
|
||||||
}
|
}
|
||||||
final String error = MakeMessages.getString("ConsoleParser.Filename_Missing_Error_Message"); //$NON-NLS-1$
|
final String error = MakeMessages.getString("ConsoleParser.Filename_Missing_Error_Message"); //$NON-NLS-1$
|
||||||
TraceUtil.outputError(error, line.toString());
|
TraceUtil.outputError(error, line.toString());
|
||||||
if (getUtility() != null) {
|
if (getUtility() != null) {
|
||||||
getUtility().generateMarker(getProject(), -1, error + line.toString(), IMarkerGenerator.SEVERITY_WARNING, null);
|
getUtility().generateMarker(getProject(), -1, error + line.toString(), IMarkerGenerator.SEVERITY_WARNING, null);
|
||||||
|
@ -175,5 +175,5 @@ public class XLCPerProjectBuildOutputParser extends
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,27 +10,27 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.make.xlc.core.scannerconfig;
|
package org.eclipse.cdt.make.xlc.core.scannerconfig;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||||
import org.eclipse.cdt.make.xlc.core.activator.Activator;
|
import org.eclipse.cdt.make.xlc.core.activator.Activator;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses output of ppuxlc -E -v specs.c or ppuxlc -E -v specs.cpp command
|
* Parses output of ppuxlc -E -v specs.c or ppuxlc -E -v specs.cpp command
|
||||||
*
|
*
|
||||||
* @author laggarcia
|
* @author laggarcia
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -46,7 +46,7 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
// pattern for the includes arguments
|
// pattern for the includes arguments
|
||||||
final Pattern includePattern = Pattern
|
final Pattern includePattern = Pattern
|
||||||
.compile("-(?:qgcc_c_stdinc|qc_stdinc|qgcc_cpp_stdinc|qcpp_stdinc)=(.*)"); //$NON-NLS-1$
|
.compile("-(?:qgcc_c_stdinc|qc_stdinc|qgcc_cpp_stdinc|qcpp_stdinc)=(.*)"); //$NON-NLS-1$
|
||||||
|
|
||||||
// xlC compiler constants
|
// xlC compiler constants
|
||||||
protected final static String [] compilerConstants = {
|
protected final static String [] compilerConstants = {
|
||||||
"__IBMCPP__", //$NON-NLS-1$
|
"__IBMCPP__", //$NON-NLS-1$
|
||||||
|
@ -54,7 +54,7 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
"__IBMC__", //$NON-NLS-1$
|
"__IBMC__", //$NON-NLS-1$
|
||||||
"__xlc__" //$NON-NLS-1$
|
"__xlc__" //$NON-NLS-1$
|
||||||
};
|
};
|
||||||
|
|
||||||
private IProject fProject = null;
|
private IProject fProject = null;
|
||||||
|
|
||||||
protected IScannerInfoCollector fCollector = null;
|
protected IScannerInfoCollector fCollector = null;
|
||||||
|
@ -65,13 +65,14 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject,
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject,
|
||||||
* org.eclipse.core.runtime.IPath,
|
* org.eclipse.core.runtime.IPath,
|
||||||
* org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector,
|
* org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector,
|
||||||
* org.eclipse.cdt.core.IMarkerGenerator)
|
* org.eclipse.cdt.core.IMarkerGenerator)
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void startup(IProject project, IPath workingDirectory,
|
public void startup(IProject project, IPath workingDirectory,
|
||||||
IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||||
this.fProject = project;
|
this.fProject = project;
|
||||||
|
@ -83,13 +84,14 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
* standard information about the compiler being used. <p> During the
|
* standard information about the compiler being used. <p> During the
|
||||||
* processing, builds two List objects, one with the standard symbols
|
* processing, builds two List objects, one with the standard symbols
|
||||||
* defined in the compiler and other with the standard include directories.
|
* defined in the compiler and other with the standard include directories.
|
||||||
*
|
*
|
||||||
* @param line the output line from the compiler command line used @return
|
* @param line the output line from the compiler command line used @return
|
||||||
* boolean
|
* boolean
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.make.intrenal.core.scannerconfig.gnu.GCCSpecsConsoleParser#processLine(java.lang.String)
|
* @see org.eclipse.cdt.make.intrenal.core.scannerconfig.gnu.GCCSpecsConsoleParser#processLine(java.lang.String)
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean processLine(String line) {
|
public boolean processLine(String line) {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
TraceUtil.outputTrace(
|
TraceUtil.outputTrace(
|
||||||
|
@ -132,13 +134,14 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
|
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
|
Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
|
||||||
|
|
||||||
// insert compiler constants, work around buggy xlC option for dumping symbols (it misses a few)
|
// insert compiler constants, work around buggy xlC option for dumping symbols (it misses a few)
|
||||||
for (String constant : compilerConstants) {
|
for (String constant : compilerConstants) {
|
||||||
if (!symbols.contains(constant))
|
if (!symbols.contains(constant))
|
||||||
|
@ -148,7 +151,7 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
// add the scanner info
|
// add the scanner info
|
||||||
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
|
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
|
||||||
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
|
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
|
||||||
|
|
||||||
fCollector.contributeToScannerConfig(fProject, scannerInfo);
|
fCollector.contributeToScannerConfig(fProject, scannerInfo);
|
||||||
if(fCollector != null && fCollector instanceof IScannerInfoCollector2) {
|
if(fCollector != null && fCollector instanceof IScannerInfoCollector2) {
|
||||||
IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
|
IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
|
||||||
|
|
|
@ -12,14 +12,13 @@ package org.eclipse.cdt.make.xlc.core.scannerconfig;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.GCCSpecsRunSIProvider;
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.GCCSpecsRunSIProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
|
|
||||||
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
|
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author laggarcia
|
* @author laggarcia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class XlCSpecsRunSIProvider extends GCCSpecsRunSIProvider {
|
public class XlCSpecsRunSIProvider extends GCCSpecsRunSIProvider {
|
||||||
|
|
||||||
|
@ -27,9 +26,10 @@ public class XlCSpecsRunSIProvider extends GCCSpecsRunSIProvider {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.GCCSpecsRunSIProvider#initialize()
|
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.GCCSpecsRunSIProvider#initialize()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected boolean initialize() {
|
protected boolean initialize() {
|
||||||
|
|
||||||
boolean rc = super.initialize();
|
boolean rc = super.initialize();
|
||||||
|
|
|
@ -18,14 +18,14 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that represents a XL C/C++ compiler command and related scanner configuration
|
* Class that represents a XL C/C++ compiler command and related scanner configuration
|
||||||
*/
|
*/
|
||||||
public class XLCCommandDSC extends CCommandDSC {
|
public class XLCCommandDSC extends CCommandDSC {
|
||||||
|
|
||||||
public XLCCommandDSC(boolean cppFileType) {
|
public XLCCommandDSC(boolean cppFileType) {
|
||||||
super(cppFileType);
|
super(cppFileType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XLCCommandDSC(boolean cppFileType, IProject project) {
|
public XLCCommandDSC(boolean cppFileType, IProject project) {
|
||||||
super(cppFileType, project);
|
super(cppFileType, project);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
public class XLCCorePlugin extends AbstractUIPlugin {
|
public class XLCCorePlugin extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public XLCCorePlugin() {
|
public XLCCorePlugin() {
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
|
|
|
@ -20,32 +20,34 @@ import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
|
||||||
public class AixConfigurationEnvironmentSupplier implements
|
public class AixConfigurationEnvironmentSupplier implements
|
||||||
IConfigurationEnvironmentVariableSupplier {
|
IConfigurationEnvironmentVariableSupplier {
|
||||||
static final String VARNAME = "PATH";
|
static final String VARNAME = "PATH";
|
||||||
static final String BINPATH = "/usr/vac/bin";
|
static final String BINPATH = "/usr/vac/bin";
|
||||||
static final String DELIMITER_AIX = ":";
|
static final String DELIMITER_AIX = ":";
|
||||||
static final String PROPERTY_DELIMITER = "path.separator";
|
static final String PROPERTY_DELIMITER = "path.separator";
|
||||||
static final String PROPERTY_OSNAME = "os.name";
|
static final String PROPERTY_OSNAME = "os.name";
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier#getVariable(java.lang.String, org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
|
* @see org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier#getVariable(java.lang.String, org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IBuildEnvironmentVariable getVariable(String variableName,
|
public IBuildEnvironmentVariable getVariable(String variableName,
|
||||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||||
|
|
||||||
if (variableName == null) return null;
|
if (variableName == null) return null;
|
||||||
if (!VARNAME.equalsIgnoreCase(variableName)) return null;
|
if (!VARNAME.equalsIgnoreCase(variableName)) return null;
|
||||||
return new BuildEnvVar(VARNAME, BINPATH,
|
return new BuildEnvVar(VARNAME, BINPATH,
|
||||||
IBuildEnvironmentVariable.ENVVAR_PREPEND,
|
IBuildEnvironmentVariable.ENVVAR_PREPEND,
|
||||||
System.getProperty(PROPERTY_DELIMITER, DELIMITER_AIX));
|
System.getProperty(PROPERTY_DELIMITER, DELIMITER_AIX));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier#getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
|
* @see org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier#getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IBuildEnvironmentVariable[] getVariables(
|
public IBuildEnvironmentVariable[] getVariables(
|
||||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||||
|
|
||||||
IBuildEnvironmentVariable[] tmp = new IBuildEnvironmentVariable[1];
|
IBuildEnvironmentVariable[] tmp = new IBuildEnvironmentVariable[1];
|
||||||
tmp[0] = getVariable(VARNAME, configuration, provider);
|
tmp[0] = getVariable(VARNAME, configuration, provider);
|
||||||
if (tmp[0] != null) return tmp;
|
if (tmp[0] != null) return tmp;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,11 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
|
||||||
public class AixPathResolver implements IBuildPathResolver {
|
public class AixPathResolver implements IBuildPathResolver {
|
||||||
static final String DELIMITER_AIX = ":";
|
static final String DELIMITER_AIX = ":";
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildPathResolver#resolveBuildPaths(int, java.lang.String, java.lang.String, org.eclipse.cdt.managedbuilder.core.IConfiguration)
|
* @see org.eclipse.cdt.managedbuilder.core.IBuildPathResolver#resolveBuildPaths(int, java.lang.String, java.lang.String, org.eclipse.cdt.managedbuilder.core.IConfiguration)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] resolveBuildPaths(int pathType, String variableName,
|
public String[] resolveBuildPaths(int pathType, String variableName,
|
||||||
String variableValue, IConfiguration configuration) {
|
String variableValue, IConfiguration configuration) {
|
||||||
return variableValue.split(DELIMITER_AIX);
|
return variableValue.split(DELIMITER_AIX);
|
||||||
|
|
|
@ -31,14 +31,15 @@ public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier#getMacro(java.lang.String, org.eclipse.cdt.managedbuilder.core.IManagedProject, org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider)
|
* @see org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier#getMacro(java.lang.String, org.eclipse.cdt.managedbuilder.core.IManagedProject, org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IBuildMacro getMacro(String macroName, IManagedProject project,
|
public IBuildMacro getMacro(String macroName, IManagedProject project,
|
||||||
IBuildMacroProvider provider) {
|
IBuildMacroProvider provider) {
|
||||||
|
|
||||||
if(macroName.equals(PreferenceConstants.P_XL_COMPILER_ROOT)) {
|
if(macroName.equals(PreferenceConstants.P_XL_COMPILER_ROOT)) {
|
||||||
String compilerPath = null;
|
String compilerPath = null;
|
||||||
|
|
||||||
// figure out compiler path from properties and preferences
|
// figure out compiler path from properties and preferences
|
||||||
|
|
||||||
// search for property first
|
// search for property first
|
||||||
IProject theProject = (IProject) project.getOwner();
|
IProject theProject = (IProject) project.getOwner();
|
||||||
try {
|
try {
|
||||||
|
@ -48,19 +49,19 @@ public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(compilerPath == null) {
|
if(compilerPath == null) {
|
||||||
// use the workbench preference
|
// use the workbench preference
|
||||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildMacro macro = new BuildMacro(macroName, ICdtVariable.VALUE_PATH_DIR,
|
BuildMacro macro = new BuildMacro(macroName, ICdtVariable.VALUE_PATH_DIR,
|
||||||
compilerPath);
|
compilerPath);
|
||||||
|
|
||||||
return macro;
|
return macro;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
return provider.getMacro(macroName, IBuildMacroProvider.CONTEXT_PROJECT, project, true);
|
return provider.getMacro(macroName, IBuildMacroProvider.CONTEXT_PROJECT, project, true);
|
||||||
}
|
}
|
||||||
|
@ -68,15 +69,16 @@ public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier#getMacros(org.eclipse.cdt.managedbuilder.core.IManagedProject, org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider)
|
* @see org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier#getMacros(org.eclipse.cdt.managedbuilder.core.IManagedProject, org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IBuildMacro[] getMacros(IManagedProject project,
|
public IBuildMacro[] getMacros(IManagedProject project,
|
||||||
IBuildMacroProvider provider) {
|
IBuildMacroProvider provider) {
|
||||||
|
|
||||||
String macroName = PreferenceConstants.P_XL_COMPILER_ROOT;
|
String macroName = PreferenceConstants.P_XL_COMPILER_ROOT;
|
||||||
|
|
||||||
String compilerPath = null;
|
String compilerPath = null;
|
||||||
|
|
||||||
// figure out compiler path from properties and preferences
|
// figure out compiler path from properties and preferences
|
||||||
|
|
||||||
// search for property first
|
// search for property first
|
||||||
IProject theProject = (IProject) project.getOwner();
|
IProject theProject = (IProject) project.getOwner();
|
||||||
try {
|
try {
|
||||||
|
@ -86,31 +88,31 @@ public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(compilerPath == null) {
|
if(compilerPath == null) {
|
||||||
// use the workbench preference
|
// use the workbench preference
|
||||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildMacro macro = new BuildMacro(macroName, ICdtVariable.VALUE_PATH_DIR,
|
BuildMacro macro = new BuildMacro(macroName, ICdtVariable.VALUE_PATH_DIR,
|
||||||
compilerPath);
|
compilerPath);
|
||||||
|
|
||||||
// our array consists of our macro, plus all the macros from our parent
|
// our array consists of our macro, plus all the macros from our parent
|
||||||
IBuildMacro[] parentMacros = provider.getMacros(IBuildMacroProvider.CONTEXT_PROJECT, project, true);
|
IBuildMacro[] parentMacros = provider.getMacros(IBuildMacroProvider.CONTEXT_PROJECT, project, true);
|
||||||
|
|
||||||
int numMacros = parentMacros.length + 1; // +1 for our macro
|
int numMacros = parentMacros.length + 1; // +1 for our macro
|
||||||
|
|
||||||
IBuildMacro[] macros = new IBuildMacro[numMacros];
|
IBuildMacro[] macros = new IBuildMacro[numMacros];
|
||||||
|
|
||||||
macros[0] = macro;
|
macros[0] = macro;
|
||||||
|
|
||||||
for(int k = 1; k < macros.length; k++) {
|
for(int k = 1; k < macros.length; k++) {
|
||||||
macros[k] = parentMacros[k-1];
|
macros[k] = parentMacros[k-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return macros;
|
return macros;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.managedbuilder.xlc.ui;
|
package org.eclipse.cdt.managedbuilder.xlc.ui;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.Plugin;
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main plugin class to be used in the desktop.
|
* The main plugin class to be used in the desktop.
|
||||||
|
@ -24,7 +25,7 @@ public class XLCUIPlugin extends AbstractUIPlugin {
|
||||||
private static XLCUIPlugin plugin;
|
private static XLCUIPlugin plugin;
|
||||||
//Resource bundle.
|
//Resource bundle.
|
||||||
private ResourceBundle resourceBundle;
|
private ResourceBundle resourceBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor.
|
* The constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -36,6 +37,7 @@ public class XLCUIPlugin extends AbstractUIPlugin {
|
||||||
/**
|
/**
|
||||||
* This method is called upon plug-in activation
|
* This method is called upon plug-in activation
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +45,7 @@ public class XLCUIPlugin extends AbstractUIPlugin {
|
||||||
/**
|
/**
|
||||||
* This method is called when the plug-in is stopped
|
* This method is called when the plug-in is stopped
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
plugin = null;
|
plugin = null;
|
||||||
|
|
|
@ -21,32 +21,32 @@ public class PreferenceConstants {
|
||||||
public static final String P_XL_COMPILER_ROOT = "XL_compilerRoot"; //$NON-NLS-1$
|
public static final String P_XL_COMPILER_ROOT = "XL_compilerRoot"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String P_XLC_COMPILER_VERSION = "XLC_compilerVersion"; //$NON-NLS-1$
|
public static final String P_XLC_COMPILER_VERSION = "XLC_compilerVersion"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String P_XL_COMPILER_VERSION_8 = "v8.0"; //$NON-NLS-1$
|
public static final String P_XL_COMPILER_VERSION_8 = "v8.0"; //$NON-NLS-1$
|
||||||
public static final String P_XL_COMPILER_VERSION_9 = "v9.0"; //$NON-NLS-1$
|
public static final String P_XL_COMPILER_VERSION_9 = "v9.0"; //$NON-NLS-1$
|
||||||
public static final String P_XL_COMPILER_VERSION_10 = "v10.1"; //$NON-NLS-1$
|
public static final String P_XL_COMPILER_VERSION_10 = "v10.1"; //$NON-NLS-1$
|
||||||
public static final String P_XL_COMPILER_VERSION_11 = "v11.1"; //$NON-NLS-1$
|
public static final String P_XL_COMPILER_VERSION_11 = "v11.1"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String P_XL_COMPILER_VERSION_8_NAME = Messages.XLCompiler_v8;
|
public static final String P_XL_COMPILER_VERSION_8_NAME = Messages.XLCompiler_v8;
|
||||||
public static final String P_XL_COMPILER_VERSION_9_NAME = Messages.XLCompiler_v9;
|
public static final String P_XL_COMPILER_VERSION_9_NAME = Messages.XLCompiler_v9;
|
||||||
public static final String P_XL_COMPILER_VERSION_10_NAME = Messages.XLCompiler_v10;
|
public static final String P_XL_COMPILER_VERSION_10_NAME = Messages.XLCompiler_v10;
|
||||||
public static final String P_XL_COMPILER_VERSION_11_NAME = Messages.XLCompiler_v11;
|
public static final String P_XL_COMPILER_VERSION_11_NAME = Messages.XLCompiler_v11;
|
||||||
|
|
||||||
public static String getVersion (String label) {
|
public static String getVersion (String label) {
|
||||||
if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_11_NAME))
|
if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_11_NAME))
|
||||||
return P_XL_COMPILER_VERSION_11;
|
return P_XL_COMPILER_VERSION_11;
|
||||||
else if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_10_NAME))
|
else if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_10_NAME))
|
||||||
return P_XL_COMPILER_VERSION_10;
|
return P_XL_COMPILER_VERSION_10;
|
||||||
else if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_9_NAME))
|
else if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_9_NAME))
|
||||||
return P_XL_COMPILER_VERSION_9;
|
return P_XL_COMPILER_VERSION_9;
|
||||||
else
|
else
|
||||||
return P_XL_COMPILER_VERSION_8;
|
return P_XL_COMPILER_VERSION_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getVersionLabel (String version) {
|
public static String getVersionLabel (String version) {
|
||||||
if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_11))
|
if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_11))
|
||||||
return P_XL_COMPILER_VERSION_11_NAME;
|
return P_XL_COMPILER_VERSION_11_NAME;
|
||||||
else if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_10))
|
else if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_10))
|
||||||
return P_XL_COMPILER_VERSION_10_NAME;
|
return P_XL_COMPILER_VERSION_10_NAME;
|
||||||
else if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_9))
|
else if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_9))
|
||||||
return P_XL_COMPILER_VERSION_9_NAME;
|
return P_XL_COMPILER_VERSION_9_NAME;
|
||||||
|
|
|
@ -11,11 +11,10 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.managedbuilder.xlc.ui.preferences;
|
package org.eclipse.cdt.managedbuilder.xlc.ui.preferences;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
||||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used to initialize default preference values.
|
* Class used to initialize default preference values.
|
||||||
*/
|
*/
|
||||||
|
@ -23,9 +22,10 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
|
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void initializeDefaultPreferences() {
|
public void initializeDefaultPreferences() {
|
||||||
IPreferenceStore store = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore store = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
store.setDefault(PreferenceConstants.P_XL_COMPILER_ROOT, "/usr/vacpp/bin"); //$NON-NLS-1$
|
store.setDefault(PreferenceConstants.P_XL_COMPILER_ROOT, "/usr/vacpp/bin"); //$NON-NLS-1$
|
||||||
|
|
|
@ -11,19 +11,21 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.managedbuilder.xlc.ui.preferences;
|
package org.eclipse.cdt.managedbuilder.xlc.ui.preferences;
|
||||||
|
|
||||||
import org.eclipse.jface.dialogs.IMessageProvider;
|
|
||||||
import org.eclipse.jface.preference.*;
|
|
||||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
|
||||||
import org.eclipse.ui.IWorkbench;
|
|
||||||
import org.eclipse.cdt.managedbuilder.xlc.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.xlc.ui.Messages;
|
||||||
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
||||||
|
import org.eclipse.jface.dialogs.IMessageProvider;
|
||||||
|
import org.eclipse.jface.preference.ComboFieldEditor;
|
||||||
|
import org.eclipse.jface.preference.DirectoryFieldEditor;
|
||||||
|
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||||
|
import org.eclipse.ui.IWorkbench;
|
||||||
|
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a preference page that
|
* This class represents a preference page that
|
||||||
* is contributed to the Preferences dialog. By
|
* is contributed to the Preferences dialog. By
|
||||||
* subclassing <samp>FieldEditorPreferencePage</samp>, we
|
* subclassing <samp>FieldEditorPreferencePage</samp>, we
|
||||||
* can use the field support built into JFace that allows
|
* can use the field support built into JFace that allows
|
||||||
* us to create a page that is small and knows how to
|
* us to create a page that is small and knows how to
|
||||||
* save, restore and apply itself.
|
* save, restore and apply itself.
|
||||||
* <p>
|
* <p>
|
||||||
* This page is used to modify preferences only. They
|
* This page is used to modify preferences only. They
|
||||||
|
@ -43,18 +45,20 @@ public class XLCompilerPreferencePage
|
||||||
setPreferenceStore(XLCUIPlugin.getDefault().getPreferenceStore());
|
setPreferenceStore(XLCUIPlugin.getDefault().getPreferenceStore());
|
||||||
setDescription(Messages.XLCompilerPreferencePage_0);
|
setDescription(Messages.XLCompilerPreferencePage_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the field editors. Field editors are abstractions of
|
* Creates the field editors. Field editors are abstractions of
|
||||||
* the common GUI blocks needed to manipulate various types
|
* the common GUI blocks needed to manipulate various types
|
||||||
* of preferences. Each field editor knows how to save and
|
* of preferences. Each field editor knows how to save and
|
||||||
* restore itself.
|
* restore itself.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void createFieldEditors() {
|
public void createFieldEditors() {
|
||||||
|
|
||||||
DirectoryFieldEditor pathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT, Messages.XLCompilerPreferencePage_1, getFieldEditorParent())
|
DirectoryFieldEditor pathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT, Messages.XLCompilerPreferencePage_1, getFieldEditorParent())
|
||||||
{
|
{
|
||||||
protected boolean doCheckState()
|
@Override
|
||||||
|
protected boolean doCheckState()
|
||||||
{
|
{
|
||||||
// always return true, as we don't want to fail cases when compiler is installed remotely
|
// always return true, as we don't want to fail cases when compiler is installed remotely
|
||||||
// just warn user
|
// just warn user
|
||||||
|
@ -66,35 +70,37 @@ public class XLCompilerPreferencePage
|
||||||
{
|
{
|
||||||
setMessage(originalMessage);
|
setMessage(originalMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkState()
|
@Override
|
||||||
|
protected boolean checkState()
|
||||||
{
|
{
|
||||||
return doCheckState();
|
return doCheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
addField(pathEditor);
|
addField(pathEditor);
|
||||||
|
|
||||||
String[][] versionEntries = {{PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_8},
|
String[][] versionEntries = {{PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_8},
|
||||||
{PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_9},
|
{PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_9},
|
||||||
{PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_10},
|
{PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_10},
|
||||||
{PreferenceConstants.P_XL_COMPILER_VERSION_11_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_11}};
|
{PreferenceConstants.P_XL_COMPILER_VERSION_11_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_11}};
|
||||||
|
|
||||||
addField(new ComboFieldEditor(PreferenceConstants.P_XLC_COMPILER_VERSION,
|
addField(new ComboFieldEditor(PreferenceConstants.P_XLC_COMPILER_VERSION,
|
||||||
Messages.XLCompilerPreferencePage_2, versionEntries, getFieldEditorParent()));
|
Messages.XLCompilerPreferencePage_2, versionEntries, getFieldEditorParent()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
||||||
*/
|
*/
|
||||||
public void init(IWorkbench workbench)
|
@Override
|
||||||
|
public void init(IWorkbench workbench)
|
||||||
{
|
{
|
||||||
originalMessage = getMessage();
|
originalMessage = getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,30 +24,33 @@ public class HiddenOptionApplicabilityCalculator implements
|
||||||
IOptionApplicability {
|
IOptionApplicability {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function decides if the option for which this class
|
* This function decides if the option for which this class
|
||||||
* is option applicability calculator is enabled or not.
|
* is option applicability calculator is enabled or not.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionEnabled(IBuildObject configuration,
|
public boolean isOptionEnabled(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function decides if the option for which this class
|
* This function decides if the option for which this class
|
||||||
* is option applicability calculator is used in command line
|
* is option applicability calculator is used in command line
|
||||||
* or not.
|
* or not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function decides if the option for which this class
|
* This function decides if the option for which this class
|
||||||
* is option applicability calculator is visible or not.
|
* is option applicability calculator is visible or not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOptionVisible(IBuildObject configuration,
|
public boolean isOptionVisible(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -18,7 +18,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.ResourceBundle;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
|
@ -37,30 +36,30 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author rkerimov
|
* @author rkerimov
|
||||||
*
|
*
|
||||||
* This applicability calculator hides/shows options that are specific to the XL compiler versions
|
* This applicability calculator hides/shows options that are specific to the XL compiler versions
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class XLCApplicabilityCalculator implements IOptionApplicability
|
public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
{
|
{
|
||||||
private static final String BUNDLE_NAME = "org/eclipse/cdt/managedbuilder/xlc/ui/properties/applicability.properties";
|
private static final String BUNDLE_NAME = "org/eclipse/cdt/managedbuilder/xlc/ui/properties/applicability.properties";
|
||||||
private static final String PROP_NAME_VERSION_ORDER = "xlc.applicability.version.order";
|
private static final String PROP_NAME_VERSION_ORDER = "xlc.applicability.version.order";
|
||||||
private static final String PROP_VALUE_PLUS = "+";
|
private static final String PROP_VALUE_PLUS = "+";
|
||||||
|
|
||||||
private static boolean initialized;
|
private static boolean initialized;
|
||||||
private static List versionOrder;
|
private static List versionOrder;
|
||||||
private static Map applicabilityMap;
|
private static Map applicabilityMap;
|
||||||
|
|
||||||
public XLCApplicabilityCalculator()
|
public XLCApplicabilityCalculator()
|
||||||
{
|
{
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
Properties props = null;
|
Properties props = null;
|
||||||
|
|
||||||
ClassLoader loader = this.getClass().getClassLoader();
|
ClassLoader loader = this.getClass().getClassLoader();
|
||||||
InputStream input = null;
|
InputStream input = null;
|
||||||
|
|
||||||
if (loader != null)
|
if (loader != null)
|
||||||
input = loader.getResourceAsStream(BUNDLE_NAME);
|
input = loader.getResourceAsStream(BUNDLE_NAME);
|
||||||
|
|
||||||
|
@ -73,24 +72,24 @@ public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
{
|
{
|
||||||
props = new Properties();
|
props = new Properties();
|
||||||
props.load(input);
|
props.load(input);
|
||||||
|
|
||||||
Set entrySet = props.entrySet();
|
Set entrySet = props.entrySet();
|
||||||
Iterator iterator = entrySet.iterator();
|
Iterator iterator = entrySet.iterator();
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
Map.Entry entry = (Map.Entry) iterator.next();
|
Map.Entry entry = (Map.Entry) iterator.next();
|
||||||
|
|
||||||
String key = (String) entry.getKey();
|
String key = (String) entry.getKey();
|
||||||
String value = (String) entry.getValue();
|
String value = (String) entry.getValue();
|
||||||
|
|
||||||
if (value == null)
|
if (value == null)
|
||||||
value = "";
|
value = "";
|
||||||
|
|
||||||
if (key.equals(PROP_NAME_VERSION_ORDER))
|
if (key.equals(PROP_NAME_VERSION_ORDER))
|
||||||
{
|
{
|
||||||
versionOrder = new ArrayList();
|
versionOrder = new ArrayList();
|
||||||
String[] versions = value.split(",");
|
String[] versions = value.split(",");
|
||||||
|
|
||||||
if (versions != null)
|
if (versions != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < versions.length; i ++)
|
for (int i = 0; i < versions.length; i ++)
|
||||||
|
@ -103,14 +102,14 @@ public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
{
|
{
|
||||||
if (applicabilityMap == null)
|
if (applicabilityMap == null)
|
||||||
applicabilityMap = new HashMap();
|
applicabilityMap = new HashMap();
|
||||||
|
|
||||||
List applicList = (List) applicabilityMap.get(key);
|
List applicList = (List) applicabilityMap.get(key);
|
||||||
if (applicList == null)
|
if (applicList == null)
|
||||||
{
|
{
|
||||||
applicList = new ArrayList();
|
applicList = new ArrayList();
|
||||||
applicabilityMap.put(key, applicList);
|
applicabilityMap.put(key, applicList);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasGreaterOption = false;
|
boolean hasGreaterOption = false;
|
||||||
//find if ends with + and set as separate option
|
//find if ends with + and set as separate option
|
||||||
if (value.endsWith(PROP_VALUE_PLUS))
|
if (value.endsWith(PROP_VALUE_PLUS))
|
||||||
|
@ -118,16 +117,16 @@ public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
hasGreaterOption = true;
|
hasGreaterOption = true;
|
||||||
value = value.substring(0, value.length() - PROP_VALUE_PLUS.length());
|
value = value.substring(0, value.length() - PROP_VALUE_PLUS.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] versions = value.split(",");
|
String[] versions = value.split(",");
|
||||||
|
|
||||||
if (versions != null)
|
if (versions != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < versions.length; i ++)
|
for (int i = 0; i < versions.length; i ++)
|
||||||
{
|
{
|
||||||
applicList.add(versions[i].trim());
|
applicList.add(versions[i].trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasGreaterOption)
|
if (hasGreaterOption)
|
||||||
|
@ -140,49 +139,49 @@ public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (input != null)
|
if (input != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isApplicable(IBuildObject configuration, IHoldsOptions holder, IOption option)
|
private boolean isApplicable(IBuildObject configuration, IHoldsOptions holder, IOption option)
|
||||||
{
|
{
|
||||||
// first we check the preference for this project, if it exists
|
// first we check the preference for this project, if it exists
|
||||||
IProject project = null;
|
IProject project = null;
|
||||||
if(configuration instanceof IConfiguration)
|
if(configuration instanceof IConfiguration)
|
||||||
{
|
{
|
||||||
IConfiguration config = (IConfiguration) configuration;
|
IConfiguration config = (IConfiguration) configuration;
|
||||||
IManagedProject managedProject = config.getManagedProject();
|
IManagedProject managedProject = config.getManagedProject();
|
||||||
|
|
||||||
project = (IProject) managedProject.getOwner();
|
project = (IProject) managedProject.getOwner();
|
||||||
}
|
}
|
||||||
else if(configuration instanceof IFolderInfo)
|
else if(configuration instanceof IFolderInfo)
|
||||||
{
|
{
|
||||||
IFolderInfo folderInfo = (IFolderInfo) configuration;
|
IFolderInfo folderInfo = (IFolderInfo) configuration;
|
||||||
|
|
||||||
IConfiguration config = folderInfo.getParent();
|
IConfiguration config = folderInfo.getParent();
|
||||||
|
|
||||||
IManagedProject managedProject = config.getManagedProject();
|
IManagedProject managedProject = config.getManagedProject();
|
||||||
|
|
||||||
project = (IProject) managedProject.getOwner();
|
project = (IProject) managedProject.getOwner();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project == null)
|
if (project == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -193,8 +192,8 @@ public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion == null)
|
if(currentVersion == null)
|
||||||
{
|
{
|
||||||
// if the property isn't set, then use the workbench preference
|
// if the property isn't set, then use the workbench preference
|
||||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
|
@ -204,20 +203,20 @@ public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
//if applicability list is empty that means all options applicable to all versions
|
//if applicability list is empty that means all options applicable to all versions
|
||||||
if (applicabilityMap == null)
|
if (applicabilityMap == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//if applicability list for this option is not defined then option has no applicability restrictions
|
//if applicability list for this option is not defined then option has no applicability restrictions
|
||||||
List applicList = (List) applicabilityMap.get(option.getId());
|
List applicList = (List) applicabilityMap.get(option.getId());
|
||||||
if (applicList == null || applicList.isEmpty())
|
if (applicList == null || applicList.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//if version is defined in the list - perfect match
|
//if version is defined in the list - perfect match
|
||||||
if (applicList.contains(currentVersion))
|
if (applicList.contains(currentVersion))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//if applicability is defined as 'starting from this version and greater', i.e. 'v8.0+',
|
//if applicability is defined as 'starting from this version and greater', i.e. 'v8.0+',
|
||||||
//then we need to find out if current version is greater than the last valid in the list
|
//then we need to find out if current version is greater than the last valid in the list
|
||||||
String lastOption = (String) applicList.get(applicList.size() - 1);
|
String lastOption = (String) applicList.get(applicList.size() - 1);
|
||||||
|
|
||||||
if (lastOption != null && lastOption.equals(PROP_VALUE_PLUS))
|
if (lastOption != null && lastOption.equals(PROP_VALUE_PLUS))
|
||||||
{
|
{
|
||||||
//if 'greater than' option is specified but no version order exists, consider config error and return false
|
//if 'greater than' option is specified but no version order exists, consider config error and return false
|
||||||
|
@ -230,31 +229,32 @@ public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
for (int k = applicList.size() - 2; k >= 0; k --)
|
for (int k = applicList.size() - 2; k >= 0; k --)
|
||||||
{
|
{
|
||||||
String version = (String) applicList.get(k);
|
String version = (String) applicList.get(k);
|
||||||
|
|
||||||
if (versionOrder.contains(version))
|
if (versionOrder.contains(version))
|
||||||
{
|
{
|
||||||
validVersion = version;
|
validVersion = version;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if version that applicability starts with doesn't exist - config error
|
//if version that applicability starts with doesn't exist - config error
|
||||||
if (validVersion == null)
|
if (validVersion == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//compare if current compiler version is greater than the applicability version
|
//compare if current compiler version is greater than the applicability version
|
||||||
if (versionOrder.indexOf(currentVersion) > versionOrder.indexOf(validVersion))
|
if (versionOrder.indexOf(currentVersion) > versionOrder.indexOf(validVersion))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionEnabled(IBuildObject configuration,
|
public boolean isOptionEnabled(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return isApplicable(configuration, holder, option);
|
return isApplicable(configuration, holder, option);
|
||||||
|
@ -263,6 +263,7 @@ public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return isApplicable(configuration, holder, option);
|
return isApplicable(configuration, holder, option);
|
||||||
|
@ -271,6 +272,7 @@ public class XLCApplicabilityCalculator implements IOptionApplicability
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionVisible(IBuildObject configuration,
|
public boolean isOptionVisible(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return isApplicable(configuration, holder, option);
|
return isApplicable(configuration, holder, option);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -37,6 +37,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void createFieldEditors() {
|
protected void createFieldEditors() {
|
||||||
createPathEditor();
|
createPathEditor();
|
||||||
createVersionEditor();
|
createVersionEditor();
|
||||||
|
@ -45,7 +46,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
|
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
|
||||||
* ()
|
* ()
|
||||||
|
@ -56,6 +57,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
|
|
||||||
fPathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT,
|
fPathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT,
|
||||||
Messages.XLCompilerPropertyPage_0, parent) {
|
Messages.XLCompilerPropertyPage_0, parent) {
|
||||||
|
@Override
|
||||||
protected boolean doCheckState() {
|
protected boolean doCheckState() {
|
||||||
// always return true, as we don't want to fail cases when
|
// always return true, as we don't want to fail cases when
|
||||||
// compiler is installed remotely
|
// compiler is installed remotely
|
||||||
|
@ -69,6 +71,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean checkState() {
|
protected boolean checkState() {
|
||||||
return doCheckState();
|
return doCheckState();
|
||||||
}
|
}
|
||||||
|
@ -147,6 +150,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
originalMessage = getMessage();
|
originalMessage = getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
// default to whatever is set on the workbench preference
|
// default to whatever is set on the workbench preference
|
||||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
|
@ -168,9 +172,10 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
|
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
// store the value in the owner text field
|
// store the value in the owner text field
|
||||||
try {
|
try {
|
||||||
|
@ -200,19 +205,21 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IAdaptable getElement() {
|
public IAdaptable getElement() {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the element that owns properties shown on this page.
|
* Sets the element that owns properties shown on this page.
|
||||||
*
|
*
|
||||||
* @param element
|
* @param element
|
||||||
* the element
|
* the element
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setElement(IAdaptable element) {
|
public void setElement(IAdaptable element) {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,9 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability {
|
||||||
if(configuration instanceof IConfiguration) {
|
if(configuration instanceof IConfiguration) {
|
||||||
IConfiguration config = (IConfiguration) configuration;
|
IConfiguration config = (IConfiguration) configuration;
|
||||||
IManagedProject managedProject = config.getManagedProject();
|
IManagedProject managedProject = config.getManagedProject();
|
||||||
|
|
||||||
IProject project = (IProject) managedProject.getOwner();
|
IProject project = (IProject) managedProject.getOwner();
|
||||||
|
|
||||||
String currentVersion = null;
|
String currentVersion = null;
|
||||||
try {
|
try {
|
||||||
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
||||||
|
@ -46,26 +46,26 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion == null) {
|
if(currentVersion == null) {
|
||||||
// if the property isn't set, then use the workbench preference
|
// if the property isn't set, then use the workbench preference
|
||||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8))
|
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(configuration instanceof IFolderInfo) {
|
if(configuration instanceof IFolderInfo) {
|
||||||
IFolderInfo folderInfo = (IFolderInfo) configuration;
|
IFolderInfo folderInfo = (IFolderInfo) configuration;
|
||||||
|
|
||||||
IConfiguration config = folderInfo.getParent();
|
IConfiguration config = folderInfo.getParent();
|
||||||
|
|
||||||
IManagedProject managedProject = config.getManagedProject();
|
IManagedProject managedProject = config.getManagedProject();
|
||||||
|
|
||||||
IProject project = (IProject) managedProject.getOwner();
|
IProject project = (IProject) managedProject.getOwner();
|
||||||
|
|
||||||
String currentVersion = null;
|
String currentVersion = null;
|
||||||
try {
|
try {
|
||||||
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
||||||
|
@ -74,25 +74,26 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion == null) {
|
if(currentVersion == null) {
|
||||||
// if the property isn't set, then use the workbench preference
|
// if the property isn't set, then use the workbench preference
|
||||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8))
|
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionEnabled(IBuildObject configuration,
|
public boolean isOptionEnabled(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return isVersion8(configuration);
|
return isVersion8(configuration);
|
||||||
|
@ -101,6 +102,7 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return isVersion8(configuration);
|
return isVersion8(configuration);
|
||||||
|
@ -109,6 +111,7 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionVisible(IBuildObject configuration,
|
public boolean isOptionVisible(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return isVersion8(configuration);
|
return isVersion8(configuration);
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author crecoskie
|
* @author crecoskie
|
||||||
*
|
*
|
||||||
* This applicability calculator hides/shows options that are specific to the XL compilers, v9.0
|
* This applicability calculator hides/shows options that are specific to the XL compilers, v9.0
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -37,9 +37,9 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability {
|
||||||
if(configuration instanceof IConfiguration) {
|
if(configuration instanceof IConfiguration) {
|
||||||
IConfiguration config = (IConfiguration) configuration;
|
IConfiguration config = (IConfiguration) configuration;
|
||||||
IManagedProject managedProject = config.getManagedProject();
|
IManagedProject managedProject = config.getManagedProject();
|
||||||
|
|
||||||
IProject project = (IProject) managedProject.getOwner();
|
IProject project = (IProject) managedProject.getOwner();
|
||||||
|
|
||||||
String currentVersion = null;
|
String currentVersion = null;
|
||||||
try {
|
try {
|
||||||
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
||||||
|
@ -48,26 +48,26 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion == null) {
|
if(currentVersion == null) {
|
||||||
// if the property isn't set, then use the workbench preference
|
// if the property isn't set, then use the workbench preference
|
||||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9))
|
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(configuration instanceof IFolderInfo) {
|
if(configuration instanceof IFolderInfo) {
|
||||||
IFolderInfo folderInfo = (IFolderInfo) configuration;
|
IFolderInfo folderInfo = (IFolderInfo) configuration;
|
||||||
|
|
||||||
IConfiguration config = folderInfo.getParent();
|
IConfiguration config = folderInfo.getParent();
|
||||||
|
|
||||||
IManagedProject managedProject = config.getManagedProject();
|
IManagedProject managedProject = config.getManagedProject();
|
||||||
|
|
||||||
IProject project = (IProject) managedProject.getOwner();
|
IProject project = (IProject) managedProject.getOwner();
|
||||||
|
|
||||||
String currentVersion = null;
|
String currentVersion = null;
|
||||||
try {
|
try {
|
||||||
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
||||||
|
@ -76,25 +76,26 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion == null) {
|
if(currentVersion == null) {
|
||||||
// if the property isn't set, then use the workbench preference
|
// if the property isn't set, then use the workbench preference
|
||||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9))
|
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionEnabled(IBuildObject configuration,
|
public boolean isOptionEnabled(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return isVersion9(configuration);
|
return isVersion9(configuration);
|
||||||
|
@ -103,6 +104,7 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return isVersion9(configuration);
|
return isVersion9(configuration);
|
||||||
|
@ -111,6 +113,7 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOptionVisible(IBuildObject configuration,
|
public boolean isOptionVisible(IBuildObject configuration,
|
||||||
IHoldsOptions holder, IOption option) {
|
IHoldsOptions holder, IOption option) {
|
||||||
return isVersion9(configuration);
|
return isVersion9(configuration);
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class DynamicVariableResolver implements IDynamicVariableResolver {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String)
|
* @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String resolveValue(IDynamicVariable variable, String argument)
|
public String resolveValue(IDynamicVariable variable, String argument)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -40,7 +40,7 @@ import org.eclipse.swt.widgets.Text;
|
||||||
public class XLCSettingsWizardPage extends MBSCustomPage {
|
public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
|
|
||||||
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.xlc.ui.XlcSettingsWizardPage"; //$NON-NLS-1$
|
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.xlc.ui.XlcSettingsWizardPage"; //$NON-NLS-1$
|
||||||
|
|
||||||
private final class BrowseButtonSelectionListener implements
|
private final class BrowseButtonSelectionListener implements
|
||||||
SelectionListener {
|
SelectionListener {
|
||||||
private final Composite composite;
|
private final Composite composite;
|
||||||
|
@ -49,26 +49,28 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
this.composite = composite;
|
this.composite = composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
// meaningless for a button... do nothing
|
// meaningless for a button... do nothing
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
// open a browse dialog
|
// open a browse dialog
|
||||||
DirectoryDialog dirDialog = new DirectoryDialog(composite.getShell(), SWT.APPLICATION_MODAL);
|
DirectoryDialog dirDialog = new DirectoryDialog(composite.getShell(), SWT.APPLICATION_MODAL);
|
||||||
String browsedDirectory = dirDialog.open();
|
String browsedDirectory = dirDialog.open();
|
||||||
fDirTextBox.setText(browsedDirectory);
|
fDirTextBox.setText(browsedDirectory);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Composite fComposite = null;
|
private Composite fComposite = null;
|
||||||
|
|
||||||
private Text fDirTextBox;
|
private Text fDirTextBox;
|
||||||
|
|
||||||
private Combo fVersionCombo;
|
private Combo fVersionCombo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pageID
|
* @param pageID
|
||||||
*/
|
*/
|
||||||
|
@ -78,13 +80,13 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public XLCSettingsWizardPage() {
|
public XLCSettingsWizardPage() {
|
||||||
super(PAGE_ID);
|
super(PAGE_ID);
|
||||||
setDefaultPreferences(PAGE_ID);
|
setDefaultPreferences(PAGE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultPreferences(String pageID) {
|
private void setDefaultPreferences(String pageID) {
|
||||||
String compilerPath = XLCUIPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
String compilerPath = XLCUIPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||||
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, compilerPath);
|
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, compilerPath);
|
||||||
|
@ -94,6 +96,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage#isCustomPageComplete()
|
* @see org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage#isCustomPageComplete()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected boolean isCustomPageComplete() {
|
protected boolean isCustomPageComplete() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -101,6 +104,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.wizard.IWizardPage#getName()
|
* @see org.eclipse.jface.wizard.IWizardPage#getName()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
String name = Messages.XLCSettingsWizardPage_0;
|
String name = Messages.XLCSettingsWizardPage_0;
|
||||||
return name;
|
return name;
|
||||||
|
@ -109,6 +113,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
// create a new composite
|
// create a new composite
|
||||||
fComposite = new Composite(parent, SWT.NONE);
|
fComposite = new Composite(parent, SWT.NONE);
|
||||||
|
@ -116,12 +121,12 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
GridLayout layout = new GridLayout(3, false);
|
GridLayout layout = new GridLayout(3, false);
|
||||||
fComposite.setLayout(layout);
|
fComposite.setLayout(layout);
|
||||||
fComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
fComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
|
||||||
// create the first label
|
// create the first label
|
||||||
Label label1 = new Label(fComposite, SWT.NONE);
|
Label label1 = new Label(fComposite, SWT.NONE);
|
||||||
label1.setText(Messages.XLCSettingsWizardPage_1);
|
label1.setText(Messages.XLCSettingsWizardPage_1);
|
||||||
label1.setVisible(true);
|
label1.setVisible(true);
|
||||||
|
|
||||||
// create the text box for the path
|
// create the text box for the path
|
||||||
GridData dirBoxGridData = new GridData();
|
GridData dirBoxGridData = new GridData();
|
||||||
dirBoxGridData.grabExcessHorizontalSpace = true;
|
dirBoxGridData.grabExcessHorizontalSpace = true;
|
||||||
|
@ -129,25 +134,26 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
fDirTextBox = new Text(fComposite, SWT.SINGLE | SWT.BORDER);
|
fDirTextBox = new Text(fComposite, SWT.SINGLE | SWT.BORDER);
|
||||||
fDirTextBox.setLayoutData(dirBoxGridData);
|
fDirTextBox.setLayoutData(dirBoxGridData);
|
||||||
fDirTextBox.setVisible(true);
|
fDirTextBox.setVisible(true);
|
||||||
|
|
||||||
// set the default compiler location based on preferences
|
// set the default compiler location based on preferences
|
||||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
String compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
String compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||||
fDirTextBox.setText(compilerPath);
|
fDirTextBox.setText(compilerPath);
|
||||||
|
|
||||||
// update the page manager with the setting
|
// update the page manager with the setting
|
||||||
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText());
|
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText());
|
||||||
|
|
||||||
fDirTextBox.addModifyListener(new ModifyListener() {
|
fDirTextBox.addModifyListener(new ModifyListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
// update the page manager with the setting
|
// update the page manager with the setting
|
||||||
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText());
|
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// create the browse button
|
// create the browse button
|
||||||
//String selectedPath = null;
|
//String selectedPath = null;
|
||||||
GridData buttonData = new GridData();
|
GridData buttonData = new GridData();
|
||||||
|
@ -157,53 +163,55 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
browseButton.setText(Messages.XLCSettingsWizardPage_2);
|
browseButton.setText(Messages.XLCSettingsWizardPage_2);
|
||||||
browseButton.addSelectionListener(new BrowseButtonSelectionListener(fComposite)
|
browseButton.addSelectionListener(new BrowseButtonSelectionListener(fComposite)
|
||||||
);
|
);
|
||||||
|
|
||||||
browseButton.setVisible(true);
|
browseButton.setVisible(true);
|
||||||
|
|
||||||
// create the second label
|
// create the second label
|
||||||
Label label2 = new Label(fComposite, SWT.NONE);
|
Label label2 = new Label(fComposite, SWT.NONE);
|
||||||
label2.setText(Messages.XLCSettingsWizardPage_3);
|
label2.setText(Messages.XLCSettingsWizardPage_3);
|
||||||
|
|
||||||
label2.setVisible(true);
|
label2.setVisible(true);
|
||||||
|
|
||||||
// create the version dropdown
|
// create the version dropdown
|
||||||
GridData comboData = new GridData();
|
GridData comboData = new GridData();
|
||||||
comboData.grabExcessHorizontalSpace = true;
|
comboData.grabExcessHorizontalSpace = true;
|
||||||
comboData.horizontalAlignment = SWT.FILL;
|
comboData.horizontalAlignment = SWT.FILL;
|
||||||
|
|
||||||
fVersionCombo = new Combo(fComposite, SWT.READ_ONLY);
|
fVersionCombo = new Combo(fComposite, SWT.READ_ONLY);
|
||||||
fVersionCombo.setLayoutData(comboData);
|
fVersionCombo.setLayoutData(comboData);
|
||||||
|
|
||||||
// populate the combo
|
// populate the combo
|
||||||
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME);
|
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME);
|
||||||
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME);
|
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME);
|
||||||
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME);
|
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME);
|
||||||
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_11_NAME);
|
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_11_NAME);
|
||||||
|
|
||||||
// set the default based on the workbench preference
|
// set the default based on the workbench preference
|
||||||
String compilerVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
String compilerVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
fVersionCombo.setText(PreferenceConstants.getVersionLabel(compilerVersion));
|
fVersionCombo.setText(PreferenceConstants.getVersionLabel(compilerVersion));
|
||||||
|
|
||||||
// update the page manager with the setting
|
// update the page manager with the setting
|
||||||
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText()));
|
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText()));
|
||||||
|
|
||||||
fVersionCombo.addModifyListener(new ModifyListener() {
|
fVersionCombo.addModifyListener(new ModifyListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
// update the page manager with the setting
|
// update the page manager with the setting
|
||||||
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText()));
|
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fVersionCombo.setVisible(true);
|
fVersionCombo.setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
|
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
fComposite.dispose();
|
fComposite.dispose();
|
||||||
}
|
}
|
||||||
|
@ -211,6 +219,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#getControl()
|
* @see org.eclipse.jface.dialogs.IDialogPage#getControl()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Control getControl() {
|
public Control getControl() {
|
||||||
return fComposite;
|
return fComposite;
|
||||||
}
|
}
|
||||||
|
@ -218,6 +227,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#getDescription()
|
* @see org.eclipse.jface.dialogs.IDialogPage#getDescription()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return Messages.XLCSettingsWizardPage_4;
|
return Messages.XLCSettingsWizardPage_4;
|
||||||
}
|
}
|
||||||
|
@ -225,6 +235,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage()
|
* @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getErrorMessage() {
|
public String getErrorMessage() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
|
@ -233,6 +244,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#getImage()
|
* @see org.eclipse.jface.dialogs.IDialogPage#getImage()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Image getImage() {
|
public Image getImage() {
|
||||||
return wizard.getDefaultPageImage();
|
return wizard.getDefaultPageImage();
|
||||||
}
|
}
|
||||||
|
@ -240,6 +252,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#getMessage()
|
* @see org.eclipse.jface.dialogs.IDialogPage#getMessage()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -247,6 +260,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#getTitle()
|
* @see org.eclipse.jface.dialogs.IDialogPage#getTitle()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return Messages.XLCSettingsWizardPage_5;
|
return Messages.XLCSettingsWizardPage_5;
|
||||||
}
|
}
|
||||||
|
@ -254,6 +268,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#performHelp()
|
* @see org.eclipse.jface.dialogs.IDialogPage#performHelp()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void performHelp() {
|
public void performHelp() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
@ -262,6 +277,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#setDescription(java.lang.String)
|
* @see org.eclipse.jface.dialogs.IDialogPage#setDescription(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
@ -270,6 +286,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#setImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
|
* @see org.eclipse.jface.dialogs.IDialogPage#setImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setImageDescriptor(ImageDescriptor image) {
|
public void setImageDescriptor(ImageDescriptor image) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
@ -278,6 +295,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#setTitle(java.lang.String)
|
* @see org.eclipse.jface.dialogs.IDialogPage#setTitle(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
@ -286,6 +304,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
|
* @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible) {
|
||||||
fComposite.setVisible(visible);
|
fComposite.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.wizard.IWizard;
|
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +34,7 @@ public class XLCSettingsWizardRunnable implements IRunnableWithProgress {
|
||||||
public XLCSettingsWizardRunnable() {
|
public XLCSettingsWizardRunnable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||||
// take the data from the page manager, and set the project properties with it
|
// take the data from the page manager, and set the project properties with it
|
||||||
String compilerPath = MBSCustomPageManager.getPageProperty(pageId, PreferenceConstants.P_XL_COMPILER_ROOT).toString();
|
String compilerPath = MBSCustomPageManager.getPageProperty(pageId, PreferenceConstants.P_XL_COMPILER_ROOT).toString();
|
||||||
|
@ -42,19 +42,19 @@ public class XLCSettingsWizardRunnable implements IRunnableWithProgress {
|
||||||
|
|
||||||
// get a handle to the wizard
|
// get a handle to the wizard
|
||||||
IWizardPage[] pages = MBSCustomPageManager.getPages();
|
IWizardPage[] pages = MBSCustomPageManager.getPages();
|
||||||
|
|
||||||
if(pages != null && pages.length > 0) {
|
if(pages != null && pages.length > 0) {
|
||||||
|
|
||||||
ICDTCommonProjectWizard wizard = (ICDTCommonProjectWizard) pages[0].getWizard();
|
ICDTCommonProjectWizard wizard = (ICDTCommonProjectWizard) pages[0].getWizard();
|
||||||
IProject project = wizard.getLastProject();
|
IProject project = wizard.getLastProject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
project.setPersistentProperty(new QualifiedName("", PreferenceConstants.P_XL_COMPILER_ROOT), compilerPath);
|
project.setPersistentProperty(new QualifiedName("", PreferenceConstants.P_XL_COMPILER_ROOT), compilerPath);
|
||||||
project.setPersistentProperty(new QualifiedName("", PreferenceConstants.P_XLC_COMPILER_VERSION), compilerVersion);
|
project.setPersistentProperty(new QualifiedName("", PreferenceConstants.P_XLC_COMPILER_VERSION), compilerVersion);
|
||||||
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,16 +20,18 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
|
|
||||||
private static Activator plugin;
|
private static Activator plugin;
|
||||||
|
|
||||||
|
|
||||||
public Activator() {
|
public Activator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
plugin = this;
|
plugin = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
plugin = null;
|
plugin = null;
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
|
|
|
@ -14,15 +14,15 @@ package org.eclipse.cdt.managedbuilder.xlupc.ui;
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public class Messages extends NLS {
|
public class Messages extends NLS {
|
||||||
|
|
||||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.xlupc.ui.messages"; //$NON-NLS-1$
|
private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.xlupc.ui.messages"; //$NON-NLS-1$
|
||||||
|
|
||||||
static {
|
static {
|
||||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Messages() {}
|
private Messages() {}
|
||||||
|
|
||||||
public static String UpcProjectWizard_0;
|
public static String UpcProjectWizard_0;
|
||||||
public static String UpcProjectWizard_1;
|
public static String UpcProjectWizard_1;
|
||||||
public static String XLUpcSettingsWizardPage_0;
|
public static String XLUpcSettingsWizardPage_0;
|
||||||
|
|
|
@ -31,17 +31,17 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
public class UpcProjectWizard extends CDTCommonProjectWizard {
|
public class UpcProjectWizard extends CDTCommonProjectWizard {
|
||||||
|
|
||||||
private static final String ARTIFACT_TYPE_UPC_EXE = "org.eclipse.cdt.build.core.buildArtefactType.xlupc.exe";
|
private static final String ARTIFACT_TYPE_UPC_EXE = "org.eclipse.cdt.build.core.buildArtefactType.xlupc.exe";
|
||||||
private static final String ARTIFACT_TYPE_UPC_EXE_DEFAULT = ARTIFACT_TYPE_UPC_EXE + ".default";
|
private static final String ARTIFACT_TYPE_UPC_EXE_DEFAULT = ARTIFACT_TYPE_UPC_EXE + ".default";
|
||||||
|
|
||||||
private static final String ARTIFACT_TYPE_UPC_SO = "org.eclipse.cdt.build.core.buildArtefactType.xlupc.sharedLib";
|
private static final String ARTIFACT_TYPE_UPC_SO = "org.eclipse.cdt.build.core.buildArtefactType.xlupc.sharedLib";
|
||||||
private static final String ARTIFACT_TYPE_UPC_SO_DEFAULT = ARTIFACT_TYPE_UPC_SO + ".default";
|
private static final String ARTIFACT_TYPE_UPC_SO_DEFAULT = ARTIFACT_TYPE_UPC_SO + ".default";
|
||||||
|
|
||||||
private static final String ARTIFACT_TYPE_UPC_LIB = "org.eclipse.cdt.build.core.buildArtefactType.xlupc.staticLib";
|
private static final String ARTIFACT_TYPE_UPC_LIB = "org.eclipse.cdt.build.core.buildArtefactType.xlupc.staticLib";
|
||||||
private static final String ARTIFACT_TYPE_UPC_LIB_DEFAULT = ARTIFACT_TYPE_UPC_LIB + ".default";
|
private static final String ARTIFACT_TYPE_UPC_LIB_DEFAULT = ARTIFACT_TYPE_UPC_LIB + ".default";
|
||||||
|
|
||||||
private final static String PAGE_NAME = "org.eclipse.cdt.managedbuilder.xlupc.ui.mainpage";
|
private final static String PAGE_NAME = "org.eclipse.cdt.managedbuilder.xlupc.ui.mainpage";
|
||||||
|
|
||||||
|
|
||||||
private static final Set<String> ALL_TYPES = new HashSet<String>() {{
|
private static final Set<String> ALL_TYPES = new HashSet<String>() {{
|
||||||
add(ARTIFACT_TYPE_UPC_EXE);
|
add(ARTIFACT_TYPE_UPC_EXE);
|
||||||
add(ARTIFACT_TYPE_UPC_EXE_DEFAULT);
|
add(ARTIFACT_TYPE_UPC_EXE_DEFAULT);
|
||||||
|
@ -50,17 +50,19 @@ public class UpcProjectWizard extends CDTCommonProjectWizard {
|
||||||
add(ARTIFACT_TYPE_UPC_LIB);
|
add(ARTIFACT_TYPE_UPC_LIB);
|
||||||
add(ARTIFACT_TYPE_UPC_LIB_DEFAULT);
|
add(ARTIFACT_TYPE_UPC_LIB_DEFAULT);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public UpcProjectWizard() {
|
public UpcProjectWizard() {
|
||||||
super(Messages.UpcProjectWizard_0, Messages.UpcProjectWizard_1);
|
super(Messages.UpcProjectWizard_0, Messages.UpcProjectWizard_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addPages() {
|
public void addPages() {
|
||||||
fMainPage = new CDTMainWizardPage(PAGE_NAME) {
|
fMainPage = new CDTMainWizardPage(PAGE_NAME) {
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List filterItems(List items) {
|
public List filterItems(List items) {
|
||||||
// filter out all non-UPC project types
|
// filter out all non-UPC project types
|
||||||
|
@ -75,13 +77,14 @@ public class UpcProjectWizard extends CDTCommonProjectWizard {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
fMainPage.setTitle(Messages.UpcProjectWizard_0);
|
fMainPage.setTitle(Messages.UpcProjectWizard_0);
|
||||||
fMainPage.setDescription(Messages.UpcProjectWizard_1);
|
fMainPage.setDescription(Messages.UpcProjectWizard_1);
|
||||||
addPage(fMainPage);
|
addPage(fMainPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
protected IProject continueCreation(IProject prj) {
|
protected IProject continueCreation(IProject prj) {
|
||||||
try {
|
try {
|
||||||
CProjectNature.addCNature(prj, new NullProgressMonitor());
|
CProjectNature.addCNature(prj, new NullProgressMonitor());
|
||||||
|
@ -90,6 +93,7 @@ public class UpcProjectWizard extends CDTCommonProjectWizard {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getNatures() {
|
public String[] getNatures() {
|
||||||
return new String[] { CProjectNature.C_NATURE_ID/*, CCProjectNature.CC_NATURE_ID, RemoteNature.REMOTE_NATURE_ID*/};
|
return new String[] { CProjectNature.C_NATURE_ID/*, CCProjectNature.CC_NATURE_ID, RemoteNature.REMOTE_NATURE_ID*/};
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,12 @@ public class XLUpcSettingsWizardPage extends XLCSettingsWizardPage {
|
||||||
pageID = PAGE_ID;
|
pageID = PAGE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return Messages.XLUpcSettingsWizardPage_0;
|
return Messages.XLUpcSettingsWizardPage_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return Messages.XLUpcSettingsWizardPage_1;
|
return Messages.XLUpcSettingsWizardPage_1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,14 +33,15 @@ import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
|
||||||
public class XLUpcSettingsWizardRunnable extends XLCSettingsWizardRunnable {
|
public class XLUpcSettingsWizardRunnable extends XLCSettingsWizardRunnable {
|
||||||
|
|
||||||
|
|
||||||
// now add UPC language mapping to the project
|
// now add UPC language mapping to the project
|
||||||
private static final String[] CONTENT_TYPE_IDS = { CCorePlugin.CONTENT_TYPE_CHEADER, CCorePlugin.CONTENT_TYPE_CSOURCE };
|
private static final String[] CONTENT_TYPE_IDS = { CCorePlugin.CONTENT_TYPE_CHEADER, CCorePlugin.CONTENT_TYPE_CSOURCE };
|
||||||
|
|
||||||
public XLUpcSettingsWizardRunnable() {
|
public XLUpcSettingsWizardRunnable() {
|
||||||
pageId = XLUpcSettingsWizardPage.PAGE_ID;
|
pageId = XLUpcSettingsWizardPage.PAGE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||||
super.run(monitor);
|
super.run(monitor);
|
||||||
// get a handle to the wizard
|
// get a handle to the wizard
|
||||||
|
@ -51,10 +52,10 @@ public class XLUpcSettingsWizardRunnable extends XLCSettingsWizardRunnable {
|
||||||
CDTCommonProjectWizard wizard = (CDTCommonProjectWizard) pages[0].getWizard();
|
CDTCommonProjectWizard wizard = (CDTCommonProjectWizard) pages[0].getWizard();
|
||||||
IProject project = wizard.getLastProject();
|
IProject project = wizard.getLastProject();
|
||||||
LanguageManager langManager = LanguageManager.getInstance();
|
LanguageManager langManager = LanguageManager.getInstance();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProjectLanguageConfiguration langConfig = langManager.getLanguageConfiguration(project);
|
ProjectLanguageConfiguration langConfig = langManager.getLanguageConfiguration(project);
|
||||||
|
|
||||||
ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
ICConfigurationDescription configDescription = projectDescription.getActiveConfiguration();
|
ICConfigurationDescription configDescription = projectDescription.getActiveConfiguration();
|
||||||
|
|
||||||
|
@ -65,9 +66,9 @@ public class XLUpcSettingsWizardRunnable extends XLCSettingsWizardRunnable {
|
||||||
langConfig.addContentTypeMapping(configDescription, id, UPCLanguage.ID);
|
langConfig.addContentTypeMapping(configDescription, id, UPCLanguage.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
langManager.storeLanguageMappingConfiguration(project, new IContentType[0]);
|
langManager.storeLanguageMappingConfiguration(project, new IContentType[0]);
|
||||||
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue