Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2012-04-04 18:45:02 -0400
committerAlexander Kurtakov2012-04-04 18:45:02 -0400
commit73d8ddea5ac6f48549c7c5aeac9ec755a76233bc (patch)
tree0b69ebe531956804dd92069077aa339f64e1ad22 /changelog
parentfb3d92a51931192325a24902f19af64e03e6d410 (diff)
downloadorg.eclipse.linuxtools-73d8ddea5ac6f48549c7c5aeac9ec755a76233bc.tar.gz
org.eclipse.linuxtools-73d8ddea5ac6f48549c7c5aeac9ec755a76233bc.tar.xz
org.eclipse.linuxtools-73d8ddea5ac6f48549c7c5aeac9ec755a76233bc.zip
Simplify things a bit now that actions are not executed by the
framework.
Diffstat (limited to 'changelog')
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/ChangeLogAction.java41
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/InsertChangeLogKeyHandler.java29
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangeLogAction.java4
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java28
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitHandler.java5
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/ui/ChangeLogActionProvider.java3
6 files changed, 31 insertions, 79 deletions
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/ChangeLogAction.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/ChangeLogAction.java
index 494afc2fdd..679b8b90d5 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/ChangeLogAction.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/ChangeLogAction.java
@@ -73,11 +73,6 @@ public abstract class ChangeLogAction extends Action {
extensionManager = ChangeLogExtensionManager.getExtensionManager();
}
- public ChangeLogAction(String name) {
- super(name);
- extensionManager = ChangeLogExtensionManager.getExtensionManager();
- }
-
protected void reportErr(String msg, Exception e) {
ChangelogPlugin.getDefault().getLog().log(
new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, msg, e));
@@ -101,12 +96,6 @@ public abstract class ChangeLogAction extends Action {
}
}
- protected String returnQualifedEditor(Class<?> ClassName) {
- return ClassName.toString().substring(
- ClassName.getPackage().toString().length() - 1,
- ClassName.toString().length());
- }
-
protected IFile createChangeLog(IPath changelog) {
IWorkspaceRoot myWorkspaceRoot = getWorkspaceRoot();
IWorkbench ws = PlatformUI.getWorkbench();
@@ -289,24 +278,20 @@ public abstract class ChangeLogAction extends Action {
IEditorInput cc = null;
String WorkspaceRoot;
- try {
- IWorkspaceRoot myWorkspaceRoot = getWorkspaceRoot();
- WorkspaceRoot = myWorkspaceRoot.getLocation().toOSString();
-
- if (currentEditor instanceof MultiPageEditorPart) {
- Object ed = ((MultiPageEditorPart) currentEditor).getSelectedPage();
- if (ed instanceof IEditorPart)
- cc = ((IEditorPart) ed).getEditorInput();
- if (cc instanceof FileEditorInput)
- return (appendRoot) ? WorkspaceRoot + ((FileEditorInput) cc).getFile().getFullPath().toOSString() :
- ((FileEditorInput) cc).getFile().getFullPath().toOSString();
- }
-
- cc = currentEditor.getEditorInput();
-
- } catch(Exception e) {
- return "";
+ IWorkspaceRoot myWorkspaceRoot = getWorkspaceRoot();
+ WorkspaceRoot = myWorkspaceRoot.getLocation().toOSString();
+
+ if (currentEditor instanceof MultiPageEditorPart) {
+ Object ed = ((MultiPageEditorPart) currentEditor).getSelectedPage();
+ if (ed instanceof IEditorPart)
+ cc = ((IEditorPart) ed).getEditorInput();
+ if (cc instanceof FileEditorInput)
+ return (appendRoot) ? WorkspaceRoot + ((FileEditorInput) cc).getFile().getFullPath().toOSString() :
+ ((FileEditorInput) cc).getFile().getFullPath().toOSString();
}
+
+ cc = currentEditor.getEditorInput();
+
if (cc == null)
return "";
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/InsertChangeLogKeyHandler.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/InsertChangeLogKeyHandler.java
index 149a1fbbb5..95f88eb9df 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/InsertChangeLogKeyHandler.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/InsertChangeLogKeyHandler.java
@@ -12,7 +12,6 @@
package org.eclipse.linuxtools.internal.changelog.core.actions;
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.core.runtime.CoreException;
@@ -35,11 +34,7 @@ public class InsertChangeLogKeyHandler extends ChangeLogAction implements
private IEditorPart currentEditor;
- public InsertChangeLogKeyHandler() {
- super();
- }
-
- String getEditorName() {
+ private String getEditorName() {
if (currentEditor != null)
return returnQualifedEditor(currentEditor.getClass());
else
@@ -47,12 +42,19 @@ public class InsertChangeLogKeyHandler extends ChangeLogAction implements
}
- String getEntryFilePath() {
+ private String getEntryFilePath() {
if (currentEditor != null)
return getDocumentLocation(currentEditor, false);
else
return "";
}
+
+ private String returnQualifedEditor(Class<?> ClassName) {
+ return ClassName.toString().substring(
+ ClassName.getPackage().toString().length() - 1,
+ ClassName.toString().length());
+ }
+
IEditorPart getChangelog() {
@@ -98,14 +100,9 @@ public class InsertChangeLogKeyHandler extends ChangeLogAction implements
}
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ public Object execute(ExecutionEvent event) {
- try {
- currentEditor = HandlerUtil.getActiveEditor(event);
- } catch (Exception e) {
- // no editor is active now so do nothing
- return null;
- }
+ currentEditor = HandlerUtil.getActiveEditor(event);
// make sure an editor is selected.
if (currentEditor == null) {
@@ -189,11 +186,7 @@ public class InsertChangeLogKeyHandler extends ChangeLogAction implements
public void run(IAction action) {
- try {
execute(null);
- } catch (ExecutionException e) {
- reportErr("Executing insert changelog failed", e);
- }
}
public void selectionChanged(IAction action, ISelection selection) {
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangeLogAction.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangeLogAction.java
index 4a77a15d76..75cd0bc3e4 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangeLogAction.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangeLogAction.java
@@ -106,10 +106,6 @@ public class PrepareChangeLogAction extends ChangeLogAction {
}
}
- public PrepareChangeLogAction(String name) {
- super(name);
- }
-
private IStructuredSelection selected;
public PrepareChangeLogAction() {
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 939b76e794..31758f16fa 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
@@ -12,12 +12,10 @@
package org.eclipse.linuxtools.internal.changelog.core.actions;
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.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
@@ -43,15 +41,9 @@ import org.eclipse.ui.handlers.HandlerUtil;
* @author klee
*
*/
-public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHandler, IWorkbenchWindowActionDelegate {
+public class PrepareChangelogKeyHandler implements IHandler, IWorkbenchWindowActionDelegate {
- private IWorkbenchWindow window;
-
- public PrepareChangelogKeyHandler() {
- super();
- }
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ public Object execute(ExecutionEvent event) {
IStructuredSelection tempResult = null;
@@ -128,7 +120,7 @@ public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHand
}
final IStructuredSelection result = tempResult;
- Action exampleAction = new PrepareChangeLogAction() {
+ IAction exampleAction = new PrepareChangeLogAction() {
@Override
public void run() {
setSelection(result);
@@ -149,13 +141,8 @@ public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHand
}
public void init(IWorkbenchWindow window) {
- this.window = window;
}
- protected IWorkbenchWindow getWorkbenchWindow() {
- return window;
- }
-
/**
* Returns active shell.
*/
@@ -168,24 +155,17 @@ public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHand
}
public void run(IAction action) {
-
- try {
- execute(null);
- } catch (ExecutionException e) {
- reportErr(Messages.getString("PrepareChangeLog.ErrExecuteFailed"), e); // $NON-NLS-1$
- }
+ execute(null);
}
public void selectionChanged(IAction action, ISelection selection) {
}
- @Override
public boolean isEnabled() {
return true;
}
- @Override
public boolean isHandled() {
return true;
}
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 4633458d9c..ce11a95721 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
@@ -14,7 +14,7 @@ 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.Action;
+import org.eclipse.jface.action.IAction;
/**
*
@@ -33,8 +33,7 @@ public class PrepareCommitHandler implements IHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
- Action exampleAction;
- exampleAction = new PrepareCommitAction() {
+ IAction exampleAction = new PrepareCommitAction() {
@Override
public void run() {
//setSelection(new StructuredSelection(rm));
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/ui/ChangeLogActionProvider.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/ui/ChangeLogActionProvider.java
index 11e8fde655..50356d362c 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/ui/ChangeLogActionProvider.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/ui/ChangeLogActionProvider.java
@@ -15,7 +15,6 @@ import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.changelog.core.Messages;
import org.eclipse.linuxtools.internal.changelog.core.actions.PrepareChangeLogAction;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter;
@@ -92,7 +91,7 @@ public class ChangeLogActionProvider extends CommonActionProvider {
* selected elements: " + buffer.toString()); } };
*/
- exampleAction = new PrepareChangeLogAction(Messages.getString("ChangeLog.PrepareChangeLog")) { // $NON-NLS-1$
+ exampleAction = new PrepareChangeLogAction() {
@Override
public void run() {
setSelection((IStructuredSelection) getContext().getSelection());

Back to the top