Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaverdova Elena
2016-05-06 14:38:15 +03:00
7 changed files with 90 additions and 26 deletions
+10 -1
View File
@@ -316,6 +316,7 @@ Page custom uninstallOldVersionDialog
Var productDir
Var control_fields
Var max_fields
Var runProductAfterInstall
!ifdef LICENSE_FILE
!insertmacro MUI_PAGE_LICENSE "$(myLicenseData)"
@@ -348,7 +349,13 @@ InstallDir "$PROGRAMFILES\${MANUFACTURER}\${PRODUCT_WITH_VER}"
BrandingText " "
Function PageFinishRun
!insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\bin\${PRODUCT_EXE_FILE}" "" "" ""
StrCmp $runProductAfterInstall "64" runExe64 runExe32
runExe64:
!insertmacro UAC_AsUser_ExecShell "" "${PRODUCT_EXE_FILE_64}" "" "$INSTDIR\bin" ""
goto done
runExe32:
!insertmacro UAC_AsUser_ExecShell "" "${PRODUCT_EXE_FILE}" "" "$INSTDIR\bin" ""
done:
FunctionEnd
;------------------------------------------------------------------------------
@@ -686,11 +693,13 @@ Section "IDEA Files" CopyIdeaFiles
; create shortcuts
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 2" "State"
StrCmp $R2 1 "" exe_64
StrCpy $runProductAfterInstall "32"
CreateShortCut "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}.lnk" \
"$INSTDIR\bin\${PRODUCT_EXE_FILE}" "" "" "" SW_SHOWNORMAL
exe_64:
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 3" "State"
StrCmp $R2 1 "" skip_desktop_shortcut
StrCpy $runProductAfterInstall "64"
CreateShortCut "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}(64).lnk" \
"$INSTDIR\bin\${PRODUCT_EXE_FILE_64}" "" "" "" SW_SHOWNORMAL
@@ -31,6 +31,7 @@ import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.RunContentManager;
import com.intellij.execution.ui.RunContentManagerImpl;
import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.ide.SaveAndSyncHandler;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataContext;
@@ -389,7 +390,7 @@ public class ExecutionManagerImpl extends ExecutionManager implements Disposable
}
project.getMessageBus().syncPublisher(EXECUTION_TOPIC).processStarted(executor.getId(), environment, processHandler);
started = true;
processHandler.addProcessListener(new ProcessExecutionListener(project, profile, processHandler));
processHandler.addProcessListener(new ProcessExecutionListener(project, profile, processHandler, descriptor));
}
environment.setContentToReuse(descriptor);
}
@@ -567,16 +568,30 @@ public class ExecutionManagerImpl extends ExecutionManager implements Disposable
private final Project myProject;
private final RunProfile myProfile;
private final ProcessHandler myProcessHandler;
private final RunContentDescriptor myDescriptor;
public ProcessExecutionListener(Project project, RunProfile profile, ProcessHandler processHandler) {
public ProcessExecutionListener(@NotNull Project project,
@NotNull RunProfile profile,
@NotNull ProcessHandler processHandler,
@NotNull RunContentDescriptor descriptor) {
myProject = project;
myProfile = profile;
myProcessHandler = processHandler;
myDescriptor = descriptor;
}
@Override
public void processTerminated(ProcessEvent event) {
if (myProject.isDisposed()) return;
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
RunnerLayoutUi ui = myDescriptor.getRunnerLayoutUi();
if (ui != null && !ui.isDisposed()) {
ui.updateActionsNow();
}
}
}, ModalityState.any());
myProject.getMessageBus().syncPublisher(EXECUTION_TOPIC).processTerminated(myProfile, myProcessHandler);
@@ -24,7 +24,9 @@ import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Conditions;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.LightPlatformTestCase;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -91,14 +93,31 @@ public class ExecutionManagerTest extends LightPlatformTestCase {
@NotNull
private static FakeProcessHandler getProcessHandler(@NotNull ExecutionManagerImpl executionManager) {
List<RunContentDescriptor> descriptors = executionManager.getRunningDescriptors(Conditions.alwaysTrue());
assertEquals(1, descriptors.size());
String actualDescriptorsMsg = stringifyDescriptors(descriptors);
assertEquals(actualDescriptorsMsg, 1, descriptors.size());
RunContentDescriptor descriptor = ContainerUtil.getFirstItem(descriptors);
assertNotNull(descriptor);
assertNotNull(actualDescriptorsMsg, descriptor);
ProcessHandler processHandler = descriptor.getProcessHandler();
assertNotNull(processHandler);
assertNotNull(actualDescriptorsMsg, processHandler);
return (FakeProcessHandler)processHandler;
}
@NotNull
private static String stringifyDescriptors(@NotNull List<RunContentDescriptor> descriptors) {
return "Actual descriptors: " + StringUtil.join(descriptors, new Function<RunContentDescriptor, String>() {
@Override
public String fun(RunContentDescriptor descriptor) {
if (descriptor == null) {
return "null";
}
ProcessHandler processHandler = descriptor.getProcessHandler();
return String.format("[%s, %s]",
descriptor.getDisplayName(),
processHandler != null ? processHandler.getClass().getName() : null);
}
}, ", ");
}
@NotNull
private static ExecutionEnvironment createEnv(@NotNull Project project, @NotNull RunnerAndConfigurationSettings settings) {
return new ExecutionEnvironmentBuilder(project, DefaultRunExecutor.getRunExecutorInstance())
@@ -19,6 +19,7 @@ package com.intellij.execution.process;
import com.intellij.execution.process.impl.ProcessListUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jvnet.winp.WinProcess;
@@ -27,17 +28,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/******************************************************************************
* Copyright (C) 2013 Fabio Zadrozny
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Fabio Zadrozny <fabiofz@gmail.com> - initial API and implementation
******************************************************************************/
public class OSProcessUtil {
private static final Logger LOG = Logger.getInstance(OSProcessUtil.class);
@@ -49,8 +39,12 @@ public class OSProcessUtil {
public static boolean killProcessTree(@NotNull Process process) {
if (SystemInfo.isWindows) {
try {
WinProcess winProcess = createWinProcess(process);
winProcess.killRecursively();
if (Registry.is("disable.winp")) {
WinProcessManager.kill(process, true);
}
else {
createWinProcess(process).killRecursively();
}
return true;
}
catch (Throwable e) {
@@ -66,8 +60,12 @@ public class OSProcessUtil {
public static void killProcess(@NotNull Process process) {
if (SystemInfo.isWindows) {
try {
WinProcess winProcess = createWinProcess(process);
winProcess.kill();
if (Registry.is("disable.winp")) {
WinProcessManager.kill(process, false);
}
else {
createWinProcess(process).kill();
}
}
catch (Throwable e) {
LOG.info("Cannot kill process", e);
@@ -77,11 +75,16 @@ public class OSProcessUtil {
UnixProcessManager.sendSignal(UnixProcessManager.getProcessPid(process), UnixProcessManager.SIGKILL);
}
}
public static int getProcessID(@NotNull Process process) {
if (SystemInfo.isWindows) {
try {
return createWinProcess(process).getPid();
if (Registry.is("disable.winp")) {
WinProcessManager.getProcessPid(process);
}
else {
return createWinProcess(process).getPid();
}
}
catch (Throwable e) {
LOG.info("Cannot get process id", e);
@@ -5,6 +5,7 @@ import com.intellij.openapi.application.impl.LaterInvocator
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.registry.Registry
import com.intellij.psi.impl.DebugUtil
import com.intellij.testFramework.LightPlatformTestCase
import com.intellij.testFramework.LoggedErrorProcessor
import com.intellij.util.ui.UIUtil
@@ -188,8 +189,12 @@ class TransactionTest extends LightPlatformTestCase {
guard.submitTransaction testRootDisposable, id, { log << '5' }
def nestedId = guard.contextTransaction
SwingUtilities.invokeLater {
guard.submitTransaction testRootDisposable, nestedId, { log << '3' }
assert log == ['1', '2']
String trace = null
guard.submitTransaction testRootDisposable, nestedId, {
trace = DebugUtil.currentStackTrace()
log << '3'
}
assert log == ['1', '2'] : log + " " + trace
}
UIUtil.dispatchAllInvocationEvents()
}
@@ -499,6 +499,7 @@ editor.injected.highlighting.enabled.description=Disables injected fragments hig
run.processes.with.pty=false
kill.windows.processes.softly=false
output.reader.blocking.mode=false
disable.winp=false
ide.certificate.manager=true
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 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.
@@ -20,6 +20,8 @@ import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.WinNT;
import java.io.IOException;
/**
* @author Alexey.Ushakov
*/
@@ -49,4 +51,14 @@ public class WinProcessManager {
throw new IllegalStateException("Unknown Process implementation");
}
}
/**
* Force kill a process (tree)
* @param process Windows process
* @param tree true to also kill all subprocesses
*/
public static void kill(Process process, boolean tree) throws IOException, InterruptedException {
int pid = getProcessPid(process);
Runtime.getRuntime().exec("taskkill /PID " + pid + (tree ? " /t" : "") + " /f").waitFor();
}
}