Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 219860 Details for
Bug 376057
Wildcard support for adding feature in product configuration editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch
eclipse.pde.ui.patch (text/plain), 5.05 KB, created by
Lars Vogel
on 2012-08-14 09:36:45 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Lars Vogel
Created:
2012-08-14 09:36:45 EDT
Size:
5.05 KB
patch
obsolete
>diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/FeatureSelectionDialog.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/FeatureSelectionDialog.java >index 7febbe2..ca6f458 100755 >--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/FeatureSelectionDialog.java >+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/FeatureSelectionDialog.java >@@ -7,29 +7,97 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Lars Vogel <Lars.Vogel@vogella.com> - Fix for bug 376057 - Wildcard suport >+ * for adding features in product configuration editor > *******************************************************************************/ > > package org.eclipse.pde.internal.ui.dialogs; > >+import java.util.Comparator; >+import org.eclipse.core.runtime.*; >+import org.eclipse.jface.dialogs.IDialogSettings; >+import org.eclipse.pde.internal.core.ifeature.IFeature; > import org.eclipse.pde.internal.core.ifeature.IFeatureModel; > import org.eclipse.pde.internal.ui.*; >-import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.*; > import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.dialogs.ElementListSelectionDialog; >+import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog; > >-public class FeatureSelectionDialog extends ElementListSelectionDialog { >+public class FeatureSelectionDialog extends FilteredItemsSelectionDialog { >+ >+ private static final String DIALOG_SETTINGS = "org.eclipse.pde.ui.dialogs.PluginSelectionDialog"; //$NON-NLS-1$ >+ private IFeatureModel[] fModels; >+ >+ private class FeatureSearchItemsFilter extends ItemsFilter { >+ >+ public boolean isConsistentItem(Object item) { >+ return true; >+ } >+ >+ public boolean matchItem(Object item) { >+ String id = null; >+ if (item instanceof IFeatureModel) { >+ IFeatureModel model = (IFeatureModel) item; >+ id = model.getFeature().getId(); >+ } >+ >+ return (matches(id)); >+ } >+ >+ protected boolean matches(String text) { >+ String pattern = patternMatcher.getPattern(); >+ if (pattern.indexOf("*") != 0 & pattern.indexOf("?") != 0 & pattern.indexOf(".") != 0) {//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ pattern = "*" + pattern; //$NON-NLS-1$ >+ patternMatcher.setPattern(pattern); >+ } >+ return patternMatcher.matches(text); >+ } >+ } >+ >+ private class FeatureSearchComparator implements Comparator { >+ >+ public int compare(Object o1, Object o2) { >+ int id1 = getId(o1); >+ int id2 = getId(o2); >+ >+ if (id1 != id2) >+ return id1 - id2; >+ return compareSimilarObjects(o1, o2); >+ } >+ >+ private int getId(Object element) { >+ if (element instanceof IFeatureModel) { >+ return 100; >+ } >+ return 0; >+ } >+ >+ private int compareSimilarObjects(Object o1, Object o2) { >+ if (o1 instanceof IFeatureModel && o2 instanceof IFeatureModel) { >+ IFeatureModel ipmb1 = (IFeatureModel) o1; >+ IFeatureModel ipmb2 = (IFeatureModel) o2; >+ return compareFeatures(ipmb1.getFeature(), ipmb2.getFeature()); >+ } >+ return 0; >+ } >+ >+ private int compareFeatures(IFeature ipmb1, IFeature ipmb2) { >+ return ipmb1.getId().compareTo(ipmb2.getId()); >+ } >+ >+ } > > /** > * @param parent > * @param renderer > */ > public FeatureSelectionDialog(Shell parent, IFeatureModel[] models, boolean multiSelect) { >- super(parent, PDEPlugin.getDefault().getLabelProvider()); >+ super(parent, multiSelect); > setTitle(PDEUIMessages.FeatureSelectionDialog_title); > setMessage(PDEUIMessages.FeatureSelectionDialog_message); >- setElements(models); >- setMultipleSelection(multiSelect); >+ this.fModels = models; > PDEPlugin.getDefault().getLabelProvider().connect(this); >+ setListLabelProvider(PDEPlugin.getDefault().getLabelProvider()); > } > > /* >@@ -45,4 +113,50 @@ > return super.close(); > } > >+ protected Control createExtendedContentArea(Composite parent) { >+ return null; >+ } >+ >+ protected IDialogSettings getDialogSettings() { >+ IDialogSettings settings = PDEPlugin.getDefault().getDialogSettings().getSection(DIALOG_SETTINGS); >+ >+ if (settings == null) { >+ settings = PDEPlugin.getDefault().getDialogSettings().addNewSection(DIALOG_SETTINGS); >+ } >+ >+ return settings; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#validateItem(java.lang.Object) >+ */ >+ protected IStatus validateItem(Object item) { >+ return new Status(IStatus.OK, IPDEUIConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$ >+ } >+ >+ protected ItemsFilter createFilter() { >+ return new FeatureSearchItemsFilter(); >+ } >+ >+ protected Comparator getItemsComparator() { >+ return new FeatureSearchComparator(); >+ } >+ >+ protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter, IProgressMonitor progressMonitor) throws CoreException { >+ for (int i = 0; i < fModels.length; i++) { >+ contentProvider.add(fModels[i], itemsFilter); >+ progressMonitor.worked(1); >+ } >+ progressMonitor.done(); >+ >+ } >+ >+ public String getElementName(Object item) { >+ if (item instanceof IFeatureModel) { >+ IFeatureModel model = (IFeatureModel) item; >+ return model.getFeature().getId(); >+ } >+ return null; >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
curtis.windatt.public
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 376057
: 219860