| Revision | 185 (tree) |
|---|---|
| Time | 2016-01-01 18:57:43 |
| Author | t_nakayama1971 |
correct ClassCastException
| @@ -0,0 +1,83 @@ | ||
| 1 | +/* | |
| 2 | + * (c) Copyright Sysdeo SA 2001, 2002. | |
| 3 | + * All Rights Reserved. | |
| 4 | + */ | |
| 5 | + | |
| 6 | +package com.sysdeo.eclipse.tomcat.actions; | |
| 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 | +} |
| @@ -0,0 +1,83 @@ | ||
| 1 | +/* | |
| 2 | + * (c) Copyright Sysdeo SA 2001, 2002. | |
| 3 | + * All Rights Reserved. | |
| 4 | + */ | |
| 5 | + | |
| 6 | +package com.sysdeo.eclipse.tomcat.actions; | |
| 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 | +} |
| @@ -0,0 +1,83 @@ | ||
| 1 | +/* | |
| 2 | + * (c) Copyright Sysdeo SA 2001, 2002. | |
| 3 | + * All Rights Reserved. | |
| 4 | + */ | |
| 5 | + | |
| 6 | +package com.sysdeo.eclipse.tomcat.actions; | |
| 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 | +} |