From 099fd7ec637483c5d7996b5532c5a028211fc86f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 28 Oct 2016 16:45:12 +0200 Subject: [PATCH] Cleanup (duplicated properties) --- .../execution/runners/ProcessProxyFactoryImpl.java | 9 +++++---- .../com/intellij/execution/runners/ProcessProxyImpl.java | 7 +------ .../com/intellij/rt/execution/application/AppMain.java | 9 +++++---- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/java/execution/impl/src/com/intellij/execution/runners/ProcessProxyFactoryImpl.java b/java/execution/impl/src/com/intellij/execution/runners/ProcessProxyFactoryImpl.java index fb1b51d7bae7..ec5412fa3773 100644 --- a/java/execution/impl/src/com/intellij/execution/runners/ProcessProxyFactoryImpl.java +++ b/java/execution/impl/src/com/intellij/execution/runners/ProcessProxyFactoryImpl.java @@ -23,6 +23,7 @@ import com.intellij.execution.process.ProcessHandler; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.projectRoots.ex.JavaSdkUtil; +import com.intellij.rt.execution.application.AppMain; import java.io.File; import java.io.IOException; @@ -50,11 +51,11 @@ public class ProcessProxyFactoryImpl extends ProcessProxyFactory { JavaSdkUtil.addRtJar(javaParameters.getClassPath()); ParametersList vmParametersList = javaParameters.getVMParametersList(); - vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_PORT_NUMBER, port); - vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_BIN_PATH, binPath); + vmParametersList.defineProperty(AppMain.LAUNCHER_PORT_NUMBER, port); + vmParametersList.defineProperty(AppMain.LAUNCHER_BIN_PATH, binPath); javaParameters.getProgramParametersList().prepend(mainClass); - javaParameters.setMainClass(ProcessProxyImpl.LAUNCH_MAIN_CLASS); + javaParameters.setMainClass(AppMain.class.getName()); } else { javaParameters.getVMParametersList().add("-javaagent:" + rtJarPath + '=' + port + ':' + binPath); @@ -73,6 +74,6 @@ public class ProcessProxyFactoryImpl extends ProcessProxyFactory { @Override public ProcessProxy getAttachedProxy(ProcessHandler processHandler) { - return processHandler != null ? processHandler.getUserData(ProcessProxyImpl.KEY) : null; + return ProcessProxyImpl.KEY.get(processHandler); } } \ No newline at end of file diff --git a/java/execution/impl/src/com/intellij/execution/runners/ProcessProxyImpl.java b/java/execution/impl/src/com/intellij/execution/runners/ProcessProxyImpl.java index 4427e33c46d3..b857f5f11cd0 100644 --- a/java/execution/impl/src/com/intellij/execution/runners/ProcessProxyImpl.java +++ b/java/execution/impl/src/com/intellij/execution/runners/ProcessProxyImpl.java @@ -35,14 +35,9 @@ import java.net.ServerSocket; * @author ven */ class ProcessProxyImpl implements ProcessProxy { - public static final Key KEY = Key.create("ProcessProxyImpl"); - - public static final String PROPERTY_BIN_PATH = "idea.launcher.bin.path"; - public static final String PROPERTY_PORT_NUMBER = "idea.launcher.port"; - public static final String LAUNCH_MAIN_CLASS = "com.intellij.rt.execution.application.AppMain"; + static final Key KEY = Key.create("ProcessProxyImpl"); private final ServerSocket mySocket; - private final Object myLock = new Object(); private Writer myWriter; private int myPid; diff --git a/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java b/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java index 3222361c1773..55503e3031f0 100644 --- a/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java +++ b/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java @@ -29,8 +29,9 @@ import java.util.Locale; * @noinspection UseOfSystemOutOrSystemErr */ public class AppMain { - private static final String PROPERTY_PORT_NUMBER = "idea.launcher.port"; - private static final String PROPERTY_BIN_PATH = "idea.launcher.bin.path"; + public static final String LAUNCHER_PORT_NUMBER = "idea.launcher.port"; + public static final String LAUNCHER_BIN_PATH = "idea.launcher.bin.path"; + private static final String JAVAFX_LAUNCHER = "com.sun.javafx.application.LauncherImpl"; private static final String LAUNCH_APPLICATION_METHOD_NAME = "launchApplication"; @@ -103,8 +104,8 @@ public class AppMain { public static void main(String[] args) throws Throwable { try { - boolean helperLibLoaded = loadHelper(System.getProperty(PROPERTY_BIN_PATH)); - int portNumber = Integer.parseInt(System.getProperty(PROPERTY_PORT_NUMBER)); + boolean helperLibLoaded = loadHelper(System.getProperty(LAUNCHER_BIN_PATH)); + int portNumber = Integer.parseInt(System.getProperty(LAUNCHER_PORT_NUMBER)); startMonitor(portNumber, helperLibLoaded); } catch (Throwable t) {