• R/O
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision192 (tree)
Time2016-01-02 10:12:02
Authort_nakayama1971

Log Message

correct ClassCastException

Change Summary

Incremental Difference

--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/CreateJSPWorkDirectoryActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/CreateJSPWorkDirectoryActionHandler.java (nonexistent)
@@ -1,40 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import org.eclipse.core.runtime.CoreException;
9-
10-import com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin;
11-import com.sysdeo.eclipse.tomcat.TomcatProject;
12-import com.sysdeo.eclipse.tomcat.actions.TomcatActionException;
13-
14-/**
15- * CreateJSPWorkDirectoryActionDelegate
16- *
17- */
18-public class CreateJSPWorkDirectoryActionHandler extends TomcatProjectAbstractActionHandler {
19-
20- /**
21- * @see com.sysdeo.eclipse.tomcat.actions.TomcatProjectAbstractActionDelegate
22- * #doActionOn(com.sysdeo.eclipse.tomcat.TomcatProject)
23- */
24- @Override
25- public void doActionOn(final TomcatProject prj) throws CoreException {
26- prj.createWorkFolder();
27- try {
28- prj.setWorkAsSourceFolder();
29- } catch (final CoreException ex) {
30- TomcatLauncherPlugin.log(ex.getMessage());
31- }
32-
33- if (prj.getUpdateXml()) {
34- prj.updateContext();
35- } else {
36- throw new TomcatActionException(
37- TomcatLauncherPlugin.getResourceString("msg.action.updateServerXML.failed"));
38- }
39- }
40-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/RestartContextActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/RestartContextActionHandler.java (nonexistent)
@@ -1,66 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import java.io.IOException;
9-import java.net.Authenticator;
10-import java.net.HttpURLConnection;
11-import java.net.PasswordAuthentication;
12-import java.net.URL;
13-
14-import org.eclipse.core.runtime.CoreException;
15-
16-import com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin;
17-import com.sysdeo.eclipse.tomcat.TomcatProject;
18-import com.sysdeo.eclipse.tomcat.actions.TomcatActionException;
19-
20-/**
21- * RestartContextActionDelegate
22- *
23- */
24-public class RestartContextActionHandler extends TomcatProjectAbstractActionHandler {
25-
26- /**
27- * @see com.sysdeo.eclipse.tomcat.actions.TomcatProjectAbstractActionDelegate
28- * #doActionOn(com.sysdeo.eclipse.tomcat.TomcatProject)
29- */
30- @Override
31- public void doActionOn(final TomcatProject prj) throws CoreException {
32- String path = TomcatLauncherPlugin.getManagerAppUrl();
33- path += "/reload?path=" + prj.getWebPath();
34-
35- Authenticator.setDefault(new PasswordAuthenticator());
36-
37- try {
38- URL url = new URL(path);
39- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
40- connection.getContent();
41- connection.disconnect();
42- Authenticator.setDefault(null);
43-
44- } catch (final IOException e) {
45- throw new TomcatActionException(e.getMessage()
46- + "The following url was used : \n" + path
47- + "\n\nCheck manager app settings (username and password)\n\n");
48- }
49- }
50-
51- /**
52- * PasswordAuthenticator
53- *
54- */
55- static final class PasswordAuthenticator extends Authenticator {
56- /**
57- * @see java.net.Authenticator#getPasswordAuthentication()
58- */
59- @Override
60- protected PasswordAuthentication getPasswordAuthentication() {
61- String user = TomcatLauncherPlugin.getManagerAppUser();
62- String password = TomcatLauncherPlugin.getManagerAppPassword();
63- return new PasswordAuthentication(user, password.toCharArray());
64- }
65- }
66-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/RemoveTomcatContextActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/RemoveTomcatContextActionHandler.java (nonexistent)
@@ -1,34 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import org.eclipse.core.runtime.CoreException;
9-
10-import com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin;
11-import com.sysdeo.eclipse.tomcat.TomcatProject;
12-import com.sysdeo.eclipse.tomcat.actions.TomcatActionException;
13-
14-/**
15- * RemoveTomcatContextActionDelegate
16- *
17- */
18-public class RemoveTomcatContextActionHandler extends TomcatProjectAbstractActionHandler {
19-
20- /**
21- * @see com.sysdeo.eclipse.tomcat.actions.TomcatProjectAbstractActionDelegate
22- * #doActionOn(com.sysdeo.eclipse.tomcat.TomcatProject)
23- */
24- @Override
25- public void doActionOn(final TomcatProject prj) throws CoreException {
26-
27- if (prj.getUpdateXml()) {
28- prj.removeContext();
29- } else {
30- throw new TomcatActionException(
31- TomcatLauncherPlugin.getResourceString("msg.action.updateServerXML.failed"));
32- }
33- }
34-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/AddTomcatJarActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/AddTomcatJarActionHandler.java (nonexistent)
@@ -1,27 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import org.eclipse.core.runtime.CoreException;
9-
10-import com.sysdeo.eclipse.tomcat.TomcatProject;
11-
12-/**
13- * AddTomcatJarActionDelegate
14- *
15- */
16-public class AddTomcatJarActionHandler extends TomcatProjectAbstractActionHandler {
17-
18- /**
19- * @see com.sysdeo.eclipse.tomcat.actions.TomcatProjectAbstractActionDelegate
20- * #doActionOn(com.sysdeo.eclipse.tomcat.TomcatProject)
21- */
22- @Override
23- public void doActionOn(final TomcatProject prj) throws CoreException {
24- prj.addTomcatJarToProjectClasspath();
25- }
26-
27-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/StartActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/StartActionHandler.java (nonexistent)
@@ -1,83 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import org.eclipse.core.commands.ExecutionEvent;
9-import org.eclipse.core.commands.ExecutionException;
10-import org.eclipse.core.commands.IHandler;
11-import org.eclipse.core.commands.IHandlerListener;
12-import org.eclipse.core.runtime.CoreException;
13-
14-import com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin;
15-
16-/**
17- * StartActionHandler
18- *
19- */
20-public class StartActionHandler implements IHandler {
21-
22- /** IHandlerListener */
23- private IHandlerListener listener;
24-
25- /**
26- * @see org.eclipse.core.commands.IHandler#addHandlerListener(org.eclipse.core.commands.IHandlerListener)
27- */
28- @Override
29- public void addHandlerListener(final IHandlerListener handlerListener) {
30- this.listener = handlerListener;
31- }
32-
33- /**
34- * @see org.eclipse.core.commands.IHandler#dispose()
35- */
36- @Override
37- public void dispose() {
38- if (this.listener != null) {
39- this.listener = null;
40- }
41- }
42-
43- /**
44- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
45- */
46- @Override
47- public Object execute(final ExecutionEvent event) throws ExecutionException {
48- if (TomcatLauncherPlugin.checkTomcatSettingsAndWarn()) {
49- try {
50- TomcatLauncherPlugin.getTomcatBootstrap().start();
51- } catch (final CoreException ex) {
52- String msg = TomcatLauncherPlugin.getResourceString("msg.start.failed");
53- TomcatLauncherPlugin.log(msg + "/n");
54- TomcatLauncherPlugin.log(ex);
55- }
56- }
57- return null;
58- }
59-
60- /**
61- * @see org.eclipse.core.commands.IHandler#isEnabled()
62- */
63- @Override
64- public boolean isEnabled() {
65- return true;
66- }
67-
68- /**
69- * @see org.eclipse.core.commands.IHandler#isHandled()
70- */
71- @Override
72- public boolean isHandled() {
73- return true;
74- }
75-
76- /**
77- * @see org.eclipse.core.commands.IHandler#removeHandlerListener(org.eclipse.core.commands.IHandlerListener)
78- */
79- @Override
80- public void removeHandlerListener(final IHandlerListener handlerListener) {
81- this.listener = null;
82- }
83-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/ExportToWarActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/ExportToWarActionHandler.java (nonexistent)
@@ -1,40 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import java.io.IOException;
9-
10-import org.eclipse.core.runtime.CoreException;
11-
12-import com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin;
13-import com.sysdeo.eclipse.tomcat.TomcatProject;
14-import com.sysdeo.eclipse.tomcat.actions.TomcatActionException;
15-
16-/**
17- * ExportToWarActionDelegate
18- *
19- */
20-public class ExportToWarActionHandler extends TomcatProjectAbstractActionHandler {
21-
22- /**
23- * @see com.sysdeo.eclipse.tomcat.actions.TomcatProjectAbstractActionDelegate
24- * #doActionOn(com.sysdeo.eclipse.tomcat.TomcatProject)
25- */
26- @Override
27- public void doActionOn(final TomcatProject prj) throws CoreException {
28-
29- if (!prj.getWarLocation().isEmpty()) {
30- try {
31- prj.exportToWar();
32- } catch (final IOException ex) {
33- throw new TomcatActionException(ex.getMessage());
34- }
35- } else {
36- throw new TomcatActionException(
37- TomcatLauncherPlugin.getResourceString("msg.action.exportWAR.failed"));
38- }
39- }
40-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/UpdateTomcatContextActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/UpdateTomcatContextActionHandler.java (nonexistent)
@@ -1,34 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import org.eclipse.core.runtime.CoreException;
9-
10-import com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin;
11-import com.sysdeo.eclipse.tomcat.TomcatProject;
12-import com.sysdeo.eclipse.tomcat.actions.TomcatActionException;
13-
14-/**
15- * UpdateTomcatContextActionDelegate
16- *
17- */
18-public class UpdateTomcatContextActionHandler extends TomcatProjectAbstractActionHandler {
19-
20- /**
21- * @see com.sysdeo.eclipse.tomcat.actions.TomcatProjectAbstractActionDelegate
22- * #doActionOn(com.sysdeo.eclipse.tomcat.TomcatProject)
23- */
24- @Override
25- public void doActionOn(final TomcatProject prj) throws CoreException {
26-
27- if (prj.getUpdateXml()) {
28- prj.updateContext();
29- } else {
30- throw new TomcatActionException(
31- TomcatLauncherPlugin.getResourceString("msg.action.updateServerXML.failed"));
32- }
33- }
34-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/TomcatProjectAbstractActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/TomcatProjectAbstractActionHandler.java (nonexistent)
@@ -1,176 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import org.eclipse.core.commands.ExecutionEvent;
9-import org.eclipse.core.commands.ExecutionException;
10-import org.eclipse.core.commands.IHandler;
11-import org.eclipse.core.commands.IHandlerListener;
12-import org.eclipse.core.resources.IProject;
13-import org.eclipse.core.runtime.CoreException;
14-import org.eclipse.jdt.core.IJavaProject;
15-import org.eclipse.jdt.internal.ui.JavaPlugin;
16-import org.eclipse.jface.dialogs.MessageDialog;
17-import org.eclipse.jface.viewers.ISelection;
18-import org.eclipse.jface.viewers.IStructuredSelection;
19-import org.eclipse.swt.widgets.Shell;
20-import org.eclipse.ui.IWorkbenchWindow;
21-
22-import com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin;
23-import com.sysdeo.eclipse.tomcat.TomcatProject;
24-import com.sysdeo.eclipse.tomcat.actions.TomcatActionException;
25-
26-/**
27- * TomcatProjectAbstractActionDelegate
28- *
29- */
30-public abstract class TomcatProjectAbstractActionHandler implements IHandler {
31-
32- /** IHandlerListener */
33- private IHandlerListener listener;
34- /** msg */
35- private String msg;
36- /** showMessageBox */
37- private boolean showMessageBox = true;
38-
39- /**
40- * @return the showMessageBox
41- */
42- protected boolean isShowMessageBox() {
43- return this.showMessageBox;
44- }
45-
46- /**
47- * @param show the showMessageBox to set
48- */
49- protected void setShowMessageBox(final boolean show) {
50- this.showMessageBox = show;
51- }
52-
53- /**
54- * @see org.eclipse.core.commands.IHandler#dispose()
55- */
56- @Override
57- public void dispose() {
58- if (this.listener != null) {
59- this.listener = null;
60- }
61- }
62-
63- /**
64- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
65- */
66- @Override
67- public Object execute(final ExecutionEvent event) throws ExecutionException {
68- setMsgToSuccess();
69- try {
70- TomcatProject prj = getCurrentSelection();
71- if (prj != null) {
72- doActionOn(prj);
73- }
74- } catch (final TomcatActionException ex) {
75- setMsgToFail(ex.getMessage(), false);
76- } catch (final CoreException ex) {
77- TomcatLauncherPlugin.log(ex);
78- setMsgToFail(ex.getMessage(), true);
79- }
80-
81- if (this.showMessageBox) {
82- Shell shell = TomcatLauncherPlugin.getShell();
83- MessageDialog.openInformation(shell, "Tomcat", this.msg);
84- }
85- return null;
86- }
87-
88- /**
89- *
90- * @return TomcatProject
91- */
92- protected TomcatProject getCurrentSelection() {
93- return getProject();
94- }
95-
96- /**
97- *
98- * @param prj TomcatProject
99- * @throws CoreException CoreException
100- */
101- public abstract void doActionOn(final TomcatProject prj) throws CoreException;
102-
103-
104- /**
105- * @return TomcatProject
106- */
107- private TomcatProject getProject() {
108- IWorkbenchWindow win = JavaPlugin.getActiveWorkbenchWindow();
109- TomcatProject result = null;
110- if (win != null) {
111- ISelection selection = win.getSelectionService().getSelection();
112- if (selection instanceof IStructuredSelection) {
113- Object project = ((IStructuredSelection)selection).getFirstElement();
114- if (project instanceof IProject) {
115- result = TomcatProject.create((IProject)project);
116- } else if (project instanceof IJavaProject) {
117- result = TomcatProject.create((IJavaProject)project);
118- }
119- }
120- }
121- return result;
122- }
123-
124- /**
125- * Sets the msg.
126- * @param detail String
127- * @param seelog boolean
128- */
129- private void setMsgToFail(final String detail, final boolean seelog) {
130- this.msg = TomcatLauncherPlugin.getResourceString("msg.action.failed");
131- this.msg += "\n";
132- this.msg += detail;
133- if (seelog) {
134- this.msg += TomcatLauncherPlugin.getResourceString("msg.action.seelog");
135- }
136- }
137-
138- /**
139- * Sets the msg.
140- */
141- private void setMsgToSuccess() {
142- this.msg = TomcatLauncherPlugin.getResourceString("msg.action.succeeded");
143- }
144-
145- /**
146- * @see org.eclipse.core.commands.IHandler#addHandlerListener(org.eclipse.core.commands.IHandlerListener)
147- */
148- @Override
149- public void addHandlerListener(final IHandlerListener handlerListener) {
150- this.listener = handlerListener;
151- }
152-
153- /**
154- * @see org.eclipse.core.commands.IHandler#isEnabled()
155- */
156- @Override
157- public boolean isEnabled() {
158- return true;
159- }
160-
161- /**
162- * @see org.eclipse.core.commands.IHandler#isHandled()
163- */
164- @Override
165- public boolean isHandled() {
166- return true;
167- }
168-
169- /**
170- * @see org.eclipse.core.commands.IHandler#removeHandlerListener(org.eclipse.core.commands.IHandlerListener)
171- */
172- @Override
173- public void removeHandlerListener(final IHandlerListener handlerListener) {
174- this.listener = null;
175- }
176-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/RestartActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/RestartActionHandler.java (nonexistent)
@@ -1,83 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import org.eclipse.core.commands.ExecutionEvent;
9-import org.eclipse.core.commands.ExecutionException;
10-import org.eclipse.core.commands.IHandler;
11-import org.eclipse.core.commands.IHandlerListener;
12-import org.eclipse.core.runtime.CoreException;
13-
14-import com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin;
15-
16-/**
17- * RestartActionDelegate
18- *
19- */
20-public class RestartActionHandler implements IHandler {
21-
22- /** IHandlerListener */
23- private IHandlerListener listener;
24-
25- /**
26- * @see org.eclipse.core.commands.IHandler#addHandlerListener(org.eclipse.core.commands.IHandlerListener)
27- */
28- @Override
29- public void addHandlerListener(final IHandlerListener handlerListener) {
30- this.listener = handlerListener;
31- }
32-
33- /**
34- * @see org.eclipse.core.commands.IHandler#dispose()
35- */
36- @Override
37- public void dispose() {
38- if (this.listener != null) {
39- this.listener = null;
40- }
41- }
42-
43- /**
44- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
45- */
46- @Override
47- public Object execute(final ExecutionEvent event) throws ExecutionException {
48- if (TomcatLauncherPlugin.checkTomcatSettingsAndWarn()) {
49- try {
50- TomcatLauncherPlugin.getTomcatBootstrap().restart();
51- } catch (final CoreException ex) {
52- String msg = TomcatLauncherPlugin.getResourceString("msg.restart.failed");
53- TomcatLauncherPlugin.log(msg + "/n");
54- TomcatLauncherPlugin.log(ex);
55- }
56- }
57- return null;
58- }
59-
60- /**
61- * @see org.eclipse.core.commands.IHandler#isEnabled()
62- */
63- @Override
64- public boolean isEnabled() {
65- return true;
66- }
67-
68- /**
69- * @see org.eclipse.core.commands.IHandler#isHandled()
70- */
71- @Override
72- public boolean isHandled() {
73- return true;
74- }
75-
76- /**
77- * @see org.eclipse.core.commands.IHandler#removeHandlerListener(org.eclipse.core.commands.IHandlerListener)
78- */
79- @Override
80- public void removeHandlerListener(final IHandlerListener handlerListener) {
81- this.listener = null;
82- }
83-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/StopActionHandler.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/handler/StopActionHandler.java (nonexistent)
@@ -1,83 +0,0 @@
1-/*
2- * (c) Copyright Sysdeo SA 2001, 2002.
3- * All Rights Reserved.
4- */
5-
6-package com.sysdeo.eclipse.tomcat.handler;
7-
8-import org.eclipse.core.commands.ExecutionEvent;
9-import org.eclipse.core.commands.ExecutionException;
10-import org.eclipse.core.commands.IHandler;
11-import org.eclipse.core.commands.IHandlerListener;
12-import org.eclipse.core.runtime.CoreException;
13-
14-import com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin;
15-
16-/**
17- * StopActionDelegate
18- *
19- */
20-public class StopActionHandler implements IHandler {
21-
22- /** IHandlerListener */
23- private IHandlerListener listener;
24-
25- /**
26- * @see org.eclipse.core.commands.IHandler#addHandlerListener(org.eclipse.core.commands.IHandlerListener)
27- */
28- @Override
29- public void addHandlerListener(final IHandlerListener handlerListener) {
30- this.listener = handlerListener;
31- }
32-
33- /**
34- * @see org.eclipse.core.commands.IHandler#dispose()
35- */
36- @Override
37- public void dispose() {
38- if (this.listener != null) {
39- this.listener = null;
40- }
41- }
42-
43- /**
44- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
45- */
46- @Override
47- public Object execute(final ExecutionEvent event) throws ExecutionException {
48- if (TomcatLauncherPlugin.checkTomcatSettingsAndWarn()) {
49- try {
50- TomcatLauncherPlugin.getTomcatBootstrap().stop();
51- } catch (final CoreException ex) {
52- String msg = TomcatLauncherPlugin.getResourceString("msg.stop.failed");
53- TomcatLauncherPlugin.log(msg + "/n");
54- TomcatLauncherPlugin.log(ex);
55- }
56- }
57- return null;
58- }
59-
60- /**
61- * @see org.eclipse.core.commands.IHandler#isEnabled()
62- */
63- @Override
64- public boolean isEnabled() {
65- return true;
66- }
67-
68- /**
69- * @see org.eclipse.core.commands.IHandler#isHandled()
70- */
71- @Override
72- public boolean isHandled() {
73- return true;
74- }
75-
76- /**
77- * @see org.eclipse.core.commands.IHandler#removeHandlerListener(org.eclipse.core.commands.IHandlerListener)
78- */
79- @Override
80- public void removeHandlerListener(final IHandlerListener handlerListener) {
81- this.listener = null;
82- }
83-}
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/actions/StartActionDelegate.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/actions/StartActionDelegate.java (revision 192)
@@ -5,6 +5,9 @@
55
66 package com.sysdeo.eclipse.tomcat.actions;
77
8+import org.eclipse.core.commands.AbstractHandler;
9+import org.eclipse.core.commands.ExecutionEvent;
10+import org.eclipse.core.commands.ExecutionException;
811 import org.eclipse.core.runtime.CoreException;
912 import org.eclipse.jface.action.IAction;
1013 import org.eclipse.jface.viewers.ISelection;
@@ -17,7 +20,7 @@
1720 * StartActionDelegate
1821 *
1922 */
20-public class StartActionDelegate implements IWorkbenchWindowActionDelegate {
23+public class StartActionDelegate extends AbstractHandler implements IWorkbenchWindowActionDelegate {
2124
2225 /** IWorkbenchWindow */
2326 private IWorkbenchWindow window;
@@ -50,6 +53,31 @@
5053 */
5154 @Override
5255 public void run(final IAction action) {
56+ start();
57+ }
58+
59+ /**
60+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(
61+ * org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
62+ */
63+ @Override
64+ public void selectionChanged(final IAction action, final ISelection selection) {
65+ return;
66+ }
67+
68+ /**
69+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
70+ */
71+ @Override
72+ public Object execute(final ExecutionEvent event) throws ExecutionException {
73+ start();
74+ return null;
75+ }
76+
77+ /**
78+ * start
79+ */
80+ private static void start() {
5381 if (TomcatLauncherPlugin.checkTomcatSettingsAndWarn()) {
5482 try {
5583 TomcatLauncherPlugin.getTomcatBootstrap().start();
@@ -60,13 +88,4 @@
6088 }
6189 }
6290 }
63-
64- /**
65- * @see org.eclipse.ui.IActionDelegate#selectionChanged(
66- * org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
67- */
68- @Override
69- public void selectionChanged(final IAction action, final ISelection selection) {
70- return;
71- }
7291 }
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/actions/TomcatProjectAbstractActionDelegate.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/actions/TomcatProjectAbstractActionDelegate.java (revision 192)
@@ -5,6 +5,9 @@
55
66 package com.sysdeo.eclipse.tomcat.actions;
77
8+import org.eclipse.core.commands.AbstractHandler;
9+import org.eclipse.core.commands.ExecutionEvent;
10+import org.eclipse.core.commands.ExecutionException;
811 import org.eclipse.core.resources.IProject;
912 import org.eclipse.core.runtime.CoreException;
1013 import org.eclipse.jdt.core.IJavaProject;
@@ -24,7 +27,8 @@
2427 * TomcatProjectAbstractActionDelegate
2528 *
2629 */
27-public abstract class TomcatProjectAbstractActionDelegate implements IWorkbenchWindowActionDelegate {
30+public abstract class TomcatProjectAbstractActionDelegate
31+ extends AbstractHandler implements IWorkbenchWindowActionDelegate {
2832
2933 /** IWorkbenchWindow */
3034 private IWorkbenchWindow window;
@@ -75,23 +79,16 @@
7579 */
7680 @Override
7781 public void run(final IAction action) {
78- setMsgToSuccess();
79- try {
80- TomcatProject prj = getCurrentSelection();
81- if (prj != null) {
82- doActionOn(prj);
83- }
84- } catch (final TomcatActionException ex) {
85- setMsgToFail(ex.getMessage(), false);
86- } catch (final CoreException ex) {
87- TomcatLauncherPlugin.log(ex);
88- setMsgToFail(ex.getMessage(), true);
89- }
82+ doAction();
83+ }
9084
91- if (this.showMessageBox) {
92- Shell shell = TomcatLauncherPlugin.getShell();
93- MessageDialog.openInformation(shell, "Tomcat", this.msg);
94- }
85+ /**
86+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
87+ */
88+ @Override
89+ public Object execute(final ExecutionEvent event) throws ExecutionException {
90+ doAction();
91+ return null;
9592 }
9693
9794 /**
@@ -120,6 +117,29 @@
120117
121118
122119 /**
120+ * callAction
121+ */
122+ protected void doAction() {
123+ setMsgToSuccess();
124+ try {
125+ TomcatProject prj = getCurrentSelection();
126+ if (prj != null) {
127+ doActionOn(prj);
128+ }
129+ } catch (final TomcatActionException ex) {
130+ setMsgToFail(ex.getMessage(), false);
131+ } catch (final CoreException ex) {
132+ TomcatLauncherPlugin.log(ex);
133+ setMsgToFail(ex.getMessage(), true);
134+ }
135+
136+ if (this.showMessageBox) {
137+ Shell shell = TomcatLauncherPlugin.getShell();
138+ MessageDialog.openInformation(shell, "Tomcat", this.msg);
139+ }
140+ }
141+
142+ /**
123143 * @return TomcatProject
124144 */
125145 private TomcatProject getProject() {
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/actions/RestartActionDelegate.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/actions/RestartActionDelegate.java (revision 192)
@@ -5,6 +5,9 @@
55
66 package com.sysdeo.eclipse.tomcat.actions;
77
8+import org.eclipse.core.commands.AbstractHandler;
9+import org.eclipse.core.commands.ExecutionEvent;
10+import org.eclipse.core.commands.ExecutionException;
811 import org.eclipse.core.runtime.CoreException;
912 import org.eclipse.jface.action.IAction;
1013 import org.eclipse.jface.viewers.ISelection;
@@ -17,7 +20,7 @@
1720 * RestartActionDelegate
1821 *
1922 */
20-public class RestartActionDelegate implements IWorkbenchWindowActionDelegate {
23+public class RestartActionDelegate extends AbstractHandler implements IWorkbenchWindowActionDelegate {
2124
2225 /** IWorkbenchWindow */
2326 private IWorkbenchWindow window;
@@ -50,6 +53,31 @@
5053 */
5154 @Override
5255 public void run(final IAction action) {
56+ restart();
57+ }
58+
59+ /**
60+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(
61+ * org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
62+ */
63+ @Override
64+ public void selectionChanged(final IAction action, final ISelection selection) {
65+ return;
66+ }
67+
68+ /**
69+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
70+ */
71+ @Override
72+ public Object execute(final ExecutionEvent event) throws ExecutionException {
73+ restart();
74+ return null;
75+ }
76+
77+ /**
78+ * restart
79+ */
80+ private static void restart() {
5381 if (TomcatLauncherPlugin.checkTomcatSettingsAndWarn()) {
5482 try {
5583 TomcatLauncherPlugin.getTomcatBootstrap().restart();
@@ -60,13 +88,4 @@
6088 }
6189 }
6290 }
63-
64- /**
65- * @see org.eclipse.ui.IActionDelegate#selectionChanged(
66- * org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
67- */
68- @Override
69- public void selectionChanged(final IAction action, final ISelection selection) {
70- return;
71- }
7291 }
--- trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/actions/StopActionDelegate.java (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/actions/StopActionDelegate.java (revision 192)
@@ -5,6 +5,9 @@
55
66 package com.sysdeo.eclipse.tomcat.actions;
77
8+import org.eclipse.core.commands.AbstractHandler;
9+import org.eclipse.core.commands.ExecutionEvent;
10+import org.eclipse.core.commands.ExecutionException;
811 import org.eclipse.core.runtime.CoreException;
912 import org.eclipse.jface.action.IAction;
1013 import org.eclipse.jface.viewers.ISelection;
@@ -17,7 +20,7 @@
1720 * StopActionDelegate
1821 *
1922 */
20-public class StopActionDelegate implements IWorkbenchWindowActionDelegate {
23+public class StopActionDelegate extends AbstractHandler implements IWorkbenchWindowActionDelegate {
2124
2225 /** IWorkbenchWindow */
2326 private IWorkbenchWindow window;
@@ -50,6 +53,31 @@
5053 */
5154 @Override
5255 public void run(final IAction action) {
56+ stop();
57+ }
58+
59+ /**
60+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(
61+ * org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
62+ */
63+ @Override
64+ public void selectionChanged(final IAction action, final ISelection selection) {
65+ return;
66+ }
67+
68+ /**
69+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
70+ */
71+ @Override
72+ public Object execute(final ExecutionEvent event) throws ExecutionException {
73+ stop();
74+ return null;
75+ }
76+
77+ /**
78+ * stop
79+ */
80+ private static void stop() {
5381 if (TomcatLauncherPlugin.checkTomcatSettingsAndWarn()) {
5482 try {
5583 TomcatLauncherPlugin.getTomcatBootstrap().stop();
@@ -60,13 +88,4 @@
6088 }
6189 }
6290 }
63-
64- /**
65- * @see org.eclipse.ui.IActionDelegate#selectionChanged(
66- * org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
67- */
68- @Override
69- public void selectionChanged(final IAction action, final ISelection selection) {
70- return;
71- }
7291 }
--- trunk/plugin/com.sysdeo.eclipse.tomcat/plugin.xml (revision 191)
+++ trunk/plugin/com.sysdeo.eclipse.tomcat/plugin.xml (revision 192)
@@ -25,15 +25,15 @@
2525 <extension point="org.eclipse.ui.handlers">
2626 <handler
2727 commandId="com.sysdeo.eclipse.tomcat.start"
28- class="com.sysdeo.eclipse.tomcat.handler.StartActionHandler"
28+ class="com.sysdeo.eclipse.tomcat.actions.StartActionDelegate"
2929 />
3030 <handler
3131 commandId="com.sysdeo.eclipse.tomcat.stop"
32- class="com.sysdeo.eclipse.tomcat.handler.StopActionHandler"
32+ class="com.sysdeo.eclipse.tomcat.actions.StopActionDelegate"
3333 />
3434 <handler
3535 commandId="com.sysdeo.eclipse.tomcat.restart"
36- class="com.sysdeo.eclipse.tomcat.handler.RestartActionHandler"
36+ class="com.sysdeo.eclipse.tomcat.actions.RestartActionDelegate"
3737 />
3838 </extension>
3939
@@ -197,27 +197,27 @@
197197 <extension point="org.eclipse.ui.handlers">
198198 <handler
199199 commandId="com.sysdeo.eclipse.tomcat.createWork"
200- class="com.sysdeo.eclipse.tomcat.handler.CreateJSPWorkDirectoryActionHandler"
200+ class="com.sysdeo.eclipse.tomcat.actions.CreateJSPWorkDirectoryActionDelegate"
201201 />
202202 <handler
203203 commandId="com.sysdeo.eclipse.tomcat.addTomcatJar"
204- class="com.sysdeo.eclipse.tomcat.handler.AddTomcatJarActionHandler"
204+ class="com.sysdeo.eclipse.tomcat.actions.AddTomcatJarActionDelegate"
205205 />
206206 <handler
207207 commandId="com.sysdeo.eclipse.tomcat.updateContext"
208- class="com.sysdeo.eclipse.tomcat.handler.UpdateTomcatContextActionHandler"
208+ class="com.sysdeo.eclipse.tomcat.actions.UpdateTomcatContextActionDelegate"
209209 />
210210 <handler
211211 commandId="com.sysdeo.eclipse.tomcat.removeContext"
212- class="com.sysdeo.eclipse.tomcat.handler.RemoveTomcatContextActionHandler"
212+ class="com.sysdeo.eclipse.tomcat.actions.RemoveTomcatContextActionDelegate"
213213 />
214214 <handler
215215 commandId="com.sysdeo.eclipse.tomcat.exportToWar"
216- class="com.sysdeo.eclipse.tomcat.handler.ExportToWarActionHandler"
216+ class="com.sysdeo.eclipse.tomcat.actions.ExportToWarActionDelegate"
217217 />
218218 <handler
219219 commandId="com.sysdeo.eclipse.tomcat.restartContext"
220- class="com.sysdeo.eclipse.tomcat.handler.RestartContextActionHandler"
220+ class="com.sysdeo.eclipse.tomcat.actions.RestartContextActionDelegate"
221221 />
222222 </extension>
223223