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.String
APPLE_APP_PATH
private static java.lang.String
APPLE_OSASCRIPT
private static java.util.List<java.lang.String>
cmd
private static java.lang.String
RESTART_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 void
actionPerformed(java.awt.event.ActionEvent e)
private static void
addVMArguments(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 defaultButtonSpec
instances for this action (Restart/Cancel).static HelpAwareOptionPane.ButtonSpec
getCancelButtonSpec()
Returns a newButtonSpec
instance that do not perform this action.private static java.util.List<java.lang.String>
getCommands()
private static java.lang.String
getJavaRuntime()
static HelpAwareOptionPane.ButtonSpec
getRestartButtonSpec()
Returns a newButtonSpec
instance that performs this action.private static boolean
isDebugSimulation()
private static boolean
isExecutableFile(java.io.File f)
static boolean
isRestartSupported()
Determines if restarting the application should be possible on this platform.private static void
logEnvironment()
private static void
logEnvironmentVariable(java.lang.String var)
static void
restartJOSM()
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:
true
if the mandatory system propertysun.java.command
is defined,false
otherwise.- 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 newButtonSpec
instance that performs this action.- Returns:
- A new
ButtonSpec
instance that performs this action.
-
getCancelButtonSpec
public static HelpAwareOptionPane.ButtonSpec getCancelButtonSpec()
Returns a newButtonSpec
instance that do not perform this action.- Returns:
- A new
ButtonSpec
instance that do not perform this action.
-
getButtonSpecs
public static HelpAwareOptionPane.ButtonSpec[] getButtonSpecs()
Returns defaultButtonSpec
instances for this action (Restart/Cancel).- Returns:
- Default
ButtonSpec
instances for this action. - See Also:
getRestartButtonSpec()
,getCancelButtonSpec()
-
-