diff options
author | Fabian Miehe | 2014-08-12 09:26:02 +0000 |
---|---|---|
committer | Vikas Chandra | 2014-08-27 13:18:12 +0000 |
commit | 35d57751fb80ce3171c018dbf3e8eb6378109b09 (patch) | |
tree | c0b8d7b060d3350b70877bd724874d0d0082a5cf | |
parent | 04f07ccfb2005c3494ca0961ed1584a5f7b83e5c (diff) | |
download | eclipse.pde.ui-35d57751fb80ce3171c018dbf3e8eb6378109b09.tar.gz eclipse.pde.ui-35d57751fb80ce3171c018dbf3e8eb6378109b09.tar.xz eclipse.pde.ui-35d57751fb80ce3171c018dbf3e8eb6378109b09.zip |
Bug 440420 - 'Remove' Button is missing in Feature Editor
Change-Id: I22140d02671ef78d967e6b311516f6a3443ff7ba
Signed-off-by: Fabian Miehe <fabian.miehe@cassidian.com>
5 files changed, 84 insertions, 19 deletions
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index ce2279d015..b676b22f87 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -8,6 +8,7 @@ * IBM Corporation - initial API and implementation * Code 9 Corporation - on going enhancements and maintenance * Brian de Alwis (MTI) - bug 429420 + * Fabian Miehe - Bug 440420 *******************************************************************************/ package org.eclipse.pde.internal.ui; @@ -699,6 +700,7 @@ public class PDEUIMessages extends NLS { public static String FeatureEditor_IncludedFeatures_title; public static String FeatureEditor_IncludedFeatures_desc; public static String FeatureEditor_IncludedFeatures_new; + public static String FeatureEditor_IncludedFeatures_remove; public static String FeatureEditor_IncludedFeatures_up; public static String FeatureEditor_IncludedFeatures_down; public static String FeatureEditor_IncludedFeatures_sortAlpha; @@ -733,6 +735,7 @@ public class PDEUIMessages extends NLS { public static String FeatureEditor_PluginSection_pluginTitle; public static String FeatureEditor_PluginSection_pluginDesc; public static String FeatureEditor_PluginSection_new; + public static String FeatureEditor_PluginSection_remove; public static String FeatureEditor_PluginSection_sortAlpha; public static String FeatureEditor_PluginPortabilitySection_title; @@ -757,6 +760,7 @@ public class PDEUIMessages extends NLS { public static String FeatureEditor_RequiresSection_plugin; public static String FeatureEditor_RequiresSection_feature; public static String FeatureEditor_RequiresSection_sortAlpha; + public static String FeatureEditor_RequiresSection_remove; public static String FeatureEditor_URLSection_desc; public static String FeatureEditor_URLSection_new; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesSection.java index 693aeb714f..ff957887ff 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesSection.java @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Alexander Kurtakov <akurtako@redhat.com> - bug 415649 + * Fabian Miehe - Bug 440420 *******************************************************************************/ package org.eclipse.pde.internal.ui.editor.feature; @@ -43,6 +44,12 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; public class IncludedFeaturesSection extends TableSection implements IFeatureModelListener, IPropertyChangeListener { + + private static final int NEW = 0; + private static final int REMOVE = 1; + private static final int UP = 2; + private static final int DOWN = 3; + private TableViewer fIncludesViewer; private Action fNewAction; @@ -63,7 +70,7 @@ public class IncludedFeaturesSection extends TableSection implements IFeatureMod } public IncludedFeaturesSection(PDEFormPage page, Composite parent) { - super(page, parent, Section.DESCRIPTION, new String[] {PDEUIMessages.FeatureEditor_IncludedFeatures_new, PDEUIMessages.FeatureEditor_IncludedFeatures_up, PDEUIMessages.FeatureEditor_IncludedFeatures_down}); + super(page, parent, Section.DESCRIPTION, new String[] {PDEUIMessages.FeatureEditor_IncludedFeatures_new, PDEUIMessages.FeatureEditor_IncludedFeatures_remove, PDEUIMessages.FeatureEditor_IncludedFeatures_up, PDEUIMessages.FeatureEditor_IncludedFeatures_down}); getSection().setText(PDEUIMessages.FeatureEditor_IncludedFeatures_title); getSection().setDescription(PDEUIMessages.FeatureEditor_IncludedFeatures_desc); getTablePart().setEditable(false); @@ -124,13 +131,16 @@ public class IncludedFeaturesSection extends TableSection implements IFeatureMod @Override protected void buttonSelected(int index) { switch (index) { - case 0 : + case NEW : handleNew(); break; - case 1 : + case REMOVE : + handleDelete(); + break; + case UP : handleUp(); break; - case 2 : + case DOWN : handleDown(); break; } @@ -433,10 +443,13 @@ public class IncludedFeaturesSection extends TableSection implements IFeatureMod Table table = tablePart.getTableViewer().getTable(); TableItem[] tableSelection = table.getSelection(); boolean hasSelection = tableSelection.length > 0; + //delete + tablePart.setButtonEnabled(REMOVE, isEditable() && hasSelection); + // up/down buttons boolean canMove = table.getItemCount() > 1 && tableSelection.length == 1 && !fSortAction.isChecked(); - tablePart.setButtonEnabled(1, canMove && isEditable() && hasSelection && table.getSelectionIndex() > 0); - tablePart.setButtonEnabled(2, canMove && hasSelection && isEditable() && table.getSelectionIndex() < table.getItemCount() - 1); + tablePart.setButtonEnabled(UP, canMove && isEditable() && hasSelection && table.getSelectionIndex() > 0); + tablePart.setButtonEnabled(DOWN, canMove && hasSelection && isEditable() && table.getSelectionIndex() < table.getItemCount() - 1); } /** diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginSection.java index 0cfd49f2fe..951e008a65 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginSection.java @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Alexander Kurtakov <akurtako@redhat.com> - bug 415649 + * Fabian Miehe - Bug 440420 *******************************************************************************/ package org.eclipse.pde.internal.ui.editor.feature; @@ -43,6 +44,11 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; public class PluginSection extends TableSection implements IPluginModelListener { + + private static final int NEW = 0; + private static final int REMOVE = 1; + private static final int SYNC = 2; + private OpenReferenceAction fOpenAction; private TableViewer fPluginViewer; @@ -63,7 +69,7 @@ public class PluginSection extends TableSection implements IPluginModelListener } public PluginSection(PDEFormPage page, Composite parent) { - super(page, parent, Section.DESCRIPTION, new String[] {PDEUIMessages.FeatureEditor_PluginSection_new, null, PDEUIMessages.FeatureEditor_SpecSection_synchronize}); + super(page, parent, Section.DESCRIPTION, new String[] {PDEUIMessages.FeatureEditor_PluginSection_new, PDEUIMessages.FeatureEditor_PluginSection_remove, PDEUIMessages.FeatureEditor_SpecSection_synchronize}); getSection().setText(PDEUIMessages.FeatureEditor_PluginSection_pluginTitle); getSection().setDescription(PDEUIMessages.FeatureEditor_PluginSection_pluginDesc); getTablePart().setEditable(false); @@ -123,10 +129,17 @@ public class PluginSection extends TableSection implements IPluginModelListener @Override protected void buttonSelected(int index) { - if (index == 0) - handleNew(); - if (index == 2) - handleSynchronize(); + switch (index) { + case NEW : + handleNew(); + break; + case REMOVE : + handleDelete(); + break; + case SYNC : + handleSynchronize(); + break; + } } @Override @@ -281,6 +294,16 @@ public class PluginSection extends TableSection implements IPluginModelListener @Override protected void selectionChanged(IStructuredSelection selection) { getPage().getPDEEditor().setSelection(selection); + updateButtons(); + } + + private void updateButtons() { + TablePart tablePart = getTablePart(); + Table table = tablePart.getTableViewer().getTable(); + TableItem[] tableSelection = table.getSelection(); + boolean hasSelection = tableSelection.length > 0; + //delete + tablePart.setButtonEnabled(REMOVE, isEditable() && hasSelection); } public void initialize() { @@ -371,6 +394,7 @@ public class PluginSection extends TableSection implements IPluginModelListener IFeatureModel model = (IFeatureModel) getPage().getModel(); IFeature feature = model.getFeature(); fPluginViewer.setInput(feature); + updateButtons(); super.refresh(); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/RequiresSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/RequiresSection.java index a983ceebc7..f39bad6910 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/RequiresSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/RequiresSection.java @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation * Alexander Kurtakov <akurtako@redhat.com> - bug 415649 * Marc-Andre Laperle (Ericsson) - Handle double click (Bug 328467) + * Fabian Miehe - Bug 440420 *******************************************************************************/ package org.eclipse.pde.internal.ui.editor.feature; @@ -46,6 +47,12 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; public class RequiresSection extends TableSection implements IPluginModelListener, IFeatureModelListener { + + private static final int RECOMPUTE_IMPORT = 3; + private static final int REMOVE = 2; + private static final int NEW_FEATURE = 1; + private static final int NEW_PLUGIN = 0; + private Button fSyncButton; private TableViewer fPluginViewer; @@ -73,7 +80,7 @@ public class RequiresSection extends TableSection implements IPluginModelListene } public RequiresSection(FeatureDependenciesPage page, Composite parent) { - super(page, parent, Section.DESCRIPTION, new String[] {PDEUIMessages.FeatureEditor_RequiresSection_plugin, PDEUIMessages.FeatureEditor_RequiresSection_feature, null, PDEUIMessages.FeatureEditor_RequiresSection_compute}); + super(page, parent, Section.DESCRIPTION, new String[] {PDEUIMessages.FeatureEditor_RequiresSection_plugin, PDEUIMessages.FeatureEditor_RequiresSection_feature, PDEUIMessages.FeatureEditor_RequiresSection_remove, PDEUIMessages.FeatureEditor_RequiresSection_compute}); getSection().setText(PDEUIMessages.FeatureEditor_RequiresSection_title); getSection().setDescription(PDEUIMessages.FeatureEditor_RequiresSection_desc); getTablePart().setEditable(false); @@ -150,15 +157,16 @@ public class RequiresSection extends TableSection implements IPluginModelListene @Override protected void buttonSelected(int index) { switch (index) { - case 0 : + case NEW_PLUGIN : handleNewPlugin(); break; - case 1 : + case NEW_FEATURE : handleNewFeature(); break; - case 2 : + case REMOVE : + handleDelete(); break; - case 3 : + case RECOMPUTE_IMPORT : recomputeImports(); break; } @@ -393,15 +401,26 @@ public class RequiresSection extends TableSection implements IPluginModelListene protected void selectionChanged(IStructuredSelection selection) { getPage().getPDEEditor().setSelection(selection); getPage().getManagedForm().fireSelectionChanged(this, selection); + updateButtons(); + } + + private void updateButtons() { + TablePart tablePart = getTablePart(); + Table table = tablePart.getTableViewer().getTable(); + TableItem[] tableSelection = table.getSelection(); + boolean hasSelection = tableSelection.length > 0; + //delete + tablePart.setButtonEnabled(REMOVE, isEditable() && hasSelection); } public void initialize() { IFeatureModel model = (IFeatureModel) getPage().getModel(); refresh(); if (model.isEditable() == false) { - getTablePart().setButtonEnabled(0, false); - getTablePart().setButtonEnabled(1, false); - getTablePart().setButtonEnabled(3, false); + getTablePart().setButtonEnabled(NEW_PLUGIN, false); + getTablePart().setButtonEnabled(NEW_FEATURE, false); + getTablePart().setButtonEnabled(REMOVE, false); + getTablePart().setButtonEnabled(RECOMPUTE_IMPORT, false); fSyncButton.setEnabled(false); } model.addModelChangedListener(this); @@ -506,6 +525,7 @@ public class RequiresSection extends TableSection implements IPluginModelListene IFeatureModel model = (IFeatureModel) getPage().getModel(); IFeature feature = model.getFeature(); fPluginViewer.setInput(feature); + updateButtons(); super.refresh(); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index 8f349d1a35..11e49f56e8 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -10,6 +10,7 @@ # Code 9 Corporation - on going enhancements and maintenance # Brian de Alwis (MTI) - bug 429420 # Rapicorps - ongoing enhancements +# Fabian Miehe - Bug 440420 ############################################################################### ##################################### # PDE resource strings @@ -167,6 +168,7 @@ FeatureEditor_PortabilitySection_edit = Browse ... FeatureEditor_IncludedFeatures_title = Included Features FeatureEditor_IncludedFeatures_desc = Create a composite feature by including references to other features. FeatureEditor_IncludedFeatures_new = Add... +FeatureEditor_IncludedFeatures_remove = Remove FeatureEditor_IncludedFeatures_up = Up FeatureEditor_IncludedFeatures_down = Down FeatureEditor_IncludedFeatures_sortAlpha = Sort the Features alphabetically @@ -203,6 +205,7 @@ FeatureEditor_licenseFeatureSection_localButton = Local license FeatureEditor_PluginSection_pluginTitle = Plug-ins and Fragments FeatureEditor_PluginSection_pluginDesc = Select plug-ins and fragments that should be packaged in this feature. FeatureEditor_PluginSection_new = Add... +FeatureEditor_PluginSection_remove = Remove FeatureEditor_PluginSection_sortAlpha = Sort the Plug-ins and Fragments alphabetically FeatureEditor_PluginPortabilitySection_title = Plug-in Environments @@ -228,6 +231,7 @@ FeatureEditor_RequiresSection_sync = Recompute when feature plug-ins change FeatureEditor_RequiresSection_compute = Compute FeatureEditor_RequiresSection_plugin = Add Plug-in... FeatureEditor_RequiresSection_feature = Add Feature... +FeatureEditor_RequiresSection_remove = Remove FeatureEditor_RequiresSection_sortAlpha = Sort the Features/Plug-ins alphabetically FeatureEditor_URLSection_desc = Add URLs of other update sites to visit while looking for new features. |