Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2014-04-04 19:13:39 +0000
committerAlexander Kurtakov2014-05-05 18:53:46 +0000
commita64af6d3367f65caa694fb05b4af430536f40b8a (patch)
tree42d333b845590f380c30f9b8d4208f446f64d3c8 /systemtap
parent811fe0d017e479d2091663b24d7a6d46dcf5d7a9 (diff)
downloadorg.eclipse.linuxtools-a64af6d3367f65caa694fb05b4af430536f40b8a.tar.gz
org.eclipse.linuxtools-a64af6d3367f65caa694fb05b4af430536f40b8a.tar.xz
org.eclipse.linuxtools-a64af6d3367f65caa694fb05b4af430536f40b8a.zip
Systemtap: Migrate OpenFileAction to commands.
Also perform other housekeeping tasks related to migrating from actions to commands. Change-Id: I04d6e1e3a55fc90d84db524b42472e3659b5f5cd Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com> Reviewed-on: https://git.eclipse.org/r/25881 Tested-by: Hudson CI Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'systemtap')
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.properties17
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.xml45
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/localization.properties8
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/handlers/file/NewFileHandler.java (renamed from systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/NewFileAction.java)16
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/handlers/file/OpenFileHandler.java (renamed from systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java)101
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml9
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDESessionSettings.java6
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IDEHandler.java26
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java8
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java14
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/DefinitionHandler.java6
12 files changed, 119 insertions, 139 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF
index d246af4c46..cda513d662 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF
@@ -6,7 +6,7 @@ Bundle-Version: 3.0.0.qualifier
Bundle-Vendor: %bundleProvider
Bundle-Localization: plugin
Export-Package: org.eclipse.linuxtools.systemtap.ui.editor,
- org.eclipse.linuxtools.systemtap.ui.editor.actions.file
+ org.eclipse.linuxtools.systemtap.ui.editor.handlers.file
Require-Bundle: org.eclipse.core.filesystem,
org.eclipse.core.runtime,
org.eclipse.jface.text,
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.properties
index 53b4ee2232..46fde932e1 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.properties
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.properties
@@ -2,18 +2,7 @@ bundleName=SystemTap Script Editor
bundleProvider=Eclipse Linux Tools
category.file.name=File
-category.file.desc=File
-
-menu.recentFiles.name=Recent Files
-menu.recentFiles.slot0.name=1 NA
-menu.recentFiles.slot1.name=2 NA
-menu.recentFiles.slot2.name=3 NA
-menu.recentFiles.slot3.name=4 NA
-
-actionset.file.name=File Action Set
-action.open.name=&Open SystemTap File...
-action.open.desc=Open a SystemTap file
-action.new.name=&New File
-action.new.desc=Create a new file
-
+category.file.desc=File Commands
+command.open.name=Open SystemTap File...
+command.open.desc=Open a SystemTap file \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.xml b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.xml
index 0140117902..d51c61962a 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.xml
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.xml
@@ -4,8 +4,8 @@
<extension
point="org.eclipse.ui.commands">
<command
- name="%action.open.name"
- description="%action.open.desc"
+ name="%command.open.name"
+ description="%command.open.desc"
categoryId="org.eclipse.linuxtools.systemtap.ui.editor.category.file"
id="org.eclipse.linuxtools.systemtap.ui.editor.commands.file.OpenFileCommand"/>
<category
@@ -15,28 +15,29 @@
</extension>
<extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- label="%actionset.file.name"
- visible="false"
- id="org.eclipse.linuxtools.systemtap.ui.editor.FileActionSet">
- <action
- label="%action.open.name"
- id="org.eclipse.linuxtools.systemtap.ui.editor.actions.file.OpenFileAction"
- icon="icons/actions/file/open_wiz.gif"
- toolbarPath="org.eclipse.ui.workbench.file/new.ext"
- class="org.eclipse.linuxtools.systemtap.ui.editor.actions.file.OpenFileAction"
- definitionId="org.eclipse.linuxtools.systemtap.ui.editor.commands.file.OpenFileCommand"
- style="push"
- state="false"/>
- </actionSet>
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.linuxtools.systemtap.ui.editor.handlers.file.OpenFileHandler"
+ commandId="org.eclipse.linuxtools.systemtap.ui.editor.commands.file.OpenFileCommand">
+ <activeWhen>
+ <with
+ variable="activeWorkbenchWindow.activePerspective">
+ <equals value="org.eclipse.linuxtools.systemtap.ui.ide.IDEPerspective"/>
+ </with>
+ </activeWhen>
+ </handler>
</extension>
<extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="org.eclipse.linuxtools.systemtap.ui.ide.IDEPerspective">
- <actionSet id="org.eclipse.linuxtools.systemtap.ui.editor.FileActionSet"/>
- </perspectiveExtension>
+ point="org.eclipse.ui.menus">
+ <menuContribution locationURI="toolbar:org.eclipse.ui.workbench.file?before=save">
+ <command
+ commandId="org.eclipse.linuxtools.systemtap.ui.editor.commands.file.OpenFileCommand"
+ icon="icons/actions/file/open_wiz.gif"
+ label="%command.open.name">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+ </menuContribution>
</extension>
+
</plugin>
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/localization.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/localization.properties
index 2e1f145a09..ab355d9e34 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/localization.properties
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/localization.properties
@@ -1,8 +1,8 @@
PathEditorInput.Untitled=untitled
-OpenFileAction.Problem=Problem
-OpenFileAction.ProblemMessage=An error occurred when opening the file.
-OpenFileAction.OpenFile=Open File
-NewFileAction.NewFile=New File
+OpenFileHandler.Problem=Problem
+OpenFileHandler.ProblemMessage=An error occurred when opening the file.
+OpenFileHandler.OpenFile=Open File
+NewFileHandler.NewFile=New File
SimpleDocumentProvider.errorCreatingFile=Error when saving file
SimpleDocumentProvider.incorrectURL=Incorrect URL
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/NewFileAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/handlers/file/NewFileHandler.java
index 028f48d66b..eb29237454 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/NewFileAction.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/handlers/file/NewFileHandler.java
@@ -1,21 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation.
+ * Copyright (c) 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
+ * IBM Corporation - original Action implementation and API
+ * Red Hat - migration to Handler implementation
*******************************************************************************/
-package org.eclipse.linuxtools.systemtap.ui.editor.actions.file;
+package org.eclipse.linuxtools.systemtap.ui.editor.handlers.file;
import org.eclipse.linuxtools.internal.systemtap.ui.editor.Localization;
import org.eclipse.swt.SWT;
-
-public class NewFileAction extends OpenFileAction {
+/**
+ * A handler that can be used to create a new SystemTap file.
+ * @since 3.0
+ */
+public class NewFileHandler extends OpenFileHandler {
@Override
protected int dialogStyle() {
@@ -24,7 +28,7 @@ public class NewFileAction extends OpenFileAction {
@Override
protected String dialogName() {
- return Localization.getString("NewFileAction.NewFile"); //$NON-NLS-1$
+ return Localization.getString("NewFileHandler.NewFile"); //$NON-NLS-1$
}
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/handlers/file/OpenFileHandler.java
index fae9b80ca0..07bc459d21 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/handlers/file/OpenFileHandler.java
@@ -1,87 +1,78 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation.
+ * Copyright (c) 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
+ * IBM Corporation - original Action implementation and API
+ * Red Hat - migration to Handler implementation
*******************************************************************************/
-package org.eclipse.linuxtools.systemtap.ui.editor.actions.file;
+package org.eclipse.linuxtools.systemtap.ui.editor.handlers.file;
import java.io.File;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.linuxtools.internal.systemtap.ui.editor.EditorPlugin;
import org.eclipse.linuxtools.internal.systemtap.ui.editor.Localization;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
/**
- * An action used for opening Systemtap scripts from the filesystem.
- * @since 2.0
+ * A handler used for opening SystemTap scripts from the filesystem.
+ * @since 3.0
*/
-public class OpenFileAction extends Action implements IWorkbenchWindowActionDelegate {
+public class OpenFileHandler extends AbstractHandler {
private boolean successful;
- private IAction action;
+ private boolean cancelled;
+ private IWorkbenchWindow window = null;
- /**
- * @since 2.0
- */
- private IWorkbenchWindow window;
-
- public OpenFileAction() {
- super();
- setEnabled(true);
- successful = false;
- }
-
- @Override
- public void run(IAction act) {
- run();
+ public OpenFileHandler() {
}
/**
- * Queries the user for a Systemtap file to open, and opens that file's editor input.
+ * Opens the provided file's editor input, if it is a valid Systemtap file.
*/
- @Override
- public void run() {
+ public void executeOnFile(File file) {
if (window == null) {
window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
- File file = queryFile();
- if (file != null) {
+ if (file != null && file.exists() && file.getName().endsWith(".stp")) { //$NON-NLS-1$
runActions(file);
}
}
/**
- * Opens the provided file's editor input, if it is a valid Systemtap file.
- * @since 3.0
+ * Queries the user for the SystemTap file to open.
+ * @param event If execution is handled by a plugin extension, this will contain
+ * an event containing all the information about the current state of the application.
+ * To execute this code elsewhere, it is sufficient to pass <code>null</code> here.
+ *
*/
- public void run(File file) {
+ @Override
+ public Object execute(ExecutionEvent event) {
if (window == null) {
window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
- if (file != null && file.exists() && file.getName().endsWith(".stp")) { //$NON-NLS-1$
+ File file = queryFile();
+ if (file != null) {
runActions(file);
}
+ return null;
}
private void runActions(File file) {
@@ -93,15 +84,15 @@ public class OpenFileAction extends Action implements IWorkbenchWindowActionDele
successful = true;
} catch (PartInitException e) {
ErrorDialog.openError(window.getShell(),
- Localization.getString("OpenFileAction.Problem"), //$NON-NLS-1$
- Localization.getString("OpenFileAction.ProblemMessage"), //$NON-NLS-1$
+ Localization.getString("OpenFileHandler.Problem"), //$NON-NLS-1$
+ Localization.getString("OpenFileHandler.ProblemMessage"), //$NON-NLS-1$
new Status(IStatus.ERROR, EditorPlugin.ID, e.getMessage(), e));
}
}
/**
* @return The style to use for the FileDialog when querying for a file.
- * @since 3.0
+ * @since 2.2
*/
protected int dialogStyle() {
return SWT.OPEN;
@@ -109,10 +100,10 @@ public class OpenFileAction extends Action implements IWorkbenchWindowActionDele
/**
* @return The name to give to the FileDialog when querying for a file.
- * @since 3.0
+ * @since 2.2
*/
protected String dialogName() {
- return Localization.getString("OpenFileAction.OpenFile"); //$NON-NLS-1$
+ return Localization.getString("OpenFileHandler.OpenFile"); //$NON-NLS-1$
}
/**
@@ -125,38 +116,24 @@ public class OpenFileAction extends Action implements IWorkbenchWindowActionDele
dialog.setText(dialogName());
String path = dialog.open();
if (path != null && path.length() > 0) {
+ cancelled = false;
return new File(path);
}
+ cancelled = true;
return null;
}
- public boolean isSuccessful() {
- return successful;
- }
-
/**
- * @since 2.0
+ * @return <code>true</code> if the last file query was cancelled,
+ * or <code>false</code> if a file was selected.
+ * @since 2.2
*/
- @Override
- public void init(IWorkbenchWindow window) {
- this.window = window;
+ public boolean wasCancelled() {
+ return cancelled;
}
- /**
- * @since 2.0
- */
- @Override
- public void selectionChanged(IAction act, ISelection select) {
- action = act;
- action.setEnabled(true);
+ public boolean isSuccessful() {
+ return successful;
}
- /**
- * @since 2.0
- */
- @Override
- public void dispose() {
- window = null;
- action = null;
- }
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml
index 133dee4fd2..6b98fb3b9a 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml
@@ -85,13 +85,8 @@
icon="icons/actions/import_wiz.gif"
label="%action.import.name"
style="push">
- <visibleWhen>
- <with
- variable="activeWorkbenchWindow.activePerspective">
- <equals
- value="org.eclipse.linuxtools.systemtap.ui.ide.IDEPerspective">
- </equals>
- </with>
+ <visibleWhen
+ checkEnabled="true">
</visibleWhen>
</command>
</menuContribution>
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDESessionSettings.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDESessionSettings.java
index 7c71890c83..c89951ed48 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDESessionSettings.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDESessionSettings.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.STPEditor;
-import org.eclipse.linuxtools.systemtap.ui.editor.actions.file.NewFileAction;
+import org.eclipse.linuxtools.systemtap.ui.editor.handlers.file.NewFileHandler;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchPage;
@@ -171,8 +171,8 @@ public class IDESessionSettings {
}
private static STPEditor openNewFile(IWorkbenchWindow window) {
- NewFileAction action = new NewFileAction();
- action.run();
+ NewFileHandler action = new NewFileHandler();
+ action.execute(null);
if (action.isSuccessful()) {
return (STPEditor) window.getActivePage().getActiveEditor();
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IDEHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IDEHandler.java
new file mode 100644
index 0000000000..d70b78b321
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IDEHandler.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Red Hat, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.systemtap.ui.ide.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.linuxtools.internal.systemtap.ui.ide.IDEPerspective;
+import org.eclipse.ui.PlatformUI;
+
+public abstract class IDEHandler extends AbstractHandler {
+
+ @Override
+ public boolean isEnabled() {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().
+ getPerspective().getId().equals(IDEPerspective.ID);
+ }
+
+}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java
index 99f974d8b2..9beffcc308 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java
@@ -17,7 +17,6 @@ import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.Arrays;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.IDEPerspective;
import org.eclipse.linuxtools.systemtap.graphing.core.datasets.IFilteredDataSet;
@@ -40,7 +39,7 @@ import org.eclipse.ui.WorkbenchException;
* into an external file, which can be imported back in later.
* @author Andrew Ferrazzutti
*/
-public class ImportDataSetHandler extends AbstractHandler {
+public class ImportDataSetHandler extends IDEHandler {
@Override
public Object execute(ExecutionEvent event) {
@@ -85,9 +84,4 @@ public class ImportDataSetHandler extends AbstractHandler {
return null;
}
- @Override
- public boolean isEnabled() {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().
- getPerspective().getId().equals(IDEPerspective.ID);
- }
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java
index d26794f053..dc5e12a4a0 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java
@@ -1,23 +1,22 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation.
+ * Copyright (c) 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse: initial API
- * Red Hat - Andrew Ferrazzutti, Alex Kurtakov: conversion from Action to Handler
+ * IBM Corporation - original Action implementation and API
+ * Red Hat - migration to Handler implementation
*******************************************************************************/
package org.eclipse.linuxtools.internal.systemtap.ui.ide.actions;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.handlers.HandlerUtil;
-public class ImportTapsetHandler extends AbstractHandler {
+public class ImportTapsetHandler extends IDEHandler {
@Override
public Object execute(ExecutionEvent event) {
@@ -26,9 +25,4 @@ public class ImportTapsetHandler extends AbstractHandler {
return null;
}
- @Override
- public boolean isEnabled() {
- return true;
- }
-
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/DefinitionHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/DefinitionHandler.java
index c279ea24e4..8adcf78d9b 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/DefinitionHandler.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/DefinitionHandler.java
@@ -23,7 +23,7 @@ import org.eclipse.linuxtools.internal.systemtap.ui.ide.CommentRemover;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.STPEditor;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.ISearchableNode;
import org.eclipse.linuxtools.systemtap.structures.TreeDefinitionNode;
-import org.eclipse.linuxtools.systemtap.ui.editor.actions.file.OpenFileAction;
+import org.eclipse.linuxtools.systemtap.ui.editor.handlers.file.OpenFileHandler;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -41,8 +41,8 @@ public class DefinitionHandler extends AbstractHandler {
return null;
}
File file = new File(filename);
- OpenFileAction open = new OpenFileAction();
- open.run(file);
+ OpenFileHandler open = new OpenFileHandler();
+ open.executeOnFile(file);
if (open.isSuccessful() && t.getData() instanceof ISearchableNode) {
IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
STPEditor editor = (STPEditor)editorPart;

Back to the top