mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -19,6 +19,7 @@ package com.intellij.execution;
|
||||
import com.intellij.execution.configurations.ConfigurationFactory;
|
||||
import com.intellij.execution.configurations.ConfigurationType;
|
||||
import com.intellij.execution.configurations.RunConfiguration;
|
||||
import com.intellij.execution.configurations.RunProfile;
|
||||
import com.intellij.execution.impl.RunDialog;
|
||||
import com.intellij.execution.impl.RunManagerImpl;
|
||||
import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
|
||||
@@ -63,50 +64,85 @@ public class ProgramRunnerUtil {
|
||||
final boolean showSettings) {
|
||||
ProgramRunner runner = getRunner(executor.getId(), configuration);
|
||||
if (runner == null) {
|
||||
LOG.error("Runner MUST not be null! Cannot find runner for " + executor.getId() + " and " + configuration.getConfiguration().getFactory().getName());
|
||||
LOG.error("Runner MUST not be null! Cannot find runner for " +
|
||||
executor.getId() +
|
||||
" and " +
|
||||
configuration.getConfiguration().getFactory().getName());
|
||||
return;
|
||||
}
|
||||
if (ExecutorRegistry.getInstance().isStarting(project, executor.getId(), runner.getRunnerId())){
|
||||
executeConfiguration(project, context, configuration, executor, target, contentToReuse, showSettings, runner, null, true);
|
||||
}
|
||||
|
||||
public static void executeConfiguration(Project project,
|
||||
DataContext context,
|
||||
@Nullable RunnerAndConfigurationSettings configuration,
|
||||
Executor executor,
|
||||
ExecutionTarget target,
|
||||
RunContentDescriptor contentToReuse,
|
||||
boolean showSettings,
|
||||
@NotNull ProgramRunner runner,
|
||||
@Nullable RunProfile runProfile,
|
||||
boolean assignNewId) {
|
||||
if (ExecutorRegistry.getInstance().isStarting(project, executor.getId(), runner.getRunnerId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ExecutionTargetManager.canRun(configuration, target)) {
|
||||
if (configuration != null && !ExecutionTargetManager.canRun(configuration, target)) {
|
||||
ExecutionUtil.handleExecutionError(
|
||||
project, executor.getToolWindowId(), configuration.getConfiguration(),
|
||||
new ExecutionException(StringUtil.escapeXml("Cannot run '" + configuration.getName() + "' on '" + target.getDisplayName() + "'")));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RunManagerImpl.canRunConfiguration(configuration, executor) || (showSettings && configuration.isEditBeforeRun())) {
|
||||
if (configuration != null &&
|
||||
(!RunManagerImpl.canRunConfiguration(configuration, executor) || (showSettings && configuration.isEditBeforeRun()))) {
|
||||
if (!RunDialog.editConfiguration(project, configuration, "Edit configuration", executor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (!RunManagerImpl.canRunConfiguration(configuration, executor)) {
|
||||
if (0 == Messages.showYesNoDialog(project, "Configuration is still incorrect. Do you want to edit it again?", "Change Configuration Settings",
|
||||
"Edit", "Continue Anyway", Messages.getErrorIcon())) {
|
||||
if (0 == Messages
|
||||
.showYesNoDialog(project, "Configuration is still incorrect. Do you want to edit it again?", "Change Configuration Settings",
|
||||
"Edit", "Continue Anyway", Messages.getErrorIcon())) {
|
||||
if (!RunDialog.editConfiguration(project, configuration, "Edit configuration", executor)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final ConfigurationType configurationType = configuration.getType();
|
||||
final ConfigurationType configurationType = configuration != null ? configuration.getType() : null;
|
||||
if (configurationType != null) {
|
||||
UsageTrigger.trigger("execute." + ConvertUsagesUtil.ensureProperKey(configurationType.getId()) + "." + executor.getId());
|
||||
}
|
||||
|
||||
try {
|
||||
ExecutionEnvironmentBuilder builder =
|
||||
new ExecutionEnvironmentBuilder(project, executor).setRunnerAndSettings(runner, configuration).setTarget(target)
|
||||
.setContentToReuse(contentToReuse).assignNewId().setDataContext(context);
|
||||
new ExecutionEnvironmentBuilder(project, executor);
|
||||
if (configuration != null) {
|
||||
builder.setRunnerAndSettings(runner, configuration);
|
||||
}
|
||||
else {
|
||||
builder.setRunnerId(runner.getRunnerId());
|
||||
}
|
||||
builder.setTarget(target).setContentToReuse(contentToReuse).setDataContext(context);
|
||||
if (assignNewId) {
|
||||
builder.assignNewId();
|
||||
}
|
||||
if (runProfile != null) {
|
||||
builder.setRunProfile(runProfile);
|
||||
}
|
||||
runner.execute(builder.build());
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
ExecutionUtil.handleExecutionError(project, executor.getToolWindowId(), configuration.getConfiguration(), e);
|
||||
String name = configuration != null ? configuration.getName() : null;
|
||||
if (name == null && runProfile != null) name = runProfile.getName();
|
||||
if (name == null && contentToReuse != null) name = contentToReuse.getDisplayName();
|
||||
if (name == null) name = "<Unknown>";
|
||||
ExecutionUtil.handleExecutionError(project, executor.getToolWindowId(), name, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -364,23 +364,8 @@ public class ExecutionManagerImpl extends ExecutionManager implements ProjectCom
|
||||
@Nullable RunContentDescriptor descriptor) {
|
||||
Runnable restarter = descriptor != null ? descriptor.getRestarter() : null;
|
||||
if (runner != null && runProfile != null) {
|
||||
try {
|
||||
ExecutionEnvironmentBuilder builder = new ExecutionEnvironmentBuilder(project, executor);
|
||||
builder.setRunProfile(runProfile).setRunnerSettings(runnerSettings).setContentToReuse(descriptor)
|
||||
.setTarget(target).setConfigurationSettings(configurationPerRunnerSettings).setDataContext(context);
|
||||
if (configuration != null) {
|
||||
builder.setRunnerAndSettings(runner, configuration);
|
||||
} else {
|
||||
builder.setRunnerId(runner.getRunnerId());
|
||||
}
|
||||
|
||||
runner.execute(builder.build());
|
||||
}
|
||||
catch (RunCanceledByUserException ignore) {
|
||||
}
|
||||
catch (ExecutionException e1) {
|
||||
Messages.showErrorDialog(project, e1.getMessage(), ExecutionBundle.message("restart.error.message.title"));
|
||||
}
|
||||
ProgramRunnerUtil.executeConfiguration(project, context, configuration, executor, target, descriptor,
|
||||
configuration != null && configuration.isEditBeforeRun(), runner, runProfile, false);
|
||||
}
|
||||
else if (configuration != null) {
|
||||
ProgramRunnerUtil.executeConfiguration(project, context, configuration, executor, target, descriptor, true);
|
||||
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
package com.intellij.remoteServer.util;
|
||||
|
||||
import com.intellij.remoteServer.configuration.deployment.DeploymentConfigurationBase;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
|
||||
public class CloudDeploymentContextConfiguration<Self extends CloudDeploymentContextConfiguration<Self>>
|
||||
extends DeploymentConfigurationBase<Self> {
|
||||
|
||||
private String myContextRoot = "/";
|
||||
private boolean myDefaultContextRoot = true;
|
||||
|
||||
public boolean isDefaultContextRoot() {
|
||||
return myDefaultContextRoot;
|
||||
}
|
||||
|
||||
public void setDefaultContextRoot(boolean defaultContextRoot) {
|
||||
myDefaultContextRoot = defaultContextRoot;
|
||||
}
|
||||
|
||||
public String getContextRoot() {
|
||||
return myContextRoot;
|
||||
}
|
||||
|
||||
public void setContextRoot(String contextRoot) {
|
||||
myContextRoot = contextRoot;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.intellij.remoteServer.util;
|
||||
|
||||
import com.intellij.remoteServer.configuration.deployment.DeploymentConfigurationBase;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
|
||||
public class CloudDeploymentNameConfiguration<Self extends CloudDeploymentNameConfiguration<Self>>
|
||||
extends DeploymentConfigurationBase<Self> implements DeploymentNameConfiguration {
|
||||
|
||||
private String myDeploymentName = "";
|
||||
private boolean myDefaultDeploymentName = true;
|
||||
|
||||
public boolean isDefaultDeploymentName() {
|
||||
return myDefaultDeploymentName;
|
||||
}
|
||||
|
||||
public void setDefaultDeploymentName(boolean defaultDeploymentName) {
|
||||
myDefaultDeploymentName = defaultDeploymentName;
|
||||
}
|
||||
|
||||
public String getDeploymentName() {
|
||||
return myDeploymentName;
|
||||
}
|
||||
|
||||
public void setDeploymentName(String deploymentName) {
|
||||
myDeploymentName = deploymentName;
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.remoteServer.util.CloudDeploymentNameEditor">
|
||||
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="451" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="4774" class="javax.swing.JCheckBox" binding="myCustomNameCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="<use context>" noi18n="true"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f3e24" class="javax.swing.JTextField" binding="myNameTextField">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="4" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="true"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="a4def">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.remoteServer.util;
|
||||
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.util.Factory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public class CloudDeploymentNameEditor<T extends DeploymentNameConfiguration> extends SettingsEditor<T> {
|
||||
|
||||
private JTextField myNameTextField;
|
||||
private JCheckBox myCustomNameCheckBox;
|
||||
private JPanel myMainPanel;
|
||||
|
||||
public CloudDeploymentNameEditor(Factory<T> deploymentModelFactory, String labelCaption) {
|
||||
super(deploymentModelFactory);
|
||||
myCustomNameCheckBox.setText(labelCaption);
|
||||
myCustomNameCheckBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updateNameEnabled();
|
||||
}
|
||||
});
|
||||
myCustomNameCheckBox.setSelected(false);
|
||||
updateNameEnabled();
|
||||
}
|
||||
|
||||
private void updateNameEnabled() {
|
||||
myNameTextField.setEnabled(myCustomNameCheckBox.isSelected());
|
||||
}
|
||||
|
||||
public void resetEditorFrom(T settings) {
|
||||
myCustomNameCheckBox.setSelected(!settings.isDefaultDeploymentName());
|
||||
updateNameEnabled();
|
||||
myNameTextField.setText(settings.getDeploymentName());
|
||||
}
|
||||
|
||||
public void applyEditorTo(T settings) throws ConfigurationException {
|
||||
settings.setDefaultDeploymentName(!myCustomNameCheckBox.isSelected());
|
||||
settings.setDeploymentName(myNameTextField.getText());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected JComponent createEditor() {
|
||||
return myMainPanel;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -41,7 +41,7 @@ import java.io.IOException;
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public abstract class CloudGitDeploymentRuntime<DC extends CloudDeploymentContextConfiguration,
|
||||
public abstract class CloudGitDeploymentRuntime<DC extends CloudDeploymentNameConfiguration,
|
||||
AD extends CloudGitAgentDeployment,
|
||||
A extends CloudGitAgent<?, AD>> extends DeploymentRuntime {
|
||||
|
||||
@@ -113,9 +113,9 @@ public abstract class CloudGitDeploymentRuntime<DC extends CloudDeploymentContex
|
||||
myPresentableName = deploymentSource.getPresentableName();
|
||||
|
||||
DC deploymentConfiguration = task.getConfiguration();
|
||||
myApplicationName = deploymentConfiguration.isDefaultContextRoot()
|
||||
myApplicationName = deploymentConfiguration.isDefaultDeploymentName()
|
||||
? deploymentNameProvider.getDeploymentName(deploymentSource)
|
||||
: deploymentConfiguration.getContextRoot();
|
||||
: deploymentConfiguration.getDeploymentName();
|
||||
|
||||
myDeployment = agent.createDeployment(getApplicationName(), loggingHandler);
|
||||
}
|
||||
|
||||
+1
-2
@@ -5,7 +5,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.remoteServer.agent.RemoteAgentManager;
|
||||
import com.intellij.remoteServer.agent.util.*;
|
||||
import com.intellij.remoteServer.configuration.deployment.DeploymentConfiguration;
|
||||
import com.intellij.remoteServer.configuration.deployment.DeploymentSource;
|
||||
import com.intellij.remoteServer.impl.configuration.deployment.DeployToServerRunConfiguration;
|
||||
import com.intellij.remoteServer.runtime.ServerConnector;
|
||||
@@ -24,7 +23,7 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
public abstract class CloudGitServerRuntimeInstanceBase<
|
||||
DC extends DeploymentConfiguration,
|
||||
DC extends CloudDeploymentNameConfiguration,
|
||||
AC extends CloudAgentConfigBase,
|
||||
A extends CloudGitAgent<AC, ?>,
|
||||
SC extends AC,
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
*/
|
||||
public abstract class CloudSupportConfigurableBase<
|
||||
SC extends CloudConfigurationBase,
|
||||
DC extends CloudDeploymentContextConfiguration,
|
||||
DC extends CloudDeploymentNameConfiguration,
|
||||
ST extends ServerType<SC>,
|
||||
SR extends CloudGitServerRuntimeInstanceBase<DC, ?, ?, ?, ?>>
|
||||
extends FrameworkSupportConfigurable {
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.intellij.remoteServer.util;
|
||||
|
||||
/**
|
||||
* @author michael.golubev
|
||||
*/
|
||||
public interface DeploymentNameConfiguration {
|
||||
|
||||
boolean isDefaultDeploymentName();
|
||||
|
||||
String getDeploymentName();
|
||||
|
||||
void setDefaultDeploymentName(boolean defaultContextRoot);
|
||||
|
||||
void setDeploymentName(String contextRoot);
|
||||
}
|
||||
Reference in New Issue
Block a user