use of com.intellij.execution.impl.ConfigurationSettingsEditorWrapper in project google-cloud-intellij by GoogleCloudPlatform.
the class BuildDeploymentSourceType method updateBuildBeforeRunOption.
/**
* Updates the pre-deploy build tasks ({@link BeforeRunTask}) when the deployment source is
* updated.
*
* <p>Similar to {@link BuildDeploymentSourceType#setBuildBeforeRunTask(RunConfiguration,
* ModuleDeploymentSource)}, but it is invoked when switching between deployment sources in the
* UI.
*
* <p>Only creates a new task if one is not already configured. In following the IntelliJ pattern
* used for bundled deployment sources, this does NOT remove any existing tasks.
*/
@Override
public void updateBuildBeforeRunOption(@NotNull JComponent runConfigurationEditorComponent, @NotNull Project project, @NotNull ModuleDeploymentSource source, boolean select) {
final DataContext dataContext = DataManager.getInstance().getDataContext(runConfigurationEditorComponent);
final ConfigurationSettingsEditorWrapper editor = ConfigurationSettingsEditorWrapper.CONFIGURATION_EDITOR_KEY.getData(dataContext);
Module module = source.getModule();
if (module == null || editor == null) {
return;
}
List<BeforeRunTask> buildTasks = editor.getStepsBeforeLaunch();
if (select && !hasBuildTaskForModule(buildTasks, module)) {
BeforeRunTask buildTask = createBuildTask(module);
if (buildTask != null) {
editor.addBeforeLaunchStep(buildTask);
}
}
}
use of com.intellij.execution.impl.ConfigurationSettingsEditorWrapper in project azure-tools-for-java by Microsoft.
the class AzureSettingPanel method syncBeforeRunTasks.
protected void syncBeforeRunTasks(AzureArtifact azureArtifact, @NotNull final RunConfiguration configuration) {
if (!AzureArtifactManager.getInstance(configuration.getProject()).equalsAzureArtifact(lastSelectedAzureArtifact, azureArtifact)) {
final JPanel pnlRoot = getMainPanel();
final DataContext context = DataManager.getInstance().getDataContext(pnlRoot);
final ConfigurationSettingsEditorWrapper editor = ConfigurationSettingsEditorWrapper.CONFIGURATION_EDITOR_KEY.getData(context);
if (editor == null) {
return;
}
if (Objects.nonNull(lastSelectedAzureArtifact)) {
BeforeRunTaskUtils.removeBeforeRunTask(editor, lastSelectedAzureArtifact);
}
lastSelectedAzureArtifact = azureArtifact;
if (Objects.nonNull(azureArtifact)) {
BeforeRunTaskUtils.addBeforeRunTask(editor, azureArtifact, configuration);
}
}
}
use of com.intellij.execution.impl.ConfigurationSettingsEditorWrapper in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfigurationPanel method onArtifactChanged.
private void onArtifactChanged(final ItemEvent e) {
final DataContext context = DataManager.getInstance().getDataContext(getContentPanel());
final ConfigurationSettingsEditorWrapper editor = ConfigurationSettingsEditorWrapper.CONFIGURATION_EDITOR_KEY.getData(context);
final AzureArtifact artifact = (AzureArtifact) e.getItem();
if (Objects.nonNull(editor) && Objects.nonNull(artifact)) {
if (e.getStateChange() == ItemEvent.DESELECTED) {
BeforeRunTaskUtils.removeBeforeRunTask(editor, artifact);
}
if (e.getStateChange() == ItemEvent.SELECTED) {
BeforeRunTaskUtils.addBeforeRunTask(editor, artifact, this.configuration);
}
}
}
use of com.intellij.execution.impl.ConfigurationSettingsEditorWrapper in project android by JetBrains.
the class ApplicationRunParameters method addOrRemoveMakeTask.
private void addOrRemoveMakeTask(boolean add) {
final DataContext dataContext = DataManager.getInstance().getDataContext(myPanel);
final ConfigurationSettingsEditorWrapper editor = ConfigurationSettingsEditorWrapper.CONFIGURATION_EDITOR_KEY.getData(dataContext);
if (editor == null) {
return;
}
final List<BeforeRunTask> makeTasks = new ArrayList<BeforeRunTask>();
for (BeforeRunTask task : editor.getStepsBeforeLaunch()) {
if (task instanceof CompileStepBeforeRun.MakeBeforeRunTask || task instanceof CompileStepBeforeRunNoErrorCheck.MakeBeforeRunTaskNoErrorCheck) {
makeTasks.add(task);
}
}
if (add) {
if (makeTasks.size() == 0) {
editor.addBeforeLaunchStep(new CompileStepBeforeRun.MakeBeforeRunTask());
} else {
for (BeforeRunTask task : makeTasks) {
task.setEnabled(true);
}
}
} else {
for (BeforeRunTask task : makeTasks) {
task.setEnabled(false);
}
}
}
use of com.intellij.execution.impl.ConfigurationSettingsEditorWrapper in project intellij-community by JetBrains.
the class BuildArtifactsBeforeRunTaskProviderBase method setBuildArtifactBeforeRunOption.
protected void setBuildArtifactBeforeRunOption(@NotNull JComponent runConfigurationEditorComponent, @NotNull Artifact artifact, final boolean enable) {
final DataContext dataContext = DataManager.getInstance().getDataContext(runConfigurationEditorComponent);
final ConfigurationSettingsEditorWrapper editor = ConfigurationSettingsEditorWrapper.CONFIGURATION_EDITOR_KEY.getData(dataContext);
if (editor != null) {
List<T> tasks = ContainerUtil.findAll(editor.getStepsBeforeLaunch(), myTaskClass);
if (enable && tasks.isEmpty()) {
T task = doCreateTask(myProject);
task.addArtifact(artifact);
task.setEnabled(true);
editor.addBeforeLaunchStep(task);
} else {
for (T task : tasks) {
if (enable) {
task.addArtifact(artifact);
task.setEnabled(true);
} else {
task.removeArtifact(artifact);
if (task.getArtifactPointers().isEmpty()) {
task.setEnabled(false);
}
}
}
}
}
}
Aggregations