'update' action for running javaee application added

This commit is contained in:
nik
2009-10-28 14:44:42 +03:00
parent 5d869f823b
commit 95ad3dcf7b
9 changed files with 51 additions and 101 deletions
@@ -34,7 +34,6 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Options;
import org.apache.oro.text.regex.*;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -70,8 +69,6 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
private final ModuleManager myModuleManager;
private final ExcludedEntriesConfiguration myExcludedEntriesConfiguration;
public int DEPLOY_AFTER_MAKE = Options.SHOW_DIALOG;
private final Collection<BackendCompiler> myRegisteredCompilers = new ArrayList<BackendCompiler>();
private JavacCompiler JAVAC_EXTERNAL_BACKEND;
private final Perl5Matcher myPatternMatcher = new Perl5Matcher();
@@ -33,6 +33,8 @@ import com.intellij.packaging.artifacts.ArtifactManager;
import com.intellij.packaging.artifacts.ModifiableArtifactModel;
import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
import java.util.Collections;
/**
* @author nik
*/
@@ -63,6 +65,6 @@ public class BuildArtifactAction extends AnAction {
}
}.execute();
}
CompilerManager.getInstance(myProject).make(ArtifactCompileScope.create(myProject, myArtifact), null);
CompilerManager.getInstance(myProject).make(ArtifactCompileScope.createArtifactsScope(myProject, Collections.singletonList(myArtifact)), null);
}
}
@@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="d5f42" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="d5f42" layout-manager="GridLayoutManager" row-count="5" 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>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -55,49 +55,6 @@
<text resource-bundle="messages/CompilerBundle" key="label.option.clear.output.directory.on.rebuild"/>
</properties>
</component>
<grid id="2aa28" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="5" bottom="0" right="0"/>
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="9e3fc" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/CompilerBundle" key="label.option.deploy.text"/>
</properties>
</component>
<component id="42c2e" class="javax.swing.JRadioButton" binding="myDeploy">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="false"/>
<text resource-bundle="messages/CompilerBundle" key="label.option.deploy.always"/>
</properties>
</component>
<component id="d789a" class="javax.swing.JRadioButton" binding="myDoNotDeploy">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/CompilerBundle" key="label.option.deploy.never"/>
</properties>
</component>
<component id="7298a" class="javax.swing.JRadioButton" binding="myShowDialog">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/CompilerBundle" key="label.option.deploy.ask"/>
</properties>
</component>
</children>
</grid>
<component id="97c22" class="javax.swing.JCheckBox" binding="myCbCompileDependent">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
@@ -24,7 +24,6 @@ import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.util.Options;
import javax.swing.*;
import java.util.ArrayList;
@@ -39,19 +38,11 @@ public class CompilerUIConfigurable implements Configurable {
private JCheckBox myCbCompileInBackground;
private JCheckBox myCbClearOutputDirectory;
private JCheckBox myCbCompileDependent;
private JRadioButton myDoNotDeploy;
private JRadioButton myDeploy;
private JRadioButton myShowDialog;
private JCheckBox myCbAssertNotNull;
private JLabel myPatternLegendLabel;
public CompilerUIConfigurable(final Project project) {
myProject = project;
ButtonGroup deployGroup = new ButtonGroup();
deployGroup.add(myShowDialog);
deployGroup.add(myDeploy);
deployGroup.add(myDoNotDeploy);
}
public void reset() {
@@ -66,16 +57,6 @@ public class CompilerUIConfigurable implements Configurable {
configuration.convertPatterns();
myResourcePatternsField.setText(patternsToString(configuration.getResourceFilePatterns()));
if (configuration.DEPLOY_AFTER_MAKE == Options.SHOW_DIALOG) {
myShowDialog.setSelected(true);
}
else if (configuration.DEPLOY_AFTER_MAKE == Options.PERFORM_ACTION_AUTOMATICALLY) {
myDeploy.setSelected(true);
}
else {
myDoNotDeploy.setSelected(true);
}
}
private static String patternsToString(final String[] patterns) {
@@ -102,9 +83,7 @@ public class CompilerUIConfigurable implements Configurable {
String extensionString = myResourcePatternsField.getText().trim();
applyResourcePatterns(extensionString, (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject));
configuration.DEPLOY_AFTER_MAKE = getSelectedDeploymentOption();
// this will schedule for compilation all files that might become compilable after resource patterns' changing
// this will schedule for compilation all files that might become compilable after resource patterns' changing
TranslatingCompilerFilesMonitor.getInstance().scanSourcesForCompilableFiles(myProject);
}
@@ -149,17 +128,10 @@ public class CompilerUIConfigurable implements Configurable {
final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject);
isModified |= ComparingUtils.isModified(myCbClearOutputDirectory, workspaceConfiguration.CLEAR_OUTPUT_DIRECTORY);
isModified |= ComparingUtils.isModified(myResourcePatternsField, patternsToString(compilerConfiguration.getResourceFilePatterns()));
isModified |= compilerConfiguration.DEPLOY_AFTER_MAKE != getSelectedDeploymentOption();
return isModified;
}
private int getSelectedDeploymentOption() {
if (myShowDialog.isSelected()) return Options.SHOW_DIALOG;
if (myDeploy.isSelected()) return Options.PERFORM_ACTION_AUTOMATICALLY;
return Options.DO_NOTHING;
}
public String getDisplayName() {
return "General";
}
@@ -16,25 +16,21 @@
package com.intellij.packaging.impl.compiler;
import com.intellij.compiler.impl.ModuleCompileScope;
import com.intellij.compiler.impl.ProjectCompileScope;
import com.intellij.openapi.compiler.CompileScope;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.compiler.CompileScope;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactManager;
import com.intellij.packaging.elements.PackagingElementResolvingContext;
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
import com.intellij.packaging.impl.elements.ModuleOutputElementType;
import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashSet;
import java.util.Set;
import java.util.Collection;
import java.util.Arrays;
import java.util.*;
/**
* @author nik
@@ -45,30 +41,29 @@ public class ArtifactCompileScope {
private ArtifactCompileScope() {
}
@NotNull
public static ModuleCompileScope create(@NotNull Project project, @NotNull Artifact artifact) {
public static ModuleCompileScope createScopeForModulesInArtifacts(@NotNull Project project, @NotNull Collection<? extends Artifact> artifacts) {
final Set<Module> modules = new HashSet<Module>();
final PackagingElementResolvingContext context = ArtifactManager.getInstance(project).getResolvingContext();
ArtifactUtil.processPackagingElements(artifact, ModuleOutputElementType.MODULE_OUTPUT_ELEMENT_TYPE, new Processor<ModuleOutputPackagingElement>() {
public boolean process(ModuleOutputPackagingElement moduleOutputPackagingElement) {
final Module module = moduleOutputPackagingElement.findModule(context);
if (module != null) {
modules.add(module);
for (Artifact artifact : artifacts) {
ArtifactUtil.processPackagingElements(artifact, ModuleOutputElementType.MODULE_OUTPUT_ELEMENT_TYPE, new Processor<ModuleOutputPackagingElement>() {
public boolean process(ModuleOutputPackagingElement moduleOutputPackagingElement) {
final Module module = moduleOutputPackagingElement.findModule(context);
if (module != null) {
modules.add(module);
}
return true;
}
return true;
}
}, context, true);
}, context, true);
}
final ModuleCompileScope scope = new ModuleCompileScope(project, modules.toArray(new Module[modules.size()]), true);
scope.putUserData(ARTIFACTS_KEY, new Artifact[]{artifact});
return scope;
return new ModuleCompileScope(project, modules.toArray(new Module[modules.size()]), true);
}
public static CompileScope create(@NotNull Project project, @NotNull Collection<Artifact> artifacts) {
return create(new ProjectCompileScope(project), artifacts);
public static CompileScope createArtifactsScope(@NotNull Project project, @NotNull Collection<Artifact> artifacts) {
return createScopeWithArtifacts(createScopeForModulesInArtifacts(project, artifacts), artifacts);
}
public static CompileScope create(final CompileScope baseScope, @NotNull Collection<Artifact> artifacts) {
public static CompileScope createScopeWithArtifacts(final CompileScope baseScope, @NotNull Collection<Artifact> artifacts) {
baseScope.putUserData(ARTIFACTS_KEY, artifacts.toArray(new Artifact[artifacts.size()]));
return baseScope;
}
@@ -136,7 +136,7 @@ public class BuildArtifactsBeforeRun implements BeforeRunTaskProvider<BuildArtif
public void run() {
final CompilerManager manager = CompilerManager.getInstance(myProject);
finished.down();
manager.make(ArtifactCompileScope.create(myProject, artifacts), compilerFilter, callback);
manager.make(ArtifactCompileScope.createArtifactsScope(myProject, artifacts), compilerFilter, callback);
}
}, ModalityState.NON_MODAL);
Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

@@ -1,3 +1,18 @@
/*
* Copyright 2000-2009 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.ui;
import com.intellij.openapi.util.Pair;
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.SideBorder;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ReflectionUtil;
@@ -136,6 +137,17 @@ public class UIUtil {
return UIManager.getIcon("OptionPane.questionIcon");
}
@NotNull
public static String removeMnemonic(@NotNull String s) {
if (s.indexOf('&') != -1) {
s = StringUtil.replace(s, "&", "");
}
if (s.indexOf(MNEMONIC) != -1) {
s = StringUtil.replace(s, String.valueOf(MNEMONIC), "");
}
return s;
}
public static String replaceMnemonicAmpersand(final String value) {
if (value.indexOf('&') >= 0) {
boolean useMacMnemonic = value.contains("&&");