[Bug293101] Context menu fix: removed the unimplemented menu choices and enabled...
authorFrancois Chouinard <fchouinard@gmail.com>
Wed, 3 Mar 2010 14:36:15 +0000 (14:36 +0000)
committerFrancois Chouinard <fchouinard@gmail.com>
Wed, 3 Mar 2010 14:36:15 +0000 (14:36 +0000)
org.eclipse.linuxtools.lttng.ui/plugin.xml
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/ProjectView.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenExperimentHandler.java

index 2e184da49f16f099fbf15039e616b2f055618cb3..55bf5083f77e985751289d3e8c077fc1b5419aba 100644 (file)
                label="Close Project"
                style="push">
          </command>
-         <command
+         <!-- command
                commandId="org.eclipse.linuxtools.lttng.ui.command.project.rename"
                id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.rename"
                label="Rename Project"
                style="push">
-         </command>
+         </command -->
          <command
                commandId="org.eclipse.linuxtools.lttng.ui.command.project.delete"
                id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.delete"
                name="org.eclipse.linuxtools.lttng.ui.menu.popup.project.separator1"
                visible="true">
          </separator>
-         <command
-               commandId="org.eclipse.linuxtools.lttng.ui.command.project.trace.import"
-               id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.trace.import"
-               label="Import Trace"
-               style="push">
-         </command>
-         <command
-               commandId="org.eclipse.linuxtools.lttng.ui.command.project.trace.open"
-               id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.trace.open"
-               label="Open Trace"
-               style="push">
-         </command>
-         <command
-               commandId="org.eclipse.linuxtools.lttng.ui.command.project.trace.rename"
-               id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.trace.rename"
-               label="Rename Trace"
-               style="push">
-         </command>
-         <command
-               commandId="org.eclipse.linuxtools.lttng.ui.command.project.trace.delete"
-               id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.trace.delete"
-               label="Delete Trace"
-               style="push">
-         </command>
-         <separator
-               name="org.eclipse.linuxtools.lttng.ui.menu.popup.project.separator2"
-               visible="true">
-         </separator>
          <command
                commandId="org.eclipse.linuxtools.lttng.ui.command.project.experiment.new"
                id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.experiment.new"
                label="Open Experiment"
                style="push">
          </command>
-         <command
+         <!-- command
                commandId="org.eclipse.linuxtools.lttng.ui.command.project.experiment.rename"
                id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.experiment.rename"
                label="Rename Experiment"
                style="push">
-         </command>
+         </command -->
          <command
                commandId="org.eclipse.linuxtools.lttng.ui.command.project.experiment.delete"
                id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.experiment.delete"
                label="Delete Experiment"
                style="push">
          </command>
+         <separator
+               name="org.eclipse.linuxtools.lttng.ui.menu.popup.project.separator2"
+               visible="true">
+         </separator>
+         <command
+               commandId="org.eclipse.linuxtools.lttng.ui.command.project.trace.import"
+               id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.trace.import"
+               label="Import Traces"
+               style="push">
+         </command>
+         <!-- command
+               commandId="org.eclipse.linuxtools.lttng.ui.command.project.trace.open"
+               id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.trace.open"
+               label="Open Trace"
+               style="push">
+         </command -->
+         <!-- command
+               commandId="org.eclipse.linuxtools.lttng.ui.command.project.trace.rename"
+               id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.trace.rename"
+               label="Rename Trace"
+               style="push">
+         </command -->
+         <command
+               commandId="org.eclipse.linuxtools.lttng.ui.command.project.trace.delete"
+               id="org.eclipse.linuxtools.lttng.ui.menu.popup.project.trace.delete"
+               label="Delete Trace"
+               style="push">
+         </command>
          <separator
                name="org.eclipse.linuxtools.lttng.ui.menu.popup.project.separator3"
                visible="true">
index 0f64981954cdfe144ffde66faae85baf45c4af6f..7199752029582b03936ae63461df05b7523cb1ec 100644 (file)
@@ -161,7 +161,7 @@ public class ProjectView extends TmfView {
 
        private boolean waitForCompletion = true;
 
-       private void selectExperiment(LTTngExperimentNode experiment) {
+       public void selectExperiment(LTTngExperimentNode experiment) {
        String expId = experiment.getName();
         if (fSelectedExperiment != null)
                fSelectedExperiment.deregister();
index 023d99d588494c23d9baa6dc6348de07146890d4..c7948b4dbb812977e7dde8266cfcbce4ad44e256 100644 (file)
@@ -16,8 +16,12 @@ import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.IHandler;
 import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView;
 import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngExperimentNode;
-import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 
 /**
@@ -34,6 +38,23 @@ public class OpenExperimentHandler implements IHandler {
        // ------------------------------------------------------------------------
 
        public boolean isEnabled() {
+               // Check if we are closing down
+               IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+               if (window == null)
+                       return false;
+
+               // Check if a trace is selected
+               IWorkbenchPage page = window.getActivePage();
+               if (!(page.getActivePart() instanceof ProjectView))
+                       return false;
+
+               // Check if a trace is selected
+               ISelection selection = page.getSelection(ProjectView.ID);
+               if (selection instanceof StructuredSelection) {
+                       Object element = ((StructuredSelection) selection).getFirstElement();
+                       fExperiment = (element instanceof LTTngExperimentNode) ? (LTTngExperimentNode) element : null;
+               }
+
                return (fExperiment != null);
        }
 
@@ -48,16 +69,15 @@ public class OpenExperimentHandler implements IHandler {
 
        public Object execute(ExecutionEvent event) throws ExecutionException {
 
-               MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
-               mb.setText("Open Experiment");
-               mb.setMessage("Not implemented yet");
-               mb.open();
+               // Set the selection to the project
+               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+               ProjectView projectView = (ProjectView) page.getActivePart();
 
-               return null;
-       }
+               if (projectView != null) {
+                       projectView.selectExperiment(fExperiment);
+               }
 
-       public void dispose() {
-               // TODO Auto-generated method stub
+               return null;
        }
 
        // ------------------------------------------------------------------------
@@ -72,4 +92,9 @@ public class OpenExperimentHandler implements IHandler {
                // TODO Auto-generated method stub
        }
 
+       public void dispose() {
+               // TODO Auto-generated method stub
+               
+       }
+
 }
This page took 0.026766 seconds and 5 git commands to generate.