mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Create new console tab toolbar button (PY-14513).
This commit is contained in:
@@ -280,6 +280,9 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory<PythonC
|
||||
toolbarActions.add(myHistoryController.getBrowseHistory());
|
||||
|
||||
toolbarActions.add(new ConnectDebuggerAction());
|
||||
|
||||
toolbarActions.add(new NewConsoleAction());
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
@@ -307,10 +310,21 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory<PythonC
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens console
|
||||
*/
|
||||
public void open() {
|
||||
run();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates new console tab
|
||||
*/
|
||||
public void createNewConsole() {
|
||||
run();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
@@ -393,7 +407,7 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory<PythonC
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAdditionalEnvs() {
|
||||
return addDefaultEnvironments(sdk, environmentVariables,getProject());
|
||||
return addDefaultEnvironments(sdk, environmentVariables, getProject());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -494,7 +508,7 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory<PythonC
|
||||
String line = s.nextLine();
|
||||
sb.append(line).append("\n");
|
||||
try {
|
||||
int i = Integer.parseInt(line);
|
||||
int i = Integer.parseInt(line);
|
||||
if (flag) {
|
||||
LOG.warn("Unexpected strings in output:\n" + sb.toString());
|
||||
}
|
||||
@@ -990,6 +1004,24 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory<PythonC
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class NewConsoleAction extends AnAction implements DumbAware {
|
||||
public NewConsoleAction() {
|
||||
super("New Console", "Creates new python console", AllIcons.General.Add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
PydevConsoleRunner runner = PythonConsoleRunnerFactory.getInstance().createConsoleRunner(e.getData(CommonDataKeys.PROJECT), e.getData(LangDataKeys.MODULE));
|
||||
runner.createNewConsole();
|
||||
}
|
||||
}
|
||||
|
||||
private XDebugSession connectToDebugger() throws ExecutionException {
|
||||
final ServerSocket serverSocket = PythonCommandLineState.createServerSocket();
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PythonConsoleToolWindow {
|
||||
|
||||
|
||||
public void init(final @NotNull ToolWindow toolWindow, final @NotNull RunContentDescriptor contentDescriptor) {
|
||||
addContent(toolWindow, contentDescriptor);
|
||||
setContent(toolWindow, contentDescriptor);
|
||||
|
||||
if (!myInitialized) {
|
||||
doInit(toolWindow);
|
||||
@@ -103,7 +103,7 @@ public class PythonConsoleToolWindow {
|
||||
});
|
||||
}
|
||||
|
||||
private static void addContent(ToolWindow toolWindow, RunContentDescriptor contentDescriptor) {
|
||||
private static void setContent(ToolWindow toolWindow, RunContentDescriptor contentDescriptor) {
|
||||
toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
|
||||
|
||||
Content content = toolWindow.getContentManager().findContent(contentDescriptor.getDisplayName());
|
||||
|
||||
Reference in New Issue
Block a user