summaryrefslogtreecommitdiff
path: root/platform/lang-api/src/com/intellij/execution
diff options
context:
space:
mode:
Diffstat (limited to 'platform/lang-api/src/com/intellij/execution')
-rw-r--r--platform/lang-api/src/com/intellij/execution/RunProfileStarter.java17
-rw-r--r--platform/lang-api/src/com/intellij/execution/configuration/EnvironmentVariablesComponent.java142
-rw-r--r--platform/lang-api/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java144
-rw-r--r--platform/lang-api/src/com/intellij/execution/configuration/RunConfigurationExtensionsManager.java3
-rw-r--r--platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationsSettings.java3
-rw-r--r--platform/lang-api/src/com/intellij/execution/configurations/SimpleProgramParameters.java4
-rw-r--r--platform/lang-api/src/com/intellij/execution/runners/AsyncGenericProgramRunner.java41
-rw-r--r--platform/lang-api/src/com/intellij/execution/runners/BaseProgramRunner.java7
-rw-r--r--platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java17
-rw-r--r--platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java31
10 files changed, 63 insertions, 346 deletions
diff --git a/platform/lang-api/src/com/intellij/execution/RunProfileStarter.java b/platform/lang-api/src/com/intellij/execution/RunProfileStarter.java
index 163031f956f9..00c87576ecfd 100644
--- a/platform/lang-api/src/com/intellij/execution/RunProfileStarter.java
+++ b/platform/lang-api/src/com/intellij/execution/RunProfileStarter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * 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.
@@ -28,8 +28,19 @@ import org.jetbrains.annotations.Nullable;
* @author nik
*/
public abstract class RunProfileStarter {
+ @SuppressWarnings("UnusedParameters")
+ @Deprecated
@Nullable
- public abstract RunContentDescriptor execute(@NotNull Project project, @NotNull Executor executor, @NotNull RunProfileState state,
- @Nullable RunContentDescriptor contentToReuse, @NotNull ExecutionEnvironment environment) throws ExecutionException;
+ /**
+ * @deprecated to remove in IDEA 15
+ */
+ public RunContentDescriptor execute(@NotNull Project project, @NotNull Executor executor, @NotNull RunProfileState state,
+ @Nullable RunContentDescriptor contentToReuse, @NotNull ExecutionEnvironment environment) throws ExecutionException {
+ return execute(state, environment);
+ }
+ @Nullable
+ public RunContentDescriptor execute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
+ throw new AbstractMethodError();
+ }
}
diff --git a/platform/lang-api/src/com/intellij/execution/configuration/EnvironmentVariablesComponent.java b/platform/lang-api/src/com/intellij/execution/configuration/EnvironmentVariablesComponent.java
deleted file mode 100644
index 21c7deabff9f..000000000000
--- a/platform/lang-api/src/com/intellij/execution/configuration/EnvironmentVariablesComponent.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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 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.HashMap;
-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);
- }
-
- public static void inlineParentOccurrences(final Map<String, String> envs) {
- final Map<String, String> parentParams = new HashMap<String, String>(System.getenv());
- for (String envKey : envs.keySet()) {
- final String val = envs.get(envKey);
- if (val != null) {
- final String parentVal = parentParams.get(envKey);
- if (parentVal != null && containsEnvKeySubstitution(envKey, val)) {
- envs.put(envKey, val.replace("$" + envKey + "$", parentVal));
- }
- }
- }
- }
-
- 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-api/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java b/platform/lang-api/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java
deleted file mode 100644
index 0fe445371186..000000000000
--- a/platform/lang-api/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.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.util.containers.ContainerUtil;
-import gnu.trove.THashMap;
-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.*;
-import java.util.List;
-
-public class EnvironmentVariablesTextFieldWithBrowseButton extends TextFieldWithBrowseButton {
-
- private final Map<String, String> myEnvs = new THashMap<String, String>();
- 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();
- }
- });
- }
-
- @NotNull
- public Map<String, String> getEnvs() {
- return myEnvs;
- }
-
- public void setEnvs(@NotNull Map<String, String> envs) {
- myEnvs.clear();
- myEnvs.putAll(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();
- }
- }
-
- public void addChangeListener(ChangeListener changeListener) {
- myListeners.add(changeListener);
- }
-
- 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.newArrayList();
- for (Map.Entry<String, String> entry : myEnvs.entrySet()) {
- envVariables.add(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-api/src/com/intellij/execution/configuration/RunConfigurationExtensionsManager.java b/platform/lang-api/src/com/intellij/execution/configuration/RunConfigurationExtensionsManager.java
index c52f6c9da729..b42cd249ca8e 100644
--- a/platform/lang-api/src/com/intellij/execution/configuration/RunConfigurationExtensionsManager.java
+++ b/platform/lang-api/src/com/intellij/execution/configuration/RunConfigurationExtensionsManager.java
@@ -16,6 +16,7 @@ import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.StringInterner;
+import com.intellij.util.containers.WeakStringInterner;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -33,7 +34,7 @@ public class RunConfigurationExtensionsManager<U extends RunConfigurationBase, T
private static final String EXT_ID_ATTR = "ID";
private static final String EXTENSION_ROOT_ATTR = "EXTENSION";
protected final ExtensionPointName<T> myExtensionPointName;
- private final StringInterner myInterner = new StringInterner();
+ private final StringInterner myInterner = new WeakStringInterner();
public RunConfigurationExtensionsManager(ExtensionPointName<T> extensionPointName) {
myExtensionPointName = extensionPointName;
diff --git a/platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationsSettings.java b/platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationsSettings.java
index 732976cf73a7..259fd4e7484c 100644
--- a/platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationsSettings.java
+++ b/platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationsSettings.java
@@ -17,11 +17,12 @@ package com.intellij.execution.configurations;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.options.UnnamedConfigurable;
+import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
public interface RunConfigurationsSettings {
ExtensionPointName<RunConfigurationsSettings> EXTENSION_POINT = ExtensionPointName.create("com.intellij.runConfigurationsSettings");
@NotNull
- UnnamedConfigurable createConfigurable();
+ UnnamedConfigurable createConfigurable(@NotNull Project project);
} \ No newline at end of file
diff --git a/platform/lang-api/src/com/intellij/execution/configurations/SimpleProgramParameters.java b/platform/lang-api/src/com/intellij/execution/configurations/SimpleProgramParameters.java
index 15bd92cfcf8c..b157d6ba7852 100644
--- a/platform/lang-api/src/com/intellij/execution/configurations/SimpleProgramParameters.java
+++ b/platform/lang-api/src/com/intellij/execution/configurations/SimpleProgramParameters.java
@@ -16,7 +16,7 @@
package com.intellij.execution.configurations;
-import com.intellij.execution.configuration.EnvironmentVariablesComponent;
+import com.intellij.util.EnvironmentUtil;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
@@ -70,7 +70,7 @@ public class SimpleProgramParameters {
public void setupEnvs(Map<String, String> envs, boolean passDefault) {
if (!envs.isEmpty()) {
final HashMap<String, String> map = new HashMap<String, String>(envs);
- EnvironmentVariablesComponent.inlineParentOccurrences(map);
+ EnvironmentUtil.inlineParentOccurrences(map);
setEnv(map);
setPassParentEnvs(passDefault);
}
diff --git a/platform/lang-api/src/com/intellij/execution/runners/AsyncGenericProgramRunner.java b/platform/lang-api/src/com/intellij/execution/runners/AsyncGenericProgramRunner.java
index aeaaf58eda65..ce7145adeaf9 100644
--- a/platform/lang-api/src/com/intellij/execution/runners/AsyncGenericProgramRunner.java
+++ b/platform/lang-api/src/com/intellij/execution/runners/AsyncGenericProgramRunner.java
@@ -17,16 +17,12 @@ package com.intellij.execution.runners;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionManager;
-import com.intellij.execution.Executor;
import com.intellij.execution.RunProfileStarter;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.configurations.RunnerSettings;
import com.intellij.execution.ui.RunContentDescriptor;
-import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.AsyncResult;
import com.intellij.util.Consumer;
-import com.intellij.util.NullableConsumer;
-import com.intellij.util.ObjectUtils;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,30 +34,19 @@ public abstract class AsyncGenericProgramRunner<Settings extends RunnerSettings>
@Override
protected final void execute(@NotNull final ExecutionEnvironment environment,
@Nullable final Callback callback,
- @NotNull final Project project,
@NotNull final RunProfileState state) throws ExecutionException {
- prepare(project, environment, state).doWhenDone(new Consumer<RunProfileStarter>() {
+ prepare(environment, state).doWhenDone(new Consumer<RunProfileStarter>() {
@Override
public void consume(@Nullable final RunProfileStarter result) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
- if (!project.isDisposed()) {
- startRunProfile(project, environment, state, callback, result);
+ if (!environment.getProject().isDisposed()) {
+ startRunProfile(environment, state, callback, result);
}
}
});
}
- }).doWhenRejected(new NullableConsumer<String>() {
- @Override
- public void consume(@Nullable String errorMessage) {
- if (project.isDisposed()) {
- return;
- }
-
- ExecutionUtil.handleExecutionError(project, environment.getExecutor().getToolWindowId(), environment.getRunProfile(),
- new ExecutionException(ObjectUtils.chooseNotNull(errorMessage, "Internal error")));
- }
});
}
@@ -69,29 +54,23 @@ public abstract class AsyncGenericProgramRunner<Settings extends RunnerSettings>
* Makes all the needed preparations for the further execution. Although this method is called in EDT,
* these preparations can be performed in a background thread.
*
- * @param project Project instance
+ * You must call {@link ExecutionUtil#handleExecutionError} in case of error
+ *
* @param environment ExecutionEnvironment instance
* @param state RunProfileState instance
* @return RunProfileStarter async result
*/
@NotNull
- protected abstract AsyncResult<RunProfileStarter> prepare(@NotNull Project project,
- @NotNull ExecutionEnvironment environment,
- @NotNull RunProfileState state) throws ExecutionException;
+ protected abstract AsyncResult<RunProfileStarter> prepare(@NotNull ExecutionEnvironment environment, @NotNull RunProfileState state) throws ExecutionException;
- private static void startRunProfile(@NotNull Project project,
- @NotNull ExecutionEnvironment environment,
+ private static void startRunProfile(@NotNull ExecutionEnvironment environment,
@NotNull RunProfileState state,
@Nullable final Callback callback,
@Nullable final RunProfileStarter starter) {
- ExecutionManager.getInstance(project).startRunProfile(new RunProfileStarter() {
+ ExecutionManager.getInstance(environment.getProject()).startRunProfile(new RunProfileStarter() {
@Override
- public RunContentDescriptor execute(@NotNull Project project,
- @NotNull Executor executor,
- @NotNull RunProfileState state,
- @Nullable RunContentDescriptor contentToReuse,
- @NotNull ExecutionEnvironment environment) throws ExecutionException {
- return postProcess(environment, starter == null ? null : starter.execute(project, executor, state, contentToReuse, environment), callback);
+ public RunContentDescriptor execute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
+ return postProcess(environment, starter == null ? null : starter.execute(state, environment), callback);
}
}, state, environment);
}
diff --git a/platform/lang-api/src/com/intellij/execution/runners/BaseProgramRunner.java b/platform/lang-api/src/com/intellij/execution/runners/BaseProgramRunner.java
index 29c9e5be0767..a2028185089b 100644
--- a/platform/lang-api/src/com/intellij/execution/runners/BaseProgramRunner.java
+++ b/platform/lang-api/src/com/intellij/execution/runners/BaseProgramRunner.java
@@ -23,7 +23,6 @@ import com.intellij.execution.RunManager;
import com.intellij.execution.configurations.*;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.openapi.options.SettingsEditor;
-import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -61,14 +60,12 @@ abstract class BaseProgramRunner<Settings extends RunnerSettings> implements Pro
return;
}
- Project project = environment.getProject();
- RunManager.getInstance(project).refreshUsagesList(environment.getRunProfile());
- execute(environment, callback, project, state);
+ RunManager.getInstance(environment.getProject()).refreshUsagesList(environment.getRunProfile());
+ execute(environment, callback, state);
}
protected abstract void execute(@NotNull ExecutionEnvironment environment,
@Nullable Callback callback,
- @NotNull Project project,
@NotNull RunProfileState state) throws ExecutionException;
@Nullable
diff --git a/platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java b/platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java
index 0d15a272498c..b6c300c3f7e2 100644
--- a/platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java
+++ b/platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java
@@ -31,6 +31,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
+import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.ui.content.Content;
import com.intellij.util.ObjectUtils;
@@ -65,18 +66,19 @@ public class ExecutionUtil {
@NotNull final String toolWindowId,
@NotNull String taskName,
@NotNull ExecutionException e) {
- if (e instanceof RunCanceledByUserException) return;
+ if (e instanceof RunCanceledByUserException) {
+ return;
+ }
LOG.debug(e);
String description = e.getMessage();
- HyperlinkListener listener = null;
-
if (description == null) {
LOG.warn("Execution error without description", e);
description = "Unknown error";
}
+ HyperlinkListener listener = null;
if ((description.contains("87") || description.contains("111") || description.contains("206")) &&
e instanceof ProcessNotCreatedException &&
!PropertiesComponent.getInstance(project).isTrueValue("dynamic.classpath")) {
@@ -110,7 +112,14 @@ public class ExecutionUtil {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
- ToolWindowManager.getInstance(project).notifyByBalloon(toolWindowId, MessageType.ERROR, fullMessage, null, finalListener);
+ ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
+ if (toolWindowManager.canShowNotification(toolWindowId)) {
+ //noinspection SSBasedInspection
+ toolWindowManager.notifyByBalloon(toolWindowId, MessageType.ERROR, fullMessage, null, finalListener);
+ }
+ else {
+ Messages.showErrorDialog(project, fullMessage, "");
+ }
NotificationListener notificationListener = ObjectUtils.tryCast(finalListener, NotificationListener.class);
ourNotificationGroup.createNotification(title, finalDescription, NotificationType.ERROR, notificationListener).notify(project);
}
diff --git a/platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java b/platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java
index adbd04e822e6..3c59227eb85a 100644
--- a/platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java
+++ b/platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java
@@ -18,7 +18,6 @@ package com.intellij.execution.runners;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionManager;
-import com.intellij.execution.Executor;
import com.intellij.execution.RunProfileStarter;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.configurations.RunnerSettings;
@@ -36,24 +35,30 @@ public abstract class GenericProgramRunner<Settings extends RunnerSettings> exte
public static final String CONTENT_TO_REUSE = CONTENT_TO_REUSE_DATA_KEY.getName();
@Override
- protected void execute(@NotNull ExecutionEnvironment environment, @Nullable final Callback callback, @NotNull Project project, @NotNull RunProfileState state)
+ protected void execute(@NotNull ExecutionEnvironment environment, @Nullable final Callback callback, @NotNull RunProfileState state)
throws ExecutionException {
- ExecutionManager.getInstance(project).startRunProfile(new RunProfileStarter() {
+ ExecutionManager.getInstance(environment.getProject()).startRunProfile(new RunProfileStarter() {
@Override
- public RunContentDescriptor execute(@NotNull Project project,
- @NotNull Executor executor,
- @NotNull RunProfileState state,
- @Nullable RunContentDescriptor contentToReuse,
- @NotNull ExecutionEnvironment environment) throws ExecutionException {
- return postProcess(environment, doExecute(project, state, contentToReuse, environment), callback);
+ public RunContentDescriptor execute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
+ return postProcess(environment, doExecute(state, environment), callback);
}
}, state, environment);
}
@Nullable
- protected abstract RunContentDescriptor doExecute(@NotNull Project project,
- @NotNull RunProfileState state,
- @Nullable RunContentDescriptor contentToReuse,
- @NotNull ExecutionEnvironment environment) throws ExecutionException;
+ protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
+ return doExecute(environment.getProject(), state, environment.getContentToReuse(), environment);
+ }
+ @Deprecated
+ @Nullable
+ /**
+ * @deprecated to remove in IDEA 16
+ */
+ protected RunContentDescriptor doExecute(@NotNull Project project,
+ @NotNull RunProfileState state,
+ @Nullable RunContentDescriptor contentToReuse,
+ @NotNull ExecutionEnvironment environment) throws ExecutionException {
+ throw new AbstractMethodError();
+ }
}