Package org.openstreetmap.josm.actions
Class RestartAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.actions.JosmAction
-
- org.openstreetmap.josm.actions.RestartAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.io.Serializable,java.lang.Cloneable,java.util.EventListener,javax.swing.Action,Destroyable
public class RestartAction extends JosmAction
Restarts JOSM as it was launched. Comes from "restart" plugin, originally written by Upliner.
Mechanisms have been improved based on #8561 discussions and this article.- Since:
- 5857
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringAPPLE_APP_PATHprivate static java.lang.StringAPPLE_OSASCRIPTprivate static java.util.List<java.lang.String>cmdprivate static java.lang.StringRESTART_APPLE_SCRIPT-
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
sc
-
-
Constructor Summary
Constructors Constructor Description RestartAction()Constructs a newRestartAction.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)private static voidaddVMArguments(java.util.Collection<java.lang.String> cmd)private static java.util.List<java.lang.String>determineRestartCommands()private static java.util.List<java.lang.String>getAppleCommands()static HelpAwareOptionPane.ButtonSpec[]getButtonSpecs()Returns defaultButtonSpecinstances for this action (Restart/Cancel).static HelpAwareOptionPane.ButtonSpecgetCancelButtonSpec()Returns a newButtonSpecinstance that do not perform this action.private static java.util.List<java.lang.String>getCommands()private static java.lang.StringgetJavaRuntime()static HelpAwareOptionPane.ButtonSpecgetRestartButtonSpec()Returns a newButtonSpecinstance that performs this action.private static booleanisDebugSimulation()private static booleanisExecutableFile(java.io.File f)static booleanisRestartSupported()Determines if restarting the application should be possible on this platform.private static voidlogEnvironment()private static voidlogEnvironmentVariable(java.lang.String var)static voidrestartJOSM()Restarts the current Java application.-
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledState, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
APPLE_OSASCRIPT
private static final java.lang.String APPLE_OSASCRIPT
- See Also:
- Constant Field Values
-
APPLE_APP_PATH
private static final java.lang.String APPLE_APP_PATH
- See Also:
- Constant Field Values
-
RESTART_APPLE_SCRIPT
private static final java.lang.String RESTART_APPLE_SCRIPT
- See Also:
- Constant Field Values
-
cmd
private static final java.util.List<java.lang.String> cmd
-
-
Constructor Detail
-
RestartAction
public RestartAction()
Constructs a newRestartAction.
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
-
isRestartSupported
public static boolean isRestartSupported()
Determines if restarting the application should be possible on this platform.- Returns:
trueif the mandatory system propertysun.java.commandis defined,falseotherwise.- Since:
- 5951
-
restartJOSM
public static void restartJOSM()
Restarts the current Java application.
-
isDebugSimulation
private static boolean isDebugSimulation()
-
logEnvironment
private static void logEnvironment()
-
logEnvironmentVariable
private static void logEnvironmentVariable(java.lang.String var)
-
isExecutableFile
private static boolean isExecutableFile(java.io.File f)
-
determineRestartCommands
private static java.util.List<java.lang.String> determineRestartCommands()
-
getAppleCommands
private static java.util.List<java.lang.String> getAppleCommands() throws java.io.IOException
- Throws:
java.io.IOException
-
getCommands
private static java.util.List<java.lang.String> getCommands() throws java.io.IOException
- Throws:
java.io.IOException
-
getJavaRuntime
private static java.lang.String getJavaRuntime() throws java.io.IOException
- Throws:
java.io.IOException
-
addVMArguments
private static void addVMArguments(java.util.Collection<java.lang.String> cmd)
-
getRestartButtonSpec
public static HelpAwareOptionPane.ButtonSpec getRestartButtonSpec()
Returns a newButtonSpecinstance that performs this action.- Returns:
- A new
ButtonSpecinstance that performs this action.
-
getCancelButtonSpec
public static HelpAwareOptionPane.ButtonSpec getCancelButtonSpec()
Returns a newButtonSpecinstance that do not perform this action.- Returns:
- A new
ButtonSpecinstance that do not perform this action.
-
getButtonSpecs
public static HelpAwareOptionPane.ButtonSpec[] getButtonSpecs()
Returns defaultButtonSpecinstances for this action (Restart/Cancel).- Returns:
- Default
ButtonSpecinstances for this action. - See Also:
getRestartButtonSpec(),getCancelButtonSpec()
-
-