Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2012-04-04 22:50:47 +0000
committerAlexander Kurtakov2012-04-04 22:50:47 +0000
commit1b347699eeb9751bc1f47faaa3a57dbf9127d89a (patch)
treea6a238dc5ac70607ca8ef9afebcaa9fc165a12a1 /changelog
parent73d8ddea5ac6f48549c7c5aeac9ec755a76233bc (diff)
downloadorg.eclipse.linuxtools-1b347699eeb9751bc1f47faaa3a57dbf9127d89a.tar.gz
org.eclipse.linuxtools-1b347699eeb9751bc1f47faaa3a57dbf9127d89a.tar.xz
org.eclipse.linuxtools-1b347699eeb9751bc1f47faaa3a57dbf9127d89a.zip
Extend AbstractHandler and remove all the boilerplate.
Diffstat (limited to 'changelog')
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java46
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitHandler.java33
2 files changed, 4 insertions, 75 deletions
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java
index 31758f16fa..9a6a9614bf 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java
@@ -11,9 +11,8 @@
package org.eclipse.linuxtools.internal.changelog.core.actions;
+import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.IAction;
@@ -32,23 +31,16 @@ import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
-/**
- *
- * @author klee
- *
- */
-public class PrepareChangelogKeyHandler implements IHandler, IWorkbenchWindowActionDelegate {
+public class PrepareChangelogKeyHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) {
IStructuredSelection tempResult = null;
// try getting currently selected project
- try {
IWorkbenchPage ref = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (part instanceof IEditorPart) {
@@ -108,9 +100,6 @@ public class PrepareChangelogKeyHandler implements IHandler, IWorkbenchWindowAct
}
}
}
- } catch (Exception e) {
- tempResult = null;
- }
// If we can't find the project directly, let the user know.
if (tempResult == null) {
@@ -133,16 +122,6 @@ public class PrepareChangelogKeyHandler implements IHandler, IWorkbenchWindowAct
return null;
}
- public void addHandlerListener(IHandlerListener handlerListener) {
-
- }
-
- public void dispose() {
- }
-
- public void init(IWorkbenchWindow window) {
- }
-
/**
* Returns active shell.
*/
@@ -153,25 +132,4 @@ public class PrepareChangelogKeyHandler implements IHandler, IWorkbenchWindowAct
}
return null;
}
-
- public void run(IAction action) {
- execute(null);
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
-
- }
-
- public boolean isEnabled() {
- return true;
- }
-
- public boolean isHandled() {
- return true;
- }
-
- public void removeHandlerListener(IHandlerListener handlerListener) {
-
- }
-
}
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitHandler.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitHandler.java
index ce11a95721..9586c34103 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitHandler.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitHandler.java
@@ -10,26 +10,12 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.changelog.core.actions;
+import org.eclipse.core.commands.AbstractHandler;
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.action.IAction;
-/**
- *
- * @author klee
- *
- */
-public class PrepareCommitHandler implements IHandler {
-
- public void addHandlerListener(IHandlerListener handlerListener) {
- // TODO Auto-generated method stub
- }
-
- public void dispose() {
- // TODO Auto-generated method stub
- }
+public class PrepareCommitHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
@@ -46,19 +32,4 @@ public class PrepareCommitHandler implements IHandler {
return null;
}
- public boolean isEnabled() {
- // TODO Auto-generated method stub
- return true;
- }
-
- public boolean isHandled() {
- // TODO Auto-generated method stub
- return true;
- }
-
- public void removeHandlerListener(IHandlerListener handlerListener) {
- // TODO Auto-generated method stub
-
- }
-
}

Back to the top