summaryrefslogtreecommitdiff
path: root/platform/lang-impl/src/com/intellij/execution
diff options
context:
space:
mode:
Diffstat (limited to 'platform/lang-impl/src/com/intellij/execution')
-rw-r--r--platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java128
-rw-r--r--platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesComponent.java142
-rw-r--r--platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java158
-rw-r--r--platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java11
-rw-r--r--platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java7
-rw-r--r--platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java10
-rw-r--r--platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java10
-rw-r--r--platform/lang-impl/src/com/intellij/execution/runners/DefaultProgramRunner.java10
-rw-r--r--platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java25
9 files changed, 407 insertions, 94 deletions
diff --git a/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java b/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java
index a4764dae0036..0c11e71e5886 100644
--- a/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java
+++ b/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java
@@ -30,6 +30,7 @@ import com.intellij.ide.util.PropertiesComponent;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.ListPopupStep;
@@ -919,35 +920,77 @@ public class ChooseRunConfigurationPopup implements ExecutorProvider {
}
}
- public static ItemWrapper[] createSettingsList(@NotNull final Project project, @NotNull ExecutorProvider executorProvider, boolean createEditAction) {
- final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
+ public static ItemWrapper[] createSettingsList(@NotNull Project project, @NotNull ExecutorProvider executorProvider, boolean createEditAction) {
+ List<ItemWrapper> result = new ArrayList<ItemWrapper>();
- final List<ItemWrapper> result = new ArrayList<ItemWrapper>();
+ if (createEditAction) {
+ ItemWrapper<Void> edit = new ItemWrapper<Void>(null) {
+ @Override
+ public Icon getIcon() {
+ return AllIcons.Actions.EditSource;
+ }
- final RunnerAndConfigurationSettings selectedConfiguration = manager.getSelectedConfiguration();
+ @Override
+ public String getText() {
+ return UIUtil.removeMnemonic(ActionsBundle.message("action.editRunConfigurations.text"));
+ }
+ @Override
+ public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
+ if (new EditConfigurationsDialog(project) {
+ @Override
+ protected void init() {
+ setOKButtonText(executor.getStartActionText());
+ setOKButtonIcon(executor.getIcon());
+ myExecutor = executor;
+ super.init();
+ }
+ }.showAndGet()) {
+ ApplicationManager.getApplication().invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ RunnerAndConfigurationSettings configuration = RunManager.getInstance(project).getSelectedConfiguration();
+ if (configuration != null) {
+ ExecutionUtil.runConfiguration(configuration, executor);
+ }
+ }
+ }, project.getDisposed());
+ }
+ }
+
+ @Override
+ public boolean available(Executor executor) {
+ return true;
+ }
+ };
+ edit.setMnemonic(0);
+ result.add(edit);
+ }
+
+ RunManagerEx manager = RunManagerEx.getInstanceEx(project);
+ final RunnerAndConfigurationSettings selectedConfiguration = manager.getSelectedConfiguration();
if (selectedConfiguration != null) {
boolean isFirst = true;
final ExecutionTarget activeTarget = ExecutionTargetManager.getActiveTarget(project);
- for (final ExecutionTarget eachTarget : ExecutionTargetManager.getTargetsToChooseFor(project, selectedConfiguration)) {
+ for (ExecutionTarget eachTarget : ExecutionTargetManager.getTargetsToChooseFor(project, selectedConfiguration)) {
result.add(new ItemWrapper<ExecutionTarget>(eachTarget, isFirst) {
{
- setChecked(eachTarget.equals(activeTarget));
+ setChecked(getValue().equals(activeTarget));
}
@Override
public Icon getIcon() {
- return eachTarget.getIcon();
+ return getValue().getIcon();
}
@Override
public String getText() {
- return eachTarget.getDisplayName();
+ return getValue().getDisplayName();
}
@Override
public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
- ExecutionTargetManager.setActiveTarget(project, eachTarget);
+ ExecutionTargetManager.setActiveTarget(project, getValue());
ExecutionUtil.runConfiguration(selectedConfiguration, executor);
}
@@ -960,18 +1003,24 @@ public class ChooseRunConfigurationPopup implements ExecutorProvider {
}
}
- final Map<RunnerAndConfigurationSettings, ItemWrapper> wrappedExisting = new LinkedHashMap<RunnerAndConfigurationSettings, ItemWrapper>();
- final ConfigurationType[] types = manager.getConfigurationFactories();
- for (final ConfigurationType type : types) {
+ Map<RunnerAndConfigurationSettings, ItemWrapper> wrappedExisting = new LinkedHashMap<RunnerAndConfigurationSettings, ItemWrapper>();
+ for (ConfigurationType type : manager.getConfigurationFactories()) {
if (!(type instanceof UnknownConfigurationType)) {
Map<String, List<RunnerAndConfigurationSettings>> structure = manager.getStructure(type);
- for (final Map.Entry<String, List<RunnerAndConfigurationSettings>> entry : structure.entrySet()) {
- if (entry.getValue().isEmpty())
+ for (Map.Entry<String, List<RunnerAndConfigurationSettings>> entry : structure.entrySet()) {
+ if (entry.getValue().isEmpty()) {
continue;
+ }
+
final String key = entry.getKey();
- if (key != null){
+ if (key != null) {
boolean isSelected = entry.getValue().contains(selectedConfiguration);
- FolderWrapper folderWrapper = new FolderWrapper(project, executorProvider, key + (isSelected ? " (mnemonic is to \"" + selectedConfiguration.getName()+"\")" : ""), entry.getValue());
+ if (isSelected) {
+ assert selectedConfiguration != null;
+ }
+ FolderWrapper folderWrapper = new FolderWrapper(project, executorProvider,
+ key + (isSelected ? " (mnemonic is to \"" + selectedConfiguration.getName() + "\")" : ""),
+ entry.getValue());
if (isSelected) {
folderWrapper.setMnemonic(1);
}
@@ -992,53 +1041,6 @@ public class ChooseRunConfigurationPopup implements ExecutorProvider {
populateWithDynamicRunners(result, wrappedExisting, project, manager, selectedConfiguration);
result.addAll(wrappedExisting.values());
-
- //noinspection unchecked
- final ItemWrapper edit = new ItemWrapper(null) {
- @Override
- public Icon getIcon() {
- return AllIcons.Actions.EditSource;
- }
-
- @Override
- public String getText() {
- return UIUtil.removeMnemonic(ActionsBundle.message("action.editRunConfigurations.text"));
- }
-
- @Override
- public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
- final EditConfigurationsDialog dialog = new EditConfigurationsDialog(project) {
- @Override
- protected void init() {
- setOKButtonText(executor.getStartActionText());
- setOKButtonIcon(executor.getIcon());
- myExecutor = executor;
- super.init();
- }
- };
-
- dialog.show();
- if (dialog.isOK()) {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- ExecutionUtil.runConfiguration(RunManager.getInstance(project).getSelectedConfiguration(), executor);
- }
- });
- }
- }
-
- @Override
- public boolean available(Executor executor) {
- return true;
- }
- };
-
- edit.setMnemonic(0);
- if (createEditAction) {
- result.add(0, edit);
- }
-
return result.toArray(new ItemWrapper[result.size()]);
}
diff --git a/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesComponent.java b/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesComponent.java
new file mode 100644
index 000000000000..4375e164fed4
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesComponent.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2000-2012 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * User: anna
+ * Date: 14-May-2007
+ */
+package com.intellij.execution.configuration;
+
+import com.intellij.execution.ExecutionBundle;
+import com.intellij.openapi.ui.LabeledComponent;
+import com.intellij.openapi.ui.TextFieldWithBrowseButton;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.ui.UserActivityProviderComponent;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.EnvironmentUtil;
+import org.jdom.Element;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.event.ChangeListener;
+import java.io.File;
+import java.util.Map;
+
+public class EnvironmentVariablesComponent extends LabeledComponent<TextFieldWithBrowseButton> implements UserActivityProviderComponent {
+ @NonNls private static final String ENVS = "envs";
+ @NonNls public static final String ENV = "env";
+ @NonNls public static final String NAME = "name";
+ @NonNls public static final String VALUE = "value";
+ @NonNls private static final String OPTION = "option";
+ @NonNls private static final String ENV_VARIABLES = "ENV_VARIABLES";
+
+ private final EnvironmentVariablesTextFieldWithBrowseButton myEnvVars;
+
+ public EnvironmentVariablesComponent() {
+ super();
+ myEnvVars = new EnvironmentVariablesTextFieldWithBrowseButton();
+ setComponent(myEnvVars);
+ setText(ExecutionBundle.message("environment.variables.component.title"));
+ }
+
+ public void setEnvs(@NotNull Map<String, String> envs) {
+ myEnvVars.setEnvs(envs);
+ }
+
+ @NotNull
+ public Map<String, String> getEnvs() {
+ return myEnvVars.getEnvs();
+ }
+
+ public boolean isPassParentEnvs() {
+ return myEnvVars.isPassParentEnvs();
+ }
+
+ public void setPassParentEnvs(final boolean passParentEnvs) {
+ myEnvVars.setPassParentEnvs(passParentEnvs);
+ }
+
+ public static void readExternal(Element element, Map<String, String> envs) {
+ final Element envsElement = element.getChild(ENVS);
+ if (envsElement != null) {
+ for (Object o : envsElement.getChildren(ENV)) {
+ Element envElement = (Element)o;
+ final String envName = envElement.getAttributeValue(NAME);
+ final String envValue = envElement.getAttributeValue(VALUE);
+ if (envName != null && envValue != null) {
+ envs.put(envName, envValue);
+ }
+ }
+ } else { //compatibility with prev version
+ for (Object o : element.getChildren(OPTION)) {
+ if (Comparing.strEqual(((Element)o).getAttributeValue(NAME), ENV_VARIABLES)) {
+ splitVars(envs, ((Element)o).getAttributeValue(VALUE));
+ break;
+ }
+ }
+ }
+ }
+
+ private static void splitVars(final Map<String, String> envs, final String val) {
+ if (val != null) {
+ final String[] envVars = val.split(";");
+ for (String envVar : envVars) {
+ final int idx = envVar.indexOf('=');
+ if (idx > -1) {
+ envs.put(envVar.substring(0, idx), idx < envVar.length() - 1 ? envVar.substring(idx + 1) : "");
+ }
+ }
+ }
+ }
+
+ public static void writeExternal(Element element, Map<String, String> envs) {
+ final Element envsElement = new Element(ENVS);
+ for (String envName : envs.keySet()) {
+ final Element envElement = new Element(ENV);
+ envElement.setAttribute(NAME, envName);
+ envElement.setAttribute(VALUE, envs.get(envName));
+ envsElement.addContent(envElement);
+ }
+ element.addContent(envsElement);
+ }
+
+ /**
+ * To be removed in IDEA 15
+ * @deprecated use {@link com.intellij.util.EnvironmentUtil#inlineParentOccurrences(java.util.Map)} instead
+ */
+ @Deprecated
+ public static void inlineParentOccurrences(final Map<String, String> envs) {
+ EnvironmentUtil.inlineParentOccurrences(envs);
+ }
+
+ /**
+ * To be removed in IDEA 15
+ */
+ @Deprecated
+ public static boolean containsEnvKeySubstitution(final String envKey, final String val) {
+ return ArrayUtil.find(val.split(File.pathSeparator), "$" + envKey + "$") != -1;
+ }
+
+ @Override
+ public void addChangeListener(final ChangeListener changeListener) {
+ myEnvVars.addChangeListener(changeListener);
+ }
+
+ @Override
+ public void removeChangeListener(final ChangeListener changeListener) {
+ myEnvVars.removeChangeListener(changeListener);
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java b/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java
new file mode 100644
index 000000000000..5f3785f1de66
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.execution.configuration;
+
+import com.google.common.collect.ImmutableMap;
+import com.intellij.execution.ExecutionBundle;
+import com.intellij.execution.util.EnvVariablesTable;
+import com.intellij.execution.util.EnvironmentVariable;
+import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.ui.TextFieldWithBrowseButton;
+import com.intellij.ui.UserActivityProviderComponent;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class EnvironmentVariablesTextFieldWithBrowseButton extends TextFieldWithBrowseButton implements UserActivityProviderComponent {
+
+ private Map<String, String> myEnvs = Collections.emptyMap();
+ private boolean myPassParentEnvs;
+ private final List<ChangeListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
+
+ public EnvironmentVariablesTextFieldWithBrowseButton() {
+ super();
+ setEditable(false);
+ addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ new MyEnvironmentVariablesDialog().show();
+ }
+ });
+ }
+
+ /**
+ * @return unmodifiable Map instance, use {@link #setEnvs(java.util.Map)} to update env vars
+ */
+ @NotNull
+ public Map<String, String> getEnvs() {
+ return myEnvs;
+ }
+
+ /**
+ * @param envs Map instance with reliable user-specified iteration order,
+ * like {@link java.util.LinkedHashMap} or {@link com.google.common.collect.ImmutableMap}
+ */
+ public void setEnvs(@NotNull Map<String, String> envs) {
+ myEnvs = ImmutableMap.copyOf(envs);
+ String envsStr = stringifyEnvs(myEnvs);
+ setText(envsStr);
+ }
+
+ @NotNull
+ private static String stringifyEnvs(@NotNull Map<String, String> envs) {
+ if (envs.isEmpty()) {
+ return "";
+ }
+ StringBuilder buf = new StringBuilder();
+ for (Map.Entry<String, String> entry : envs.entrySet()) {
+ if (buf.length() > 0) {
+ buf.append(";");
+ }
+ buf.append(entry.getKey()).append("=").append(entry.getValue());
+ }
+ return buf.toString();
+ }
+
+ public boolean isPassParentEnvs() {
+ return myPassParentEnvs;
+ }
+
+ public void setPassParentEnvs(boolean passParentEnvs) {
+ if (myPassParentEnvs != passParentEnvs) {
+ myPassParentEnvs = passParentEnvs;
+ fireStateChanged();
+ }
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener changeListener) {
+ myListeners.add(changeListener);
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener changeListener) {
+ myListeners.remove(changeListener);
+ }
+
+ private void fireStateChanged() {
+ for (ChangeListener listener : myListeners) {
+ listener.stateChanged(new ChangeEvent(this));
+ }
+ }
+
+ private class MyEnvironmentVariablesDialog extends DialogWrapper {
+ private final EnvVariablesTable myEnvVariablesTable;
+ private final JCheckBox myUseDefaultCb = new JCheckBox(ExecutionBundle.message("env.vars.checkbox.title"));
+ private final JPanel myWholePanel = new JPanel(new BorderLayout());
+
+ protected MyEnvironmentVariablesDialog() {
+ super(EnvironmentVariablesTextFieldWithBrowseButton.this, true);
+ myEnvVariablesTable = new EnvVariablesTable();
+ List<EnvironmentVariable> envVariables = ContainerUtil.map(myEnvs.entrySet(), new Function<Map.Entry<String, String>, EnvironmentVariable>() {
+ @Override
+ public EnvironmentVariable fun(Map.Entry<String, String> entry) {
+ return new EnvironmentVariable(entry.getKey(), entry.getValue(), false);
+ }
+ });
+ myEnvVariablesTable.setValues(envVariables);
+ myUseDefaultCb.setSelected(isPassParentEnvs());
+ myWholePanel.add(myEnvVariablesTable.getComponent(), BorderLayout.CENTER);
+ myWholePanel.add(myUseDefaultCb, BorderLayout.SOUTH);
+ setTitle(ExecutionBundle.message("environment.variables.dialog.title"));
+ init();
+ }
+
+ @Override
+ @Nullable
+ protected JComponent createCenterPanel() {
+ return myWholePanel;
+ }
+
+ @Override
+ protected void doOKAction() {
+ myEnvVariablesTable.stopEditing();
+ final Map<String, String> envs = new LinkedHashMap<String, String>();
+ for (EnvironmentVariable variable : myEnvVariablesTable.getEnvironmentVariables()) {
+ envs.put(variable.getName(), variable.getValue());
+ }
+ setEnvs(envs);
+ setPassParentEnvs(myUseDefaultCb.isSelected());
+ super.doOKAction();
+ }
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
index 605d073945b5..3fce510e725e 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
@@ -674,7 +674,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
final Document document = myEditor.getDocument();
final RangeMarker lastProcessedOutput = document.createRangeMarker(document.getTextLength(), document.getTextLength());
final int caretOffset = myEditor.getCaretModel().getOffset();
- final boolean isAtLastLine = document.getLineNumber(caretOffset) >= document.getLineCount() - 1;
+ final boolean isAtLastLine = isCaretAtLastLine();
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
@Override
@@ -1078,6 +1078,9 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
};
if (immediately) {
model.runBatchFoldingOperation(operation);
+ if (isCaretAtLastLine()) {
+ EditorUtil.scrollToTheEnd(myEditor);
+ }
}
else {
model.runBatchFoldingOperationDoNotCollapseCaret(operation);
@@ -1092,6 +1095,12 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
}
}
+ private boolean isCaretAtLastLine() {
+ final Document document = myEditor.getDocument();
+ final int caretOffset = myEditor.getCaretModel().getOffset();
+ return document.getLineNumber(caretOffset) >= document.getLineCount() - 1;
+ }
+
private void addFolding(Document document, CharSequence chars, int line, List<FoldRegion> toAdd) {
String commandLinePlaceholder = myCommandLineFolding.getPlaceholder(line);
if (commandLinePlaceholder != null) {
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java b/platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java
index d206283375e2..265d9c3f7410 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java
@@ -26,7 +26,7 @@ public class EditConfigurationsDialog extends SingleConfigurableEditor implement
protected Executor myExecutor;
public EditConfigurationsDialog(final Project project) {
- super(project, new RunConfigurable(project), IdeModalityType.PROJECT);
+ super(project, new RunConfigurable(project), "#com.intellij.execution.impl.EditConfigurationsDialog", IdeModalityType.PROJECT);
((RunConfigurable)getConfigurable()).setRunDialog(this);
setTitle(ExecutionBundle.message("run.debug.dialog.title"));
setHorizontalStretch(1.3F);
@@ -42,11 +42,6 @@ public class EditConfigurationsDialog extends SingleConfigurableEditor implement
}
}
- @Override
- protected String getDimensionServiceKey() {
- return "#com.intellij.execution.impl.EditConfigurationsDialog";
- }
-
@Nullable
@Override
public Executor getExecutor() {
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java
index 3645439db470..95d4db09c297 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java
@@ -589,8 +589,14 @@ class RunConfigurable extends BaseConfigurable {
@Override
public JComponent createComponent() {
for (RunConfigurationsSettings each : Extensions.getExtensions(RunConfigurationsSettings.EXTENSION_POINT)) {
- UnnamedConfigurable configurable = each.createConfigurable();
- myAdditionalSettings.add(Pair.create(configurable, configurable.createComponent()));
+ try {
+ UnnamedConfigurable configurable = each.createConfigurable(myProject);
+ myAdditionalSettings.add(Pair.create(configurable, configurable.createComponent()));
+ }
+ catch (NoSuchMethodError e) {
+ // in case someone has already implemented old RunConfigurationsSettings.createConfigurable()
+ LOG.error(e);
+ }
}
myWholePanel = new JPanel(new BorderLayout());
diff --git a/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java b/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java
index 7bcabebf256a..d1c3c4877493 100644
--- a/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java
+++ b/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java
@@ -104,6 +104,13 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole
myConsoleView.attachToProcess(myProcessHandler);
// Runner creating
+ createContentDescriptorAndActions();
+
+ // Run
+ myProcessHandler.startNotify();
+ }
+
+ protected void createContentDescriptorAndActions() {
final Executor defaultExecutor = DefaultRunExecutor.getRunExecutorInstance();
final DefaultActionGroup toolbarActions = new DefaultActionGroup();
final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
@@ -134,9 +141,6 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole
panel.updateUI();
showConsole(defaultExecutor, contentDescriptor);
-
- // Run
- myProcessHandler.startNotify();
}
protected String constructConsoleTitle(final @NotNull String consoleTitle) {
diff --git a/platform/lang-impl/src/com/intellij/execution/runners/DefaultProgramRunner.java b/platform/lang-impl/src/com/intellij/execution/runners/DefaultProgramRunner.java
index 5f7321aa8068..f4cae36d1ffe 100644
--- a/platform/lang-impl/src/com/intellij/execution/runners/DefaultProgramRunner.java
+++ b/platform/lang-impl/src/com/intellij/execution/runners/DefaultProgramRunner.java
@@ -21,25 +21,19 @@ import com.intellij.execution.ExecutionResult;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
/**
* @author spleaner
*/
public abstract class DefaultProgramRunner extends GenericProgramRunner {
-
@Override
- protected RunContentDescriptor doExecute(@NotNull final Project project,
- @NotNull final RunProfileState state,
- final RunContentDescriptor contentToReuse,
- @NotNull final ExecutionEnvironment env) throws ExecutionException {
+ protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
ExecutionResult executionResult = state.execute(env.getExecutor(), this);
if (executionResult == null) {
return null;
}
- return new RunContentBuilder(executionResult, env).showRunContent(contentToReuse);
+ return new RunContentBuilder(executionResult, env).showRunContent(env.getContentToReuse());
}
-
}
diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
index b8225b0c238b..5384ea06de23 100644
--- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
+++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
@@ -290,7 +290,8 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
final ContentManager manager = ContentFactory.SERVICE.getInstance().createContentManager(this, false, myProject);
Disposer.register((Disposable)myRunnerUi, manager);
manager.getComponent();
- } else {
+ }
+ else {
final DockManager dockManager = DockManager.getInstance(myProject);
if (dockManager != null) { //default project
dockManager.register(this);
@@ -518,13 +519,15 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
@Override
public void closeAll() {
final Content[] contents = myManager.getContents();
- for (Content content : contents) {
- getStateFor(content).setWindow(0);
- }
if (myOriginal != null) {
for (Content content : contents) {
+ getStateFor(content).setWindow(0);
myOriginal.myManager.addContent(content);
- myOriginal.findCellFor(content).minimize(content);
+ GridCell cell = myOriginal.findCellFor(content);
+ if (cell != null) {
+ myOriginal.restoreContent(content.getUserData(ViewImpl.ID));
+ cell.minimize(content);
+ }
}
}
myManager.removeAllContents(false);
@@ -1373,7 +1376,6 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
}
private class MyComponent extends Wrapper.FocusHolder implements DataProvider, QuickActionProvider {
-
private boolean myWasEverAdded;
public MyComponent() {
@@ -1388,9 +1390,13 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
if (KEY.is(dataId)) {
return RunnerContentUi.this;
}
- else {
- return null;
+
+ ContentManager originalContentManager = myOriginal == null ? null : myOriginal.getContentManager();
+ JComponent originalContentComponent = originalContentManager == null ? null : originalContentManager.getComponent();
+ if (originalContentComponent instanceof DataProvider) {
+ return ((DataProvider)originalContentComponent).getData(dataId);
}
+ return null;
}
@SuppressWarnings("NullableProblems")
@@ -1839,9 +1845,6 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
public void dragOutFinished(MouseEvent event, TabInfo source) {
final Component component = event.getComponent();
final IdeFrame window = UIUtil.getParentOfType(IdeFrame.class, component);
- if (window != null) {
-
- }
mySession.process(event);
mySession = null;
}