diff options
Diffstat (limited to 'org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/VirtualMachineManagerImpl.java')
-rw-r--r-- | org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/VirtualMachineManagerImpl.java | 111 |
1 files changed, 62 insertions, 49 deletions
diff --git a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/VirtualMachineManagerImpl.java b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/VirtualMachineManagerImpl.java index f22453bb1..20adaaace 100644 --- a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/VirtualMachineManagerImpl.java +++ b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/VirtualMachineManagerImpl.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.jdi.internal; - import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -22,6 +21,7 @@ import java.util.List; import java.util.MissingResourceException; import java.util.PropertyResourceBundle; +import org.eclipse.jdi.internal.connect.ConnectorImpl; import org.eclipse.jdi.internal.connect.SocketAttachingConnectorImpl; import org.eclipse.jdi.internal.connect.SocketLaunchingConnectorImpl; import org.eclipse.jdi.internal.connect.SocketListeningConnectorImpl; @@ -34,20 +34,22 @@ import com.sun.jdi.connect.LaunchingConnector; import com.sun.jdi.connect.spi.Connection; /** - * this class implements the corresponding interfaces - * declared by the JDI specification. See the com.sun.jdi package - * for more information. - * + * this class implements the corresponding interfaces declared by the JDI + * specification. See the com.sun.jdi package for more information. + * */ public class VirtualMachineManagerImpl implements VirtualMachineManager { /** Major interface version. */ public static int MAJOR_INTERFACE_VERSION = 1; /** Minor interface version. */ public static int MINOR_INTERFACE_VERSION = 5; - /** PrintWriter where verbose info is written to, null if no verbose must be given. */ + /** + * PrintWriter where verbose info is written to, null if no verbose must be + * given. + */ private PrintWriter fVerbosePrintWriter = null; /** List of all VMs that are currently connected. */ - List fConnectedVMs = new ArrayList(); + List<VirtualMachineImpl> fConnectedVMs = new ArrayList<VirtualMachineImpl>(); /** True if in verbose mode. */ private boolean fVerbose = false; /** Name of verbose file. */ @@ -57,9 +59,9 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager { * Creates new VirtualMachineManagerImpl. */ public VirtualMachineManagerImpl() { - + getPreferences(); - + // See if verbose info must be given. if (fVerbose) { OutputStream out; @@ -68,7 +70,11 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager { out = new FileOutputStream(fVerboseFile); } catch (IOException e) { out = System.out; - System.out.println(JDIMessages.VirtualMachineManagerImpl_Could_not_open_verbose_file___1 + fVerboseFile + JDIMessages.VirtualMachineManagerImpl_____2 + e); // + System.out + .println(JDIMessages.VirtualMachineManagerImpl_Could_not_open_verbose_file___1 + + fVerboseFile + + JDIMessages.VirtualMachineManagerImpl_____2 + + e); // } } else { out = System.out; @@ -83,14 +89,14 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager { public int majorInterfaceVersion() { return MAJOR_INTERFACE_VERSION; } - + /** * Returns the minor version number of the JDI interface. */ public int minorInterfaceVersion() { return MINOR_INTERFACE_VERSION; } - + /** * Loads the user preferences from the jdi.ini file. */ @@ -100,16 +106,17 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager { if (url == null) { return; } - + try { InputStream stream = url.openStream(); PropertyResourceBundle prefs = new PropertyResourceBundle(stream); - - try { - fVerbose = Boolean.valueOf(prefs.getString("User.verbose")).booleanValue(); //$NON-NLS-1$ + + try { + fVerbose = Boolean + .valueOf(prefs.getString("User.verbose")).booleanValue(); //$NON-NLS-1$ } catch (MissingResourceException e) { } - + try { fVerboseFile = prefs.getString("Verbose.out"); //$NON-NLS-1$ } catch (MissingResourceException e) { @@ -117,53 +124,56 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager { } catch (IOException e) { } - + } /** - * @return Returns Timeout value for requests to VM, if not overridden for the VM. - * This value is used to throw the exception TimeoutException in JDI calls. - * NOTE: This is not in compliance with the Sun's JDI. + * @return Returns Timeout value for requests to VM, if not overridden for + * the VM. This value is used to throw the exception + * TimeoutException in JDI calls. NOTE: This is not in compliance + * with the Sun's JDI. */ public int getGlobalRequestTimeout() { try { if (JDIDebugModel.getPreferences() != null) { - return JDIDebugModel.getPreferences().getInt(JDIDebugModel.PREF_REQUEST_TIMEOUT); - } + return JDIDebugModel.getPreferences().getInt( + JDIDebugModel.PREF_REQUEST_TIMEOUT); + } // JDI plug-in is not loaded return JDIDebugModel.DEF_REQUEST_TIMEOUT; } catch (NoClassDefFoundError e) { } - // return the hard coded preference if the jdi debug plug-in does not exist + // return the hard coded preference if the jdi debug plug-in does not + // exist return 3000; } - + /** - * Adds a VM to the connected VM list. + * Adds a VM to the connected VM list. */ public void addConnectedVM(VirtualMachineImpl vm) { fConnectedVMs.add(vm); } /** - * Removes a VM from the connected VM list. + * Removes a VM from the connected VM list. */ public void removeConnectedVM(VirtualMachineImpl vm) { fConnectedVMs.remove(vm); } /** - * @return Returns all target VMs which are connected to the debugger. + * @return Returns all target VMs which are connected to the debugger. */ - public List connectedVirtualMachines() { + public List<VirtualMachineImpl> connectedVirtualMachines() { return fConnectedVMs; } /** * @return Returns all connectors. */ - public List allConnectors() { - List result = new ArrayList(attachingConnectors()); + public List<ConnectorImpl> allConnectors() { + List<ConnectorImpl> result = new ArrayList<ConnectorImpl>(attachingConnectors()); result.addAll(launchingConnectors()); result.addAll(listeningConnectors()); return result; @@ -172,53 +182,56 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager { /** * @return Returns attaching connectors. */ - public List attachingConnectors() { - ArrayList list = new ArrayList(1); + public List<SocketAttachingConnectorImpl> attachingConnectors() { + ArrayList<SocketAttachingConnectorImpl> list = new ArrayList<SocketAttachingConnectorImpl>(1); list.add(new SocketAttachingConnectorImpl(this)); return list; } - + /** * @return Returns launching connectors. */ - public List launchingConnectors() { - ArrayList list = new ArrayList(2); + public List<ConnectorImpl> launchingConnectors() { + ArrayList<ConnectorImpl> list = new ArrayList<ConnectorImpl>(2); list.add(new SocketLaunchingConnectorImpl(this)); list.add(new SocketRawLaunchingConnectorImpl(this)); return list; } - + /** * @return Returns listening connectors. */ - public List listeningConnectors() { - ArrayList list = new ArrayList(1); + public List<SocketListeningConnectorImpl> listeningConnectors() { + ArrayList<SocketListeningConnectorImpl> list = new ArrayList<SocketListeningConnectorImpl>(1); list.add(new SocketListeningConnectorImpl(this)); return list; } - + /** * @return Returns default connector. */ public LaunchingConnector defaultConnector() { return new SocketLaunchingConnectorImpl(this); } - + /** - * @return Returns PrintWriter to which verbose info must be written, or null if no verbose must be given. + * @return Returns PrintWriter to which verbose info must be written, or + * null if no verbose must be given. */ public PrintWriter verbosePrintWriter() { return fVerbosePrintWriter; } - - public VirtualMachine createVirtualMachine(Connection connection) throws IOException { - VirtualMachineImpl vmImpl = new VirtualMachineImpl(connection); + + public VirtualMachine createVirtualMachine(Connection connection) + throws IOException { + VirtualMachineImpl vmImpl = new VirtualMachineImpl(connection); return vmImpl; } - - public VirtualMachine createVirtualMachine(Connection connection, Process process) throws IOException { - VirtualMachineImpl vmImpl = new VirtualMachineImpl(connection); - vmImpl.setLaunchedProcess(process); + + public VirtualMachine createVirtualMachine(Connection connection, + Process process) throws IOException { + VirtualMachineImpl vmImpl = new VirtualMachineImpl(connection); + vmImpl.setLaunchedProcess(process); return vmImpl; } } |