Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Hufmann2015-01-27 19:44:55 +0000
committerBernd Hufmann2015-01-28 22:52:04 +0000
commit1c076c65b0f2c51399326b1be75279766f32a441 (patch)
treecfabdc3016d2166239e0e83cafcf494e9c44cff2
parent7f6df67cf10b27bc1c4cb755fa6db638fbdd3479 (diff)
downloadorg.eclipse.linuxtools-1c076c65b0f2c51399326b1be75279766f32a441.tar.gz
org.eclipse.linuxtools-1c076c65b0f2c51399326b1be75279766f32a441.tar.xz
org.eclipse.linuxtools-1c076c65b0f2c51399326b1be75279766f32a441.zip
tmf: Missing delete action in Filter dialog of ColorsView (bug 458582)
Change-Id: I02d461a8e599b4e51a1f8e6883246bf926d15413 Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com> Reviewed-on: https://git.eclipse.org/r/40494 Tested-by: Hudson CI Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java5
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties5
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterDialog.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java31
4 files changed, 36 insertions, 7 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java
index e82aaa8502..264ebd8f1b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java
@@ -251,9 +251,10 @@ public class Messages extends NLS {
public static String FilterView_FileDialogFilterName;
public static String FilterView_ImportActionToolTipText;
public static String FilterView_SaveActionToolTipText;
- public static String FilterViewer_EmptyTreeHintText;
- public static String FilterViewer_CommonCategory;
public static String FilterViewer_AlphaButtonText;
+ public static String FilterViewer_CommonCategory;
+ public static String FilterViewer_DeleteActionText;
+ public static String FilterViewer_EmptyTreeHintText;
public static String FilterViewer_FieldLabel;
public static String FilterViewer_FilterNameHint;
public static String FilterViewer_IgnoreCaseButtonText;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties
index a466259bdf..4f1cb93bee 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties
@@ -250,9 +250,10 @@ FilterView_ExportActionToolTipText=Export filters
FilterView_FileDialogFilterName=TMF Filter files
FilterView_ImportActionToolTipText=Import filters
FilterView_SaveActionToolTipText=Save filters
-FilterViewer_EmptyTreeHintText=<Right-click to add filter node>
-FilterViewer_CommonCategory=[common]
FilterViewer_AlphaButtonText=Alpha
+FilterViewer_CommonCategory=[common]
+FilterViewer_DeleteActionText=Delete
+FilterViewer_EmptyTreeHintText=<Right-click to add filter node>
FilterViewer_FieldLabel=field:
FilterViewer_FilterNameHint=type filter name
FilterViewer_IgnoreCaseButtonText=ignore case
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterDialog.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterDialog.java
index d573c1760d..b0b72ac931 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterDialog.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterDialog.java
@@ -49,7 +49,7 @@ public class FilterDialog extends Dialog {
getShell().setMinimumSize(getShell().computeSize(500, 200));
Composite composite = (Composite) super.createDialogArea(parent);
- fViewer = new FilterViewer(composite, SWT.BORDER);
+ fViewer = new FilterViewer(composite, SWT.BORDER, true);
fViewer.setInput(fRoot);
return composite;
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java
index 5a7e510f67..a55008c446 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java
@@ -81,6 +81,9 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.PlatformUI;
class FilterViewer extends Composite {
@@ -91,9 +94,17 @@ class FilterViewer extends Composite {
private Composite fComposite;
private MenuManager fMenuManager;
+ private boolean fIsDialog = false;
+
public FilterViewer(Composite parent, int style) {
+ this(parent, style, false);
+ }
+
+ public FilterViewer(Composite parent, int style, boolean isDialog) {
super(parent, style);
+ this.fIsDialog = isDialog;
+
setLayout(new FillLayout());
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
setLayoutData(gd);
@@ -192,10 +203,26 @@ class FilterViewer extends Composite {
}
}
- if (filterTreeNode != null) {
- fillContextMenuForNode(filterTreeNode, manager);
+ final ITmfFilterTreeNode selectedNode = filterTreeNode;
+ if (selectedNode != null) {
+ fillContextMenuForNode(selectedNode, manager);
}
+
manager.add(new Separator("delete")); //$NON-NLS-1$
+
+ if (fIsDialog && (selectedNode != null)) {
+ Action deleteAction = new Action(Messages.FilterViewer_DeleteActionText) {
+ @Override
+ public void run() {
+ selectedNode.remove();
+ fViewer.refresh();
+ }
+ };
+ deleteAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
+ deleteAction.setAccelerator(SWT.DEL);
+ manager.add(deleteAction);
+ }
manager.add(new Separator("edit")); //$NON-NLS-1$
if (fViewer.getInput() instanceof TmfFilterRootNode || filterTreeNode == null) {

Back to the top