diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties index 200af0f347a..dfcd344e313 100644 --- a/core/org.eclipse.cdt.ui/plugin.properties +++ b/core/org.eclipse.cdt.ui/plugin.properties @@ -3,6 +3,7 @@ providerName=Eclipse.org elementFiltersName=CElement Filters binaryParserPage=Binary Parser Page +pathContainerPage=Path Container Page textHoversName=Text Hovers editorActionsName=Editor Actions editorRulerActionsName=Editor Ruler Actions diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 33fb363b38b..e71ca7e2519 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -32,7 +32,7 @@ - + @@ -683,4 +683,12 @@ --> + + + + diff --git a/core/org.eclipse.cdt.ui/schema/CPathContainerPage.exsd b/core/org.eclipse.cdt.ui/schema/PathContainerPage.exsd similarity index 89% rename from core/org.eclipse.cdt.ui/schema/CPathContainerPage.exsd rename to core/org.eclipse.cdt.ui/schema/PathContainerPage.exsd index 5dbdb034ca0..b9d9a03a840 100644 --- a/core/org.eclipse.cdt.ui/schema/CPathContainerPage.exsd +++ b/core/org.eclipse.cdt.ui/schema/PathContainerPage.exsd @@ -3,7 +3,7 @@ - + [Enter description of this extension point.] @@ -13,7 +13,7 @@ - + @@ -39,7 +39,7 @@ - + diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPListElement.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPListElement.java index 07ea7860ae3..6ecf8cb2f0d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPListElement.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPListElement.java @@ -37,63 +37,63 @@ public class CPListElement { public static final String BASE_REF = "base-ref"; //$NON-NLS-1$ public static final String BASE = "base-path"; //$NON-NLS-1$ - private ICProject fProject; + private final int fEntryKind; + private final IPath fPath; + private final ICProject fCProject; + private final IResource fResource; + private final ArrayList fChildren; - private int fEntryKind; - private IPath fPath; - private IResource fResource; private boolean fIsExported; private boolean fIsMissing; private CPListElement fParentContainer; - private IPathEntry fCachedEntry; - private ArrayList fChildren; public CPListElement(ICProject project, int entryKind, IPath path, IResource res) { - fProject = project; - + fCProject = project; fEntryKind = entryKind; fPath = path; fChildren = new ArrayList(); fResource = res; - fIsExported = false; + fIsExported = false; fIsMissing = false; fCachedEntry = null; fParentContainer = null; switch (entryKind) { - case IPathEntry.CDT_OUTPUT: + case IPathEntry.CDT_OUTPUT : createAttributeElement(EXCLUSION, new Path[0]); break; - case IPathEntry.CDT_SOURCE: + case IPathEntry.CDT_SOURCE : createAttributeElement(EXCLUSION, new Path[0]); break; - case IPathEntry.CDT_LIBRARY: + case IPathEntry.CDT_LIBRARY : createAttributeElement(SOURCEATTACHMENT, null); + createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$ + createAttributeElement(BASE, new Path("")); //$NON-NLS-1$ break; - case IPathEntry.CDT_INCLUDE: + case IPathEntry.CDT_INCLUDE : createAttributeElement(INCLUDE, new Path("")); //$NON-NLS-1$ createAttributeElement(EXCLUSION, new Path[0]); createAttributeElement(SYSTEM_INCLUDE, Boolean.valueOf(false)); createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$ createAttributeElement(BASE, new Path("")); //$NON-NLS-1$ break; - case IPathEntry.CDT_MACRO: + case IPathEntry.CDT_MACRO : createAttributeElement(MACRO_NAME, ""); //$NON-NLS-1$ createAttributeElement(MACRO_VALUE, ""); //$NON-NLS-1$ createAttributeElement(EXCLUSION, new Path[0]); createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$ createAttributeElement(BASE, new Path("")); //$NON-NLS-1$ break; - case IPathEntry.CDT_CONTAINER: + case IPathEntry.CDT_CONTAINER : try { - IPathEntryContainer container = CoreModel.getDefault().getPathEntryContainer(fPath, fProject); + IPathEntryContainer container = CoreModel.getDefault().getPathEntryContainer(fPath, fCProject); if (container != null) { IPathEntry[] entries = container.getPathEntries(); for (int i = 0; i < entries.length; i++) { - CPListElement curr = createFromExisting(entries[i], fProject); + CPListElement curr = createFromExisting(entries[i], fCProject); curr.setParentContainer(this); fChildren.add(curr); } @@ -101,7 +101,7 @@ public class CPListElement { } catch (CModelException e) { } break; - default: + default : } } @@ -113,44 +113,45 @@ public class CPListElement { } private IPathEntry newPathEntry() { - IPath[] exclusionPattern; - //IPath[] exclusionPattern = (IPath[]) getAttribute(EXCLUSION); - Object o = getAttribute(EXCLUSION); - Class clazz = o.getClass(); - if (clazz.isArray()) { - exclusionPattern = (IPath[]) o; - } else { - exclusionPattern = new IPath[0]; - } + IPath[] exclusionPattern = (IPath[]) getAttribute(EXCLUSION); IPath base = (IPath) getAttribute(BASE); IPath baseRef = (IPath) getAttribute(BASE_REF); switch (fEntryKind) { - case IPathEntry.CDT_OUTPUT: + case IPathEntry.CDT_OUTPUT : return CoreModel.newOutputEntry(fPath, exclusionPattern); - case IPathEntry.CDT_SOURCE: + case IPathEntry.CDT_SOURCE : return CoreModel.newSourceEntry(fPath, exclusionPattern); - case IPathEntry.CDT_LIBRARY: + case IPathEntry.CDT_LIBRARY : IPath attach = (IPath) getAttribute(SOURCEATTACHMENT); - return CoreModel.newLibraryEntry(base, fPath, attach, null, null, isExported()); - case IPathEntry.CDT_PROJECT: - return CoreModel.newProjectEntry(fPath, isExported()); - case IPathEntry.CDT_CONTAINER: - return CoreModel.newContainerEntry(fPath, isExported()); - case IPathEntry.CDT_INCLUDE: - if (base != null) { - return CoreModel.newIncludeEntry(fPath, base, (IPath) getAttribute(INCLUDE), - ((Boolean) getAttribute(SYSTEM_INCLUDE)).booleanValue(), exclusionPattern); + if (baseRef != null) { + return CoreModel.newLibraryRefEntry(baseRef, fPath); } else { - + return CoreModel.newLibraryEntry(base, fPath, attach, null, null, isExported()); } - case IPathEntry.CDT_MACRO: - return CoreModel.newMacroEntry(fPath, (String) getAttribute(MACRO_NAME), - (String) getAttribute(MACRO_VALUE), exclusionPattern); - default: + case IPathEntry.CDT_PROJECT : + return CoreModel.newProjectEntry(fPath, isExported()); + case IPathEntry.CDT_CONTAINER : + return CoreModel.newContainerEntry(fPath, isExported()); + case IPathEntry.CDT_INCLUDE : + IPath include = (IPath) getAttribute(INCLUDE); + if (baseRef != null) { + return CoreModel.newIncludeRefEntry(fPath, baseRef, include); + } else { + return CoreModel.newIncludeEntry(fPath, base, include, ((Boolean) getAttribute(SYSTEM_INCLUDE)).booleanValue(), + exclusionPattern); + } + case IPathEntry.CDT_MACRO : + String macroName = (String) getAttribute(MACRO_NAME); + String macroValue = (String) getAttribute(MACRO_VALUE); + if (baseRef != null) { + return CoreModel.newMacroRefEntry(fPath, baseRef, macroName); + } else { + return CoreModel.newMacroEntry(fPath, macroName, macroValue, exclusionPattern); + } + default : return null; } } - public static StringBuffer appendEncodePath(IPath path, StringBuffer buf) { if (path != null) { String str = path.toString(); @@ -169,17 +170,17 @@ public class CPListElement { appendEncodePath(fPath, buf).append(';'); buf.append(Boolean.valueOf(fIsExported)).append(';'); switch (fEntryKind) { - case IPathEntry.CDT_OUTPUT: - case IPathEntry.CDT_SOURCE: - case IPathEntry.CDT_INCLUDE: - case IPathEntry.CDT_MACRO: + case IPathEntry.CDT_OUTPUT : + case IPathEntry.CDT_SOURCE : + case IPathEntry.CDT_INCLUDE : + case IPathEntry.CDT_MACRO : IPath[] exclusion = (IPath[]) getAttribute(EXCLUSION); buf.append('[').append(exclusion.length).append(']'); for (int i = 0; i < exclusion.length; i++) { appendEncodePath(exclusion[i], buf); } switch (fEntryKind) { - case IPathEntry.CDT_INCLUDE: + case IPathEntry.CDT_INCLUDE : IPath baseRef = (IPath) getAttribute(BASE_REF); appendEncodePath(baseRef, buf); IPath base = (IPath) getAttribute(BASE); @@ -187,25 +188,27 @@ public class CPListElement { IPath include = (IPath) getAttribute(INCLUDE); appendEncodePath(include, buf); break; - case IPathEntry.CDT_MACRO: + case IPathEntry.CDT_MACRO : baseRef = (IPath) getAttribute(BASE_REF); appendEncodePath(baseRef, buf); base = (IPath) getAttribute(BASE); appendEncodePath(base, buf); String symbol = (String) getAttribute(MACRO_NAME); buf.append(symbol).append(';'); - default: + default : } break; - case IPathEntry.CDT_LIBRARY: + case IPathEntry.CDT_LIBRARY : + IPath baseRef = (IPath) getAttribute(BASE_REF); + appendEncodePath(baseRef, buf); IPath base = (IPath) getAttribute(BASE); appendEncodePath(base, buf); IPath sourceAttach = (IPath) getAttribute(SOURCEATTACHMENT); appendEncodePath(sourceAttach, buf); break; - default: + default : } - buf.setLength(buf.length()-1); + buf.setLength(buf.length() - 1); return buf; } @@ -228,8 +231,7 @@ public class CPListElement { } /** - * Entries without resource are either non existing or a variable entry - * External jars do not have a resource + * Entries without resource are either non existing or a variable entry External jars do not have a resource */ public IResource getResource() { return fResource; @@ -263,7 +265,7 @@ public class CPListElement { if (attrib != null) { return attrib.getValue(); } - return new Path(""); + return null; } private void createAttributeElement(String key, Object value) { @@ -272,7 +274,7 @@ public class CPListElement { public Object[] getChildren() { if (fEntryKind == IPathEntry.CDT_OUTPUT || fEntryKind == IPathEntry.CDT_SOURCE) { - return new Object[] { findAttributeElement(EXCLUSION)}; + return new Object[]{findAttributeElement(EXCLUSION)}; } return fChildren.toArray(); } @@ -299,13 +301,14 @@ public class CPListElement { return false; } switch (fEntryKind) { - case IPathEntry.CDT_LIBRARY: - return getAttribute(BASE).equals(elem.getAttribute(BASE)); - case IPathEntry.CDT_INCLUDE: + case IPathEntry.CDT_LIBRARY : + return getAttribute(BASE).equals(elem.getAttribute(BASE)) + && getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)); + case IPathEntry.CDT_INCLUDE : return (getAttribute(INCLUDE).equals(elem.getAttribute(INCLUDE)) && getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals( elem.getAttribute(BASE))); - case IPathEntry.CDT_MACRO: + case IPathEntry.CDT_MACRO : return (getAttribute(MACRO_NAME).equals(elem.getAttribute(MACRO_NAME)) && getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals( elem.getAttribute(BASE))); @@ -319,16 +322,25 @@ public class CPListElement { * @see Object#hashCode() */ public int hashCode() { - int hashCode = 0; + final int HASH_FACTOR = 89; + int hashCode = fPath.hashCode() + fEntryKind; switch (fEntryKind) { - case IPathEntry.CDT_LIBRARY: - hashCode = getAttribute(BASE).hashCode(); - case IPathEntry.CDT_INCLUDE: - hashCode = getAttribute(INCLUDE).hashCode() + getAttribute(BASE_REF).hashCode() + getAttribute(BASE).hashCode(); - case IPathEntry.CDT_MACRO: - hashCode = getAttribute(MACRO_NAME).hashCode() + getAttribute(BASE_REF).hashCode() + getAttribute(BASE).hashCode(); + case IPathEntry.CDT_LIBRARY : + hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode(); + hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode(); + break; + case IPathEntry.CDT_INCLUDE : + hashCode = hashCode * HASH_FACTOR + getAttribute(INCLUDE).hashCode(); + hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode(); + hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode(); + break; + case IPathEntry.CDT_MACRO : + hashCode = hashCode * HASH_FACTOR + getAttribute(MACRO_NAME).hashCode(); + hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode(); + hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode(); + break; } - return fPath.hashCode() + fEntryKind; + return hashCode; } /* @@ -382,7 +394,7 @@ public class CPListElement { * @return Returns a ICProject */ public ICProject getCProject() { - return fProject; + return fCProject; } public static CPListElement createFromExisting(IPathEntry curr, ICProject project) { @@ -403,14 +415,14 @@ public class CPListElement { // URL javaDocLocation = null; switch (curr.getEntryKind()) { - case IPathEntry.CDT_CONTAINER: + case IPathEntry.CDT_CONTAINER : res = null; try { isMissing = (CoreModel.getDefault().getPathEntryContainer(path, project) == null); } catch (CModelException e) { } break; - case IPathEntry.CDT_LIBRARY: + case IPathEntry.CDT_LIBRARY : res = root.findMember(path); if (res == null) { // if (!ArchiveFileFilter.isArchivePath(path)) { @@ -421,8 +433,10 @@ public class CPListElement { isMissing = !path.toFile().isFile(); // look for external } sourceAttachment = ((ILibraryEntry) curr).getSourceAttachmentPath(); + base = ((ILibraryEntry) curr).getBasePath(); + baseRef = ((ILibraryEntry) curr).getBaseReference(); break; - case IPathEntry.CDT_SOURCE: + case IPathEntry.CDT_SOURCE : path = path.removeTrailingSeparator(); res = root.findMember(path); if (res == null) { @@ -433,7 +447,7 @@ public class CPListElement { } exclusion = ((ISourceEntry) curr).getExclusionPatterns(); break; - case IPathEntry.CDT_OUTPUT: + case IPathEntry.CDT_OUTPUT : path = path.removeTrailingSeparator(); res = root.findMember(path); if (res == null) { @@ -444,7 +458,7 @@ public class CPListElement { } exclusion = ((IOutputEntry) curr).getExclusionPatterns(); break; - case IPathEntry.CDT_INCLUDE: + case IPathEntry.CDT_INCLUDE : path = path.removeTrailingSeparator(); res = root.findMember(path); if (res == null) { @@ -457,12 +471,11 @@ public class CPListElement { } exclusion = ((IIncludeEntry) curr).getExclusionPatterns(); sysInclude = ((IIncludeEntry) curr).isSystemInclude(); - baseRef = ((IIncludeEntry) curr).getBasePath(); - base = new Path(""); - // base = ((IIncludeEntry) curr).getBasePath(); + baseRef = ((IIncludeEntry) curr).getBaseReference(); + base = ((IIncludeEntry) curr).getBasePath(); include = ((IIncludeEntry) curr).getIncludePath(); break; - case IPathEntry.CDT_MACRO: + case IPathEntry.CDT_MACRO : path = path.removeTrailingSeparator(); res = root.findMember(path); if (res == null) { @@ -476,11 +489,10 @@ public class CPListElement { exclusion = ((IMacroEntry) curr).getExclusionPatterns(); macroName = ((IMacroEntry) curr).getMacroName(); macroValue = ((IMacroEntry) curr).getMacroValue(); - baseRef = ((IMacroEntry) curr).getBasePath(); - base = new Path(""); - // base = ((IIncludeEntry) curr).getBasePath(); + baseRef = ((IMacroEntry) curr).getBaseReference(); + base = ((IIncludeEntry) curr).getBasePath(); break; - case IPathEntry.CDT_PROJECT: + case IPathEntry.CDT_PROJECT : res = root.findMember(path); isMissing = (res == null); break; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java index 29845fb4f3a..5f2f15043ca 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java @@ -104,7 +104,7 @@ public class CPathContainerDefaultPage extends NewElementWizardPage implements I /* (non-Javadoc) * @see IClasspathContainerPage#getSelection() */ - public IPathEntry[] getNewContainers() { + public IPathEntry[] getContainerEntries() { return new IPathEntry[] {CoreModel.newContainerEntry(new Path(fEntryField.getText()))}; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java index 2fb7ecd7c08..7f5c60774f1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java @@ -89,7 +89,7 @@ public class CPathContainerWizard extends Wizard { public boolean performFinish() { if (fContainerPage != null) { if (fContainerPage.finish()) { - fNewEntries = fContainerPage.getNewContainers(); + fNewEntries = fContainerPage.getContainerEntries(); return true; } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathEntryMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathEntryMessages.properties index ad977995fa2..c546f6030c4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathEntryMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathEntryMessages.properties @@ -12,7 +12,7 @@ CPathsPropertyPage.closed_project.message=Path information is not available for CPathsPropertyPage.error.title=Error Setting Propject Paths CPathsPropertyPage.error.message=An error occurred while setting the project path CPathsPropertyPage.unsavedchanges.title=Setting C/C++ Project Path -CPathsPropertyPage.unsavedchanges.message=The C/C++ Project path property page contains unsaved modifications. Do you want to save changes so that other build path related property pages can be updated? +CPathsPropertyPage.unsavedchanges.message=The C/C++ Project path property page contains unsaved modifications. Do you want to save changes so that other path related property pages can be updated? CPathsPropertyPage.unsavedchanges.button.save=Apply CPathsPropertyPage.unsavedchanges.button.discard=Discard CPathsPropertyPage.unsavedchanges.button.ignore=Apply Later @@ -26,6 +26,7 @@ SymbolEntryPage.add=Add User Defined... SymbolEntryPage.addFromWorkspace=Add from Workspace... SymbolEntryPage.addContributed=Add Contributed... SymbolEntryPage.remove=Remove +SymbolEntryPage.edit=Edit... SymbolEntryPage.listName=Defines: SymbolEntryPage.editSourcePaths=Edit Source Paths... SymbolEntryPage.sourcePaths=Source Paths: @@ -38,12 +39,14 @@ IncludeEntryPage.add=Add External... IncludeEntryPage.addFromWorkspace=Add From Workspace... IncludeEntryPage.addContributed=Add Contributed... IncludeEntryPage.remove=Remove +IncludeEntryPage.edit=Edit... IncludeEntryPage.listName=Include Paths: IncludeEntryPage.editSourcePaths=Edit Source Paths... IncludeEntryPage.sourcePaths=Source Paths: IncludeEntryPage.addExternal.button.browse=Browse... IncludeEntryPage.addExternal.title=Add External Include Path IncludeEntryPage.addExternal.message=Include path: + # ------- BuildPathsBlock ------- CPathsBlock.path.up.button=&Up CPathsBlock.path.down.button=&Down @@ -51,9 +54,9 @@ CPathsBlock.path.checkall.button=Select &All CPathsBlock.path.uncheckall.button=D&eselect All CPathsBlock.path.label=Path order and exported entries:\n(Exported entries are contributed to dependent projects) CPathsBlock.warning.EntryMissing=Build path entry is missing: {0} -CPathsBlock.warning.EntriesMissing={0} build path entries are missing. +CPathsBlock.warning.EntriesMissing={0} project path entries are missing. CPathsBlock.operationdesc_project=Creating project... -CPathsBlock.operationdesc_c=Setting build paths... +CPathsBlock.operationdesc_c=Setting project paths... # ------- SourcePathEntryPage------- SourcePathEntryPage.title=&Source @@ -78,7 +81,6 @@ SourcePathEntryPage.exclusion_added.title=Source Folder Added SourcePathEntryPage.exclusion_added.message=Exclusion filters have been added to nesting folders. # ------- OutputPathEntryPage------- - OutputPathEntryPage.title=&Output OutputPathEntryPage.description=Build Output locations OutputPathEntryPage.folders.label=Output folders on build pat&h: @@ -103,18 +105,13 @@ ProjectsEntryPage.projects.checkall.button=Select &All ProjectsEntryWorkbookPage.projects.uncheckall.button=&Deselect All # ------- LibrariesWorkbookPage------- - -LibrariesWorkbookPage.libraries.label=JARs &and class folders on the build path: -LibrariesWorkbookPage.libraries.remove.button=&Remove +LibrariesEntryPage.libraries.label=Libraries on the build path: +LibrariesEntryPage.libraries.remove.button=&Remove -LibrariesWorkbookPage.libraries.addjar.button=Add &JARs... -LibrariesWorkbookPage.libraries.addextjar.button=Add E&xternal JARs... -LibrariesWorkbookPage.libraries.addvariable.button=Add &Variable... -LibrariesWorkbookPage.libraries.addlibrary.button=Add Li&brary... -LibrariesWorkbookPage.libraries.addclassfolder.button=Add Class &Folder... - - -LibrariesWorkbookPage.libraries.edit.button=&Edit... +LibrariesEntryPage.libraries.addextlib.button=Add E&xternal Library... +LibrariesEntryPage.libraries.addcontriblib.button=Add &Contributed... +LibrariesEntryPage.libraries.addworkspacelib.button=Add from Workspace... +LibrariesEntryPage.libraries.edit.button=&Edit... LibrariesWorkbookPage.ExistingClassFolderDialog.new.title=Class Folder Selection LibrariesWorkbookPage.ExistingClassFolderDialog.new.description=&Choose class folders to be added to the build path: @@ -157,7 +154,6 @@ OrderExportsPage.title=&Order and Export OrderExportsPage.description= # ------- ExclusionPatternDialog ------- - ExclusionPatternDialog.title=Source Folder Exclusion Patterns ExclusionPatternDialog.pattern.label=E&xclusion patterns for ''{0}'': ExclusionPatternDialog.pattern.add=A&dd... @@ -168,7 +164,6 @@ ExclusionPatternDialog.ChooseExclusionPattern.title=Exclusion Pattern Selection ExclusionPatternDialog.ChooseExclusionPattern.description=&Choose folders or files to exclude: # ------- ExclusionPatternEntryDialog ------- - ExclusionPatternEntryDialog.add.title=Add Exclusion Pattern ExclusionPatternEntryDialog.edit.title=Edit Exclusion Pattern ExclusionPatternEntryDialog.description=Enter a pattern for excluding files from the source folder. Allowed wildcards are '*', '?' and '**'. Examples: 'java/util/A*.java', 'java/util/', '**/Test*'. @@ -181,7 +176,6 @@ ExclusionPatternEntryDialog.ChooseExclusionPattern.title=Exclusion Pattern Selec ExclusionPatternEntryDialog.ChooseExclusionPattern.description=&Choose a folder or file to exclude: # ------- CPListLabelProvider ------- - CPListLabelProvider.new=(new) CPListLabelProvider.classcontainer=(class folder) CPListLabelProvider.twopart={0} - {1} @@ -194,7 +188,6 @@ CPListLabelProvider.exclusion_filter_separator=; CPListLabelProvider.unknown_element.label=unknown element # ------- NewSourceFolderDialog------- - NewSourceFolderDialog.useproject.button=&Project as source folder NewSourceFolderDialog.usefolder.button=&Folder as source folder NewSourceFolderDialog.sourcefolder.label=&Source folder name: diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeEntryPage.java index 362889c2834..70030eb31c0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeEntryPage.java @@ -14,6 +14,7 @@ import java.util.List; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.InputDialog; @@ -47,7 +48,7 @@ public class CPathIncludeEntryPage extends ExtendedCPathBasePage { if (newItem != null && !newItem.equals("")) { //$NON-NLS-1$ List cplist = fPathList.getElements(); - CPListElement newPath = newCPElement(((ICElement) getSelection().get(0)).getResource()); + CPListElement newPath = newCPElement(((ICElement) getSelection().get(0)).getResource(), null); newPath.setAttribute(CPListElement.INCLUDE, new Path(newItem)); if (!cplist.contains(newPath)) { fPathList.addElement(newPath); @@ -87,4 +88,13 @@ public class CPathIncludeEntryPage extends ExtendedCPathBasePage { } + protected CPListElement newCPElement(IResource resource, CPListElement copyFrom) { + CPListElement element = new CPListElement(fCurrCProject, getEntryKind(), resource.getFullPath(), resource); + if (copyFrom != null) { + element.setAttribute(CPListElement.INCLUDE, copyFrom.getAttribute(CPListElement.INCLUDE)); + element.setAttribute(CPListElement.SYSTEM_INCLUDE, copyFrom.getAttribute(CPListElement.SYSTEM_INCLUDE)); + } + return element; + } + } \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSymbolEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSymbolEntryPage.java index b90eefd3456..42eb021887b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSymbolEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSymbolEntryPage.java @@ -14,6 +14,7 @@ import java.util.List; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter; +import org.eclipse.core.resources.IResource; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.window.Window; @@ -39,7 +40,7 @@ public class CPathSymbolEntryPage extends ExtendedCPathBasePage { if (symbol != null && symbol.length() > 0) { List cplist = fPathList.getElements(); - CPListElement newPath = newCPElement(((ICElement) getSelection().get(0)).getResource()); + CPListElement newPath = newCPElement(((ICElement) getSelection().get(0)).getResource(), null); String name, value = ""; //$NON-NLS-1$ int index = symbol.indexOf("="); //$NON-NLS-1$ if (index != -1) { @@ -58,4 +59,12 @@ public class CPathSymbolEntryPage extends ExtendedCPathBasePage { } } } + + protected CPListElement newCPElement(IResource resource, CPListElement copyFrom) { + CPListElement element = new CPListElement(fCurrCProject, getEntryKind(), resource.getFullPath(), resource); + if (copyFrom != null) { + element.setAttribute(CPListElement.MACRO_NAME, copyFrom.getAttribute(CPListElement.MACRO_NAME)); + } + return element; + } } \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExtendedCPathBasePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExtendedCPathBasePage.java index 6ecae933041..fbcad6d1059 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExtendedCPathBasePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExtendedCPathBasePage.java @@ -67,7 +67,8 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { private static final int IDX_ADD = 0; private static final int IDX_ADD_WORKSPACE = 1; private static final int IDX_ADD_CONTRIBUTED = 2; - private static final int IDX_REMOVE = 4; + private static final int IDX_EDIT = 4; + private static final int IDX_REMOVE = 5; private String fPrefix; private class IncludeListAdapter implements IListAdapter, IDialogFieldListener { @@ -86,6 +87,11 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { case IDX_ADD_CONTRIBUTED: addContributed(); break; + case IDX_EDIT: + if (canEdit(field.getSelectedElements())) { + editPath((CPListElement) field.getSelectedElements().get(0)); + } + break; case IDX_REMOVE: if (canRemove(field.getSelectedElements())) { removePath((CPListElement) field.getSelectedElements().get(0)); @@ -97,6 +103,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { public void selectionChanged(ListDialogField field) { List selected = fPathList.getSelectedElements(); fPathList.enableButton(IDX_REMOVE, canRemove(selected)); + fPathList.enableButton(IDX_EDIT, canEdit(selected)); } public void doubleClicked(ListDialogField field) { @@ -145,7 +152,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { * @see Object#hashCode() */ public int hashCode() { - return fBaseImage.hashCode() | (showInherited ? 0x1 : 0); + return fBaseImage.hashCode() & (showInherited ? ~0x1 : ~0); } /** @@ -179,7 +186,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { public Image getImage(Object element) { Image image = super.getImage(element); - if (isPathInherited((CPListElement) element)) { + if (isPathInheritedFromSelected((CPListElement) element)) { image = new CPListImageDescriptor(image, true).createImage(); } return image; @@ -190,25 +197,11 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { } public Color getForeground(Object element) { - if (isPathInherited((CPListElement) element)) { + if (isPathInheritedFromSelected((CPListElement) element)) { return inDirect; } return null; } - - boolean isPathInherited(CPListElement element) { - IPath resPath = element.getPath(); - List sel = getSelection(); - if (!sel.isEmpty()) { - if (sel.get(0) instanceof ICElement) { - ICElement celem = (ICElement) sel.get(0); - if (!celem.getPath().equals(resPath)) { - return true; - } - } - } - return false; - } } public ExtendedCPathBasePage(ITreeListAdapter adapter, String prefix) { @@ -219,7 +212,8 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { String[] buttonLabel = new String[] { /* 0 */CPathEntryMessages.getString(prefix + ".add"), //$NON-NLS-1$ /* 1 */CPathEntryMessages.getString(prefix + ".addFromWorkspace"), //$NON-NLS-1$ /* 2 */CPathEntryMessages.getString(prefix + ".addContributed"), null, //$NON-NLS-1$ - /* 4 */CPathEntryMessages.getString(prefix + ".remove")}; //$NON-NLS-1$ + /* 4 */CPathEntryMessages.getString(prefix + ".edit"), //$NON-NLS-1$ + /* 5 */CPathEntryMessages.getString(prefix + ".remove")}; //$NON-NLS-1$ fPathList = new ListDialogField(includeListAdaper, buttonLabel, new ModifiedCPListLabelProvider()) { protected int getListStyle() { @@ -251,7 +245,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { int buttonBarWidth = converter.convertWidthInCharsToPixels(30); fPathList.setButtonsMinWidth(buttonBarWidth); fPathList.enableButton(IDX_REMOVE, false); - + fPathList.enableButton(IDX_EDIT, false); } public boolean isEntryKind(int kind) { @@ -262,10 +256,34 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { abstract int getEntryKind(); + protected boolean isPathInheritedFromSelected(CPListElement element) { + IPath resPath = element.getPath(); + List sel = getSelection(); + if (!sel.isEmpty()) { + if (sel.get(0) instanceof ICElement) { + ICElement celem = (ICElement) sel.get(0); + if (!celem.getPath().equals(resPath)) { + return true; + } + } + } + return false; + } + protected boolean canRemove(List selected) { return !selected.isEmpty(); } + protected boolean canEdit(List selected) { + if( !selected.isEmpty() ) { + return !isPathInheritedFromSelected((CPListElement) selected.get(0)); + } + return false; + } + + protected void editPath(CPListElement element) { + } + protected void removePath(CPListElement element) { ICElement celem = (ICElement) getSelection().get(0); if (!celem.getPath().equals(element.getPath())) { @@ -370,12 +388,12 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { CPathContainerWizard wizard = new CPathContainerWizard(elem, fCurrCProject, getRawClasspath()); wizard.setWindowTitle(title); if (CPathContainerWizard.openWizard(getShell(), wizard) == Window.OK) { - IPathEntry[] created = wizard.getNewEntries(); - if (created != null) { - CPListElement[] res = new CPListElement[created.length]; + IPathEntry[] elements = wizard.getNewEntries(); + if (elements != null) { + CPListElement[] res = new CPListElement[elements.length]; for (int i = 0; i < res.length; i++) { - res[i] = newCPElement(((ICElement) getSelection().get(0)).getResource()); - res[i].setAttribute(CPListElement.BASE_REF, created[i].getPath()); + res[i] = newCPElement(((ICElement) getSelection().get(0)).getResource(), (CPListElement) elements[i]); + res[i].setAttribute(CPListElement.BASE_REF, elements[i].getPath()); } return res; } @@ -383,9 +401,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { return null; } - protected CPListElement newCPElement(IResource resource) { - return new CPListElement(fCurrCProject, getEntryKind(), resource.getFullPath(), resource); - } + abstract protected CPListElement newCPElement(IResource resource, CPListElement copyFrom); private class WorkbenchCPathLabelProvider extends CPListLabelProvider { @@ -482,8 +498,8 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage { Object[] elements = dialog.getResult(); CPListElement[] res = new CPListElement[elements.length]; for (int i = 0; i < res.length; i++) { - res[i] = newCPElement(((ICElement) getSelection().get(0)).getResource()); - + res[i] = newCPElement(((ICElement) getSelection().get(0)).getResource(), (CPListElement)elements[i]); + res[i].setAttribute(CPListElement.BASE_REF, ((CPListElement)elements[i]).getCProject().getPath()); } return res; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ICPathContainerPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ICPathContainerPage.java index 60c35b33291..d717f1b8184 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ICPathContainerPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ICPathContainerPage.java @@ -61,7 +61,7 @@ public interface ICPathContainerPage extends IWizardPage { * @return the classpath entries created on the page. All returned entries must be {@link * IClasspathEntry#CPE_CONTAINER} */ - public IPathEntry[] getNewContainers(); + public IPathEntry[] getContainerEntries(); /** * Sets the path container entry to be edited or null