Merge branch 'master' of git.labs.intellij.net:idea/ultimate

This commit is contained in:
Ekaterina Tuzova
2011-02-18 20:14:48 +03:00
7 changed files with 65 additions and 21 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ private List platformImplementationModules() {
}
private List<String> platformApiModules() {
return ["platform-api", "lvcs-api", "lang-api", "vcs-api", "usageView", "xdebugger-api", "xml-openapi", "dom-openapi"]
return ["platform-api", "lvcs-api", "lang-api", "vcs-api", "usageView", "xdebugger-api", "xml-openapi", "dom-openapi", "webide-api"]
}
def includeFile(String filepath) {
@@ -44,6 +44,8 @@ public class PydevXmlRpcClient implements IPydevXmlRpcClient {
*/
private static final Logger LOG = Logger.getInstance(PydevXmlRpcClient.class.getName());
private static final long TIME_LIMIT = 5000;
/**
* Constructor (see fields description)
@@ -79,8 +81,9 @@ public class PydevXmlRpcClient implements IPydevXmlRpcClient {
}
});
long started = System.currentTimeMillis();
//busy loop waiting for the answer (or having the console die).
while (result[0] == null) {
while (result[0] == null && System.currentTimeMillis() - started < TIME_LIMIT) {
try {
if (process != null) {
final String errStream = stdErrReader.getContents();
@@ -113,6 +116,9 @@ public class PydevXmlRpcClient implements IPydevXmlRpcClient {
}
}
}
if (result[0] == null) {
throw new XmlRpcException(-1, "Timeout while connecting to server");
}
return result[0];
}
}
+1 -1
View File
@@ -32,7 +32,7 @@
<orderEntry type="module" module-name="python-pydev" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="module" module-name="css-api" />
<orderEntry type="library" name="Groovy" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Groovy" level="project" />
</component>
<component name="copyright">
<Base>
@@ -1,9 +1,9 @@
package com.jetbrains.python.console;
import com.intellij.execution.console.LanguageConsoleImpl;
import com.intellij.execution.process.ColoredProcessHandler;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
import com.jetbrains.python.console.pydev.PydevConsoleCommunication;
import com.jetbrains.python.run.PythonProcessHandler;
import java.nio.charset.Charset;
@@ -13,13 +13,15 @@ import java.nio.charset.Charset;
*/
public class PyConsoleProcessHandler extends PythonProcessHandler {
private final LanguageConsoleImpl myLanguageConsole;
private final PydevConsoleCommunication myPydevConsoleCommunication;
public PyConsoleProcessHandler(final Process process,
final LanguageConsoleImpl languageConsole,
final String commandLine,
PydevConsoleCommunication pydevConsoleCommunication, final String commandLine,
final Charset charset) {
super(process, commandLine, charset);
myLanguageConsole = languageConsole;
myPydevConsoleCommunication = pydevConsoleCommunication;
}
@@ -42,18 +44,19 @@ public class PyConsoleProcessHandler extends PythonProcessHandler {
for (String prompt : PROMPTS) {
if (string.startsWith(prompt)) {
// Process multi prompts here
if (prompt != PyConsoleHighlightingUtil.HELP_PROMPT){
if (prompt != PyConsoleHighlightingUtil.HELP_PROMPT) {
final StringBuilder builder = new StringBuilder();
builder.append(prompt).append(prompt);
while (string.startsWith(builder.toString())){
while (string.startsWith(builder.toString())) {
builder.append(prompt);
}
final String multiPrompt = builder.toString().substring(prompt.length());
if (prompt == PyConsoleHighlightingUtil.INDENT_PROMPT){
if (prompt == PyConsoleHighlightingUtil.INDENT_PROMPT) {
prompt = multiPrompt;
}
string = string.substring(multiPrompt.length());
} else {
}
else {
string = string.substring(prompt.length());
}
@@ -68,4 +71,30 @@ public class PyConsoleProcessHandler extends PythonProcessHandler {
}
return string;
}
@Override
protected void destroyProcessImpl() {
doCloseCommunication();
super.destroyProcessImpl();
}
@Override
protected void detachProcessImpl() {
doCloseCommunication();
super.detachProcessImpl();
}
private void doCloseCommunication() {
if (myPydevConsoleCommunication != null) {
try {
myPydevConsoleCommunication.close();
// waiting for REPL communication before destroying process handler
Thread.sleep(300);
}
catch (Exception e1) {
// Ignore
}
}
}
}
@@ -3,12 +3,14 @@ package com.jetbrains.python.console;
import com.google.common.collect.ImmutableMap;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionHelper;
import com.intellij.execution.Executor;
import com.intellij.execution.console.LanguageConsoleImpl;
import com.intellij.execution.console.LanguageConsoleViewImpl;
import com.intellij.execution.process.CommandLineArgumentsProvider;
import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.execution.runners.AbstractConsoleRunnerWithHistory;
import com.intellij.execution.runners.ConsoleExecuteActionHandler;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
@@ -121,7 +123,7 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory {
@Override
protected PyConsoleProcessHandler createProcessHandler(final Process process, final String commandLine) {
myProcessHandler = new PyConsoleProcessHandler(process, getConsoleView().getConsole(), commandLine,
myProcessHandler = new PyConsoleProcessHandler(process, getConsoleView().getConsole(), myPydevConsoleCommunication, commandLine,
CharsetToolkit.UTF8_CHARSET);
return myProcessHandler;
}
@@ -185,6 +187,17 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory {
@Override
protected AnAction createStopAction() {
final AnAction generalStopAction = super.createStopAction();
return createConsoleStoppingAction(generalStopAction);
}
@Override
protected AnAction createCloseAction(Executor defaultExecutor, RunContentDescriptor myDescriptor) {
final AnAction generalCloseAction = super.createCloseAction(defaultExecutor, myDescriptor);
return createConsoleStoppingAction(generalCloseAction);
}
private AnAction createConsoleStoppingAction(final AnAction generalStopAction) {
final AnAction stopAction = new AnAction() {
@Override
public void update(AnActionEvent e) {
@@ -29,13 +29,9 @@ public class PyCompatibilityInspection extends PyInspection {
public String fromVersion = LanguageLevel.PYTHON24.toString();
public String toVersion = LanguageLevel.PYTHON27.toString();
private List<LanguageLevel> myVersionsToProcess;
public PyCompatibilityInspection () {
super();
if (ApplicationManager.getApplication().isUnitTestMode()) toVersion = LanguageLevel.PYTHON31.toString();
myVersionsToProcess = new ArrayList<LanguageLevel>();
updateVersionsToProcess();
}
@Override
@@ -43,8 +39,8 @@ public class PyCompatibilityInspection extends PyInspection {
return false;
}
private void updateVersionsToProcess() {
myVersionsToProcess.clear();
private List<LanguageLevel> updateVersionsToProcess() {
List<LanguageLevel> result = new ArrayList<LanguageLevel>();
boolean add = false;
for (String version : UnsupportedFeaturesUtil.ALL_LANGUAGE_LEVELS) {
@@ -52,12 +48,13 @@ public class PyCompatibilityInspection extends PyInspection {
if (version.equals(fromVersion))
add = true;
if (version.equals(toVersion)) {
myVersionsToProcess.add(level);
result.add(level);
add = false;
}
if (add)
myVersionsToProcess.add(level);
result.add(level);
}
return result;
}
@Nls
@@ -102,8 +99,7 @@ public class PyCompatibilityInspection extends PyInspection {
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
updateVersionsToProcess();
return new Visitor(holder, myVersionsToProcess);
return new Visitor(holder, updateVersionsToProcess());
}
private static class Visitor extends CompatibilityVisitor {
@@ -27,7 +27,7 @@ import java.util.List;
public class PythonSdkUpdater implements ProjectComponent {
private static final Logger LOG = Logger.getInstance("#com.jetbrains.python.sdk.PythonSdkUpdater");
public static int SKELETONS_VERSION = 16;
public static int SKELETONS_VERSION = 17;
public PythonSdkUpdater(final Project project, StartupManager startupManager) {
if (ApplicationManager.getApplication().isUnitTestMode()) {