diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/activator/Activator.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/activator/Activator.java index 7c510d2533d..483cd5f1550 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/activator/Activator.java +++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/activator/Activator.java @@ -25,7 +25,7 @@ public class Activator extends Plugin { private static Activator fInstance; /** - * + * */ public Activator() { super(); @@ -33,18 +33,18 @@ public class Activator extends Plugin { fInstance = this; } } - + public static void log(String e) { log(createStatus(e)); } - + public static void log(Throwable e) { log("Error", e); //$NON-NLS-1$ } - + public static void log(String message, Throwable e) { Throwable nestedException; - if (e instanceof CModelException + if (e instanceof CModelException && (nestedException = ((CModelException)e).getException()) != null) { e = nestedException; } @@ -58,7 +58,7 @@ public class Activator extends Plugin { public static IStatus createStatus(String msg, Throwable e) { return new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, msg, e); } - + public static void log(IStatus status) { getDefault().getLog().log(status); } diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java index 8bbacedb0c4..115a69ded71 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java +++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java @@ -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.internal.core.scannerconfig.util.TraceUtil; 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.ScannerConfigProfileManager; import org.eclipse.cdt.make.xlc.core.activator.Activator; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; @@ -33,7 +33,7 @@ import org.eclipse.core.runtime.content.IContentTypeManager; /** * @author crecoskie - * + * */ 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 - * + * * @return String[] */ protected String[] computeCompilerCommands() { @@ -103,11 +103,12 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol /* * (non-Javadoc) - * + * * @see * org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine * (java.lang.String) */ + @Override public boolean processLine(String line) { boolean rc = false; int lineBreakPos = line.length() - 1; @@ -183,16 +184,17 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol /* * (non-Javadoc) - * + * * @see * org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#shutdown * () */ + @Override public void shutdown() { if (getUtility() != null) { getUtility().reportProblems(); } - + if(fCollector != null && fCollector instanceof IScannerInfoCollector2) { IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector; try { @@ -211,7 +213,7 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol * back-quotes a backslash escapes white-spaces, all quotes, the backslash, * '&' and '|'. A backslash used for escaping is removed. Quotes other than * the back-quote plus '&&', '||', ';' are removed, also. - * + * * @param line * to tokenize * @return array of commands @@ -365,6 +367,7 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol return -1; } + @Override public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { fProject = project; diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java index 5a3d7bbd2cb..01c66069930 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java +++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java @@ -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.CygpathTranslator; 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.messages.Messages; 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 { protected class ScannerConfigUpdateJob extends Job { - + private InfoContext fContext; private IDiscoveredPathInfo fPathInfo; private boolean fIsDefaultContext; private List fChangedResources; - + public ScannerConfigUpdateJob(InfoContext context, IDiscoveredPathInfo pathInfo, boolean isDefaultContext, List changedResources) { super(Messages.getString("PerFileXLCScannerInfoCollector.0")); //$NON-NLS-1$); fContext = context; @@ -106,24 +105,24 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I @Override protected IStatus run(IProgressMonitor monitor) { try { - + // get the scanner info profile ID - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IConfiguration config = info.getDefaultConfiguration(); - + String profileID = config.getToolChain().getScannerConfigDiscoveryProfileId(); IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager(); - + if(manager instanceof DiscoveredPathManager) { ((DiscoveredPathManager)manager).updateDiscoveredInfo(fContext, fPathInfo, fIsDefaultContext, fChangedResources, profileID); } - + // reload project description to hopefully get the data to take ICProjectDescriptionManager descriptionManager = CoreModel.getDefault().getProjectDescriptionManager(); ICProjectDescription cProjectDescription = descriptionManager.getProjectDescription(project, true /* writable */); ICConfigurationDescription configDes = cProjectDescription.getActiveConfiguration(); - + IToolChain toolchain = config.getToolChain(); for(ITool tool : toolchain.getTools()) { for(IInputType inputType : tool.getInputTypes()) { @@ -132,14 +131,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I for(IResource resource : fChangedResources) { // get language settings for the resource ICLanguageSetting langSetting = configDes.getLanguageSettingForFile(resource.getProjectRelativePath(), false); - + if(langSetting == null) { continue; } - + // get content type IDs for the setting String[] contentTypeIDs = langSetting.getSourceContentTypeIds(); - + // if the setting doesn't handle our content type ID, then go to the next resource boolean found = false; for(String id : contentTypeIDs) { @@ -148,23 +147,23 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I break; } } - + if(!found) { continue; } - + // update all the scanner config entries on the setting updateIncludeSettings(langSetting); updateMacroSettings(langSetting); - + } } - + } } - + descriptionManager.setProjectDescription(project, cProjectDescription, true /* force */, monitor); - + } catch (CoreException e) { Activator.log(e); return Activator.createStatus(Messages.getString("PerFileXLCScannerInfoCollector.1")); //$NON-NLS-1$ @@ -178,22 +177,22 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I for(ICLanguageSettingEntry entry : entries) { newEntries.add(entry); } - - + + boolean entriesChanged = false; - + // look for settings corresponding to each path we discovered Map discSymbols = fPathInfo.getSymbols(); for (String symbol : discSymbols.keySet()) { boolean symbolFound = false; - + for (ICLanguageSettingEntry entry : entries) { if (((CMacroEntry) entry).getName().equals(symbol)) { symbolFound = true; // it's already there, so don't set it break; } } - + // if we didn't find the path, add it if(!symbolFound) { entriesChanged = true; @@ -201,13 +200,13 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I newEntries.add(newEntry); } } - + // if we changed the entries, then set the new ones if(entriesChanged) { langSetting.setSettingEntries(ICSettingEntry.MACRO, newEntries.toArray(new ICLanguageSettingEntry[0])); } - - return entriesChanged; + + return entriesChanged; } private boolean updateIncludeSettings(ICLanguageSetting langSetting) { @@ -216,22 +215,22 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I for(ICLanguageSettingEntry entry : entries) { newEntries.add(entry); } - - + + boolean entriesChanged = false; - + // look for settings corresponding to each path we discovered IPath[] discPaths = fPathInfo.getIncludePaths(); for (IPath path : discPaths) { boolean pathFound = false; - + for (ICLanguageSettingEntry entry : entries) { if (((CIncludePathEntry) entry).getLocation().equals(path)) { pathFound = true; // it's already there, so don't set it break; } } - + // if we didn't find the path, add it if(!pathFound) { entriesChanged = true; @@ -239,20 +238,20 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I newEntries.add(newEntry); } } - + // if we changed the entries, then set the new ones if(entriesChanged) { langSetting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, newEntries.toArray(new ICLanguageSettingEntry[0])); } - + return entriesChanged; } } - + protected class MergedPerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 { private IDiscoveredPathInfo fInfo1; private IPerFileDiscoveredPathInfo2 fInfo2; - + public MergedPerFileDiscoveredPathInfo(IDiscoveredPathInfo info1, IPerFileDiscoveredPathInfo2 info2) { fInfo1 = info1; fInfo2 = info2; @@ -262,12 +261,13 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I if(fInfo1 instanceof IPerFileDiscoveredPathInfo2) { return (IPerFileDiscoveredPathInfo2) fInfo1; } - + else { return null; } } - + + @Override public Map getPathInfoMap() { synchronized (fLock) { IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1(); @@ -287,6 +287,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath) */ + @Override public IPath[] getIncludeFiles(IPath path) { synchronized (fLock) { IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1(); @@ -308,6 +309,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } } + @Override public IPath[] getIncludePaths(IPath path) { synchronized (fLock) { @@ -339,6 +341,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } } + @Override public IPath[] getMacroFiles(IPath path) { synchronized (fLock) { Set pathSet = new HashSet(); @@ -360,6 +363,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } } + @Override public IPath[] getQuoteIncludePaths(IPath path) { synchronized (fLock) { @@ -382,13 +386,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } } + @Override public Map getSymbols(IPath path) { synchronized (fLock) { Map symbols = new HashMap(); // add project level settings - Map projectSymbols = (Map) fInfo1.getSymbols(); + Map projectSymbols = fInfo1.getSymbols(); for (String symbol : projectSymbols.keySet()) { symbols.put(symbol, projectSymbols.get(symbol)); } @@ -409,6 +414,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath) */ + @Override public boolean isEmpty(IPath path) { synchronized (fLock) { boolean info1empty = false; @@ -424,40 +430,45 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } } + @Override public IPath[] getIncludePaths() { synchronized (fLock) { return fInfo1.getIncludePaths(); } } + @Override public IProject getProject() { return fInfo1.getProject(); } + @Override public IDiscoveredScannerInfoSerializable getSerializable() { return fInfo2.getSerializable(); } + @Override public Map getSymbols() { synchronized (fLock) { return fInfo1.getSymbols(); } } - + } - + /** * Per file DPI object - * + * * @author vhirsl */ protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 { /* (non-Javadoc) * @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) { - + Set pathSet = new LinkedHashSet(); // get the command CCommandDSC cmd = getCommand(path); @@ -473,7 +484,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I for(IPath path2 : psi.includeFiles) { pathSet.add(path2); } - + return pathSet.toArray(new IPath[0]); } } @@ -481,7 +492,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths() */ - public IPath[] getIncludePaths() { + @Override + public IPath[] getIncludePaths() { final IPath[] includepaths; final IPath[] quotepaths; synchronized (fLock) { @@ -504,7 +516,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @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) { Set pathSet = new LinkedHashSet(); // get the command @@ -521,7 +534,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I for(IPath path2 : psi.includePaths) { pathSet.add(path2); } - + return pathSet.toArray(new IPath[0]); } } @@ -529,7 +542,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @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) { Set pathSet = new LinkedHashSet(); // get the command @@ -546,12 +560,13 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I for(IPath path2 : psi.macrosFiles) { pathSet.add(path2); } - + return pathSet.toArray(new IPath[0]); } } - public Map getPathInfoMap() { + @Override + public Map getPathInfoMap() { synchronized (fLock) { //TODO: do we need to cache this? return calculatePathInfoMap(); @@ -561,14 +576,16 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject() */ - public IProject getProject() { + @Override + public IProject getProject() { return project; } /* (non-Javadoc) * @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) { Set pathSet = new LinkedHashSet(); // get the command @@ -585,7 +602,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I for(IPath path2 : psi.quoteIncludePaths) { pathSet.add(path2); } - + return pathSet.toArray(new IPath[0]); } } @@ -593,7 +610,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getSerializable() */ - public IDiscoveredScannerInfoSerializable getSerializable() { + @Override + public IDiscoveredScannerInfoSerializable getSerializable() { synchronized (fLock) { return sid; } @@ -602,7 +620,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols() */ - public Map getSymbols() { + @Override + public Map getSymbols() { // return new HashMap(); synchronized (fLock) { return getAllSymbols(); @@ -611,10 +630,11 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* * (non-Javadoc) - * + * * @seeorg.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager. * IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath) */ + @Override public Map getSymbols(IPath path) { synchronized (fLock) { Map definedSymbols = new HashMap(); @@ -650,6 +670,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath) */ + @Override public boolean isEmpty(IPath path) { synchronized (fLock) { boolean rc = true; @@ -690,7 +711,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I public static final String INCLUDE_PATH = "includePath"; //$NON-NLS-1$ private static final String NAME = "name"; //$NON-NLS-1$ - + public static final String PATH = "path"; //$NON-NLS-1$ private static final String PROJECT = "project"; //$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 commandIdCommandMap; // map of all commands public final Map> commandIdToFilesMap; // command id and set of files it applies to public final Map fileToCommandIdMap; // maps each file to the corresponding command id - + public ScannerInfoData() { commandIdCommandMap = new LinkedHashMap(); // [commandId, command] fileToCommandIdMap = new HashMap(); // [file, commandId] @@ -708,21 +729,22 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @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) { - + for (Node child = collectorElem.getFirstChild(); child != null; child = child.getNextSibling()) { if(child.getNodeName().equals(PROJECT)) { Element projectElement = (Element) child; String projectName = projectElement.getAttribute(NAME); - + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - + Map> scannerInfo = new HashMap>(); - + List includes = new LinkedList(); List symbols = new LinkedList(); - + // iterate over children for(Node projectChild = projectElement.getFirstChild(); projectChild != null; projectChild = projectChild.getNextSibling()) { if(projectChild.getNodeName().equals(INCLUDE_PATH)) { @@ -735,21 +757,21 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I else if(projectChild.getNodeName().equals(DEFINED_SYMBOL)) { Element childElem = (Element) projectChild; String symbol = childElem.getAttribute(SYMBOL); - + if(symbol != null) { symbols.add(symbol); } } } - + // add loaded scanner info to project settings for this collector scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes); scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols); fProjectSettingsMap.put(project, scannerInfo); } - - - else if (child.getNodeName().equals(CC_ELEM)) { + + + else if (child.getNodeName().equals(CC_ELEM)) { Element cmdElem = (Element) child; boolean cppFileType = cmdElem.getAttribute(FILE_TYPE_ATTR).equals("c++"); //$NON-NLS-1$ XLCCommandDSC command = new XLCCommandDSC(cppFileType, project); @@ -777,27 +799,29 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId() */ - public String getCollectorId() { + @Override + public String getCollectorId() { return COLLECTOR_ID; } /* (non-Javadoc) * @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 { synchronized (fLock) { Document doc = collectorElem.getOwnerDocument(); - + // serialize project level info for (IProject project : fProjectSettingsMap.keySet()) { // create a project node Element projectElement = doc.createElement(PROJECT); projectElement.setAttribute(NAME, project.getName()); - + Map> scannerInfo = (Map>) fProjectSettingsMap.get(project); - - List includes = scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS); + + List includes = scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS); for(String include : includes) { Element pathElement = doc.createElement(INCLUDE_PATH); pathElement.setAttribute(PATH, include); @@ -808,10 +832,10 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I pathElement.setAttribute(REMOVED, "false"); //$NON-NLS-1$ projectElement.appendChild(pathElement); } - + // Now do the same for the symbols List symbols = scannerInfo.get(ScannerInfoTypes.SYMBOL_DEFINITIONS); - + for(String symbol : symbols) { Element symbolElement = doc.createElement(DEFINED_SYMBOL); symbolElement.setAttribute(SYMBOL, symbol); @@ -819,36 +843,36 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } collectorElem.appendChild(projectElement); } - + // serialize file level info List commandIds = new ArrayList(commandIdCommandMap.keySet()); Collections.sort(commandIds); for (Iterator i = commandIds.iterator(); i.hasNext(); ) { Integer commandId = i.next(); CCommandDSC command = commandIdCommandMap.get(commandId); - - Element cmdElem = doc.createElement(CC_ELEM); + + Element cmdElem = doc.createElement(CC_ELEM); 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$ // write command and scanner info command.serialize(cmdElem); // write files command applies to - Element filesElem = doc.createElement(APPLIES_TO_ATTR); + Element filesElem = doc.createElement(APPLIES_TO_ATTR); cmdElem.appendChild(filesElem); Set files = commandIdToFilesMap.get(commandId); if (files != null) { for (Iterator j = files.iterator(); j.hasNext(); ) { - Element fileElem = doc.createElement(FILE_ELEM); + Element fileElem = doc.createElement(FILE_ELEM); IFile file = j.next(); IPath path = file.getProjectRelativePath(); - fileElem.setAttribute(PATH_ATTR, path.toString()); + fileElem.setAttribute(PATH_ATTR, path.toString()); filesElem.appendChild(fileElem); } } } } - + } catch(Throwable e) { 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 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_PATH = 1; - - + + protected static final int MACROS_FILE = 4; protected static final String PATH_ATTR = "path"; //$NON-NLS-1$ protected static final int QUOTE_INCLUDE_PATH = 2; - + protected static PathInfo createFilePathInfo(CCommandDSC cmd){ IPath[] includes = stringListToPathArray(cmd.getIncludes()); IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes()); @@ -894,7 +918,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I String value = ScannerConfigUtil.getSymbolValue(symbol); definedSymbols.put(key, value); } - + return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles); } /** @@ -914,12 +938,12 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } protected int commandIdCounter = 0; protected InfoContext context; - + /** monitor for data access */ protected final Object fLock = new Object(); - + private Map> fProjectSettingsMap = new HashMap>(); - + protected final SortedSet freeCommandIdPool; // sorted set of free command ids protected IProject project; 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 final Map siChangedForFileMap; // (file, comandId) map for deltas protected ScannerInfoData sid; // scanner info data - + /** - * + * */ public PerFileXLCScannerInfoCollector() { sid = new ScannerInfoData(); - + // siChangedForFileList = new ArrayList(); siChangedForFileMap = new HashMap(); siChangedForCommandIdList = new ArrayList(); - + freeCommandIdPool = new TreeSet(); } - + /** - * @param file + * @param file * @param object */ protected void addCompilerCommand(IFile file, CCommandDSC cmd) { @@ -967,7 +991,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I generateFileDelta(file, cmd); } } - + /** * @param commandId * @param scannerInfo @@ -991,14 +1015,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } } } - + /** * @param type * @param object */ protected void addScannerInfo(ScannerInfoTypes type, List delta) { // TODO Auto-generated method stub - + } /** * @param file @@ -1049,7 +1073,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I generateProjectScannerInfo(); } } - + protected Map calculatePathInfoMap() { synchronized (fLock) { @@ -1083,7 +1107,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I return map; } } - + + @Override public void contributeToScannerConfig(Object resource, Map scannerInfo) { // check the resource String errorMessage = null; @@ -1096,7 +1121,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } return; } - + if ((resource instanceof IFile)) { if (((IFile) resource).getProject() == null) { @@ -1125,24 +1150,25 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } } } - + else if(resource instanceof IProject) { // save to project level settings synchronized (fLock) { fProjectSettingsMap.put(((IProject) resource), scannerInfo); } } - + else { // error TraceUtil.outputError("PerFileSICollector.contributeToScannerConfig : ", "Not a project or file."); //$NON-NLS-1$ //$NON-NLS-2$ return; } } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject() */ - public IDiscoveredPathInfo createPathInfoObject() { + @Override + public IDiscoveredPathInfo createPathInfoObject() { return new PerFileDiscoveredPathInfo(); } /* (non-Javadoc) @@ -1151,11 +1177,11 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I public void deleteAll(IResource resource) { synchronized (fLock) { if (resource instanceof IProject) { - fProjectSettingsMap.remove(((IProject) resource)); + fProjectSettingsMap.remove(resource); } } } - + /* (non-Javadoc) * @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); siChangedForFileMap.put(file, null); } - + sid = new ScannerInfoData(); psi = null; - + commandIdCounter = 0; freeCommandIdPool.clear(); } @@ -1183,7 +1209,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* * (non-Javadoc) - * + * * @see * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector# * deleteAllPaths(org.eclipse.core.resources.IResource) @@ -1191,14 +1217,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I public void deleteAllPaths(IResource resource) { synchronized (fLock) { if (resource instanceof IProject && fProjectSettingsMap != null) { - fProjectSettingsMap.remove(((IProject) resource)); + fProjectSettingsMap.remove(resource); } } } /* * (non-Javadoc) - * + * * @see * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector# * deleteAllSymbols(org.eclipse.core.resources.IResource) @@ -1206,14 +1232,14 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I public void deleteAllSymbols(IResource resource) { synchronized (fLock) { if (resource instanceof IProject && fProjectSettingsMap != null) { - fProjectSettingsMap.remove(((IProject) resource)); + fProjectSettingsMap.remove(resource); } } } /* * (non-Javadoc) - * + * * @see * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector# * 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) { synchronized (fLock) { if (resource instanceof IProject && fProjectSettingsMap != null) { - fProjectSettingsMap.remove(((IProject) resource)); + fProjectSettingsMap.remove(resource); } } } /* * (non-Javadoc) - * + * * @see * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector# * 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) { synchronized (fLock) { if (resource instanceof IProject && fProjectSettingsMap != null) { - fProjectSettingsMap.remove(((IProject) resource)); + fProjectSettingsMap.remove(resource); } } } @@ -1309,7 +1335,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I *
  • QUOTE_INCLUDE_PATH *
  • INCLUDE_FILE *
  • MACROS_FILE - * + * * @return list of IPath(s). */ protected IPath[] getAllIncludePaths1(int type) { @@ -1354,7 +1380,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* * (non-Javadoc) - * + * * @see * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector# * getAllSymbols() @@ -1386,7 +1412,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I return symbols; } } - + /** * @return */ @@ -1413,14 +1439,15 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes) */ - public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { - + @Override + public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { + List rv = new ArrayList(); // check the resource String errorMessage = null; if (resource == null) { errorMessage = "resource is null";//$NON-NLS-1$ - } + } else if (!(resource instanceof IResource)) { 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) { errorMessage = "wrong project";//$NON-NLS-1$ } - + if (errorMessage != null) { TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$ return rv; @@ -1509,15 +1536,17 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getDefinedSymbols() */ + @Override public Map getDefinedSymbols() { synchronized (fLock) { return getAllSymbols(); } } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getIncludePaths() */ + @Override public List getIncludePaths() { synchronized (fLock) { List pathStrings = new LinkedList(); @@ -1532,7 +1561,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I return pathStrings; } } - + protected InfoContext getInfoContext() { 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) { this.project = context.getProject(); this.context = context; @@ -1588,13 +1618,15 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I /* (non-Javadoc) * @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) { setInfoContext(new InfoContext(project)); } } - public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException { + @Override + public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException { if (monitor == null) { monitor = new NullProgressMonitor(); } @@ -1609,10 +1641,10 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I siChangedForFileMap.clear(); } siChangedForCommandIdList.clear(); - + // add in any projects that got project level info (from the specs provider) changedResources.addAll(fProjectSettingsMap.keySet()); - + monitor.worked(50); if (!changedResources.isEmpty()) { // update outside monitor scope @@ -1626,7 +1658,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I } else { PerFileDiscoveredPathInfo perFilePathInfo = new PerFileDiscoveredPathInfo(); - + // merge them if (!(pathInfo instanceof IPerFileDiscoveredPathInfo)) { pathInfo = new MergedPerFileDiscoveredPathInfo(pathInfo, perFilePathInfo); @@ -1635,32 +1667,32 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I pathInfo = perFilePathInfo; } } - - + + Job job = new ScannerConfigUpdateJob(context, pathInfo, context.isDefaultContext(), changedResources); ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot(); job.setRule(rule); job.schedule(); - - + + // } finally { // manager.endRule(rule); // } - + } catch (CoreException e) { MakeCorePlugin.log(e); } - + catch (Throwable e) { e.printStackTrace(); } } } - + monitor.worked(50); monitor.done(); } - + } \ No newline at end of file diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java index 88853204425..fe785919df1 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java +++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java @@ -87,7 +87,7 @@ public class XLCBuildOutputParserUtility { private IProject project; private int workingDirsN = 0; - + /* * For tracking the location of files being compiled */ @@ -102,10 +102,10 @@ public class XLCBuildOutputParserUtility { if (workingDirectory != null) { pushDirectory(workingDirectory); } - + } /** - * + * */ public XLCBuildOutputParserUtility(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator) { @@ -136,7 +136,7 @@ public class XLCBuildOutputParserUtility { if (compiledFileList.contains(longFileName)) return; compiledFileList.add(longFileName); - + String workingDir = getWorkingDirectory().toString(); List directoryCommandList = (List) directoryCommandListMap.get(workingDir); if (directoryCommandList == null) { @@ -219,7 +219,7 @@ public class XLCBuildOutputParserUtility { } /** - * + * */ void generateReport() { TraceUtil.metricsTrace("Stats for directory ", //$NON-NLS-1$ @@ -227,7 +227,7 @@ public class XLCBuildOutputParserUtility { directoryCommandListMap); TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN); //$NON-NLS-1$ } - + /** * @param filePath : String * @return filePath : IPath - not null @@ -239,7 +239,7 @@ public class XLCBuildOutputParserUtility { } else if (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) == '/'))) { // absolute path pFilePath = new Path(filePath); @@ -268,7 +268,7 @@ public class XLCBuildOutputParserUtility { public IPath getBaseDirectory() { return fBaseDirectory; } - + /** * Returns all CCommandDSC collected so far. * Currently this list is not filled, so it will always return an empty list. @@ -277,7 +277,7 @@ public class XLCBuildOutputParserUtility { public List getCCommandDSCList() { return new ArrayList(commandsList2); } - + protected int getDirectoryLevel() { return fDirectoryStack.size(); } @@ -303,7 +303,7 @@ public class XLCBuildOutputParserUtility { /** * @param genericLine * @param cppFileType - * @return CCommandDSC compile command description + * @return CCommandDSC compile command description */ public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) { ArrayList dirafter = new ArrayList(); @@ -327,7 +327,7 @@ public class XLCBuildOutputParserUtility { token.equals("-fno-signed-char") || //$NON-NLS-1$ token.equals("-fsigned-char") || //$NON-NLS-1$ token.startsWith("-fabi-version=") //$NON-NLS-1$ - ) { + ) { command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), token)); continue; } @@ -343,7 +343,7 @@ public class XLCBuildOutputParserUtility { for (Iterator iter=includes.iterator(); iter.hasNext(); ) { option = (String)iter.next(); KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option); - command.addSCOption(pair); + command.addSCOption(pair); } includes = new ArrayList(); // -I- has no parameter @@ -356,17 +356,17 @@ public class XLCBuildOutputParserUtility { } else break; } - + if (option.length() > 0 && ( optionKind.equals(SCDOptionsEnum.INCLUDE) || optionKind.equals(SCDOptionsEnum.INCLUDE_FILE) || optionKind.equals(SCDOptionsEnum.IMACROS_FILE) || optionKind.equals(SCDOptionsEnum.IDIRAFTER) || - optionKind.equals(SCDOptionsEnum.ISYSTEM) || + optionKind.equals(SCDOptionsEnum.ISYSTEM) || optionKind.equals(SCDOptionsEnum.IQUOTE) )) { option = (getAbsolutePath(option)).toString(); } - + if (optionKind.equals(SCDOptionsEnum.IDIRAFTER)) { KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option); dirafter.add(pair); @@ -391,10 +391,10 @@ public class XLCBuildOutputParserUtility { for (Iterator iter=includes.iterator(); iter.hasNext(); ) { option = (String)iter.next(); KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option); - command.addSCOption(pair); + command.addSCOption(pair); } for (Iterator iter=dirafter.iterator(); iter.hasNext(); ) { - command.addSCOption((KVStringPair)iter.next()); + command.addSCOption((KVStringPair)iter.next()); } return command; } @@ -470,11 +470,11 @@ public class XLCBuildOutputParserUtility { fDefaultMacroDefinitionValue= val; } } - + public String getDefaultMacroDefinitionValue() { return fDefaultMacroDefinitionValue; } - + public String normalizePath(String path) { int column = path.indexOf(':'); if (column > 0) { @@ -534,12 +534,12 @@ public class XLCBuildOutputParserUtility { } } newBuf.append(buf.substring(scp, len)); - + IPath orgPath = new Path(newBuf.toString()); return orgPath.toString(); } - + /** * Called by the console line parsers to find a file with a given name. * @param fileName @@ -554,7 +554,7 @@ public class XLCBuildOutputParserUtility { // If there is a conflict then try all files in the project. if (isConflictingName(fileName)) { file = null; - + // Create a problem marker final String error = MakeMessages.getString("ConsoleParser.Ambiguous_Filepath_Error_Message"); //$NON-NLS-1$ TraceUtil.outputError(error, fileName); @@ -564,7 +564,7 @@ public class XLCBuildOutputParserUtility { } return file; } - + /** * @param filePath * @return @@ -611,7 +611,7 @@ public class XLCBuildOutputParserUtility { */ protected IFile findFileName(String fileName) { IPath path = new Path(fileName); - return (IFile) fFilesInProject.get(path.lastSegment()); + return fFilesInProject.get(path.lastSegment()); } protected IFile findFileInWorkspace(IPath path) { @@ -672,7 +672,7 @@ public class XLCBuildOutputParserUtility { if (!cwd.isAbsolute()) { cwd = getBaseDirectory().append(cwd); } - + IPath filePath = new Path(fileName); if (!filePath.isAbsolute()) { // check if the cwd is the right one @@ -686,11 +686,11 @@ public class XLCBuildOutputParserUtility { // probably multiple choices for cwd, hopeless final String error = MakeMessages.getString("ConsoleParser.Working_Directory_Error_Message"); //$NON-NLS-1$ TraceUtil.outputError(error, fileName); - generateMarker(file, -1, error, IMarkerGenerator.SEVERITY_WARNING, fileName); + generateMarker(file, -1, error, IMarkerGenerator.SEVERITY_WARNING, fileName); break; } else { - // remove common segments at the end + // remove common segments at the end IPath tPath = new Path(fileName); if (fileName.startsWith(".")) { //$NON-NLS-1$ tPath = tPath.removeFirstSegments(1); @@ -703,14 +703,14 @@ public class XLCBuildOutputParserUtility { } } } - + IPath candidatePath = cwd.append(includePath); File dir = candidatePath.toFile(); include = candidatePath.toString(); if (!dir.exists()) { final String error = MakeMessages.getString("ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$ 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 diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java index 3482c1a790c..4fd45a07cb1 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java +++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java @@ -36,7 +36,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser { @Override protected boolean processCommand(String[] tokens) { try { - + // GCC C/C++ compiler invocation int compilerInvocationIndex = findCompilerInvocation(tokens); if (compilerInvocationIndex < 0) { @@ -47,7 +47,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser { int extensionsIndex = -1; boolean found = false; String filePath = null; - + // check for automake format first // e.g. line will start with // source='/some/path/source.cpp' @@ -63,7 +63,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser { } } } - + if (!found) { for (int i = compilerInvocationIndex + 1; i < tokens.length; i++) { String token = tokens[i]; @@ -79,7 +79,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser { } } } - + if (!found) { TraceUtil.outputTrace("Error identifying file name :1", tokens, TraceUtil.EOL); //$NON-NLS-1$ return false; @@ -150,12 +150,12 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser { // cmdList.add(cmd); Map> sc = new HashMap>(); // sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList); - - + + // put in empty info for the other types sc.put(ScannerInfoTypes.INCLUDE_PATHS, new LinkedList()); sc.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, new LinkedList()); - + getCollector().contributeToScannerConfig(getProject(), sc); if (fCollector != null && fCollector instanceof IScannerInfoCollector2) { IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector; @@ -166,12 +166,12 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser { Activator.log(e); } } - + */ } } return true; - + } catch(Throwable e) { e.printStackTrace(); @@ -190,7 +190,7 @@ public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser { int equalsIndex = string.indexOf('='); if(equalsIndex != -1 && equalsIndex < string.length()) return string.substring(equalsIndex+1); - + } return null; } diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java index cae37f6b94b..61aef0ff865 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java +++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java @@ -31,7 +31,7 @@ import org.eclipse.core.runtime.CoreException; */ public class XLCPerProjectBuildOutputParser extends AbstractXLCBuildOutputParser { - + /* (non-Javadoc) * @see org.eclipse.cdt.make.xlc.core.scannerconfig.AbstractXLCBuildOutputParser#processCommand(java.lang.String[]) */ @@ -41,7 +41,7 @@ public class XLCPerProjectBuildOutputParser extends if (compilerInvocationIdx<0) { return false; } - + if (compilerInvocationIdx+1 >= tokens.length) { return false; } @@ -102,14 +102,14 @@ public class XLCPerProjectBuildOutputParser extends } } } - + else if (fileName == null) { int extIndex = token.lastIndexOf('.'); String extension=null; - + if(extIndex != -1) extension = token.substring(extIndex); - + List extensions = getFileExtensionsList(); if(extension != null && extensions.contains(extension)) fileName = token; @@ -120,7 +120,7 @@ public class XLCPerProjectBuildOutputParser extends return false; // return when no file was given (analogous to GCCPerFileBOPConsoleParser) } - IProject project = getProject(); + IProject project = getProject(); IFile file = null; List translatedIncludes = includes; if (includes.size() > 0) { @@ -139,7 +139,7 @@ public class XLCPerProjectBuildOutputParser extends line.append(tokens[j]); 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()); if (getUtility() != null) { getUtility().generateMarker(getProject(), -1, error + line.toString(), IMarkerGenerator.SEVERITY_WARNING, null); @@ -175,5 +175,5 @@ public class XLCPerProjectBuildOutputParser extends } - + } diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsConsoleParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsConsoleParser.java index d4fbeb094a5..04cd1c42b9f 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsConsoleParser.java +++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsConsoleParser.java @@ -10,27 +10,27 @@ *******************************************************************************/ package org.eclipse.cdt.make.xlc.core.scannerconfig; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.regex.Matcher; 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.IScannerInfoConsoleParser; -import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector; import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes; import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil; import org.eclipse.cdt.make.xlc.core.activator.Activator; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; 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 - * + * * @author laggarcia * @since 1.0.0 */ @@ -46,7 +46,7 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser { // pattern for the includes arguments final Pattern includePattern = Pattern .compile("-(?:qgcc_c_stdinc|qc_stdinc|qgcc_cpp_stdinc|qcpp_stdinc)=(.*)"); //$NON-NLS-1$ - + // xlC compiler constants protected final static String [] compilerConstants = { "__IBMCPP__", //$NON-NLS-1$ @@ -54,7 +54,7 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser { "__IBMC__", //$NON-NLS-1$ "__xlc__" //$NON-NLS-1$ }; - + private IProject fProject = null; protected IScannerInfoCollector fCollector = null; @@ -65,13 +65,14 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser { /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, * org.eclipse.core.runtime.IPath, * org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, * org.eclipse.cdt.core.IMarkerGenerator) * @since 1.0 */ + @Override public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { this.fProject = project; @@ -83,13 +84,14 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser { * standard information about the compiler being used.

    During the * processing, builds two List objects, one with the standard symbols * defined in the compiler and other with the standard include directories. - * + * * @param line the output line from the compiler command line used @return * boolean - * + * * @see org.eclipse.cdt.make.intrenal.core.scannerconfig.gnu.GCCSpecsConsoleParser#processLine(java.lang.String) * @since 1.0 */ + @Override public boolean processLine(String line) { boolean rc = false; TraceUtil.outputTrace( @@ -132,13 +134,14 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser { /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown() * @since 1.0 */ + @Override public void shutdown() { Map> scannerInfo = new HashMap>(); - + // insert compiler constants, work around buggy xlC option for dumping symbols (it misses a few) for (String constant : compilerConstants) { if (!symbols.contains(constant)) @@ -148,7 +151,7 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser { // add the scanner info scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes); scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols); - + fCollector.contributeToScannerConfig(fProject, scannerInfo); if(fCollector != null && fCollector instanceof IScannerInfoCollector2) { IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector; diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsRunSIProvider.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsRunSIProvider.java index 343f5f56a24..450b080f50e 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsRunSIProvider.java +++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsRunSIProvider.java @@ -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.managedbuilder.core.ManagedBuildManager; -import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider; import org.eclipse.cdt.managedbuilder.macros.BuildMacroException; import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider; import org.eclipse.core.runtime.Path; /** * @author laggarcia - * + * */ public class XlCSpecsRunSIProvider extends GCCSpecsRunSIProvider { @@ -27,9 +26,10 @@ public class XlCSpecsRunSIProvider extends GCCSpecsRunSIProvider { /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.make.internal.core.scannerconfig2.GCCSpecsRunSIProvider#initialize() */ + @Override protected boolean initialize() { boolean rc = super.initialize(); diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java index f1bf2a7ccae..4840345d62d 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java +++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java @@ -18,14 +18,14 @@ import org.eclipse.core.resources.IProject; 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 XLCCommandDSC(boolean cppFileType) { super(cppFileType); } - + public XLCCommandDSC(boolean cppFileType, IProject project) { super(cppFileType, project); } diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/src/org/eclipse/cdt/managedbuilder/xlc/core/XLCCorePlugin.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/src/org/eclipse/cdt/managedbuilder/xlc/core/XLCCorePlugin.java index bf329d4797e..4cd944c8f90 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/src/org/eclipse/cdt/managedbuilder/xlc/core/XLCCorePlugin.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/src/org/eclipse/cdt/managedbuilder/xlc/core/XLCCorePlugin.java @@ -19,7 +19,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; public class XLCCorePlugin extends AbstractUIPlugin { /** - * + * */ public XLCCorePlugin() { // TODO Auto-generated constructor stub diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/aix/AixConfigurationEnvironmentSupplier.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/aix/AixConfigurationEnvironmentSupplier.java index 682ef830ab8..735e824ca9e 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/aix/AixConfigurationEnvironmentSupplier.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/aix/AixConfigurationEnvironmentSupplier.java @@ -20,32 +20,34 @@ import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar; public class AixConfigurationEnvironmentSupplier implements IConfigurationEnvironmentVariableSupplier { static final String VARNAME = "PATH"; - static final String BINPATH = "/usr/vac/bin"; - static final String DELIMITER_AIX = ":"; - static final String PROPERTY_DELIMITER = "path.separator"; - static final String PROPERTY_OSNAME = "os.name"; + static final String BINPATH = "/usr/vac/bin"; + static final String DELIMITER_AIX = ":"; + static final String PROPERTY_DELIMITER = "path.separator"; + static final String PROPERTY_OSNAME = "os.name"; /* (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) */ + @Override public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) { - + if (variableName == null) return null; if (!VARNAME.equalsIgnoreCase(variableName)) return null; - return new BuildEnvVar(VARNAME, BINPATH, - IBuildEnvironmentVariable.ENVVAR_PREPEND, - System.getProperty(PROPERTY_DELIMITER, DELIMITER_AIX)); + return new BuildEnvVar(VARNAME, BINPATH, + IBuildEnvironmentVariable.ENVVAR_PREPEND, + System.getProperty(PROPERTY_DELIMITER, DELIMITER_AIX)); } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier#getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider) */ + @Override public IBuildEnvironmentVariable[] getVariables( IConfiguration configuration, IEnvironmentVariableProvider provider) { - - IBuildEnvironmentVariable[] tmp = new IBuildEnvironmentVariable[1]; + + IBuildEnvironmentVariable[] tmp = new IBuildEnvironmentVariable[1]; tmp[0] = getVariable(VARNAME, configuration, provider); - if (tmp[0] != null) return tmp; + if (tmp[0] != null) return tmp; return null; } } diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/aix/AixPathResolver.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/aix/AixPathResolver.java index 1c3ab094429..ae2557c7434 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/aix/AixPathResolver.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/aix/AixPathResolver.java @@ -16,10 +16,11 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration; public class AixPathResolver implements IBuildPathResolver { static final String DELIMITER_AIX = ":"; - + /* (non-Javadoc) * @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, String variableValue, IConfiguration configuration) { return variableValue.split(DELIMITER_AIX); diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/XLCProjectMacroSupplier.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/XLCProjectMacroSupplier.java index 80db6253dd7..4f614e44c67 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/XLCProjectMacroSupplier.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/XLCProjectMacroSupplier.java @@ -31,14 +31,15 @@ public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier { /* (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) */ + @Override public IBuildMacro getMacro(String macroName, IManagedProject project, IBuildMacroProvider provider) { - + if(macroName.equals(PreferenceConstants.P_XL_COMPILER_ROOT)) { String compilerPath = null; - + // figure out compiler path from properties and preferences - + // search for property first IProject theProject = (IProject) project.getOwner(); try { @@ -48,19 +49,19 @@ public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier { // TODO Auto-generated catch block e.printStackTrace(); } - + if(compilerPath == null) { // use the workbench preference IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore(); 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); - + return macro; } - + else return provider.getMacro(macroName, IBuildMacroProvider.CONTEXT_PROJECT, project, true); } @@ -68,15 +69,16 @@ public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier { /* (non-Javadoc) * @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, IBuildMacroProvider provider) { - + String macroName = PreferenceConstants.P_XL_COMPILER_ROOT; - + String compilerPath = null; - + // figure out compiler path from properties and preferences - + // search for property first IProject theProject = (IProject) project.getOwner(); try { @@ -86,31 +88,31 @@ public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier { // TODO Auto-generated catch block e.printStackTrace(); } - + if(compilerPath == null) { // use the workbench preference IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore(); 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); - + // our array consists of our macro, plus all the macros from our parent IBuildMacro[] parentMacros = provider.getMacros(IBuildMacroProvider.CONTEXT_PROJECT, project, true); - + int numMacros = parentMacros.length + 1; // +1 for our macro - + IBuildMacro[] macros = new IBuildMacro[numMacros]; - + macros[0] = macro; - + for(int k = 1; k < macros.length; k++) { macros[k] = parentMacros[k-1]; } - + return macros; - + } } diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/XLCUIPlugin.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/XLCUIPlugin.java index b203d510be9..32980049dd1 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/XLCUIPlugin.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/XLCUIPlugin.java @@ -11,10 +11,11 @@ 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.osgi.framework.BundleContext; -import java.util.*; /** * The main plugin class to be used in the desktop. @@ -24,7 +25,7 @@ public class XLCUIPlugin extends AbstractUIPlugin { private static XLCUIPlugin plugin; //Resource bundle. private ResourceBundle resourceBundle; - + /** * The constructor. */ @@ -36,6 +37,7 @@ public class XLCUIPlugin extends AbstractUIPlugin { /** * This method is called upon plug-in activation */ + @Override public void start(BundleContext context) throws Exception { super.start(context); } @@ -43,6 +45,7 @@ public class XLCUIPlugin extends AbstractUIPlugin { /** * This method is called when the plug-in is stopped */ + @Override public void stop(BundleContext context) throws Exception { super.stop(context); plugin = null; diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceConstants.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceConstants.java index a3e977c85d7..4dcc8f6607e 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceConstants.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceConstants.java @@ -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_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_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_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_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_11_NAME = Messages.XLCompiler_v11; - + public static String getVersion (String label) { if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_11_NAME)) 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; else if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_9_NAME)) return P_XL_COMPILER_VERSION_9; else return P_XL_COMPILER_VERSION_8; } - + public static String getVersionLabel (String version) { if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_11)) 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; else if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_9)) return P_XL_COMPILER_VERSION_9_NAME; diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceInitializer.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceInitializer.java index ec82d79444e..fbb44af7ee8 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceInitializer.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceInitializer.java @@ -11,11 +11,10 @@ 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.jface.preference.IPreferenceStore; -import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin; - /** * Class used to initialize default preference values. */ @@ -23,9 +22,10 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer { /* * (non-Javadoc) - * + * * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() */ + @Override public void initializeDefaultPreferences() { IPreferenceStore store = XLCUIPlugin.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.P_XL_COMPILER_ROOT, "/usr/vacpp/bin"); //$NON-NLS-1$ diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/XLCompilerPreferencePage.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/XLCompilerPreferencePage.java index 80d53ec3737..be341803369 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/XLCompilerPreferencePage.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/XLCompilerPreferencePage.java @@ -11,19 +11,21 @@ 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.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 - * is contributed to the Preferences dialog. By + * is contributed to the Preferences dialog. By * subclassing FieldEditorPreferencePage, we * 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. *

    * This page is used to modify preferences only. They @@ -43,18 +45,20 @@ public class XLCompilerPreferencePage setPreferenceStore(XLCUIPlugin.getDefault().getPreferenceStore()); setDescription(Messages.XLCompilerPreferencePage_0); } - + /** * Creates the field editors. Field editors are abstractions of * the common GUI blocks needed to manipulate various types * of preferences. Each field editor knows how to save and * restore itself. */ + @Override 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 // just warn user @@ -66,35 +70,37 @@ public class XLCompilerPreferencePage { setMessage(originalMessage); } - + return true; } - protected boolean checkState() + @Override + protected boolean checkState() { return doCheckState(); } - + }; addField(pathEditor); - + 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_10_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_10}, {PreferenceConstants.P_XL_COMPILER_VERSION_11_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_11}}; - + addField(new ComboFieldEditor(PreferenceConstants.P_XLC_COMPILER_VERSION, Messages.XLCompilerPreferencePage_2, versionEntries, getFieldEditorParent())); - + } /* (non-Javadoc) * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) */ - public void init(IWorkbench workbench) + @Override + public void init(IWorkbench workbench) { originalMessage = getMessage(); } - + } \ No newline at end of file diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/HiddenOptionApplicabilityCalculator.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/HiddenOptionApplicabilityCalculator.java index 02da2ad7940..1998b865c3e 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/HiddenOptionApplicabilityCalculator.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/HiddenOptionApplicabilityCalculator.java @@ -24,30 +24,33 @@ public class HiddenOptionApplicabilityCalculator implements 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. */ + @Override public boolean isOptionEnabled(IBuildObject configuration, IHoldsOptions holder, IOption option) { return false; } /** - * This function decides if the option for which this class - * is option applicability calculator is used in command line + * This function decides if the option for which this class + * is option applicability calculator is used in command line * or not. */ + @Override public boolean isOptionUsedInCommandLine(IBuildObject configuration, IHoldsOptions holder, IOption option) { 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. */ + @Override public boolean isOptionVisible(IBuildObject configuration, IHoldsOptions holder, IOption option) { diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCApplicabilityCalculator.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCApplicabilityCalculator.java index a006f1ea5db..dc67c85acf6 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCApplicabilityCalculator.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCApplicabilityCalculator.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -18,7 +18,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; -import java.util.ResourceBundle; import java.util.Set; import org.eclipse.cdt.managedbuilder.core.IBuildObject; @@ -37,30 +36,30 @@ import org.eclipse.jface.preference.IPreferenceStore; /** * @author rkerimov - * + * * 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 PROP_NAME_VERSION_ORDER = "xlc.applicability.version.order"; private static final String PROP_VALUE_PLUS = "+"; - + private static boolean initialized; private static List versionOrder; private static Map applicabilityMap; - + public XLCApplicabilityCalculator() { if (!initialized) { Properties props = null; - + ClassLoader loader = this.getClass().getClassLoader(); - InputStream input = null; - + InputStream input = null; + if (loader != null) input = loader.getResourceAsStream(BUNDLE_NAME); @@ -73,24 +72,24 @@ public class XLCApplicabilityCalculator implements IOptionApplicability { props = new Properties(); props.load(input); - + Set entrySet = props.entrySet(); Iterator iterator = entrySet.iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); - + String key = (String) entry.getKey(); String value = (String) entry.getValue(); - + if (value == null) value = ""; - + if (key.equals(PROP_NAME_VERSION_ORDER)) { versionOrder = new ArrayList(); String[] versions = value.split(","); - + if (versions != null) { for (int i = 0; i < versions.length; i ++) @@ -103,14 +102,14 @@ public class XLCApplicabilityCalculator implements IOptionApplicability { if (applicabilityMap == null) applicabilityMap = new HashMap(); - + List applicList = (List) applicabilityMap.get(key); if (applicList == null) { applicList = new ArrayList(); applicabilityMap.put(key, applicList); } - + boolean hasGreaterOption = false; //find if ends with + and set as separate option if (value.endsWith(PROP_VALUE_PLUS)) @@ -118,16 +117,16 @@ public class XLCApplicabilityCalculator implements IOptionApplicability hasGreaterOption = true; value = value.substring(0, value.length() - PROP_VALUE_PLUS.length()); } - + String[] versions = value.split(","); - + if (versions != null) { for (int i = 0; i < versions.length; i ++) { applicList.add(versions[i].trim()); } - + } if (hasGreaterOption) @@ -140,49 +139,49 @@ public class XLCApplicabilityCalculator implements IOptionApplicability { e.printStackTrace(); } - finally + finally { if (input != null) { - try + try { input.close(); - } - catch (IOException e) + } + catch (IOException e) { // ignore } } } - + 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 IProject project = null; - if(configuration instanceof IConfiguration) + if(configuration instanceof IConfiguration) { IConfiguration config = (IConfiguration) configuration; IManagedProject managedProject = config.getManagedProject(); - + project = (IProject) managedProject.getOwner(); } - else if(configuration instanceof IFolderInfo) + else if(configuration instanceof IFolderInfo) { IFolderInfo folderInfo = (IFolderInfo) configuration; - + IConfiguration config = folderInfo.getParent(); - + IManagedProject managedProject = config.getManagedProject(); - + project = (IProject) managedProject.getOwner(); - + } - + if (project == null) return false; @@ -193,8 +192,8 @@ public class XLCApplicabilityCalculator implements IOptionApplicability } catch (CoreException e) { e.printStackTrace(); } - - if(currentVersion == null) + + if(currentVersion == null) { // if the property isn't set, then use the workbench preference 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 (applicabilityMap == null) 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()); if (applicList == null || applicList.isEmpty()) return true; - + //if version is defined in the list - perfect match if (applicList.contains(currentVersion)) return true; - + //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); - + 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 @@ -230,31 +229,32 @@ public class XLCApplicabilityCalculator implements IOptionApplicability for (int k = applicList.size() - 2; k >= 0; k --) { String version = (String) applicList.get(k); - + if (versionOrder.contains(version)) { validVersion = version; break; } } - + //if version that applicability starts with doesn't exist - config error if (validVersion == null) return false; - + //compare if current compiler version is greater than the applicability version if (versionOrder.indexOf(currentVersion) > versionOrder.indexOf(validVersion)) return true; } - - + + return false; - + } - + /* (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) */ + @Override public boolean isOptionEnabled(IBuildObject configuration, IHoldsOptions holder, IOption option) { return isApplicable(configuration, holder, option); @@ -263,6 +263,7 @@ public class XLCApplicabilityCalculator implements IOptionApplicability /* (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) */ + @Override public boolean isOptionUsedInCommandLine(IBuildObject configuration, IHoldsOptions holder, IOption option) { return isApplicable(configuration, holder, option); @@ -271,6 +272,7 @@ public class XLCApplicabilityCalculator implements IOptionApplicability /* (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) */ + @Override public boolean isOptionVisible(IBuildObject configuration, IHoldsOptions holder, IOption option) { return isApplicable(configuration, holder, option); diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java index 66d5b2365b4..dcd6d60190a 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -37,6 +37,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements /* (non-Javadoc) * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() */ + @Override protected void createFieldEditors() { createPathEditor(); createVersionEditor(); @@ -45,7 +46,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements /* * (non-Javadoc) - * + * * @see * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors * () @@ -56,6 +57,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements fPathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT, Messages.XLCompilerPropertyPage_0, parent) { + @Override protected boolean doCheckState() { // always return true, as we don't want to fail cases when // compiler is installed remotely @@ -69,6 +71,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements return true; } + @Override protected boolean checkState() { return doCheckState(); } @@ -147,6 +150,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements originalMessage = getMessage(); } + @Override protected void performDefaults() { // default to whatever is set on the workbench preference IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore(); @@ -168,9 +172,10 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements /* * (non-Javadoc) - * + * * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk() */ + @Override public boolean performOk() { // store the value in the owner text field try { @@ -200,19 +205,21 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement() */ + @Override public IAdaptable getElement() { return element; } /** * Sets the element that owns properties shown on this page. - * + * * @param element * the element */ + @Override public void setElement(IAdaptable element) { this.element = element; } diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCv8ApplicabiltyCalculator.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCv8ApplicabiltyCalculator.java index 4d8ddd4242c..22357ff7c29 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCv8ApplicabiltyCalculator.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCv8ApplicabiltyCalculator.java @@ -35,9 +35,9 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability { if(configuration instanceof IConfiguration) { IConfiguration config = (IConfiguration) configuration; IManagedProject managedProject = config.getManagedProject(); - + IProject project = (IProject) managedProject.getOwner(); - + String currentVersion = null; try { currentVersion = project.getPersistentProperty(new QualifiedName("", @@ -46,26 +46,26 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability { // TODO Auto-generated catch block e.printStackTrace(); } - + if(currentVersion == null) { // if the property isn't set, then use the workbench preference IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore(); currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION); } - + if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8)) return true; } - + if(configuration instanceof IFolderInfo) { IFolderInfo folderInfo = (IFolderInfo) configuration; - + IConfiguration config = folderInfo.getParent(); - + IManagedProject managedProject = config.getManagedProject(); - + IProject project = (IProject) managedProject.getOwner(); - + String currentVersion = null; try { currentVersion = project.getPersistentProperty(new QualifiedName("", @@ -74,25 +74,26 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability { // TODO Auto-generated catch block e.printStackTrace(); } - + if(currentVersion == null) { // if the property isn't set, then use the workbench preference IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore(); currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION); } - + if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8)) return true; - + } - + return false; - + } - + /* (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) */ + @Override public boolean isOptionEnabled(IBuildObject configuration, IHoldsOptions holder, IOption option) { return isVersion8(configuration); @@ -101,6 +102,7 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability { /* (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) */ + @Override public boolean isOptionUsedInCommandLine(IBuildObject configuration, IHoldsOptions holder, IOption option) { return isVersion8(configuration); @@ -109,6 +111,7 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability { /* (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) */ + @Override public boolean isOptionVisible(IBuildObject configuration, IHoldsOptions holder, IOption option) { return isVersion8(configuration); diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCv9ApplicabilityCalculator.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCv9ApplicabilityCalculator.java index 47d7201208b..3c12ce121dc 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCv9ApplicabilityCalculator.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCv9ApplicabilityCalculator.java @@ -26,7 +26,7 @@ import org.eclipse.jface.preference.IPreferenceStore; /** * @author crecoskie - * + * * 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) { IConfiguration config = (IConfiguration) configuration; IManagedProject managedProject = config.getManagedProject(); - + IProject project = (IProject) managedProject.getOwner(); - + String currentVersion = null; try { currentVersion = project.getPersistentProperty(new QualifiedName("", @@ -48,26 +48,26 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability { // TODO Auto-generated catch block e.printStackTrace(); } - + if(currentVersion == null) { // if the property isn't set, then use the workbench preference IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore(); currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION); } - + if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9)) return true; } - + if(configuration instanceof IFolderInfo) { IFolderInfo folderInfo = (IFolderInfo) configuration; - + IConfiguration config = folderInfo.getParent(); - + IManagedProject managedProject = config.getManagedProject(); - + IProject project = (IProject) managedProject.getOwner(); - + String currentVersion = null; try { currentVersion = project.getPersistentProperty(new QualifiedName("", @@ -76,25 +76,26 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability { // TODO Auto-generated catch block e.printStackTrace(); } - + if(currentVersion == null) { // if the property isn't set, then use the workbench preference IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore(); currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION); } - + if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9)) return true; - + } - + return false; - + } - + /* (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) */ + @Override public boolean isOptionEnabled(IBuildObject configuration, IHoldsOptions holder, IOption option) { return isVersion9(configuration); @@ -103,6 +104,7 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability { /* (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) */ + @Override public boolean isOptionUsedInCommandLine(IBuildObject configuration, IHoldsOptions holder, IOption option) { return isVersion9(configuration); @@ -111,6 +113,7 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability { /* (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) */ + @Override public boolean isOptionVisible(IBuildObject configuration, IHoldsOptions holder, IOption option) { return isVersion9(configuration); diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/variables/DynamicVariableResolver.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/variables/DynamicVariableResolver.java index 2943c09fe97..9b1fd9e8d8f 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/variables/DynamicVariableResolver.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/variables/DynamicVariableResolver.java @@ -26,6 +26,7 @@ public class DynamicVariableResolver implements IDynamicVariableResolver { /* (non-Javadoc) * @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String) */ + @Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java index 9692b450bec..e1a41720c55 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -40,7 +40,7 @@ import org.eclipse.swt.widgets.Text; public class XLCSettingsWizardPage extends MBSCustomPage { public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.xlc.ui.XlcSettingsWizardPage"; //$NON-NLS-1$ - + private final class BrowseButtonSelectionListener implements SelectionListener { private final Composite composite; @@ -49,26 +49,28 @@ public class XLCSettingsWizardPage extends MBSCustomPage { this.composite = composite; } + @Override public void widgetDefaultSelected(SelectionEvent e) { // meaningless for a button... do nothing - + } + @Override public void widgetSelected(SelectionEvent e) { // open a browse dialog DirectoryDialog dirDialog = new DirectoryDialog(composite.getShell(), SWT.APPLICATION_MODAL); String browsedDirectory = dirDialog.open(); fDirTextBox.setText(browsedDirectory); - + } } - + private Composite fComposite = null; private Text fDirTextBox; private Combo fVersionCombo; - + /** * @param pageID */ @@ -78,13 +80,13 @@ public class XLCSettingsWizardPage extends MBSCustomPage { } /** - * + * */ public XLCSettingsWizardPage() { super(PAGE_ID); setDefaultPreferences(PAGE_ID); } - + private void setDefaultPreferences(String pageID) { String compilerPath = XLCUIPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.P_XL_COMPILER_ROOT); MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, compilerPath); @@ -94,6 +96,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage#isCustomPageComplete() */ + @Override protected boolean isCustomPageComplete() { return true; } @@ -101,6 +104,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.wizard.IWizardPage#getName() */ + @Override public String getName() { String name = Messages.XLCSettingsWizardPage_0; return name; @@ -109,6 +113,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { // create a new composite fComposite = new Composite(parent, SWT.NONE); @@ -116,12 +121,12 @@ public class XLCSettingsWizardPage extends MBSCustomPage { GridLayout layout = new GridLayout(3, false); fComposite.setLayout(layout); fComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); - + // create the first label Label label1 = new Label(fComposite, SWT.NONE); label1.setText(Messages.XLCSettingsWizardPage_1); label1.setVisible(true); - + // create the text box for the path GridData dirBoxGridData = new GridData(); dirBoxGridData.grabExcessHorizontalSpace = true; @@ -129,25 +134,26 @@ public class XLCSettingsWizardPage extends MBSCustomPage { fDirTextBox = new Text(fComposite, SWT.SINGLE | SWT.BORDER); fDirTextBox.setLayoutData(dirBoxGridData); fDirTextBox.setVisible(true); - + // set the default compiler location based on preferences IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore(); String compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT); fDirTextBox.setText(compilerPath); - + // update the page manager with the setting MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText()); - + fDirTextBox.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { // update the page manager with the setting MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText()); - + } - + }); - + // create the browse button //String selectedPath = null; GridData buttonData = new GridData(); @@ -157,53 +163,55 @@ public class XLCSettingsWizardPage extends MBSCustomPage { browseButton.setText(Messages.XLCSettingsWizardPage_2); browseButton.addSelectionListener(new BrowseButtonSelectionListener(fComposite) ); - + browseButton.setVisible(true); - + // create the second label Label label2 = new Label(fComposite, SWT.NONE); label2.setText(Messages.XLCSettingsWizardPage_3); - + label2.setVisible(true); - + // create the version dropdown GridData comboData = new GridData(); comboData.grabExcessHorizontalSpace = true; comboData.horizontalAlignment = SWT.FILL; - + fVersionCombo = new Combo(fComposite, SWT.READ_ONLY); fVersionCombo.setLayoutData(comboData); - + // populate the combo 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_10_NAME); fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_11_NAME); - + // set the default based on the workbench preference String compilerVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION); fVersionCombo.setText(PreferenceConstants.getVersionLabel(compilerVersion)); - + // update the page manager with the setting MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText())); - + fVersionCombo.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { // update the page manager with the setting MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText())); - + } - + }); - + fVersionCombo.setVisible(true); - + } /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#dispose() */ + @Override public void dispose() { fComposite.dispose(); } @@ -211,6 +219,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#getControl() */ + @Override public Control getControl() { return fComposite; } @@ -218,6 +227,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#getDescription() */ + @Override public String getDescription() { return Messages.XLCSettingsWizardPage_4; } @@ -225,6 +235,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage() */ + @Override public String getErrorMessage() { // TODO Auto-generated method stub return null; @@ -233,6 +244,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#getImage() */ + @Override public Image getImage() { return wizard.getDefaultPageImage(); } @@ -240,6 +252,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#getMessage() */ + @Override public String getMessage() { return null; } @@ -247,6 +260,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#getTitle() */ + @Override public String getTitle() { return Messages.XLCSettingsWizardPage_5; } @@ -254,6 +268,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#performHelp() */ + @Override public void performHelp() { // TODO Auto-generated method stub @@ -262,6 +277,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#setDescription(java.lang.String) */ + @Override public void setDescription(String description) { // TODO Auto-generated method stub @@ -270,6 +286,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#setImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) */ + @Override public void setImageDescriptor(ImageDescriptor image) { // TODO Auto-generated method stub @@ -278,6 +295,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#setTitle(java.lang.String) */ + @Override public void setTitle(String title) { // TODO Auto-generated method stub @@ -286,6 +304,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean) */ + @Override public void setVisible(boolean visible) { fComposite.setVisible(visible); } diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardRunnable.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardRunnable.java index 5a71a9d6a09..4c47bd297d8 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardRunnable.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardRunnable.java @@ -21,7 +21,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.QualifiedName; import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.IWizard; import org.eclipse.jface.wizard.IWizardPage; /** @@ -35,6 +34,7 @@ public class XLCSettingsWizardRunnable implements IRunnableWithProgress { public XLCSettingsWizardRunnable() { } + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { // 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(); @@ -42,19 +42,19 @@ public class XLCSettingsWizardRunnable implements IRunnableWithProgress { // get a handle to the wizard IWizardPage[] pages = MBSCustomPageManager.getPages(); - + if(pages != null && pages.length > 0) { - + ICDTCommonProjectWizard wizard = (ICDTCommonProjectWizard) pages[0].getWizard(); IProject project = wizard.getLastProject(); - + try { project.setPersistentProperty(new QualifiedName("", PreferenceConstants.P_XL_COMPILER_ROOT), compilerPath); project.setPersistentProperty(new QualifiedName("", PreferenceConstants.P_XLC_COMPILER_VERSION), compilerVersion); - + } catch (CoreException e) { CCorePlugin.log(e); - } + } } } diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/Activator.java b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/Activator.java index 459f613723e..5d72f45aef8 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/Activator.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/Activator.java @@ -20,16 +20,18 @@ public class Activator extends AbstractUIPlugin { private static Activator plugin; - + public Activator() { } + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; } + @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/Messages.java b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/Messages.java index f78eeb59d8f..845d6d5971d 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/Messages.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/Messages.java @@ -14,15 +14,15 @@ package org.eclipse.cdt.managedbuilder.xlupc.ui; import org.eclipse.osgi.util.NLS; public class Messages extends NLS { - + private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.xlupc.ui.messages"; //$NON-NLS-1$ - + static { NLS.initializeMessages(BUNDLE_NAME, Messages.class); } private Messages() {} - + public static String UpcProjectWizard_0; public static String UpcProjectWizard_1; public static String XLUpcSettingsWizardPage_0; diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/UpcProjectWizard.java b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/UpcProjectWizard.java index 30dbe13c4ea..316741d5bcf 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/UpcProjectWizard.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/UpcProjectWizard.java @@ -31,17 +31,17 @@ import org.eclipse.core.runtime.NullProgressMonitor; 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_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_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_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_DEFAULT = ARTIFACT_TYPE_UPC_LIB + ".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_DEFAULT = ARTIFACT_TYPE_UPC_LIB + ".default"; + private final static String PAGE_NAME = "org.eclipse.cdt.managedbuilder.xlupc.ui.mainpage"; - - + + private static final Set ALL_TYPES = new HashSet() {{ add(ARTIFACT_TYPE_UPC_EXE); 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_DEFAULT); }}; - - + + public UpcProjectWizard() { - super(Messages.UpcProjectWizard_0, Messages.UpcProjectWizard_1); + super(Messages.UpcProjectWizard_0, Messages.UpcProjectWizard_1); } - + + @Override public void addPages() { fMainPage = new CDTMainWizardPage(PAGE_NAME) { - + + @Override @SuppressWarnings("unchecked") public List filterItems(List items) { // filter out all non-UPC project types @@ -75,13 +77,14 @@ public class UpcProjectWizard extends CDTCommonProjectWizard { return items; } }; - - fMainPage.setTitle(Messages.UpcProjectWizard_0); - fMainPage.setDescription(Messages.UpcProjectWizard_1); + + fMainPage.setTitle(Messages.UpcProjectWizard_0); + fMainPage.setDescription(Messages.UpcProjectWizard_1); addPage(fMainPage); } + @Override protected IProject continueCreation(IProject prj) { try { CProjectNature.addCNature(prj, new NullProgressMonitor()); @@ -90,6 +93,7 @@ public class UpcProjectWizard extends CDTCommonProjectWizard { } + @Override public String[] getNatures() { return new String[] { CProjectNature.C_NATURE_ID/*, CCProjectNature.CC_NATURE_ID, RemoteNature.REMOTE_NATURE_ID*/}; } diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/XLUpcSettingsWizardPage.java b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/XLUpcSettingsWizardPage.java index f379581c1d8..637c757190c 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/XLUpcSettingsWizardPage.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/XLUpcSettingsWizardPage.java @@ -29,10 +29,12 @@ public class XLUpcSettingsWizardPage extends XLCSettingsWizardPage { pageID = PAGE_ID; } + @Override public String getName() { return Messages.XLUpcSettingsWizardPage_0; } + @Override public String getTitle() { return Messages.XLUpcSettingsWizardPage_1; } diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/XLUpcSettingsWizardRunnable.java b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/XLUpcSettingsWizardRunnable.java index 477592549cb..6b8ff391608 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/XLUpcSettingsWizardRunnable.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/src/org/eclipse/cdt/managedbuilder/xlupc/ui/wizards/XLUpcSettingsWizardRunnable.java @@ -33,14 +33,15 @@ import org.eclipse.jface.wizard.IWizardPage; public class XLUpcSettingsWizardRunnable extends XLCSettingsWizardRunnable { - + // now add UPC language mapping to the project private static final String[] CONTENT_TYPE_IDS = { CCorePlugin.CONTENT_TYPE_CHEADER, CCorePlugin.CONTENT_TYPE_CSOURCE }; - + public XLUpcSettingsWizardRunnable() { pageId = XLUpcSettingsWizardPage.PAGE_ID; } + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { super.run(monitor); // get a handle to the wizard @@ -51,10 +52,10 @@ public class XLUpcSettingsWizardRunnable extends XLCSettingsWizardRunnable { CDTCommonProjectWizard wizard = (CDTCommonProjectWizard) pages[0].getWizard(); IProject project = wizard.getLastProject(); LanguageManager langManager = LanguageManager.getInstance(); - + try { ProjectLanguageConfiguration langConfig = langManager.getLanguageConfiguration(project); - + ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project, false); ICConfigurationDescription configDescription = projectDescription.getActiveConfiguration(); @@ -65,9 +66,9 @@ public class XLUpcSettingsWizardRunnable extends XLCSettingsWizardRunnable { langConfig.addContentTypeMapping(configDescription, id, UPCLanguage.ID); } } - + langManager.storeLanguageMappingConfiguration(project, new IContentType[0]); - + } catch (CoreException e) { CCorePlugin.log(e); }