diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java index 906dd6afb62..3701765770e 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java @@ -39,7 +39,7 @@ import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; import org.eclipse.cdt.make.internal.ui.scannerconfig.DiscoveredElement; import org.eclipse.cdt.make.internal.ui.scannerconfig.DiscoveredElementLabelProvider; import org.eclipse.cdt.make.internal.ui.scannerconfig.DiscoveredElementSorter; -import org.eclipse.cdt.ui.wizards.ICPathContainerPage; +import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; @@ -71,7 +71,7 @@ import org.eclipse.ui.contexts.IWorkbenchContextSupport; * * @author vhirsl */ -public class DiscoveredPathContainerPage extends WizardPage implements ICPathContainerPage { +public class DiscoveredPathContainerPage extends WizardPage implements IPathEntryContainerPage { private static final String PREFIX = "DiscoveredScannerConfigurationContainerPage"; //$NON-NLS-1$ private static final String DISC_COMMON_PREFIX = "ManageScannerConfigDialogCommon"; //$NON-NLS-1$ @@ -214,18 +214,16 @@ public class DiscoveredPathContainerPage extends WizardPage implements ICPathCon /* (non-Javadoc) * @see org.eclipse.cdt.ui.wizards.ICPathContainerPage#getContainerEntries() */ - public IPathEntry[] getContainerEntries() { - return new IPathEntry[] { fPathEntry }; + public IContainerEntry[] getNewContainers() { + return new IContainerEntry[] { fPathEntry }; } /* (non-Javadoc) * @see org.eclipse.cdt.ui.wizards.ICPathContainerPage#setSelection(org.eclipse.cdt.core.model.IPathEntry) */ - public void setSelection(IPathEntry containerEntry) { + public void setSelection(IContainerEntry containerEntry) { if (containerEntry != null) { - if (containerEntry.getEntryKind() == IPathEntry.CDT_CONTAINER) { - fPathEntry = (IContainerEntry) containerEntry; - } + fPathEntry = containerEntry; } else { fPathEntry = CoreModel.newContainerEntry(DiscoveredPathContainer.CONTAINER_ID); 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 eae9bf56f4d..011de081abe 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 @@ -12,6 +12,7 @@ import java.util.ArrayList; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IContainerEntry; import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.dialogs.StatusInfo; @@ -20,7 +21,7 @@ import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField; import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener; import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil; import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringDialogField; -import org.eclipse.cdt.ui.wizards.ICPathContainerPage; +import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.Dialog; @@ -30,7 +31,7 @@ import org.eclipse.swt.widgets.Composite; /** */ -public class CPathContainerDefaultPage extends NewElementWizardPage implements ICPathContainerPage { +public class CPathContainerDefaultPage extends NewElementWizardPage implements IPathEntryContainerPage { private StringDialogField fEntryField; private ArrayList fUsedPaths; @@ -103,8 +104,8 @@ public class CPathContainerDefaultPage extends NewElementWizardPage implements I /* (non-Javadoc) * @see IClasspathContainerPage#getSelection() */ - public IPathEntry[] getContainerEntries() { - return new IPathEntry[] {CoreModel.newContainerEntry(new Path(fEntryField.getText()))}; + public IContainerEntry[] getNewContainers() { + return new IContainerEntry[] {CoreModel.newContainerEntry(new Path(fEntryField.getText()))}; } /* (non-Javadoc) @@ -122,7 +123,7 @@ public class CPathContainerDefaultPage extends NewElementWizardPage implements I /* (non-Javadoc) * @see IClasspathContainerPage#setSelection(IClasspathEntry) */ - public void setSelection(IPathEntry containerEntry) { + public void setSelection(IContainerEntry containerEntry) { if (containerEntry != null) { fUsedPaths.remove(containerEntry.getPath()); fEntryField.setText(containerEntry.getPath().toString()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java index fe707d0cbb3..fd6a94b1db8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java @@ -12,10 +12,12 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IContainerEntry; import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.internal.ui.util.CoreUtility; import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.cdt.ui.wizards.ICPathContainerPage; +import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; @@ -24,12 +26,211 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.swt.SWTException; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.osgi.framework.Bundle; public class CPathContainerDescriptor implements IContainerDescriptor { + + /** + * Adapter class to adapter deprecated ICPathContainerPage to new IPathEntryContainerPage + * @author Dave + * @deprecated + */ + public class PathEntryContainerPageAdapter implements IWizardPage, IPathEntryContainerPage { + private final org.eclipse.cdt.ui.wizards.ICPathContainerPage fPage; + /** + * @param pageName + */ + protected PathEntryContainerPageAdapter(org.eclipse.cdt.ui.wizards.ICPathContainerPage page) { + fPage = page; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.ui.wizards.IPathEntryContainerPage#initialize(org.eclipse.cdt.core.model.ICProject, org.eclipse.cdt.core.model.IPathEntry[]) + */ + public void initialize(ICProject project, IPathEntry[] currentEntries) { + fPage.initialize(project, currentEntries); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.ui.wizards.IPathEntryContainerPage#finish() + */ + public boolean finish() { + return fPage.finish(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.ui.wizards.IPathEntryContainerPage#getNewContainers() + */ + public IContainerEntry[] getNewContainers() { + IPathEntry[] entries = fPage.getContainerEntries(); + IContainerEntry[] containers = new IContainerEntry[entries.length]; + System.arraycopy(entries, 0, containers, 0, entries.length); + return containers; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.ui.wizards.IPathEntryContainerPage#setSelection(org.eclipse.cdt.core.model.IContainerEntry) + */ + public void setSelection(IContainerEntry containerEntry) { + fPage.setSelection(containerEntry); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) + */ + public void createControl(Composite parent) { + fPage.createControl(parent); + + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage() + */ + public boolean canFlipToNextPage() { + return fPage.canFlipToNextPage(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.IWizardPage#getName() + */ + public String getName() { + return fPage.getName(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.IWizardPage#getNextPage() + */ + public IWizardPage getNextPage() { + return fPage.getNextPage(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.IWizardPage#getPreviousPage() + */ + public IWizardPage getPreviousPage() { + return fPage.getPreviousPage(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.IWizardPage#getWizard() + */ + public IWizard getWizard() { + return fPage.getWizard(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.IWizardPage#isPageComplete() + */ + public boolean isPageComplete() { + return fPage.isPageComplete(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.IWizardPage#setPreviousPage(org.eclipse.jface.wizard.IWizardPage) + */ + public void setPreviousPage(IWizardPage page) { + fPage.setPreviousPage(page); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.IWizardPage#setWizard(org.eclipse.jface.wizard.IWizard) + */ + public void setWizard(IWizard newWizard) { + fPage.setWizard(newWizard); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#dispose() + */ + public void dispose() { + fPage.dispose(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#getControl() + */ + public Control getControl() { + return fPage.getControl(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#getDescription() + */ + public String getDescription() { + return fPage.getDescription(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage() + */ + public String getErrorMessage() { + return fPage.getErrorMessage(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#getImage() + */ + public Image getImage() { + return fPage.getImage(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#getMessage() + */ + public String getMessage() { + return fPage.getMessage(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#getTitle() + */ + public String getTitle() { + return fPage.getTitle(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#performHelp() + */ + public void performHelp() { + fPage.performHelp(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#setDescription(java.lang.String) + */ + public void setDescription(String description) { + fPage.setDescription(description); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#setImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) + */ + public void setImageDescriptor(ImageDescriptor image) { + fPage.setImageDescriptor(image); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#setTitle(java.lang.String) + */ + public void setTitle(String title) { + fPage.setTitle(title); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean) + */ + public void setVisible(boolean visible) { + fPage.setVisible(visible); + } + + } private IConfigurationElement fConfigElement; private static final String ATT_EXTENSION = "PathContainerPage"; //$NON-NLS-1$ @@ -59,11 +260,13 @@ public class CPathContainerDescriptor implements IContainerDescriptor { } } - public ICPathContainerPage createPage() throws CoreException { + public IPathEntryContainerPage createPage() throws CoreException { Object elem = CoreUtility.createExtension(fConfigElement, ATT_PAGE_CLASS); - if (elem instanceof ICPathContainerPage) { - return (ICPathContainerPage) elem; - } + if (elem instanceof IPathEntryContainerPage) { + return (IPathEntryContainerPage) elem; + } else if (elem instanceof org.eclipse.cdt.ui.wizards.ICPathContainerPage) { + return new PathEntryContainerPageAdapter((org.eclipse.cdt.ui.wizards.ICPathContainerPage)elem); + } String id = fConfigElement.getAttribute(ATT_ID); throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0, "Invalid extension (page not of type IClasspathContainerPage): " + id, null)); //$NON-NLS-1$ 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 b250f38043b..f162ffcdd9f 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 @@ -12,6 +12,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IContainerEntry; import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.internal.ui.ICHelpContextIds; import org.eclipse.cdt.internal.ui.util.PixelConverter; @@ -396,13 +397,13 @@ public class CPathContainerEntryPage extends CPathBasePage { } private CPElement[] openContainerSelectionDialog(CPElement existing) { - IPathEntry elem = null; + IContainerEntry elem = null; String title; if (existing == null) { title = CPathEntryMessages.getString("ContainerEntryPage.ContainerDialog.new.title"); //$NON-NLS-1$ } else { title = CPathEntryMessages.getString("ContainerEntryPage.ContainerDialog.edit.title"); //$NON-NLS-1$ - elem = existing.getPathEntry(); + elem = (IContainerEntry)existing.getPathEntry(); } CPathContainerWizard wizard = new CPathContainerWizard(elem, fCurrCProject, getRawClasspath()); wizard.setWindowTitle(title); 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 2bd7410f1c7..9102118328e 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 @@ -13,10 +13,12 @@ import java.util.Arrays; import java.util.List; import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.IContainerEntry; import org.eclipse.cdt.core.model.IPathEntry; +import org.eclipse.cdt.core.model.IProjectEntry; import org.eclipse.cdt.internal.ui.util.ExceptionHandler; import org.eclipse.cdt.internal.ui.util.PixelConverter; -import org.eclipse.cdt.ui.wizards.ICPathContainerPage; +import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.Wizard; @@ -28,11 +30,13 @@ import org.eclipse.swt.widgets.Shell; public class CPathContainerWizard extends Wizard { private IContainerDescriptor fPageDesc; - private IPathEntry fEntryToEdit; + private IContainerEntry fEntryToEdit; private IPathEntry[] fNewEntries; - private IPathEntry[] fContainerEntries; - private ICPathContainerPage fContainerPage; + private IContainerEntry[] fContainerEntries; + private IProjectEntry fProjectEntry; + + private IPathEntryContainerPage fContainerPage; private ICElement fCurrElement; private IPathEntry[] fCurrCPath; private CPathFilterPage fFilterPage; @@ -43,7 +47,7 @@ public class CPathContainerWizard extends Wizard { /** * Constructor for ClasspathContainerWizard. */ - public CPathContainerWizard(IPathEntry entryToEdit, ICElement currElement, IPathEntry[] currEntries) { + public CPathContainerWizard(IContainerEntry entryToEdit, ICElement currElement, IPathEntry[] currEntries) { this(entryToEdit, null, currElement, currEntries, null); } @@ -54,7 +58,7 @@ public class CPathContainerWizard extends Wizard { this(null, pageDesc, currElement, currEntries, null); } - public CPathContainerWizard(IPathEntry entryToEdit, IContainerDescriptor pageDesc, ICElement currElement, + public CPathContainerWizard(IContainerEntry entryToEdit, IContainerDescriptor pageDesc, ICElement currElement, IPathEntry[] currEntries, int[] filterType) { fEntryToEdit = entryToEdit; fPageDesc = pageDesc; @@ -66,6 +70,9 @@ public class CPathContainerWizard extends Wizard { } public IPathEntry getEntriesParent() { + if (fProjectEntry != null) { + return fProjectEntry; + } return fContainerEntries[0]; } @@ -73,7 +80,7 @@ public class CPathContainerWizard extends Wizard { return fNewEntries; } - public IPathEntry[] getContainers() { + public IContainerEntry[] getContainers() { return fContainerEntries; } @@ -85,7 +92,11 @@ public class CPathContainerWizard extends Wizard { public boolean performFinish() { if (fContainerPage != null) { if (fContainerPage.finish()) { - fContainerEntries = fContainerPage.getContainerEntries(); + if (fContainerPage instanceof ProjectContainerPage) { + fProjectEntry = ((ProjectContainerPage)fContainerPage).getProjectEntry(); + } else { + fContainerEntries = fContainerPage.getNewContainers(); + } if (fFilterPage != null && fFilterPage.isPageComplete()) { fNewEntries = fFilterPage.getSelectedEntries(); } @@ -131,8 +142,8 @@ public class CPathContainerWizard extends Wizard { super.addPages(); } - private ICPathContainerPage getContainerPage(IContainerDescriptor pageDesc) { - ICPathContainerPage containerPage = null; + private IPathEntryContainerPage getContainerPage(IContainerDescriptor pageDesc) { + IPathEntryContainerPage containerPage = null; if (pageDesc != null) { try { containerPage = pageDesc.createPage(); @@ -145,7 +156,9 @@ public class CPathContainerWizard extends Wizard { containerPage = new CPathContainerDefaultPage(); } containerPage.initialize(fCurrElement.getCProject(), fCurrCPath); - containerPage.setSelection(fEntryToEdit); + if (!(containerPage instanceof ProjectContainerPage)) { + containerPage.setSelection(fEntryToEdit); + } containerPage.setWizard(this); return containerPage; } @@ -162,9 +175,15 @@ public class CPathContainerWizard extends Wizard { fContainerPage = getContainerPage(selected); return fContainerPage; } else if (page == fContainerPage && fFilterPage != null) { - if (fContainerPage.finish() && fContainerPage.getContainerEntries().length > 0 - && fContainerPage.getContainerEntries()[0] != null) { - fFilterPage.setParentEntry(fContainerPage.getContainerEntries()[0]); + if (fContainerPage.finish() && fContainerPage.getNewContainers().length > 0 + && fContainerPage.getNewContainers()[0] != null) { + IPathEntry entry; + if (fContainerPage instanceof ProjectContainerPage) { + entry = ((ProjectContainerPage)fContainerPage).getProjectEntry(); + } else { + entry = fContainerPage.getNewContainers()[0]; + } + fFilterPage.setParentEntry(entry); } return fFilterPage; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java index 3fd9728efb6..0d9791b24cf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java @@ -18,6 +18,7 @@ import org.eclipse.cdt.core.model.CoreModelUtil; import org.eclipse.cdt.core.model.ICContainer; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IContainerEntry; import org.eclipse.cdt.core.model.IIncludeEntry; import org.eclipse.cdt.core.model.IMacroEntry; import org.eclipse.cdt.core.model.IPathEntry; @@ -991,13 +992,13 @@ public class CPathIncludeSymbolEntryPage extends CPathBasePage { } protected CPElement[] openContainerSelectionDialog(CPElement existing) { - IPathEntry elem = null; + IContainerEntry elem = null; String title; if (existing == null) { title = CPathEntryMessages.getString("IncludeSymbolEntryPage.ContainerDialog.new.title"); //$NON-NLS-1$ } else { title = CPathEntryMessages.getString("IncludeSymbolEntryPage.ContainerDialog.edit.title"); //$NON-NLS-1$ - elem = existing.getPathEntry(); + elem = (IContainerEntry)existing.getPathEntry(); } CPathContainerWizard wizard = new CPathContainerWizard(elem, null, fCurrCProject, getRawPathEntries(), new int[]{ IPathEntry.CDT_INCLUDE, IPathEntry.CDT_MACRO}); 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 88e7cdda486..5869287b77f 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 @@ -15,6 +15,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IContainerEntry; import org.eclipse.cdt.core.model.ILibraryEntry; import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.internal.ui.CPluginImages; @@ -505,13 +506,13 @@ public class CPathLibraryEntryPage extends CPathBasePage { } protected CPElement[] openContainerSelectionDialog(CPElement existing) { - IPathEntry elem = null; + IContainerEntry elem = null; String title; if (existing == null) { title = CPathEntryMessages.getString("LibrariesEntryPage.ContainerDialog.new.title"); //$NON-NLS-1$ } else { title = CPathEntryMessages.getString("LibrariesEntryPage.ContainerDialog.edit.title"); //$NON-NLS-1$ - elem = existing.getPathEntry(); + elem = (IContainerEntry)existing.getPathEntry(); } CPathContainerWizard wizard = new CPathContainerWizard(elem, null, fCurrCProject, getRawPathEntries(), new int[] {IPathEntry.CDT_LIBRARY}); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/IContainerDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/IContainerDescriptor.java index 6258921f0f4..bdaf0e83ca6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/IContainerDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/IContainerDescriptor.java @@ -9,13 +9,13 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths; import org.eclipse.cdt.core.model.IPathEntry; -import org.eclipse.cdt.ui.wizards.ICPathContainerPage; +import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.graphics.Image; public interface IContainerDescriptor { - public ICPathContainerPage createPage() throws CoreException; + public IPathEntryContainerPage createPage() throws CoreException; public String getName(); public Image getImage(); public boolean canEdit(IPathEntry entry); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerDescriptor.java index 4d98b835255..16d894acb8c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerDescriptor.java @@ -10,7 +10,7 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths; import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.cdt.ui.wizards.ICPathContainerPage; +import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.ide.IDE; @@ -22,7 +22,7 @@ public class ProjectContainerDescriptor implements IContainerDescriptor { fFilterType = filterType; } - public ICPathContainerPage createPage() throws CoreException { + public IPathEntryContainerPage createPage() throws CoreException { return new ProjectContainerPage(fFilterType); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerPage.java index 611a740dc6e..512b119707b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerPage.java @@ -14,11 +14,13 @@ import java.util.List; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IContainerEntry; import org.eclipse.cdt.core.model.IPathEntry; +import org.eclipse.cdt.core.model.IProjectEntry; import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.util.SelectionUtil; import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider; -import org.eclipse.cdt.ui.wizards.ICPathContainerPage; +import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.SelectionChangedEvent; @@ -34,7 +36,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.model.WorkbenchLabelProvider; -public class ProjectContainerPage extends WizardPage implements ICPathContainerPage { +public class ProjectContainerPage extends WizardPage implements IPathEntryContainerPage { private int[] fFilterType; private TableViewer viewer; @@ -57,22 +59,29 @@ public class ProjectContainerPage extends WizardPage implements ICPathContainerP return true; } - public IPathEntry[] getContainerEntries() { + public IContainerEntry[] getNewContainers() { + return new IContainerEntry[0]; + } + + IProjectEntry getProjectEntry() { if (viewer != null) { ISelection selection = viewer.getSelection(); ICProject project = (ICProject)SelectionUtil.getSingleElement(selection); if (project != null) { - return new IPathEntry[]{CoreModel.newProjectEntry(project.getPath())}; + return CoreModel.newProjectEntry(project.getPath()); } } - return new IPathEntry[0]; - + return null; } - public void setSelection(IPathEntry containerEntry) { - if (containerEntry != null) { - viewer.setSelection(new StructuredSelection(containerEntry)); + + void setProjectEntry(IProjectEntry entry) { + if (entry != null) { + viewer.setSelection(new StructuredSelection(entry)); } } + + public void setSelection(IContainerEntry containerEntry) { + } public void createControl(Composite parent) { // create a composite with standard margins and spacing @@ -147,6 +156,6 @@ public class ProjectContainerPage extends WizardPage implements ICPathContainerP } private IPathEntry getSelected() { - return getContainerEntries().length > 0 ? getContainerEntries()[0] : null; + return getProjectEntry(); } } \ No newline at end of file