diff --git a/platform/platform-impl/src/com/intellij/idea/SocketLock.java b/platform/platform-impl/src/com/intellij/idea/SocketLock.java index da9053d98511..c629d3f2d37a 100644 --- a/platform/platform-impl/src/com/intellij/idea/SocketLock.java +++ b/platform/platform-impl/src/com/intellij/idea/SocketLock.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package com.intellij.idea; +import com.intellij.openapi.application.JetBrainsProtocolHandler; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.io.FileUtil; @@ -189,6 +190,7 @@ public final class SocketLock { @NotNull private static ActivateStatus tryActivate(int portNumber, @NotNull Collection paths, @NotNull String[] args) { log("trying: port=%s", portNumber); + args = checkForJetBrainsProtocolCommand(args); try { Socket socket = new Socket(NetUtils.getLoopbackAddress(), portNumber); try { @@ -245,6 +247,14 @@ public final class SocketLock { return ActivateStatus.NO_INSTANCE; } + private static String[] checkForJetBrainsProtocolCommand(String[] args) { + final String jbUrl = System.getProperty(JetBrainsProtocolHandler.class.getName()); + if (jbUrl != null) { + return new String[]{jbUrl}; + } + return args; + } + private static class MyChannelInboundHandler extends MessageDecoder { private enum State {HEADER, CONTENT}