From 95ad3dcf7b6053e3d04217eed45ed65b5a89bf2c Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 28 Oct 2009 14:44:42 +0300 Subject: [PATCH] 'update' action for running javaee application added --- .../compiler/CompilerConfigurationImpl.java | 3 -- .../compiler/actions/BuildArtifactAction.java | 4 +- .../options/CompilerOptionsPanel.form | 45 +----------------- .../options/CompilerUIConfigurable.java | 30 +----------- .../impl/compiler/ArtifactCompileScope.java | 41 +++++++--------- .../impl/run/BuildArtifactsBeforeRun.java | 2 +- .../src/javaee/updateRunningApplication.png | Bin 0 -> 789 bytes .../intellij/ui/OptionalChooserComponent.java | 15 ++++++ .../util/src/com/intellij/util/ui/UIUtil.java | 12 +++++ 9 files changed, 51 insertions(+), 101 deletions(-) create mode 100644 platform/icons/src/javaee/updateRunningApplication.png diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java index dea086b43fd4..95fb5b6d587b 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java @@ -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 myRegisteredCompilers = new ArrayList(); private JavacCompiler JAVAC_EXTERNAL_BACKEND; private final Perl5Matcher myPatternMatcher = new Perl5Matcher(); diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactAction.java b/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactAction.java index 4fae96e82f68..dc9206436c1c 100644 --- a/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactAction.java +++ b/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactAction.java @@ -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); } } diff --git a/java/compiler/impl/src/com/intellij/compiler/options/CompilerOptionsPanel.form b/java/compiler/impl/src/com/intellij/compiler/options/CompilerOptionsPanel.form index b07e57fe72a2..fd103479d5c6 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/CompilerOptionsPanel.form +++ b/java/compiler/impl/src/com/intellij/compiler/options/CompilerOptionsPanel.form @@ -8,7 +8,7 @@ - + @@ -55,49 +55,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/compiler/impl/src/com/intellij/compiler/options/CompilerUIConfigurable.java b/java/compiler/impl/src/com/intellij/compiler/options/CompilerUIConfigurable.java index 6981d4898584..38ac669aa16b 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/CompilerUIConfigurable.java +++ b/java/compiler/impl/src/com/intellij/compiler/options/CompilerUIConfigurable.java @@ -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"; } diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java index 20d779dcb969..882f166e33dc 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java @@ -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 artifacts) { final Set modules = new HashSet(); final PackagingElementResolvingContext context = ArtifactManager.getInstance(project).getResolvingContext(); - ArtifactUtil.processPackagingElements(artifact, ModuleOutputElementType.MODULE_OUTPUT_ELEMENT_TYPE, new Processor() { - 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() { + 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 artifacts) { - return create(new ProjectCompileScope(project), artifacts); + public static CompileScope createArtifactsScope(@NotNull Project project, @NotNull Collection artifacts) { + return createScopeWithArtifacts(createScopeForModulesInArtifacts(project, artifacts), artifacts); } - public static CompileScope create(final CompileScope baseScope, @NotNull Collection artifacts) { + public static CompileScope createScopeWithArtifacts(final CompileScope baseScope, @NotNull Collection artifacts) { baseScope.putUserData(ARTIFACTS_KEY, artifacts.toArray(new Artifact[artifacts.size()])); return baseScope; } diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRun.java b/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRun.java index 37cc0974b880..d16dfac6052f 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRun.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRun.java @@ -136,7 +136,7 @@ public class BuildArtifactsBeforeRun implements BeforeRunTaskProvider2+CZZr=Aqx?~#1t?!N{e78 z(3TFRc3PRvd)_G&%9@wV%zN*?bKg1V&Sfa2u%E%}uZ!1*wpMyF2CiVzHlXALuH6&} z?vp8;&rm|fCSLWu(T|?H){FB8t^7_Z3I>FCH@lnfRoB;vg=RAVCxAvM$Pw8cl7epk zytkvZb1+zc`g}Rj)Z`8W{bmYGSBvM;9)L z!^UzaM@c#-0f49JRO7?CMi(25^5B;gkR?CFR~La`0@3b-l7rR2L z*8|kqR@>+@t}8qQqy$LwlPgM8YTsB1d}2^YDi$6P@{4YWwn{#g21un5p`{^L!f~<4 z489fAD+NFY-|FfZzv^VS=-qr)Q|+{KOX~oH(2OsXsJRKqN!_q`5_KbO{pPH<==O)p zop&z0pNlg%Xojy|Eu!T}pae8+%P>MRW!nbdAKXmHm2aQloy|C{$3O#`xs!^y45sBZ z*{!=>P<9BCvB(+R9q)P4*Mr}ltdu?DTh|^2U&GR}TPU)CvD5*1;pLZ4`(LytLkp7_ zqeE6l6K|>LHXUt=QdaPT@AaS1cV%{J1iV=W!vXwBN^497jNkxs)mb}N_;ZvsnN>6` zVX!))yzNMcFhW`hd?`uzrjm$R+hstschPWYKqHgAU|r|9iUu$qXaGY+z3w=RkAN1L z6#r+7;v3n7^yVlqOfV+_ftVcaS5qlqR)e?M-?PQ6tqKg~HM(zHGB}r)lDsB0@(UoX z4kP4awh4E70Slxi{>C36n;D3NJ#^9AyxmY7`ryU7O(SRwk51%z$?UhC{|hhxM1FXI T-0L=-00000NkvXXu0mjfMPO;d literal 0 HcmV?d00001 diff --git a/platform/util/src/com/intellij/ui/OptionalChooserComponent.java b/platform/util/src/com/intellij/ui/OptionalChooserComponent.java index 67e294ed1503..fb6ca56b5d28 100644 --- a/platform/util/src/com/intellij/ui/OptionalChooserComponent.java +++ b/platform/util/src/com/intellij/ui/OptionalChooserComponent.java @@ -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; diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 870f3126dfd0..4123abb5dd83 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -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("&&");