diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementLabelProvider.java index 0cce1899cd4..85d492afc03 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementLabelProvider.java @@ -121,6 +121,7 @@ class CPElementLabelProvider extends LabelProvider { { StringBuffer str = new StringBuffer( ((IPath)cpentry.getAttribute(CPElement.LIBRARY)).toOSString()); addBaseString(cpentry, str); + addExport(cpentry, str); return str.toString(); } case IPathEntry.CDT_PROJECT : @@ -130,6 +131,7 @@ class CPElementLabelProvider extends LabelProvider { IPath incPath = ((IPath)cpentry.getAttribute(CPElement.INCLUDE)); StringBuffer str = new StringBuffer(incPath.toOSString()); addBaseString(cpentry, str); + addExport(cpentry, str); return str.toString(); } case IPathEntry.CDT_MACRO : @@ -137,17 +139,23 @@ class CPElementLabelProvider extends LabelProvider { StringBuffer str = new StringBuffer((String)cpentry.getAttribute(CPElement.MACRO_NAME) + "=" //$NON-NLS-1$ + (String)cpentry.getAttribute(CPElement.MACRO_VALUE)); addBaseString(cpentry, str); + addExport(cpentry, str); return str.toString(); } case IPathEntry.CDT_CONTAINER : - try { - IPathEntryContainer container = CoreModel.getPathEntryContainer(cpentry.getPath(), cpentry.getCProject()); - if (container != null) { - return container.getDescription(); + { + StringBuffer str = new StringBuffer(path.toString()); + try { + IPathEntryContainer container = CoreModel.getPathEntryContainer(cpentry.getPath(), cpentry.getCProject()); + if (container != null) { + str.setLength(0); + str.append(container.getDescription()); + } + } catch (CModelException e) { } - } catch (CModelException e) { + addExport(cpentry, str); + return str.toString(); } - return path.toString(); case IPathEntry.CDT_SOURCE : case IPathEntry.CDT_OUTPUT : { @@ -168,16 +176,22 @@ class CPElementLabelProvider extends LabelProvider { } return CPathEntryMessages.getString("CPElementLabelProvider.unknown_element.label"); //$NON-NLS-1$ } + private void addExport(CPElement cpentry, StringBuffer str) { + if (cpentry.isExported()) { + str.append(' '); + str.append(CPathEntryMessages.getString("CPElementLabelProvider.export.label")); //$NON-NLS-1$ + } + } private void addBaseString(CPElement cpentry, StringBuffer str) { IPath baseRef = (IPath)cpentry.getAttribute(CPElement.BASE_REF); if (!baseRef.isEmpty()) { str.append(" - ("); //$NON-NLS-1$ if (baseRef.isAbsolute()) { -// str.append("From project "); + // str.append("From project "); str.append(baseRef); } else { -// str.append("From contribution "); + // str.append("From contribution "); IPathEntryContainer container; try { container = CoreModel.getPathEntryContainer(baseRef, cpentry.getCProject()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java index 3a1ed3c0d9e..247a30b0815 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java @@ -42,6 +42,7 @@ public class CPathContainerEntryPage extends CPathBasePage { private final int IDX_EDIT = 2; private final int IDX_REMOVE = 3; + private final int IDX_EXPORT = 5; public CPathContainerEntryPage(ListDialogField cPathList) { super(CPathEntryMessages.getString("ContainerEntryPage.title")); //$NON-NLS-1$ @@ -51,7 +52,9 @@ public class CPathContainerEntryPage extends CPathBasePage { /* IDX_ADD */CPathEntryMessages.getString("ContainerEntryPage.add.button"), //$NON-NLS-1$ /* */null, /* IDX_EDIT */CPathEntryMessages.getString("ContainerEntryPage.edit.button"), //$NON-NLS-1$ - /* IDX_REMOVE */CPathEntryMessages.getString("ContainerEntryPage.remove.button") //$NON-NLS-1$ + /* IDX_REMOVE */CPathEntryMessages.getString("ContainerEntryPage.remove.button"), //$NON-NLS-1$ + null, + /* IDX_EXPORT */CPathEntryMessages.getString("ContainerEntryPage.export.button") //$NON-NLS-1$ }; ContainersAdapter adapter = new ContainersAdapter(); @@ -62,6 +65,7 @@ public class CPathContainerEntryPage extends CPathBasePage { fContainersList.enableButton(IDX_REMOVE, false); fContainersList.enableButton(IDX_EDIT, false); + fContainersList.enableButton(IDX_EXPORT, false); fContainersList.setViewerSorter(new CPElementSorter()); @@ -100,10 +104,10 @@ public class CPathContainerEntryPage extends CPathBasePage { fContainersList.setButtonsMinWidth(buttonBarWidth); fContainersList.getTreeViewer().addFilter(new ViewerFilter() { - + public boolean select(Viewer viewer, Object parentElement, Object element) { - if ( element instanceof CPElementGroup) { - return ((CPElementGroup)element).getChildren().length != 0; + if (element instanceof CPElementGroup) { + return ((CPElementGroup)element).getChildren().length != 0; } return true; } @@ -183,6 +187,10 @@ public class CPathContainerEntryPage extends CPathBasePage { /* remove */ removeEntry(); return; + case IDX_EXPORT : + /* export */ + exportEntry(); + return; } if (containers != null) { int nElementsChosen = containers.length; @@ -224,24 +232,6 @@ public class CPathContainerEntryPage extends CPathBasePage { } } - private void removeEntry() { - List selElements = fContainersList.getSelectedElements(); - for (int i = selElements.size() - 1; i >= 0; i--) { - Object elem = selElements.get(i); - if (elem instanceof CPElementAttribute) { - CPElementAttribute attrib = (CPElementAttribute)elem; - attrib.getParent().setAttribute(attrib.getKey(), null); - selElements.remove(i); - } - } - if (selElements.isEmpty()) { - fContainersList.refresh(); - fCPathList.dialogFieldChanged(); // validate - } else { - fContainersList.removeElements(selElements); - } - } - private boolean canRemove(List selElements) { if (selElements.size() == 0) { return false; @@ -262,6 +252,52 @@ public class CPathContainerEntryPage extends CPathBasePage { return true; } + private void removeEntry() { + List selElements = fContainersList.getSelectedElements(); + for (int i = selElements.size() - 1; i >= 0; i--) { + Object elem = selElements.get(i); + if (elem instanceof CPElementAttribute) { + CPElementAttribute attrib = (CPElementAttribute)elem; + attrib.getParent().setAttribute(attrib.getKey(), null); + selElements.remove(i); + } + } + if (selElements.isEmpty()) { + fContainersList.refresh(); + fCPathList.dialogFieldChanged(); // validate + } else { + fContainersList.removeElements(selElements); + } + } + + private boolean canExport(List selElements) { + if (selElements.size() == 0) { + return false; + } + for (int i = 0; i < selElements.size(); i++) { + Object elem = selElements.get(i); + if (elem instanceof CPElement) { + CPElement curr = (CPElement)elem; + if (curr.getParentContainer() != null) { + return false; + } + } + } + return true; + } + + private void exportEntry() { + List selElements = fContainersList.getSelectedElements(); + if (selElements.size() != 1) { + return; + } + Object elem = selElements.get(0); + if (fContainersList.getIndexOfElement(elem) != -1) { + ((CPElement)elem).setExported(!((CPElement)elem).isExported()); // toggle export + fContainersList.refresh(elem); + } + } + /** * Method editEntry. */ @@ -316,6 +352,7 @@ public class CPathContainerEntryPage extends CPathBasePage { List selElements = fContainersList.getSelectedElements(); fContainersList.enableButton(IDX_EDIT, canEdit(selElements)); fContainersList.enableButton(IDX_REMOVE, canRemove(selElements)); + fContainersList.enableButton(IDX_EXPORT, canExport(selElements)); } private boolean canEdit(List selElements) { @@ -422,12 +459,8 @@ public class CPathContainerEntryPage extends CPathBasePage { } public void performApply(IProgressMonitor monitor) throws CoreException { - // dinglis-TODO Auto-generated method stub - } public void performDefaults() { - // dinglis-TODO Auto-generated method stub - } } \ No newline at end of file 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 a00ba9492dc..49023f355b8 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 @@ -87,6 +87,7 @@ ContainerEntryPage.title=Path Containers ContainerEntryPage.add.button=Add... ContainerEntryPage.edit.button=Edit... ContainerEntryPage.remove.button=Remove +ContainerEntryPage.export.button=Export ContainerEntryPage.libraries.label=Containers: ContainerEntryPage.ContainerDialog.new.title=Add New C/C++ Path Container ContainerEntryPage.ContainerDialog.edit.title=Edit C/C++ Path Container @@ -157,45 +158,16 @@ 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... +LibrariesEntryPage.libraries.export.button=Export LibrariesEntryPage.ContainerDialog.new.title=Contributed Library Path Selection LibrariesEntryPage.ContainerDialog.edit.title=Contributed Library Path Selection -LibrariesWorkbookPage.ExistingClassFolderDialog.new.title=Class Folder Selection -LibrariesWorkbookPage.ExistingClassFolderDialog.new.description=&Choose class folders to be added to the build path: +LibrariesEntryPage.ExtLibDialog.new.title=Library Selection +LibrariesEntryPage.ExtLibDialog.new.description=&Choose Library to be added to the project paths: -LibrariesWorkbookPage.ExistingClassFolderDialog.edit.title=Edit Class Folder -LibrariesWorkbookPage.ExistingClassFolderDialog.edit.description=&Select the class folder: - -LibrariesWorkbookPage.NewClassFolderDialog.new.title=New Class Folder -LibrariesWorkbookPage.NewClassFolderDialog.edit.title=Edit Class Folder - -LibrariesWorkbookPage.NewClassFolderDialog.description=&Enter a path relative to ''{0}'': - -LibrariesWorkbookPage.JARArchiveDialog.new.title=JAR Selection -LibrariesWorkbookPage.JARArchiveDialog.new.description=&Choose jar archives to be added to the build path: - -LibrariesWorkbookPage.JARArchiveDialog.edit.title=Edit JAR -LibrariesWorkbookPage.JARArchiveDialog.edit.description=&Select the jar archive: - -LibrariesWorkbookPage.ContainerDialog.new.title=Add Library -LibrariesWorkbookPage.ContainerDialog.edit.title=Edit Library - -LibrariesWorkbookPage.VariableSelectionDialog.new.title=New Variable Classpath Entry -LibrariesWorkbookPage.VariableSelectionDialog.edit.title=Edit Variable Entry - -LibrariesWorkbookPage.ExtJARArchiveDialog.new.title=JAR Selection - -LibrariesWorkbookPage.ExtJARArchiveDialog.edit.title=Edit JAR - -LibrariesWorkbookPage.SourceAttachmentDialog.title=Source For ''{0}'' -LibrariesWorkbookPage.JavadocPropertyDialog.title=Javadoc For ''{0}'' - -LibrariesWorkbookPage.AdvancedDialog.title=Add Classpath Entry -LibrariesWorkbookPage.AdvancedDialog.description=Select the entry to add to the classpath: -LibrariesWorkbookPage.AdvancedDialog.createfolder=Create &New Class Folder -LibrariesWorkbookPage.AdvancedDialog.addfolder=Add &Existing Class Folder -LibrariesWorkbookPage.AdvancedDialog.addcontainer=Add &Container: +LibrariesEntryPage.ExtLibDialog.edit.title=Edit Library +LibrariesEntryPage.ExtLibDialog.edit.description=&Select the library: # -------- OrderExportPage --------- OrderExportsPage.title=&Order and Export @@ -235,6 +207,7 @@ CPElementLabelProvider.unknown_element.label=unknown element CPElementLabelProvider.Includes=Includes CPElementLabelProvider.PreprocessorSymbols=Preprocessor Symbols CPElementLabelProvider.Libraries=Libraries +CPElementLabelProvider.export.label= (Exported) # ------- NewSourceFolderDialog------- NewSourceFolderDialog.useproject.button=&Project as source folder @@ -250,29 +223,18 @@ MultipleFolderSelectionDialog.button=Create &New Folder... # ------- SourceAttachmentBlock------- SourceAttachmentBlock.message=Select the location (folder, JAR or zip) containing the source for ''{0}'': -SourceAttachmentBlock.filename.description=Source attachments for variable entries are defined by variable paths. The first segment of such a path describes a variable name, the rest is an optional path extension. SourceAttachmentBlock.filename.label=Lo&cation path: SourceAttachmentBlock.filename.externalfile.button=External &File... SourceAttachmentBlock.filename.externalfolder.button=External F&older... SourceAttachmentBlock.filename.internal.button=&Workspace... -SourceAttachmentBlock.filename.varlabel=Lo&cation variable path: -SourceAttachmentBlock.filename.variable.button=&Variable... -SourceAttachmentBlock.filename.external.varbutton=&Extension.... - SourceAttachmentBlock.filename.error.notvalid= The archive path is not a valid path. SourceAttachmentBlock.filename.error.filenotexists= The path ''{0}'' does not exist. -SourceAttachmentBlock.filename.error.varnotexists= The variable in the location variable path does not exist. -SourceAttachmentBlock.filename.error.deviceinpath= The location variable path must begin with a variable. -SourceAttachmentBlock.filename.warning.varempty= The location variable path is empty. SourceAttachmentBlock.intjardialog.title=Source Location Selection SourceAttachmentBlock.intjardialog.message=&Select folder or JAR/zip archive containing the source: -SourceAttachmentBlock.extvardialog.title=Variable Extension Selection -SourceAttachmentBlock.extvardialog.description=Select source location: - SourceAttachmentBlock.extjardialog.text=JAR/ZIP File Selection SourceAttachmentBlock.extfolderdialog.text=Folder Selection diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java index 398e4122bb0..d3630cad62e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; import org.eclipse.cdt.core.model.ICProject; @@ -36,7 +35,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.StructuredSelection; @@ -69,6 +67,7 @@ public class CPathLibraryEntryPage extends CPathBasePage { private final int IDX_ADD_CONTRIBUTED = 2; private final int IDX_EDIT = 4; private final int IDX_REMOVE = 5; + private final int IDX_EXPORT = 7; /** * @param title @@ -88,7 +87,9 @@ public class CPathLibraryEntryPage extends CPathBasePage { /* IDX_ADD_CONTRIBUTED*/ CPathEntryMessages.getString("LibrariesEntryPage.libraries.addcontriblib.button"), //$NON-NLS-1$ /* */ null, /* IDX_EDIT */ CPathEntryMessages.getString("LibrariesEntryPage.libraries.edit.button"), //$NON-NLS-1$ - /* IDX_REMOVE */ CPathEntryMessages.getString("LibrariesEntryPage.libraries.remove.button") //$NON-NLS-1$ + /* IDX_REMOVE */ CPathEntryMessages.getString("LibrariesEntryPage.libraries.remove.button"), //$NON-NLS-1$ + null, + /* IDX_EXPORT */ CPathEntryMessages.getString("LibrariesEntryPage.libraries.export.button") //$NON-NLS-1$ }; fLibrariesList = new TreeListDialogField(adapter, buttonLabels, new CPElementLabelProvider()); @@ -97,6 +98,7 @@ public class CPathLibraryEntryPage extends CPathBasePage { fLibrariesList.setViewerSorter(new CPElementSorter()); fLibrariesList.enableButton(IDX_EDIT, false); + fLibrariesList.enableButton(IDX_EXPORT, false); } public Image getImage() { @@ -227,8 +229,13 @@ public class CPathLibraryEntryPage extends CPathBasePage { return; case IDX_REMOVE: /* remove */ removeEntry(); - return; + return; + case IDX_EXPORT : + /* export */ + exportEntry(); + return; } + if (libentries != null) { int nElementsChosen= libentries.length; // remove duplicates @@ -242,10 +249,6 @@ public class CPathLibraryEntryPage extends CPathBasePage { //curr.setAttribute(CPElement.SOURCEATTACHMENT, BuildPathSupport.guessSourceAttachment(curr)); } } - if (!elementsToAdd.isEmpty()) { - askForAddingExclusionPatternsDialog(elementsToAdd); - } - fLibrariesList.addElements(elementsToAdd); fCPathList.addElements(elementsToAdd); if (index == IDX_ADD_LIB) { @@ -255,13 +258,31 @@ public class CPathLibraryEntryPage extends CPathBasePage { } } - private void askForAddingExclusionPatternsDialog(List newEntries) { - HashSet modified= new HashSet(); - fixNestingConflicts(newEntries, fCPathList.getElements(), modified); - if (!modified.isEmpty()) { - String title= CPathEntryMessages.getString("LibrariesWorkbookPage.exclusion_added.title"); //$NON-NLS-1$ - String message= CPathEntryMessages.getString("LibrariesWorkbookPage.exclusion_added.message"); //$NON-NLS-1$ - MessageDialog.openInformation(getShell(), title, message); + private boolean canExport(List selElements) { + if (selElements.size() == 0) { + return false; + } + for (int i = 0; i < selElements.size(); i++) { + Object elem = selElements.get(i); + if (elem instanceof CPElement) { + CPElement curr = (CPElement)elem; + if (curr.getParentContainer() != null) { + return false; + } + } + } + return true; + } + + private void exportEntry() { + List selElements = fLibrariesList.getSelectedElements(); + if (selElements.size() != 1) { + return; + } + Object elem = selElements.get(0); + if (fLibrariesList.getIndexOfElement(elem) != -1) { + ((CPElement)elem).setExported(!((CPElement)elem).isExported()); // toggle export + fLibrariesList.refresh(elem); } } @@ -375,6 +396,7 @@ public class CPathLibraryEntryPage extends CPathBasePage { List selElements= fLibrariesList.getSelectedElements(); fLibrariesList.enableButton(IDX_EDIT, canEdit(selElements)); fLibrariesList.enableButton(IDX_REMOVE, canRemove(selElements)); + fLibrariesList.enableButton(IDX_EXPORT, canExport(selElements)); } private IFile[] getUsedLibFiles(CPElement existing) { @@ -399,11 +421,11 @@ public class CPathLibraryEntryPage extends CPathBasePage { } private CPElement[] openExtLibFileDialog(CPElement existing) { - String title= CPathEntryMessages.getString("LibrariesWorkbookPage.ExtLibDialog.new.title"); //$NON-NLS-1$ + String title= CPathEntryMessages.getString("LibrariesEntryPage.ExtLibDialog.new.title"); //$NON-NLS-1$ FileDialog dialog= new FileDialog(getShell(), existing == null ? SWT.MULTI : SWT.SINGLE); dialog.setText(title); - dialog.setFilterExtensions(new String[] {"*.a;*.so;*.dll"}); //$NON-NLS-1$ + dialog.setFilterExtensions(new String[] {"*.a;*.so;*.dll;*.lib"}); //$NON-NLS-1$ //dialog.setFilterPath(lastUsedPath); if (existing != null) { dialog.setFileName(existing.getPath().lastSegment()); @@ -435,8 +457,8 @@ public class CPathLibraryEntryPage extends CPathBasePage { ILabelProvider lp= new WorkbenchLabelProvider(); ITreeContentProvider cp= new WorkbenchContentProvider(); - String title= (existing == null) ? CPathEntryMessages.getString("LibrariesWorkbookPage.JARArchiveDialog.new.title") : CPathEntryMessages.getString("LibrariesWorkbookPage.JARArchiveDialog.edit.title"); //$NON-NLS-1$ //$NON-NLS-2$ - String message= (existing == null) ? CPathEntryMessages.getString("LibrariesWorkbookPage.JARArchiveDialog.new.description") : CPathEntryMessages.getString("LibrariesWorkbookPage.JARArchiveDialog.edit.description"); //$NON-NLS-1$ //$NON-NLS-2$ + String title= (existing == null) ? CPathEntryMessages.getString("LibrariesEntryPage.ExtLibDialog.new.title") : CPathEntryMessages.getString("LibrariesEntryPage.ExtLibDialog.edit.title"); //$NON-NLS-1$ //$NON-NLS-2$ + String message= (existing == null) ? CPathEntryMessages.getString("LibrariesEntryPage.ExtLibDialog.new.description") : CPathEntryMessages.getString("LibrariesEntryPage.ExtLibDialog.edit.description"); //$NON-NLS-1$ //$NON-NLS-2$ ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp); dialog.setValidator(validator); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOrderExportPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOrderExportPage.java index 7c3d3c66ae3..bb32e18953d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOrderExportPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOrderExportPage.java @@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Composite; public class CPathOrderExportPage extends CPathBasePage { private ListDialogField fCPathList; - + public CPathOrderExportPage(ListDialogField cPathList) { super(CPathEntryMessages.getString("OrderExportsPage.title")); //$NON-NLS-1$ setDescription(CPathEntryMessages.getString("OrderExportsPage.description")); //$NON-NLS-1$