[115919] Properties view's Remove Property action does not work
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ConfigurablePropertySheetPage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ConfigurablePropertySheetPage.java
index 92398c1..1e4f9aa 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ConfigurablePropertySheetPage.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ConfigurablePropertySheetPage.java
@@ -12,19 +12,13 @@
*******************************************************************************/
package org.eclipse.wst.sse.ui.internal.properties;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.views.properties.IPropertySheetEntry;
@@ -53,6 +47,7 @@
private long _DEBUG_TIME = 0;
private PropertySheetConfiguration fConfiguration;
+ private Object[] fSelectedEntries = null;
private ISelection fInput = null;
private IMenuManager fMenuManager;
@@ -88,6 +83,12 @@
public void handleEntrySelection(ISelection selection) {
if (getControl() != null && !getControl().isDisposed() && selection != null) {
super.handleEntrySelection(selection);
+ if (selection instanceof IStructuredSelection) {
+ fSelectedEntries = ((IStructuredSelection) selection).toArray();
+ }
+ else {
+ fSelectedEntries = null;
+ }
fRemoveAction.setEnabled(!selection.isEmpty());
}
}
@@ -112,17 +113,15 @@
}
void remove() {
- if (getControl() instanceof Tree) {
- TreeItem[] items = ((Tree) getControl()).getSelection();
- List selectedNodes = new ArrayList(0);
- if (items != null && items.length == 1 && selectedNodes != null) {
- Object data = items[0].getData();
- if (data instanceof IPropertySheetEntry) {
- IPropertySheetEntry entry = (IPropertySheetEntry) data;
- ISelection selection = getConfiguration().getInputSelection(null, new StructuredSelection(selectedNodes));
- if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
- IPropertySource source = getConfiguration().getPropertySourceProvider(this).getPropertySource(((IStructuredSelection) selection).getFirstElement());
- if (source != null && source instanceof IPropertySourceExtension) {
+ if (fSelectedEntries != null) {
+ Object[] entries = fSelectedEntries;
+ ISelection selection = fInput;
+ if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
+ IPropertySource source = getConfiguration().getPropertySourceProvider(this).getPropertySource(((IStructuredSelection) selection).getFirstElement());
+ if (source != null && source instanceof IPropertySourceExtension) {
+ for (int i = 0; i < entries.length; i++) {
+ if (entries[i] instanceof IPropertySheetEntry) {
+ IPropertySheetEntry entry = (IPropertySheetEntry) entries[i];
((IPropertySourceExtension) source).removeProperty(entry.getDisplayName());
}
}
@@ -156,6 +155,7 @@
*/
if (!preferredSelection.equals(fInput)) {
fInput = preferredSelection;
+ fSelectedEntries = null;
super.selectionChanged(part, preferredSelection);
}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/IPropertySourceExtension.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/IPropertySourceExtension.java
index 5ea5ae4..bfbabfa 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/IPropertySourceExtension.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/IPropertySourceExtension.java
@@ -28,11 +28,11 @@
boolean isPropertyRemovable(Object id);
/**
- * Removes the property with the given ID. If no such property exists,
- * nothing is done.
+ * Removes the property with the given displayed name. If no such property
+ * exists, nothing is done.
*
* @param id
- * the ID of the property
+ * the displayed name of the property
*/
- void removeProperty(Object id);
+ void removeProperty(Object name);
}