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">
private boolean waitForCompletion = true;
- private void selectExperiment(LTTngExperimentNode experiment) {
+ public void selectExperiment(LTTngExperimentNode experiment) {
String expId = experiment.getName();
if (fSelectedExperiment != null)
fSelectedExperiment.deregister();
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;
/**
// ------------------------------------------------------------------------
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);
}
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;
}
// ------------------------------------------------------------------------
// TODO Auto-generated method stub
}
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
}