Merge remote branch 'origin/master'
authorirengrig <Irina.Chernushina@jetbrains.com>
Tue, 7 Aug 2012 12:04:33 +0000 (16:04 +0400)
committerirengrig <Irina.Chernushina@jetbrains.com>
Tue, 7 Aug 2012 12:04:33 +0000 (16:04 +0400)
124 files changed:
build.txt
build/scripts/libLicenses.gant
java/java-impl/src/com/intellij/codeInsight/completion/BasicExpressionCompletionContributor.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberLookupElement.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaStaticMemberProcessor.java
java/java-impl/src/com/intellij/codeInsight/completion/StaticMemberProcessor.java
java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java
java/java-impl/src/com/intellij/psi/filters/getters/JavaMembersGetter.java
java/java-impl/src/com/intellij/psi/filters/getters/MembersGetter.java
java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStaticMemberNameIndex.java [new file with mode: 0644]
java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStaticMemberTypeIndex.java [new file with mode: 0644]
java/java-psi-impl/src/com/intellij/psi/impl/cache/TypeInfo.java
java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsModifierListImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaFieldStubElementType.java
java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaMethodElementType.java
java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStubIndexKeys.java
java/java-psi-impl/src/com/intellij/psi/impl/source/JavaFileElementType.java
java/java-tests/testData/codeInsight/completion/smartType/second/GlobalFactoryMethods.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/smartType/second/NoLeftRecursion.java
java/java-tests/testData/codeInsight/completion/smartType/second/NoUnqualifiedCastsInQualifiedContext.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/SecondSmartTypeCompletionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy
java/testFramework/src/com/intellij/codeInsight/completion/LightCompletionTestCase.java
jps/model-api/src/org/jetbrains/jps/model/JpsDummyElement.java [new file with mode: 0644]
jps/model-api/src/org/jetbrains/jps/model/JpsElementFactory.java
jps/model-api/src/org/jetbrains/jps/model/JpsElementTypeWithDefaultProperties.java
jps/model-api/src/org/jetbrains/jps/model/JpsProject.java
jps/model-api/src/org/jetbrains/jps/model/JpsSimpleElement.java [moved from jps/model-api/src/org/jetbrains/jps/model/SimpleJpsElement.java with 67% similarity]
jps/model-api/src/org/jetbrains/jps/model/artifact/JpsArtifact.java
jps/model-api/src/org/jetbrains/jps/model/java/JpsJavaModuleType.java
jps/model-api/src/org/jetbrains/jps/model/module/JpsModule.java
jps/model-api/src/org/jetbrains/jps/model/module/JpsModuleType.java
jps/model-impl/src/org/jetbrains/jps/model/artifact/impl/JpsArtifactImpl.java
jps/model-impl/src/org/jetbrains/jps/model/impl/JpsDummyElementImpl.java [new file with mode: 0644]
jps/model-impl/src/org/jetbrains/jps/model/impl/JpsElementFactoryImpl.java
jps/model-impl/src/org/jetbrains/jps/model/impl/JpsNamedElementReferenceBase.java
jps/model-impl/src/org/jetbrains/jps/model/impl/JpsProjectImpl.java
jps/model-impl/src/org/jetbrains/jps/model/impl/JpsSimpleElementImpl.java [moved from jps/model-impl/src/org/jetbrains/jps/model/impl/SimpleJpsElementImpl.java with 59% similarity]
jps/model-impl/src/org/jetbrains/jps/model/impl/JpsTypedDataImpl.java
jps/model-impl/src/org/jetbrains/jps/model/impl/SimpleJpsElementRole.java
jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleImpl.java
jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsElementPropertiesSerializer.java
jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsLibraryTableSerializer.java
jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsModelSerializerExtension.java
jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsModulePropertiesSerializer.java
jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsModuleSerializer.java
jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsProjectLoader.java
jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsArtifactLoader.java [deleted file]
jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsArtifactSerializer.java [new file with mode: 0644]
jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsArtifactTypeSerializer.java [new file with mode: 0644]
jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsPackagingElementLoader.java [deleted file]
jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsPackagingElementSerializer.java [new file with mode: 0644]
jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/JpsJavaModelSerializerExtension.java
jps/model-serialization/testData/sampleProject/.idea/artifacts/dir.xml [new file with mode: 0644]
jps/model-serialization/testData/sampleProject/.idea/artifacts/jar.xml [new file with mode: 0644]
jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsArtifactSerializationTest.java [new file with mode: 0644]
jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsProjectSerializationTest.java
platform/core-api/src/com/intellij/lang/LanguageExtension.java
platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
platform/core-impl/src/com/intellij/psi/stubs/StubTreeBuilder.java
platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java
platform/lang-api/src/com/intellij/lang/documentation/DocumentationProvider.java
platform/lang-api/src/com/intellij/psi/search/scope/NonProjectFilesScope.java
platform/lang-api/src/com/intellij/psi/search/scope/TestsScope.java
platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionData.java
platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.java
platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java
platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java
platform/lang-impl/src/com/intellij/ui/tabs/FileColorConfigurationEditDialog.java
platform/lang-impl/src/com/intellij/ui/tabs/FileColorManagerImpl.java
platform/platform-api/src/com/intellij/openapi/ui/TextFieldWithBrowseButton.java
platform/platform-api/src/com/intellij/ui/ScreenUtil.java
platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java
platform/platform-impl/src/com/intellij/ide/ui/laf/DarculaInstaller.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/DarculaLaf.java [moved from platform/platform-impl/src/com/intellij/ide/ui/laf/DurculaLaf.java with 97% similarity]
platform/platform-impl/src/com/intellij/ide/ui/laf/DarculaLookAndFeelInfo.java [moved from platform/platform-impl/src/com/intellij/ide/ui/laf/IdeaDarkLookAndFeelInfo.java with 86% similarity]
platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/impl/VirtualFilePointerManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java
platform/platform-impl/src/com/intellij/ui/BalloonImpl.java
platform/platform-tests/testSrc/com/intellij/psi/util/NameUtilTest.java
platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java
platform/util/src/com/intellij/ui/ColorUtil.java
platform/util/src/com/intellij/ui/Colored.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserManyUnversionedFilesNode.java
plugins/android-designer/src/com/intellij/android/designer/propertyTable/editors/ResourceEditor.java
plugins/android/jps-plugin/src/org/jetbrains/jps/android/model/impl/JpsAndroidModuleProperties.java
plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/builder/JpsPluginSyntheticArtifactProvider.java
plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsPluginModuleProperties.java
plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsPluginModuleType.java
plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/impl/JpsDevKitModelSerializerExtension.java
plugins/devkit/src/references/extensions/ExtensionPointQuickDocProvider.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyMembersGetter.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovySmartCompletionContributor.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyElementTypes.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrModifierListImpl.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrFieldStub.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrMethodStub.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrStubUtils.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrFieldElementType.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrMethodElementType.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrStubFileElementType.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/processors/JavaResolverProcessor.java [new file with mode: 0644]
plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/introduceParameter/IntroduceParameterTest.groovy [moved from plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/introduceParameter/IntroduceParameterTest.java with 65% similarity]
plugins/groovy/testdata/refactoring/introduceParameter/introduceConstantField/IntroduceConstantFieldAfter.groovy [new file with mode: 0644]
plugins/groovy/testdata/refactoring/introduceParameter/introduceConstantField/IntroduceConstantFieldBefore.groovy [new file with mode: 0644]
plugins/groovy/testdata/refactoring/introduceParameter/introduceConstantField/IntroduceConstantFieldMyClass.java [new file with mode: 0644]
plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectOpenProcessor.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/AnnotationProcessorImportingTest.groovy
plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceFilteringTest.java
plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/TreeContentProvider.java
plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/TreeEditableArea.java
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/context/ContextProvider.java
resources/src/META-INF/IdeaPlugin.xml
xml/dom-tests/testData/performance.xml [new file with mode: 0644]
xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java

index c867e12758959ec5673156890e3b657480c25d60..fe591aa095df5120bde87b353c623c605cb54494 100644 (file)
--- a/build.txt
+++ b/build.txt
@@ -1 +1 @@
-120.SNAPSHOT\r
+122.SNAPSHOT\r
index d9813258faf5bf1723c190c50aa177ecf65a7a9b..73c43e8d279341dbbf9f119b31bfadad03790045 100644 (file)
@@ -237,7 +237,7 @@ libraryLicense(name: "protobuf", version: "2.3.0", license: "New BSD", url: "htt
 libraryLicense(name: "Netty", libraryName: "Netty", version: "3.3.1", license: "Apache 2.0", url: "http://netty.io", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
 libraryLicense(name: "Kryo", libraryName: "Kryo", version: "1.04", license: "New BSD License", url: "http://code.google.com/p/kryo/", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php")
 libraryLicense(name: "Snappy-Java", libraryName: "Snappy-Java", version: "1.0.4.1", license: "Apache 2.0", url: "http://code.google.com/p/snappy-java/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "cucumber-jvm", libraryName: "Cucumber-JVM", version: "1.0.11", license: "MIT License", url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
+libraryLicense(name: "Cucumber-JVM", libraryName: "cucumber-jvm", version: "1.0.11", license: "MIT License", url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
 jetbrainsLibrary("JPS")
 jetbrainsLibrary("Maven Embedder")
 jetbrainsLibrary("tcServiceMessages")
index d5a3d0e213568b6ee28dc23c030df009b6af022c..ac68d64f57333901bdf012ee2ce78c4e628b5f73 100644 (file)
@@ -68,10 +68,12 @@ public class BasicExpressionCompletionContributor {
     }
 
     if (!AFTER_DOT.accepts(element)) {
-      new CollectionsUtilityMethodsProvider(parameters.getPosition(),
-                                            parameters.getExpectedType(),
-                                            parameters.getDefaultType(), result)
-        .addCompletions(parameters.getParameters().getInvocationCount() > 1 || StringUtil.isNotEmpty(matcher.getPrefix()));
+      if (parameters.getParameters().getInvocationCount() <= 1) {
+        new CollectionsUtilityMethodsProvider(parameters.getPosition(),
+                                              parameters.getExpectedType(),
+                                              parameters.getDefaultType(), result)
+          .addCompletions(StringUtil.isNotEmpty(matcher.getPrefix()));
+      }
       ClassLiteralGetter.addCompletions(parameters, result, matcher);
 
       final PsiElement position = parameters.getPosition();
index 45c4e6e8d6e2da5bae1d82f54d3a1a0096caedc5..e79c47edf9b2279897176ec15d9737933a2aef32 100644 (file)
@@ -540,7 +540,7 @@ public class JavaCompletionData extends JavaAwareCompletionData {
 
   static void addExpectedTypeMembers(CompletionParameters parameters, final CompletionResultSet result, PsiElement position) {
     for (final ExpectedTypeInfo info : JavaSmartCompletionContributor.getExpectedTypes(parameters)) {
-      new JavaMembersGetter(info.getDefaultType(), position).addMembers(parameters, parameters.getInvocationCount() > 1, new Consumer<LookupElement>() {
+      new JavaMembersGetter(info.getDefaultType(), parameters).addMembers(parameters.getInvocationCount() > 1, new Consumer<LookupElement>() {
         @Override
         public void consume(LookupElement element) {
           result.addElement(element);
index 91c2aa8e5c59fce8e696fcf867f7d25926a38a66..5dcbe17d75798acc64e994b474f4e68724340c37 100644 (file)
@@ -3,6 +3,7 @@ package com.intellij.codeInsight.completion;
 import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer;
 import com.intellij.codeInsight.lookup.LookupElement;
 import com.intellij.codeInsight.lookup.LookupElementPresentation;
+import com.intellij.featureStatistics.FeatureUsageTracker;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiMember;
 import com.intellij.psi.PsiMethod;
@@ -85,6 +86,8 @@ public class JavaGlobalMemberLookupElement extends LookupElement implements Stat
 
   @Override
   public void handleInsert(InsertionContext context) {
+    FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);
+
     (willBeImported() ? myImportInsertion : myQualifiedInsertion).handleInsert(context, this);
   }
 
index fc292da6fb7d0efe6e0c0dae53974af0ac0e641a..228c630eda8d0492033c7e00938e0ea49bb2ae43 100644 (file)
@@ -311,9 +311,9 @@ public class JavaSmartCompletionContributor extends CompletionContributor {
     PsiElement position = params.getPosition();
     if (!BasicExpressionCompletionContributor.AFTER_DOT.accepts(position)) {
       for (ExpectedTypeInfo info : mergedInfos) {
-        new JavaMembersGetter(info.getType(), position).addMembers(params, !quick, consumer);
+        new JavaMembersGetter(info.getType(), params).addMembers(!quick, consumer);
         if (!info.getDefaultType().equals(info.getType())) {
-          new JavaMembersGetter(info.getDefaultType(), position).addMembers(params, !quick, consumer);
+          new JavaMembersGetter(info.getDefaultType(), params).addMembers(!quick, consumer);
         }
       }
     }
index 571d7300bb3f06b48cd2bb79a241bbb4631c9762..345e059634002fdba1456bca4991f2a8325b2846 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.codeInsight.completion;
 import com.intellij.codeInsight.lookup.AutoCompletionPolicy;\r
 import com.intellij.codeInsight.lookup.LookupElement;\r
 import com.intellij.codeInsight.lookup.VariableLookupItem;\r
+import com.intellij.featureStatistics.FeatureUsageTracker;\r
 import com.intellij.psi.*;\r
 import com.intellij.psi.util.PsiTreeUtil;\r
 import org.jetbrains.annotations.NotNull;\r
@@ -51,9 +52,16 @@ public class JavaStaticMemberProcessor extends StaticMemberProcessor {
     shouldImport |= myOriginalPosition != null && PsiTreeUtil.isAncestor(containingClass, myOriginalPosition, false);\r
 \r
     if (member instanceof PsiMethod) {\r
-      return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new JavaMethodCallElement((PsiMethod)member, shouldImport, false));\r
+      return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new GlobalMethodCallElement((PsiMethod)member, shouldImport, false));\r
     }\r
-    return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new VariableLookupItem((PsiField)member, shouldImport));\r
+    return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new VariableLookupItem((PsiField)member, shouldImport) {\r
+      @Override\r
+      public void handleInsert(InsertionContext context) {\r
+        FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);\r
+\r
+        super.handleInsert(context);\r
+      }\r
+    });\r
   }\r
 \r
   @Override\r
@@ -62,8 +70,21 @@ public class JavaStaticMemberProcessor extends StaticMemberProcessor {
                                               boolean shouldImport) {\r
     shouldImport |= myOriginalPosition != null && PsiTreeUtil.isAncestor(containingClass, myOriginalPosition, false);\r
 \r
-    final JavaMethodCallElement element = new JavaMethodCallElement(overloads.get(0), shouldImport, true);\r
+    final JavaMethodCallElement element = new GlobalMethodCallElement(overloads.get(0), shouldImport, true);\r
     element.putUserData(JavaCompletionUtil.ALL_METHODS_ATTRIBUTE, overloads);\r
     return element;\r
   }\r
+\r
+  private static class GlobalMethodCallElement extends JavaMethodCallElement {\r
+    public GlobalMethodCallElement(PsiMethod member, boolean shouldImport, boolean mergedOverloads) {\r
+      super(member, shouldImport, mergedOverloads);\r
+    }\r
+\r
+    @Override\r
+    public void handleInsert(InsertionContext context) {\r
+      FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);\r
+\r
+      super.handleInsert(context);\r
+    }\r
+  }\r
 }\r
index 826c9fdd98aca9633ccfcc26944c494e7e04eba6..ec59d18e78abb24889994483bd839e04649b3fd4 100644 (file)
@@ -2,13 +2,12 @@ package com.intellij.codeInsight.completion;
 
 import com.intellij.codeInsight.daemon.impl.quickfix.StaticImportMethodFix;
 import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.featureStatistics.FeatureUsageTracker;
 import com.intellij.openapi.actionSystem.IdeActions;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Condition;
 import com.intellij.psi.*;
+import com.intellij.psi.impl.java.stubs.index.JavaStaticMemberNameIndex;
 import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.PsiShortNamesCache;
 import com.intellij.util.Consumer;
 import com.intellij.util.PairConsumer;
 import com.intellij.util.containers.CollectionFactory;
@@ -17,7 +16,10 @@ import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
 
 import static com.intellij.util.containers.CollectionFactory.hashSet;
 import static com.intellij.util.containers.ContainerUtil.addIfNotNull;
@@ -45,58 +47,39 @@ public abstract class StaticMemberProcessor {
   }
 
   public void processStaticMethodsGlobally(final PrefixMatcher matcher, Consumer<LookupElement> consumer) {
-    FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);
-
     final GlobalSearchScope scope = myPosition.getResolveScope();
-    final PsiShortNamesCache namesCache = PsiShortNamesCache.getInstance(myProject);
-    String[] methodNames = namesCache.getAllMethodNames();
-    for (final String methodName : CompletionUtil.sortMatching(matcher, Arrays.asList(methodNames))) {
-      if (matcher.prefixMatches(methodName)) {
-        Set<PsiClass> classes = new THashSet<PsiClass>();
-        for (final PsiMethod method : namesCache.getMethodsByName(methodName, scope)) {
-          if (isStaticallyImportable(method)) {
-            final PsiClass containingClass = method.getContainingClass();
-            assert containingClass != null : method.getName() + "; " + method + "; " + method.getClass();
-
-            if (classes.add(containingClass) && JavaCompletionUtil.isSourceLevelAccessible(myPosition, containingClass, myPackagedContext)) {
-              final boolean shouldImport = myStaticImportedClasses.contains(containingClass);
-              showHint(shouldImport);
-
+    Collection<String> memberNames = JavaStaticMemberNameIndex.getInstance().getAllKeys(myProject);
+    for (final String memberName : CompletionUtil.sortMatching(matcher, memberNames)) {
+      Set<PsiClass> classes = new THashSet<PsiClass>();
+      for (final PsiMember member : JavaStaticMemberNameIndex.getInstance().getStaticMembers(memberName, myProject, scope)) {
+        if (isStaticallyImportable(member)) {
+          final PsiClass containingClass = member.getContainingClass();
+          assert containingClass != null : member.getName() + "; " + member + "; " + member.getClass();
+
+          if (JavaCompletionUtil.isSourceLevelAccessible(myPosition, containingClass, myPackagedContext)) {
+            final boolean shouldImport = myStaticImportedClasses.contains(containingClass);
+            showHint(shouldImport);
+            if (member instanceof PsiMethod && classes.add(containingClass)) {
               final PsiMethod[] allMethods = containingClass.getAllMethods();
               final List<PsiMethod> overloads = ContainerUtil.findAll(allMethods, new Condition<PsiMethod>() {
                 @Override
                 public boolean value(PsiMethod psiMethod) {
-                  return methodName.equals(psiMethod.getName()) && isStaticallyImportable(psiMethod);
+                  return memberName.equals(psiMethod.getName()) && isStaticallyImportable(psiMethod);
                 }
               });
 
               assert !overloads.isEmpty();
               if (overloads.size() == 1) {
-                assert method == overloads.get(0);
-                consumer.consume(createLookupElement(method, containingClass, shouldImport));
+                assert member == overloads.get(0);
+                consumer.consume(createLookupElement(member, containingClass, shouldImport));
               } else {
                 if (overloads.get(0).getParameterList().getParametersCount() == 0) {
                   overloads.add(0, overloads.remove(1));
                 }
                 consumer.consume(createLookupElement(overloads, containingClass, shouldImport));
               }
-            }
-          }
-        }
-      }
-    }
-    String[] fieldNames = namesCache.getAllFieldNames();
-    for (final String fieldName : CompletionUtil.sortMatching(matcher, Arrays.asList(fieldNames))) {
-      if (matcher.prefixMatches(fieldName)) {
-        for (final PsiField field : namesCache.getFieldsByName(fieldName, scope)) {
-          if (isStaticallyImportable(field)) {
-            final PsiClass containingClass = field.getContainingClass();
-            assert containingClass != null : field.getName() + "; " + field + "; " + field.getClass();
-
-            if (JavaCompletionUtil.isSourceLevelAccessible(myPosition, containingClass, myPackagedContext)) {
-              final boolean shouldImport = myStaticImportedClasses.contains(containingClass);
-              showHint(shouldImport);
-              consumer.consume(createLookupElement(field, containingClass, shouldImport));
+            } else if (member instanceof PsiField) {
+              consumer.consume(createLookupElement(member, containingClass, shouldImport));
             }
           }
         }
index eba6e79ffef82570f05aed2c173417fc387d2cd4..228d3f7129342da9deea2c756d8441088be7c51f 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.editorActions.smartEnter;
 
 import com.intellij.codeInsight.CodeInsightUtil;
 import com.intellij.codeInsight.lookup.LookupManager;
+import com.intellij.featureStatistics.FeatureUsageTracker;
 import com.intellij.openapi.actionSystem.IdeActions;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
@@ -96,6 +97,8 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
 
   @Override
   public boolean process(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile psiFile) {
+    FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.complete.statement");
+
     final Document document = editor.getDocument();
     final String textForRollback = document.getText();
     try {
index 195ea967e8beb6aec2361c9b6c32c2e615288d4e..fe99e4889216564f5753189bea40c0803ad1c3da 100644 (file)
@@ -37,37 +37,34 @@ import java.util.Set;
  */\r
 public class JavaMembersGetter extends MembersGetter {\r
   private final PsiType myExpectedType;\r
-  private final PsiElement myPlace;\r
 \r
-  public JavaMembersGetter(@NotNull PsiType expectedType, PsiElement place) {\r
-    myPlace = place;\r
+  public JavaMembersGetter(@NotNull PsiType expectedType, CompletionParameters parameters) {\r
+    super(new JavaStaticMemberProcessor(parameters), parameters.getPosition());\r
     myExpectedType = JavaCompletionUtil.originalize(expectedType);\r
   }\r
 \r
-  public void addMembers(CompletionParameters parameters, boolean searchInheritors, final Consumer<LookupElement> results) {\r
-    final StaticMemberProcessor processor = new JavaStaticMemberProcessor(parameters);\r
-    final PsiElement position = parameters.getPosition();\r
+  public void addMembers(boolean searchInheritors, final Consumer<LookupElement> results) {\r
     if (myExpectedType instanceof PsiPrimitiveType && PsiType.DOUBLE.isAssignableFrom(myExpectedType)) {\r
-      addConstantsFromTargetClass(position, results, searchInheritors, processor);\r
-      addConstantsFromReferencedClassesInSwitch(position, results, processor);\r
+      addConstantsFromTargetClass(results, searchInheritors);\r
+      addConstantsFromReferencedClassesInSwitch(results);\r
     }\r
 \r
-    if (position.getParent().getParent() instanceof PsiSwitchLabelStatement) {\r
+    if (myPlace.getParent().getParent() instanceof PsiSwitchLabelStatement) {\r
       return; //non-enum values are processed above, enum values will be suggested by reference completion\r
     }\r
 \r
     final PsiClass psiClass = PsiUtil.resolveClassInType(myExpectedType);\r
-    processMembers(position, results, psiClass, PsiTreeUtil.getParentOfType(position, PsiAnnotation.class) != null, searchInheritors, processor);\r
+    processMembers(results, psiClass, PsiTreeUtil.getParentOfType(myPlace, PsiAnnotation.class) == null, searchInheritors);\r
   }\r
 \r
-  private void addConstantsFromReferencedClassesInSwitch(PsiElement position, final Consumer<LookupElement> results, final StaticMemberProcessor processor) {\r
-    final Set<PsiField> fields = ReferenceExpressionCompletionContributor.findConstantsUsedInSwitch(position);\r
+  private void addConstantsFromReferencedClassesInSwitch(final Consumer<LookupElement> results) {\r
+    final Set<PsiField> fields = ReferenceExpressionCompletionContributor.findConstantsUsedInSwitch(myPlace);\r
     final Set<PsiClass> classes = new HashSet<PsiClass>();\r
     for (PsiField field : fields) {\r
       ContainerUtil.addIfNotNull(classes, field.getContainingClass());\r
     }\r
     for (PsiClass aClass : classes) {\r
-      processMembers(position, new Consumer<LookupElement>() {\r
+      processMembers(new Consumer<LookupElement>() {\r
         @Override\r
         public void consume(LookupElement element) {\r
           //noinspection SuspiciousMethodCalls\r
@@ -75,14 +72,12 @@ public class JavaMembersGetter extends MembersGetter {
             results.consume(TailTypeDecorator.withTail(element, TailType.CASE_COLON));\r
           }\r
         }\r
-      }, aClass, false, false, processor);\r
+      }, aClass, true, false);\r
     }\r
   }\r
 \r
-  private void addConstantsFromTargetClass(PsiElement position,\r
-                                           Consumer<LookupElement> results,\r
-                                           boolean searchInheritors, final StaticMemberProcessor processor) {\r
-    PsiElement parent = position.getParent();\r
+  private void addConstantsFromTargetClass(Consumer<LookupElement> results, boolean searchInheritors) {\r
+    PsiElement parent = myPlace.getParent();\r
     if (!(parent instanceof PsiReferenceExpression)) {\r
       return;\r
     }\r
@@ -94,8 +89,8 @@ public class JavaMembersGetter extends MembersGetter {
       final IElementType op = binaryExpression.getOperationTokenType();\r
       if (JavaTokenType.EQEQ == op || JavaTokenType.NE == op) {\r
         if (prev == binaryExpression.getROperand()) {\r
-          processMembers(position, results, getCalledClass(binaryExpression.getLOperand()), false, searchInheritors,\r
-                         processor);\r
+          processMembers(results, getCalledClass(binaryExpression.getLOperand()), true, searchInheritors\r
+          );\r
         }\r
         return;\r
       }\r
@@ -103,7 +98,7 @@ public class JavaMembersGetter extends MembersGetter {
       parent = parent.getParent();\r
     }\r
     if (parent instanceof PsiExpressionList) {\r
-      processMembers(position, results, getCalledClass(parent.getParent()), false, searchInheritors, processor);\r
+      processMembers(results, getCalledClass(parent.getParent()), true, searchInheritors);\r
     }\r
   }\r
 \r
index 5f237cfce4ba66967fcfc86613e031f550271e7d..6209d6a9686aa882d632ec8d033ce7732ba9da6d 100644 (file)
@@ -22,11 +22,13 @@ import com.intellij.codeInsight.completion.PrefixMatcher;
 import com.intellij.codeInsight.completion.StaticMemberProcessor;
 import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
 import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Key;
 import com.intellij.psi.*;
 import com.intellij.psi.filters.TrueFilter;
+import com.intellij.psi.impl.java.stubs.index.JavaStaticMemberTypeIndex;
 import com.intellij.psi.scope.processor.FilterScopeProcessor;
+import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
@@ -35,10 +37,7 @@ import com.intellij.util.PairConsumer;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  * @author ik
@@ -46,89 +45,107 @@ import java.util.Set;
  */
 public abstract class MembersGetter {
   public static final Key<Boolean> EXPECTED_TYPE_INHERITOR_MEMBER = Key.create("EXPECTED_TYPE_INHERITOR_MEMBER");
+  private final Set<PsiMember> myImportedStatically = new HashSet<PsiMember>();
+  private final List<PsiClass> myPlaceClasses = new ArrayList<PsiClass>();
+  private final List<PsiMethod> myPlaceMethods = new ArrayList<PsiMethod>();
+  protected final PsiElement myPlace;
 
-  public void processMembers(@NotNull final PsiElement context, final Consumer<LookupElement> results, @Nullable final PsiClass where,
-                             final boolean acceptMethods, boolean searchInheritors,
-                             StaticMemberProcessor processor) {
-    if (where == null) return;
-    
-    final List<PsiClass> placeClasses = new ArrayList<PsiClass>();
-    
-    PsiClass current = PsiTreeUtil.getContextOfType(context, PsiClass.class);
-    while (current != null) {
-      current = CompletionUtil.getOriginalOrSelf(current);
-      placeClasses.add(current);
-      current = PsiTreeUtil.getContextOfType(current, PsiClass.class);
-    }
-
-    final Set<PsiMember> importedStatically = new HashSet<PsiMember>();
+  protected MembersGetter(StaticMemberProcessor processor, @NotNull final PsiElement place) {
+    myPlace = place;
     processor.processMembersOfRegisteredClasses(PrefixMatcher.ALWAYS_TRUE, new PairConsumer<PsiMember, PsiClass>() {
       @Override
       public void consume(PsiMember member, PsiClass psiClass) {
-        importedStatically.add(member);
+        myImportedStatically.add(member);
       }
     });
-    
-    final Condition<PsiClass> mayProcessMembers = new Condition<PsiClass>() {
-      @Override
-      public boolean value(PsiClass psiClass) {
-        if (psiClass == null) {
-          return false;
-        }
 
-        psiClass = CompletionUtil.getOriginalOrSelf(psiClass);
-        for (PsiClass placeClass : placeClasses) {
-          if (InheritanceUtil.isInheritorOrSelf(placeClass, psiClass, true)) {
-            return false;
-          }
-        }
-        return true;
+    PsiClass current = PsiTreeUtil.getContextOfType(place, PsiClass.class);
+    while (current != null) {
+      current = CompletionUtil.getOriginalOrSelf(current);
+      myPlaceClasses.add(current);
+      current = PsiTreeUtil.getContextOfType(current, PsiClass.class);
+    }
+
+    PsiMethod eachMethod = PsiTreeUtil.getContextOfType(place, PsiMethod.class);
+    while (eachMethod != null) {
+      eachMethod = CompletionUtil.getOriginalOrSelf(eachMethod);
+      myPlaceMethods.add(eachMethod);
+      eachMethod = PsiTreeUtil.getContextOfType(eachMethod, PsiMethod.class);
+    }
+
+  }
+
+  private boolean mayProcessMembers(@Nullable PsiClass psiClass) {
+    if (psiClass == null) {
+      return false;
+    }
+
+    for (PsiClass placeClass : myPlaceClasses) {
+      if (InheritanceUtil.isInheritorOrSelf(placeClass, psiClass, true)) {
+        return false;
       }
-    };
-    
-    final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(context.getProject()).getResolveHelper();
+    }
+    return true;
+  }
+
+  public void processMembers(final Consumer<LookupElement> results, @Nullable final PsiClass where,
+                             final boolean acceptMethods, final boolean searchInheritors) {
+    if (where == null) return;
+
+    final boolean searchFactoryMethods = searchInheritors &&
+                                   !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName()) &&
+                                   !CommonClassNames.JAVA_LANG_STRING.equals(where.getQualifiedName());
+
+    final Project project = myPlace.getProject();
+    final GlobalSearchScope scope = myPlace.getResolveScope();
 
-    final PsiClassType baseType = JavaPsiFacade.getElementFactory(where.getProject()).createType(where);
+    final PsiClassType baseType = JavaPsiFacade.getElementFactory(project).createType(where);
     Consumer<PsiType> consumer = new Consumer<PsiType>() {
       @Override
       public void consume(PsiType psiType) {
         PsiClass psiClass = PsiUtil.resolveClassInType(psiType);
-        if (mayProcessMembers.value(psiClass)) {
-          psiClass = CompletionUtil.getOriginalOrSelf(psiClass);
-          for (PsiClass placeClass : placeClasses) {
-            if (InheritanceUtil.isInheritorOrSelf(placeClass, psiClass, true)) {
-              return;
-            }
+        if (psiClass == null) {
+          return;
+        }
+        psiClass = CompletionUtil.getOriginalOrSelf(psiClass);
+        if (mayProcessMembers(psiClass)) {
+          final FilterScopeProcessor<PsiElement> declProcessor = new FilterScopeProcessor<PsiElement>(TrueFilter.INSTANCE);
+          psiClass.processDeclarations(declProcessor, ResolveState.initial(), null, myPlace);
+          doProcessMembers(acceptMethods, results, psiType != baseType, declProcessor.getResults());
+
+          String name = psiClass.getName();
+          if (name != null && searchFactoryMethods) {
+            Collection<PsiMember> factoryMethods = JavaStaticMemberTypeIndex.getInstance().getStaticMembers(name, project, scope);
+            doProcessMembers(acceptMethods, results, psiType != baseType, factoryMethods);
           }
-          processClassDeclaredMembers(psiClass, context, acceptMethods, results, resolveHelper, importedStatically, psiType != baseType);
         }
       }
     };
     consumer.consume(baseType);
     if (searchInheritors && !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName())) {
-      CodeInsightUtil.processSubTypes(baseType, context, true, PrefixMatcher.ALWAYS_TRUE, consumer);
+      CodeInsightUtil.processSubTypes(baseType, myPlace, true, PrefixMatcher.ALWAYS_TRUE, consumer);
     }
   }
 
-  private void processClassDeclaredMembers(PsiClass where,
-                                           PsiElement context,
-                                           boolean acceptMethods,
-                                           Consumer<LookupElement> results, final PsiResolveHelper resolveHelper, final Set<PsiMember> importedStatically, boolean isInheritor) {
-    final FilterScopeProcessor<PsiElement> processor = new FilterScopeProcessor<PsiElement>(TrueFilter.INSTANCE);
-    where.processDeclarations(processor, ResolveState.initial(), null, context);
-
-    for (final PsiElement result : processor.getResults()) {
+  private void doProcessMembers(boolean acceptMethods,
+                                Consumer<LookupElement> results,
+                                boolean isInheritor, Collection<? extends PsiElement> declarations) {
+    for (final PsiElement result : declarations) {
       if (result instanceof PsiMember && !(result instanceof PsiClass)) {
         final PsiMember member = (PsiMember)result;
-        if (JavaCompletionUtil.isInExcludedPackage(member, false) || importedStatically.contains(member)) continue;
-        if (member.hasModifierProperty(PsiModifier.STATIC) && resolveHelper.isAccessible(member, context, null)) {
-          if (result instanceof PsiField && !member.hasModifierProperty(PsiModifier.FINAL)) continue;
-          if (result instanceof PsiMethod && acceptMethods) continue;
-          final LookupElement item = result instanceof PsiMethod ? createMethodElement((PsiMethod)result) : createFieldElement((PsiField)result);
-          if (item != null) {
-            item.putUserData(EXPECTED_TYPE_INHERITOR_MEMBER, isInheritor);
-            results.consume(AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(item));
-          }
+        if (!member.hasModifierProperty(PsiModifier.STATIC)) continue;
+        if (result instanceof PsiField && !member.hasModifierProperty(PsiModifier.FINAL)) continue;
+        if (result instanceof PsiMethod && (!acceptMethods || myPlaceMethods.contains(result))) continue;
+        if (JavaCompletionUtil.isInExcludedPackage(member, false) || myImportedStatically.contains(member)) continue;
+
+        if (!JavaPsiFacade.getInstance(myPlace.getProject()).getResolveHelper().isAccessible(member, myPlace, null)) {
+          continue;
+        }
+
+        final LookupElement item = result instanceof PsiMethod ? createMethodElement((PsiMethod)result) : createFieldElement((PsiField)result);
+        if (item != null) {
+          item.putUserData(EXPECTED_TYPE_INHERITOR_MEMBER, isInheritor);
+          results.consume(AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(item));
         }
       }
     }
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStaticMemberNameIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStaticMemberNameIndex.java
new file mode 100644 (file)
index 0000000..3787bdf
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+/*
+ * @author max
+ */
+package com.intellij.psi.impl.java.stubs.index;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiMember;
+import com.intellij.psi.impl.search.JavaSourceFilterScope;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.stubs.StringStubIndexExtension;
+import com.intellij.psi.stubs.StubIndexKey;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+public class JavaStaticMemberNameIndex extends StringStubIndexExtension<PsiMember> {
+
+  private static final JavaStaticMemberNameIndex ourInstance = new JavaStaticMemberNameIndex();
+  public static JavaStaticMemberNameIndex getInstance() {
+    return ourInstance;
+  }
+
+  @NotNull
+  @Override
+  public StubIndexKey<String, PsiMember> getKey() {
+    return JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES;
+  }
+
+  public Collection<PsiMember> getStaticMembers(final String name, final Project project, @NotNull final GlobalSearchScope scope) {
+    return super.get(name, project, new JavaSourceFilterScope(scope));
+  }
+
+  @Override
+  public boolean isKeyHighlySelective() {
+    return true;
+  }
+}
\ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStaticMemberTypeIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStaticMemberTypeIndex.java
new file mode 100644 (file)
index 0000000..baf5ec5
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+/*
+ * @author max
+ */
+package com.intellij.psi.impl.java.stubs.index;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiMember;
+import com.intellij.psi.impl.search.JavaSourceFilterScope;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.stubs.StringStubIndexExtension;
+import com.intellij.psi.stubs.StubIndexKey;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+public class JavaStaticMemberTypeIndex extends StringStubIndexExtension<PsiMember> {
+
+  private static final JavaStaticMemberTypeIndex ourInstance = new JavaStaticMemberTypeIndex();
+  public static JavaStaticMemberTypeIndex getInstance() {
+    return ourInstance;
+  }
+
+  @NotNull
+  @Override
+  public StubIndexKey<String, PsiMember> getKey() {
+    return JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES;
+  }
+
+  public Collection<PsiMember> getStaticMembers(@NotNull final String shortTypeText, final Project project, @NotNull final GlobalSearchScope scope) {
+    return super.get(shortTypeText, project, new JavaSourceFilterScope(scope));
+  }
+
+  @Override
+  public boolean isKeyHighlySelective() {
+    return true;
+  }
+}
\ No newline at end of file
index 3799d960534427a2da0d11e939bbfd6eee93fde3..9e6d0eca89997cb1d06158301fdad7b7da368a1c 100644 (file)
@@ -18,8 +18,10 @@ package com.intellij.psi.impl.cache;
 import com.intellij.lang.LighterAST;
 import com.intellij.lang.LighterASTNode;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.CommonClassNames;
 import com.intellij.psi.JavaTokenType;
+import com.intellij.psi.PsiNameHelper;
 import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
 import com.intellij.psi.impl.java.stubs.PsiAnnotationStub;
 import com.intellij.psi.impl.java.stubs.PsiClassStub;
@@ -275,4 +277,11 @@ public class TypeInfo {
   public void addAnnotation(PsiAnnotationStub annotation) {
     myAnnotationStubs.add(annotation);
   }
+
+  @NotNull
+  public String getShortTypeText() {
+    if (text == null) return "";
+    String name = PsiNameHelper.getShortClassName(text.getString());
+    return arrayCount > 0 ? name + StringUtil.repeat("[]", arrayCount) : name;
+  }
 }
\ No newline at end of file
index 35d1558c973ab8ccd72539c798a64a2ae1de49c5..25f99d758334dc1d8c8c4b94e84c98e554d41117 100644 (file)
@@ -43,9 +43,13 @@ public class ClsModifierListImpl extends ClsRepositoryPsiElement<PsiModifierList
 
   @Override
   public boolean hasModifierProperty(@NotNull String name) {
+    return hasMaskModifierProperty(name, getStub().getModifiersMask());
+  }
+
+  public static boolean hasMaskModifierProperty(String name, int mask) {
     int flag = PsiModifierListImpl.NAME_TO_MODIFIER_FLAG_MAP.get(name);
     assert flag != 0;
-    return (getStub().getModifiersMask() & flag) != 0;
+    return (mask & flag) != 0;
   }
 
   @Override
index f9e27b3d59d22049739959e2c2fd50f09acb2c81..0a391cf40dd1c37636b34ab7a765b1f2ab7833e9 100644 (file)
@@ -138,6 +138,10 @@ public abstract class JavaFieldStubElementType extends JavaStubElementType<PsiFi
     final String name = stub.getName();
     if (name != null) {
       sink.occurrence(JavaStubIndexKeys.FIELDS, name);
+      if (JavaMethodElementType.isJavaStaticMemberStub(stub)) {
+        sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
+        sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getType(false).getShortTypeText());
+      }
     }
   }
 
index 562128f464a8abe36839f27d88c3a0fd2b241cf5..ea655e8f94573a7c6ccecb4cfdf71a2f3863fc93 100644 (file)
@@ -20,8 +20,11 @@ import com.intellij.lang.LighterAST;
 import com.intellij.lang.LighterASTNode;
 import com.intellij.psi.JavaTokenType;
 import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiModifier;
+import com.intellij.psi.PsiModifierList;
 import com.intellij.psi.impl.cache.RecordUtil;
 import com.intellij.psi.impl.cache.TypeInfo;
+import com.intellij.psi.impl.compiled.ClsModifierListImpl;
 import com.intellij.psi.impl.java.stubs.impl.PsiMethodStubImpl;
 import com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys;
 import com.intellij.psi.impl.source.PsiAnnotationMethodImpl;
@@ -145,6 +148,18 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
     final String name = stub.getName();
     if (name != null) {
       sink.occurrence(JavaStubIndexKeys.METHODS, name);
+      if (isJavaStaticMemberStub(stub)) {
+        sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
+        sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getReturnTypeText(false).getShortTypeText());
+      }
+    }
+  }
+
+  public static boolean isJavaStaticMemberStub(StubElement<?> stub) {
+    StubElement<PsiModifierList> type = stub.findChildStubByType(JavaStubElementTypes.MODIFIER_LIST);
+    if (type instanceof PsiModifierListStub) {
+      return ClsModifierListImpl.hasMaskModifierProperty(PsiModifier.STATIC, ((PsiModifierListStub)type).getModifiersMask());
     }
+    return true;
   }
 }
index f82a28fbb692cfbe19ee78e47d5d4ed7b98618f8..04b476b3bf62b6770fbd1760ca1b07e13c463f0e 100644 (file)
@@ -26,6 +26,8 @@ public class JavaStubIndexKeys {
   public static final StubIndexKey<String, PsiReferenceList> SUPER_CLASSES = StubIndexKey.createIndexKey("java.class.extlist");
   public static final StubIndexKey<String, PsiField> FIELDS = StubIndexKey.createIndexKey("java.field.name");
   public static final StubIndexKey<String, PsiMethod> METHODS = StubIndexKey.createIndexKey("java.method.name");
+  public static final StubIndexKey<String, PsiMember> JVM_STATIC_MEMBERS_NAMES = StubIndexKey.createIndexKey("jvm.static.member.name");
+  public static final StubIndexKey<String, PsiMember> JVM_STATIC_MEMBERS_TYPES = StubIndexKey.createIndexKey("jvm.static.member.type");
   public static final StubIndexKey<String,PsiAnonymousClass> ANONYMOUS_BASEREF = StubIndexKey.createIndexKey("java.anonymous.baseref");
   public static final StubIndexKey<String,PsiClass> CLASS_SHORT_NAMES = StubIndexKey.createIndexKey("java.class.shortname");
   public static final StubIndexKey<Integer,PsiClass> CLASS_FQN = StubIndexKey.createIndexKey("java.class.fqn");
index 4a91aa5f33173292a02972429b3dfc903345bd35..653579eafea512d95a3894091d0a970ecc1598a4 100644 (file)
@@ -37,7 +37,7 @@ import java.io.IOException;
  * @author max
  */
 public class JavaFileElementType extends ILightStubFileElementType<PsiJavaFileStub> {
-  public static final int STUB_VERSION = 12;
+  public static final int STUB_VERSION = 13;
 
   public JavaFileElementType() {
     super("java.FILE", JavaLanguage.INSTANCE);
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/second/GlobalFactoryMethods.java b/java/java-tests/testData/codeInsight/completion/smartType/second/GlobalFactoryMethods.java
new file mode 100644 (file)
index 0000000..4b8f4a7
--- /dev/null
@@ -0,0 +1,27 @@
+import java.lang.Object;
+
+class Super<T> {
+}
+
+class SubString extends Super<String> {
+  public static SubString createSubString() {}
+}
+class SubInt extends Super<Integer> { }
+class SubGeneric<T> extends Super<T> { }
+class SubRaw extends Super { }
+
+class Factory {
+  public static Object createObject() {}
+  public static <T> Super<T> createExpected() {}
+  public static Super<Integer> createSuperInt() {}
+  public static SubInt createSubInt() {}
+  public static <T> SubGeneric<T> createSubGeneric() {}
+  public static SubRaw createSubRaw() {}
+}
+
+class Intermediate {
+
+    Super<String> s = create<caret>x
+}
+
+
index f4724e77c25ba93745404722289ee2a33a6b7b37..c2275393446671ae8be886cb86aaccbad3a4683e 100644 (file)
@@ -2,7 +2,7 @@ public class Test {
 
   static MyEnum getAvailabilityStatusCode() {
 
-    return get<caret>
+    return getAS<caret>
   }
 
 
index 9144d10238c8b5ce33e2d2a3dfacf3024ed2c76c..0528557793b1e9a588a0e32ffafbaa71956614e9 100644 (file)
@@ -2,7 +2,7 @@ class C{
     {
         Object o;
         if (o instanceof Foo) {
-            new Object().do<caret>
+            new Object().dofo<caret>
         }
     }
 }
index ff0a598a799149b4576a6f6598b1c9af62d7fb0f..6e880247754a4c83d56377b365fc8ae49beffa1c 100644 (file)
@@ -2,23 +2,25 @@ package com.intellij.codeInsight.completion;
 
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInsight.CodeInsightSettings;
-import com.intellij.codeInsight.lookup.*;
-import com.intellij.codeInsight.lookup.impl.LookupImpl;
+import com.intellij.codeInsight.lookup.LookupElementDecorator;
+import com.intellij.codeInsight.lookup.LookupElementPresentation;
+import com.intellij.codeInsight.lookup.LookupItem;
+import com.intellij.codeInsight.lookup.LookupManager;
 import com.intellij.testFramework.PlatformTestUtil;
 import com.intellij.util.ThrowableRunnable;
 import org.jetbrains.annotations.NonNls;
 
 @SuppressWarnings({"ALL"})
-public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
-  private static final String BASE_PATH = "/codeInsight/completion/smartType/second";
+public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCase {
 
-  public SecondSmartTypeCompletionTest() {
-    setType(CompletionType.SMART);
+  @Override
+  protected void complete() {
+    myItems = myFixture.complete(CompletionType.SMART, 2);
   }
 
   @Override
-  protected String getTestDataPath() {
-    return JavaTestUtil.getJavaTestDataPath();
+  protected String getBasePath() {
+    return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/completion/smartType/second";
   }
 
   public void testMethodAsQualifier() throws Throwable { doTest(); }
@@ -69,7 +71,7 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
   public void testDontIgnoreToStringInsideIt() throws Throwable { doTest(); }
   public void testDontIgnoreToStringInStringBuilders() throws Throwable {
     configure();
-    assertStringItems("bar.substring", "bar.substring", "bar.toString");
+    myFixture.assertPreferredCompletionItems(0, "bar.substring", "bar.substring", "bar.toString");
   }
 
   public void testNoObjectMethodsAsFirstPart() throws Throwable { doTest(); }
@@ -81,7 +83,7 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
   public void testNewStaticProblem() throws Throwable { doTest(); }
 
   public void testChainingPerformance() throws Throwable {
-    configureByFileNoComplete(BASE_PATH + "/" + getTestName(false) + ".java");
+    myFixture.configureByFile(getTestName(false) + ".java");
     PlatformTestUtil.startPerformanceTest(getTestName(false), 1000, new ThrowableRunnable() {
       @Override
       public void run() throws Exception {
@@ -103,12 +105,12 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
   }
 
   private void configure() {
-    configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+    configureByFile(getTestName(false) + ".java");
   }
 
   public void testNoArraysAsListCommonPrefix() throws Throwable {
     configure();
-    checkResultByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+    checkResultByFile(getTestName(false) + ".java");
     assertStringItems("bar()", "foo()");
     assertEquals("Arrays.asList(f.bar())", ((LookupItem)((LookupElementDecorator)myItems[0]).getDelegate()).getPresentableText());
     assertEquals("Arrays.asList(f.foo())", ((LookupItem)((LookupElementDecorator)myItems[1]).getDelegate()).getPresentableText());
@@ -117,11 +119,11 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
   }
 
   public void testRestoreInitialPrefix() throws Throwable {
-    configureByFileNoComplete(BASE_PATH + "/" + getTestName(false) + ".java");
-    complete(1);
+    myFixture.configureByFile(getTestName(false) + ".java");
+    myFixture.complete(CompletionType.SMART);
     assertStringItems("MyEnum.Bar", "MyEnum.Foo");
     checkResult();
-    complete(1);
+    myFixture.complete(CompletionType.SMART);
     assertStringItems("my.getEnum", "MyEnum.Bar", "MyEnum.Foo");
   }
 
@@ -138,8 +140,8 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
 
   private void doAntiTest() throws Exception {
     configure();
-    assertNull(myItems);
-    checkResultByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+    assertEmpty(myItems);
+    checkResultByFile(getTestName(false) + ".java");
   }
 
   public void testCastInstanceofedQualifier() throws Throwable { doTest(); }
@@ -157,7 +159,7 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
 
   public void testNoRedundantCasts() throws Throwable {
     configure();
-    checkResultByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+    checkResultByFile(getTestName(false) + ".java");
     assertStringItems("o.gggg", "false", "true"); 
   }
 
@@ -168,7 +170,7 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
   }
 
   private void checkResult() {
-    checkResultByFile(BASE_PATH + "/" + getTestName(false) + "-out.java");
+    checkResultByFile(getTestName(false) + "-out.java");
   }
 
   public void testSingletonMap() throws Throwable {
@@ -202,6 +204,11 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
     checkResult();
   }
 
+  public void testGlobalFactoryMethods() {
+    configure();
+    assertStringItems("createExpected", "createSubGeneric", "createSubRaw", "createSubString");
+  }
+
   public void testEmptyMapPresentation() {
     configure();
     LookupElementPresentation presentation = new LookupElementPresentation();
@@ -216,13 +223,6 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
     assertEquals("Collections.emptyMap", presentation.getItemText());
   }
 
-  @Override
-  protected void complete() {
-    complete(2);
-    LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(myEditor);
-    myItems = lookup == null ? null : lookup.getItems().toArray(LookupElement.EMPTY_ARRAY);
-  }
-
   protected void tearDown() throws Exception {
     LookupManager.getInstance(getProject()).hideActiveLookup();
     super.tearDown();
index cddb71d9e6bcff7140dc4cc939a6e5d372c0cd07..62929e6514844cdcdd3e9a139e37e60b463d057b 100644 (file)
@@ -301,9 +301,8 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
     myFixture.addClass("package foo; public class FList<T> implements java.util.List<T> { public static <T> FList<T> emptyList() {} }");
     configureNoCompletion(getTestName(false) + ".java");
     myFixture.complete(CompletionType.SMART, 2);
-    assertPreferredItems(0, "local", "local.subList", "locMethod", "locMethod().subList", "emptyList", "singletonList", "unmodifiableList", "emptyList");
-    assert 'Collections.emptyList' in lookup.items[4].allLookupStrings
-    assert 'FList.emptyList' in lookup.items[7].allLookupStrings
+    assert lookup.items.findIndexOf { 'Collections.emptyList' in it.allLookupStrings } < lookup.items.findIndexOf { 'FList.emptyList' in it.allLookupStrings }
+    assertPreferredItems(0, "local", "local.subList", "locMethod")
   }
 
   public void testDispreferGetterInSetterCall() {
index 9c242c06b177436514693c3c402bc075fe2b8b69..5ad6caab81ff7db6135d5db667f5fc21926b07a7 100644 (file)
@@ -23,7 +23,6 @@ import com.intellij.util.containers.HashSet;
 import org.jetbrains.annotations.NonNls;\r
 \r
 import java.util.ArrayList;\r
-import java.util.Arrays;\r
 import java.util.Collection;\r
 import java.util.Set;\r
 \r
@@ -103,7 +102,7 @@ public abstract class LightCompletionTestCase extends LightCodeInsightTestCase {
   }\r
 \r
   protected void assertStringItems(@NonNls String... items) {\r
-    assertEquals(getLookupStrings(new ArrayList<String>()), Arrays.asList(items));\r
+    assertOrderedEquals(getLookupStrings(new ArrayList<String>()), items);\r
   }\r
 \r
   protected void assertContainsItems(final String... expected) {\r
diff --git a/jps/model-api/src/org/jetbrains/jps/model/JpsDummyElement.java b/jps/model-api/src/org/jetbrains/jps/model/JpsDummyElement.java
new file mode 100644 (file)
index 0000000..54c7233
--- /dev/null
@@ -0,0 +1,7 @@
+package org.jetbrains.jps.model;
+
+/**
+ * @author nik
+ */
+public interface JpsDummyElement extends JpsElement {
+}
index 07d4f02b9b630d1c0bd3f727dbf4a2df7d46ed90..7b9cdaa4536c90ade617038086c6ecfa53f02d40 100644 (file)
@@ -20,7 +20,7 @@ public abstract class JpsElementFactory {
 
   public abstract JpsModel createModel();
 
-  public abstract <P extends JpsElementProperties> JpsModule createModule(@NotNull String name, @NotNull JpsModuleType<P> type, @NotNull P properties);
+  public abstract <P extends JpsElement> JpsModule createModule(@NotNull String name, @NotNull JpsModuleType<P> type, @NotNull P properties);
 
   public abstract <P extends JpsElementProperties> JpsTypedLibrary<P> createLibrary(@NotNull String name, @NotNull JpsLibraryType<P> type, @NotNull P properties);
 
@@ -39,4 +39,10 @@ public abstract class JpsElementFactory {
 
   @NotNull
   public abstract JpsElementReference<JpsGlobal> createGlobalReference();
+
+  @NotNull
+  public abstract JpsDummyElement createDummyElement();
+
+  @NotNull
+  public abstract <P> JpsSimpleElement<P> createSimpleElement(@NotNull P properties);
 }
index 08516acb240a0fcccd2d60566bfdaa54221bdc2c..c6a0f99c0761d006e721887dac05351c532d9b1b 100644 (file)
@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull;
 /**
  * @author nik
  */
-public interface JpsElementTypeWithDefaultProperties<P extends JpsElementProperties> {
+public interface JpsElementTypeWithDefaultProperties<P> {
   @NotNull
   P createDefaultProperties();
 }
index cf0a2508d55e7e6cc4ea1e553fa00bf22545f39e..18d66a2901692c32e9aeaa20c229342d17191d46 100644 (file)
@@ -16,7 +16,7 @@ import java.util.List;
 public interface JpsProject extends JpsCompositeElement, JpsReferenceableElement<JpsProject> {
 
   @NotNull
-  <P extends JpsElementProperties, ModuleType extends JpsModuleType<P> & JpsElementTypeWithDefaultProperties<P>>
+  <P extends JpsElement, ModuleType extends JpsModuleType<P> & JpsElementTypeWithDefaultProperties<P>>
   JpsModule addModule(@NotNull String name, @NotNull ModuleType moduleType);
 
   void addModule(@NotNull JpsModule module);
similarity index 67%
rename from jps/model-api/src/org/jetbrains/jps/model/SimpleJpsElement.java
rename to jps/model-api/src/org/jetbrains/jps/model/JpsSimpleElement.java
index 09a565fda058230e670f693d5adbbae58c5c6676..18c1ee3129e0533ffa8c6e28662ddb1d65a60d73 100644 (file)
@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull;
 /**
  * @author nik
  */
-public interface SimpleJpsElement<P extends JpsElementProperties> extends JpsElement {
+public interface JpsSimpleElement<P> extends JpsElement {
   @NotNull
   P getProperties();
 
index 0fbf491a99d390e2da7d0bed366e7dcb9dd75d99..7a4526b555eb1f118d9d18596cd0e1b9f1342eee 100644 (file)
@@ -24,7 +24,11 @@ public interface JpsArtifact extends JpsNamedElement, JpsReferenceableElement<Jp
 
   void setRootElement(@NotNull JpsCompositePackagingElement rootElement);
 
+  boolean isBuildOnMake();
+
   @NotNull
   @Override
   JpsArtifactReference createReference();
+
+  void setBuildOnMake(boolean buildOnMake);
 }
index 299e950147abcea45965c900d01cf880159ff68f..5100be989f53773932ccb7b3475685b525864500 100644 (file)
@@ -1,24 +1,20 @@
 package org.jetbrains.jps.model.java;
 
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jps.model.DummyJpsElementProperties;
+import org.jetbrains.jps.model.JpsDummyElement;
+import org.jetbrains.jps.model.JpsElementFactory;
 import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
 import org.jetbrains.jps.model.module.JpsModuleType;
 
 /**
  * @author nik
  */
-public class JpsJavaModuleType extends JpsModuleType<DummyJpsElementProperties> implements JpsElementTypeWithDefaultProperties<DummyJpsElementProperties> {
+public class JpsJavaModuleType extends JpsModuleType<JpsDummyElement> implements JpsElementTypeWithDefaultProperties<JpsDummyElement> {
   public static final JpsJavaModuleType INSTANCE = new JpsJavaModuleType();
 
   @NotNull
   @Override
-  public DummyJpsElementProperties createDefaultProperties() {
-    return DummyJpsElementProperties.INSTANCE;
-  }
-
-  @Override
-  public DummyJpsElementProperties createCopy(DummyJpsElementProperties properties) {
-    return DummyJpsElementProperties.INSTANCE;
+  public JpsDummyElement createDefaultProperties() {
+    return JpsElementFactory.getInstance().createDummyElement();
   }
 }
index 0e9692e5b44ce843b67ed77c4bbefd98989dec0f..d83a463b10786254f835c0fdd0fd4e5482506a65 100644 (file)
@@ -68,5 +68,5 @@ public interface JpsModule extends JpsNamedElement, JpsReferenceableElement<JpsM
   JpsModuleType<?> getModuleType();
 
   @NotNull
-  JpsElementProperties getProperties();
+  JpsElement getProperties();
 }
index a5e720b73b0a74033ee41c5bc8e92458f224c253..05de84e1ea2b04a3b39361f7531fbf73cee0c0cd 100644 (file)
@@ -1,11 +1,15 @@
 package org.jetbrains.jps.model.module;
 
-import org.jetbrains.jps.model.JpsElementProperties;
-import org.jetbrains.jps.model.JpsElementType;
+import org.jetbrains.jps.model.JpsElement;
+import org.jetbrains.jps.model.JpsElementChildRole;
 
 /**
  * @author nik
  */
-public abstract class JpsModuleType<P extends JpsElementProperties> extends JpsElementType<P> {
+public abstract class JpsModuleType<P extends JpsElement> {
+  private final JpsElementChildRole<P> myPropertiesRole = new JpsElementChildRole<P>();
 
+  public final JpsElementChildRole<P> getPropertiesRole() {
+    return myPropertiesRole;
+  }
 }
index 8298e3dbb7ddf93f51a7d2644f2a5bb854573120..cf1708f39b2bb180a962a2eab65a6ff153579d31 100644 (file)
@@ -21,6 +21,8 @@ public class JpsArtifactImpl extends JpsNamedCompositeElementBase<JpsArtifactImp
     ROOT_ELEMENT_CHILD_ROLE = JpsElementChildRoleBase.create("root element");
   private static final JpsTypedDataRole<JpsArtifactType> TYPED_DATA_ROLE = new JpsTypedDataRole<JpsArtifactType>();
   private String myOutputPath;
+  private boolean myBuildOnMake;
+
 
   public JpsArtifactImpl(@NotNull String name, @NotNull JpsCompositePackagingElement rootElement, @NotNull JpsArtifactType type) {
     super(name);
@@ -72,4 +74,17 @@ public class JpsArtifactImpl extends JpsNamedCompositeElementBase<JpsArtifactImp
   public void setRootElement(@NotNull JpsCompositePackagingElement rootElement) {
     myContainer.setChild(ROOT_ELEMENT_CHILD_ROLE, rootElement);
   }
+
+  @Override
+  public boolean isBuildOnMake() {
+    return myBuildOnMake;
+  }
+
+  @Override
+  public void setBuildOnMake(boolean buildOnMake) {
+    if (myBuildOnMake != buildOnMake) {
+      myBuildOnMake = buildOnMake;
+      fireElementChanged();
+    }
+  }
 }
diff --git a/jps/model-impl/src/org/jetbrains/jps/model/impl/JpsDummyElementImpl.java b/jps/model-impl/src/org/jetbrains/jps/model/impl/JpsDummyElementImpl.java
new file mode 100644 (file)
index 0000000..5c36238
--- /dev/null
@@ -0,0 +1,19 @@
+package org.jetbrains.jps.model.impl;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jps.model.JpsDummyElement;
+
+/**
+ * @author nik
+ */
+public class JpsDummyElementImpl extends JpsElementBase<JpsDummyElementImpl> implements JpsDummyElement {
+  @NotNull
+  @Override
+  public JpsDummyElementImpl createCopy() {
+    return new JpsDummyElementImpl();
+  }
+
+  @Override
+  public void applyChanges(@NotNull JpsDummyElementImpl modified) {
+  }
+}
index 17da1cd953e3a86df4d36bd7df39f9e415726564..d8de04b8388c03755642c4859042a9889cb9223b 100644 (file)
@@ -33,8 +33,8 @@ public class JpsElementFactoryImpl extends JpsElementFactory {
   }
 
   @Override
-  public <P extends JpsElementProperties> JpsModule createModule(@NotNull String name, @NotNull JpsModuleType<P> type, @NotNull P properties) {
-    return new JpsModuleImpl(type, name, properties);
+  public <P extends JpsElement> JpsModule createModule(@NotNull String name, @NotNull JpsModuleType<P> type, @NotNull P properties) {
+    return new JpsModuleImpl<P>(type, name, properties);
   }
 
 
@@ -75,4 +75,16 @@ public class JpsElementFactoryImpl extends JpsElementFactory {
   public JpsElementReference<JpsGlobal> createGlobalReference() {
     return new JpsGlobalElementReference();
   }
+
+  @NotNull
+  @Override
+  public JpsDummyElement createDummyElement() {
+    return new JpsDummyElementImpl();
+  }
+
+  @NotNull
+  @Override
+  public <P> JpsSimpleElement<P> createSimpleElement(@NotNull P properties) {
+    return new JpsSimpleElementImpl<P>(properties);
+  }
 }
index b3e79b1364b5415e8188026d3454b47c5a2ad1c0..b539125bc7a93e831b09314f73d6a9299757c3e0 100644 (file)
@@ -11,7 +11,7 @@ import java.util.List;
 public abstract class JpsNamedElementReferenceBase<T extends JpsNamedElement, Self extends JpsNamedElementReferenceBase<T, Self>>
   extends JpsCompositeElementBase<Self> implements JpsElementReference<T> {
   private static final JpsElementChildRole<JpsElementReference<? extends JpsCompositeElement>> PARENT_REFERENCE_ROLE = JpsElementChildRoleBase.create("parent");
-  private final JpsElementCollectionRole<? extends T> myCollectionRole;
+  protected final JpsElementCollectionRole<? extends T> myCollectionRole;
   protected final String myElementName;
 
   protected JpsNamedElementReferenceBase(@NotNull JpsElementCollectionRole<? extends T> role,
index 68aaa272ca2b84e68827ce5beccebca337120676..dd07e0a019a6ddbcbc50f2c0b099673bd613ba43 100644 (file)
@@ -44,10 +44,10 @@ public class JpsProjectImpl extends JpsRootElementBase<JpsProjectImpl> implement
   @NotNull
   @Override
   public
-  <P extends JpsElementProperties, ModuleType extends JpsModuleType<P> & JpsElementTypeWithDefaultProperties<P>>
+  <P extends JpsElement, ModuleType extends JpsModuleType<P> & JpsElementTypeWithDefaultProperties<P>>
   JpsModule addModule(@NotNull final String name, @NotNull ModuleType moduleType) {
     final JpsElementCollectionImpl<JpsModule> collection = myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE);
-    return collection.addChild(new JpsModuleImpl(moduleType, name, moduleType.createDefaultProperties()));
+    return collection.addChild(new JpsModuleImpl<P>(moduleType, name, moduleType.createDefaultProperties()));
   }
 
   @NotNull
similarity index 59%
rename from jps/model-impl/src/org/jetbrains/jps/model/impl/SimpleJpsElementImpl.java
rename to jps/model-impl/src/org/jetbrains/jps/model/impl/JpsSimpleElementImpl.java
index db16f0c05b5d69040486c8705b097bf3485d754e..70190869e623a745dd84d7843e20d804cd245d07 100644 (file)
@@ -6,14 +6,14 @@ import org.jetbrains.jps.model.*;
 /**
  * @author nik
  */
-public class SimpleJpsElementImpl<P extends JpsElementProperties> extends JpsElementBase<SimpleJpsElementImpl<P>> implements SimpleJpsElement<P> {
+public class JpsSimpleElementImpl<P> extends JpsElementBase<JpsSimpleElementImpl<P>> implements JpsSimpleElement<P> {
   private P myProperties;
 
-  public SimpleJpsElementImpl(P properties) {
+  public JpsSimpleElementImpl(P properties) {
     myProperties = properties;
   }
 
-  public SimpleJpsElementImpl(SimpleJpsElementImpl<P> original) {
+  public JpsSimpleElementImpl(JpsSimpleElementImpl<P> original) {
     myProperties = original.myProperties;
   }
 
@@ -33,12 +33,12 @@ public class SimpleJpsElementImpl<P extends JpsElementProperties> extends JpsEle
 
   @NotNull
   @Override
-  public SimpleJpsElementImpl<P> createCopy() {
-    return new SimpleJpsElementImpl<P>(this);
+  public JpsSimpleElementImpl<P> createCopy() {
+    return new JpsSimpleElementImpl<P>(this);
   }
 
   @Override
-  public void applyChanges(@NotNull SimpleJpsElementImpl<P> modified) {
+  public void applyChanges(@NotNull JpsSimpleElementImpl<P> modified) {
     setProperties(modified.getProperties());
   }
 }
index 6caf52c5a7549e0ce1a3b7e1b9172b6b8ae949d7..2cfe973a3f735156372986fdb26630b5374693b2 100644 (file)
@@ -61,10 +61,6 @@ public class JpsTypedDataImpl<T extends JpsElementType<?>> extends JpsElementBas
     setProperties(data.getProperties());
   }
 
-  public static <T extends JpsElementType<?> & JpsElementTypeWithDefaultProperties<?>> JpsTypedDataImpl<T> createTypedData(T type) {
-    return createTypedData(type, type.createDefaultProperties());
-  }
-
   public static <T extends JpsElementType<?>> JpsTypedDataImpl<T> createTypedData(T type, final JpsElementProperties properties) {
     return new JpsTypedDataImpl<T>(type, properties);
   }
index 8cf2909af017dfafc245654ce65155af8348a023..7bdc4a3101d53cd4ca2c0655359f5cf16230d355 100644 (file)
@@ -1,12 +1,12 @@
 package org.jetbrains.jps.model.impl;
 
 import org.jetbrains.jps.model.JpsElementProperties;
-import org.jetbrains.jps.model.SimpleJpsElement;
+import org.jetbrains.jps.model.JpsSimpleElement;
 
 /**
  * @author nik
  */
-public class SimpleJpsElementRole<P extends JpsElementProperties> extends JpsElementChildRoleBase<SimpleJpsElement<P>> {
+public class SimpleJpsElementRole<P extends JpsElementProperties> extends JpsElementChildRoleBase<JpsSimpleElement<P>> {
   public SimpleJpsElementRole(String debugName) {
     super(debugName);
   }
index 75e059efa2ed69b218f153c09e6eeb8b97fdcc19..0e2eb20d7b8f7c714ad6330bdeae54e81411163f 100644 (file)
@@ -14,17 +14,17 @@ import java.util.List;
 /**
  * @author nik
  */
-public class JpsModuleImpl extends JpsNamedCompositeElementBase<JpsModuleImpl> implements JpsModule {
-  private static final JpsTypedDataRole<JpsModuleType<?>> TYPED_DATA_ROLE = new JpsTypedDataRole<JpsModuleType<?>>();
+public class JpsModuleImpl<P extends JpsElement> extends JpsNamedCompositeElementBase<JpsModuleImpl<P>> implements JpsModule {
   private static final JpsUrlListRole CONTENT_ROOTS_ROLE = new JpsUrlListRole("content roots");
   private static final JpsUrlListRole EXCLUDED_ROOTS_ROLE = new JpsUrlListRole("excluded roots");
-  public static final JpsElementChildRole<JpsDependenciesListImpl>
-    DEPENDENCIES_LIST_CHILD_ROLE = JpsElementChildRoleBase.create("dependencies");
+  public static final JpsElementChildRole<JpsDependenciesListImpl> DEPENDENCIES_LIST_CHILD_ROLE = JpsElementChildRoleBase.create("dependencies");
+  private final JpsModuleType<P> myModuleType;
   private final JpsLibraryCollection myLibraryCollection;
 
-  public <P extends JpsElementProperties> JpsModuleImpl(JpsModuleType<P> type, @NotNull String name, @NotNull P properties) {
+  public JpsModuleImpl(JpsModuleType<P> type, @NotNull String name, @NotNull P properties) {
     super(name);
-    myContainer.setChild(TYPED_DATA_ROLE, new JpsTypedDataImpl<JpsModuleType<?>>(type, properties));
+    myModuleType = type;
+    myContainer.setChild(myModuleType.getPropertiesRole(), properties);
     myContainer.setChild(CONTENT_ROOTS_ROLE);
     myContainer.setChild(EXCLUDED_ROOTS_ROLE);
     myContainer.setChild(JpsFacetRole.COLLECTION_ROLE);
@@ -34,21 +34,22 @@ public class JpsModuleImpl extends JpsNamedCompositeElementBase<JpsModuleImpl> i
     myContainer.setChild(JpsSdkReferencesTableImpl.ROLE);
   }
 
-  private JpsModuleImpl(JpsModuleImpl original) {
+  private JpsModuleImpl(JpsModuleImpl<P> original) {
     super(original);
+    myModuleType = original.myModuleType;
     myLibraryCollection = new JpsLibraryCollectionImpl(myContainer.getChild(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE));
   }
 
   @NotNull
   @Override
-  public JpsModuleImpl createCopy() {
-    return new JpsModuleImpl(this);
+  public JpsModuleImpl<P> createCopy() {
+    return new JpsModuleImpl<P>(this);
   }
 
   @Override
   @NotNull
-  public JpsElementProperties getProperties() {
-    return myContainer.getChild(TYPED_DATA_ROLE).getProperties();
+  public P getProperties() {
+    return myContainer.getChild(myModuleType.getPropertiesRole());
   }
 
   @NotNull
@@ -178,6 +179,6 @@ public class JpsModuleImpl extends JpsNamedCompositeElementBase<JpsModuleImpl> i
 
   @Override
   public JpsModuleType<?> getModuleType() {
-    return myContainer.getChild(TYPED_DATA_ROLE).getType();
+    return myModuleType;
   }
 }
index 02142809d724ad3b690824974101908602e24875..349242dc483a6de0e9556a7bfb82ac913be39061 100644 (file)
@@ -6,7 +6,7 @@ import org.jetbrains.jps.model.JpsElementType;
 /**
  * @author nik
  */
-public abstract class JpsElementPropertiesSerializer<P extends JpsElementProperties, Type extends JpsElementType<P>> {
+public abstract class JpsElementPropertiesSerializer<P, Type> {
   private final String myTypeId;
   private final Type myType;
 
index a16a04fc3f170d67db8f4d59db2834b98e51a8b6..d818964503e5a7eab3f380b99bfc4e2f32ab4b64 100644 (file)
@@ -5,11 +5,10 @@ import com.intellij.util.containers.MultiMap;
 import org.jdom.Element;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.DummyJpsElementProperties;
-import org.jetbrains.jps.model.JpsElementFactory;
-import org.jetbrains.jps.model.JpsElementProperties;
+import org.jetbrains.jps.model.*;
 import org.jetbrains.jps.model.java.JpsJavaLibraryType;
 import org.jetbrains.jps.model.library.*;
+import org.jetbrains.jps.model.module.JpsModuleReference;
 
 import java.util.*;
 
@@ -40,6 +39,9 @@ public class JpsLibraryTableSerializer {
       public void saveProperties(DummyJpsElementProperties properties, Element element) {
       }
     };
+  private static final String MODULE_LEVEL = "module";
+  private static final String PROJECT_LEVEL = "project";
+  private static final String APPLICATION_LEVEL = "application";
 
   public static void loadLibraries(Element libraryTableElement, JpsLibraryCollection result) {
     for (Element libraryElement : JDOMUtil.getChildren(libraryTableElement, LIBRARY_TAG)) {
@@ -207,4 +209,41 @@ public class JpsLibraryTableSerializer {
     }
     throw new IllegalArgumentException("unknown type library:" + type);
   }
+
+  public static JpsElementReference<? extends JpsCompositeElement> createLibraryTableReference(String level) {
+    JpsElementFactory elementFactory = JpsElementFactory.getInstance();
+    if (level.equals(PROJECT_LEVEL)) {
+      return elementFactory.createProjectReference();
+    }
+    if (level.equals(APPLICATION_LEVEL)) {
+      return elementFactory.createGlobalReference();
+    }
+    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+      final JpsElementReference<? extends JpsCompositeElement> reference = extension.createLibraryTableReference(level);
+      if (reference != null) {
+        return reference;
+      }
+    }
+    throw new UnsupportedOperationException();
+  }
+
+  public static String getLevelId(JpsElementReference<? extends JpsCompositeElement> reference) {
+    if (reference instanceof JpsModuleReference) {
+      return MODULE_LEVEL;
+    }
+    JpsCompositeElement element = reference.resolve();
+    if (element instanceof JpsProject) {
+      return PROJECT_LEVEL;
+    }
+    else if (element instanceof JpsGlobal) {
+      return APPLICATION_LEVEL;
+    }
+    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+      String levelId = extension.getLibraryTableLevelId(reference);
+      if (levelId != null) {
+        return levelId;
+      }
+    }
+    return null;
+  }
 }
index 554fbb53449a0919eb183f532336959c9636cca7..3ef2636b0ca32656da3d69a98368710fff577915 100644 (file)
@@ -6,10 +6,10 @@ import org.jetbrains.annotations.Nullable;
 import org.jetbrains.jps.model.JpsCompositeElement;
 import org.jetbrains.jps.model.JpsElementReference;
 import org.jetbrains.jps.model.JpsProject;
-import org.jetbrains.jps.model.artifact.JpsArtifactType;
 import org.jetbrains.jps.model.module.JpsDependencyElement;
 import org.jetbrains.jps.model.module.JpsModule;
-import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementLoader;
+import org.jetbrains.jps.model.serialization.artifact.JpsArtifactTypeSerializer;
+import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementSerializer;
 import org.jetbrains.jps.model.serialization.facet.JpsModuleExtensionLoader;
 import org.jetbrains.jps.service.JpsServiceManager;
 
@@ -79,12 +79,11 @@ public abstract class JpsModelSerializerExtension {
     return Collections.emptyList();
   }
 
-  public List<? extends JpsPackagingElementLoader<?>> getPackagingElementLoaders() {
+  public List<? extends JpsPackagingElementSerializer<?>> getPackagingElementSerializers() {
     return Collections.emptyList();
   }
 
-  @Nullable
-  public JpsArtifactType getArtifactType(@NotNull String typeId) {
-    return null;
+  public List<JpsArtifactTypeSerializer> getArtifactTypeSerializers() {
+    return Collections.emptyList();
   }
 }
index 5dc1c3d2a76485ef518db35b6a366f4a11ec7347..278150350bedca1a4302609b9c83194f0f20e3e3 100644 (file)
@@ -2,14 +2,13 @@ package org.jetbrains.jps.model.serialization;
 
 import org.jdom.Element;
 import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.JpsElementProperties;
+import org.jetbrains.jps.model.JpsElement;
 import org.jetbrains.jps.model.module.JpsModuleType;
 
 /**
  * @author nik
  */
-public abstract class JpsModulePropertiesSerializer<P extends JpsElementProperties> extends
-                                                                                    JpsElementPropertiesSerializer<P, JpsModuleType<P>> {
+public abstract class JpsModulePropertiesSerializer<P extends JpsElement> extends JpsElementPropertiesSerializer<P, JpsModuleType<P>> {
   protected JpsModulePropertiesSerializer(JpsModuleType<P> type, String typeId) {
     super(type, typeId);
   }
index 5072f99e9d78f411ae0c607c5d4825c49b995e46..eb33ef7b6ba00a6a54fc2f427d59bbdd87e84934 100644 (file)
@@ -42,8 +42,6 @@ public class JpsModuleSerializer {
   private static final String MODULE_LIBRARY_TYPE = "module-library";
   private static final String MODULE_TYPE = "module";
   private static final String MODULE_NAME_ATTRIBUTE = "module-name";
-  private static final String PROJECT_LEVEL = "project";
-  private static final String APPLICATION_LEVEL = "application";
   private static final String GENERATED_LIBRARY_NAME_PREFIX = "#";
 
   public static void loadRootModel(JpsModule module, Element rootModelComponent, JpsSdkType<?> projectSdkType) {
@@ -84,7 +82,8 @@ public class JpsModuleSerializer {
         String name = orderEntry.getAttributeValue(NAME_ATTRIBUTE);
         String level = orderEntry.getAttributeValue(LEVEL_ATTRIBUTE);
         final JpsLibraryDependency dependency =
-          dependenciesList.addLibraryDependency(elementFactory.createLibraryReference(name, createLibraryTableReference(level)));
+          dependenciesList.addLibraryDependency(elementFactory.createLibraryReference(name, JpsLibraryTableSerializer
+            .createLibraryTableReference(level)));
         loadModuleDependencyProperties(dependency, orderEntry);
       }
       else if (MODULE_LIBRARY_TYPE.equals(type)) {
@@ -170,14 +169,14 @@ public class JpsModuleSerializer {
           JpsLibrary library = reference.resolve();
           String libraryName = library.getName();
           JpsLibraryTableSerializer
-            .saveLibrary(library, libraryElement, libraryName.startsWith(GENERATED_LIBRARY_NAME_PREFIX) ? null : libraryName);
+            .saveLibrary(library, libraryElement, isGeneratedName(libraryName) ? null : libraryName);
           element.addContent(libraryElement);
         }
         else {
           element = createDependencyElement(LIBRARY_TYPE);
           saveModuleDependencyProperties(dependency, element);
           element.setAttribute(NAME_ATTRIBUTE, reference.getLibraryName());
-          element.setAttribute(LEVEL_ATTRIBUTE, getLevelId(parentReference));
+          element.setAttribute(LEVEL_ATTRIBUTE, JpsLibraryTableSerializer.getLevelId(parentReference));
         }
         rootModelElement.addContent(element);
       }
@@ -194,6 +193,10 @@ public class JpsModuleSerializer {
     }
   }
 
+  private static boolean isGeneratedName(String libraryName) {
+    return libraryName.startsWith(GENERATED_LIBRARY_NAME_PREFIX);
+  }
+
   private static Element createDependencyElement(final String type) {
     return new Element(ORDER_ENTRY_TAG).setAttribute(TYPE_ATTRIBUTE, type);
   }
@@ -215,38 +218,4 @@ public class JpsModuleSerializer {
       extension.saveModuleDependencyProperties(dependency, orderEntry);
     }
   }
-
-  public static JpsElementReference<? extends JpsCompositeElement> createLibraryTableReference(String level) {
-    JpsElementFactory elementFactory = JpsElementFactory.getInstance();
-    if (level.equals(PROJECT_LEVEL)) {
-      return elementFactory.createProjectReference();
-    }
-    if (level.equals(APPLICATION_LEVEL)) {
-      return elementFactory.createGlobalReference();
-    }
-    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
-      final JpsElementReference<? extends JpsCompositeElement> reference = extension.createLibraryTableReference(level);
-      if (reference != null) {
-        return reference;
-      }
-    }
-    throw new UnsupportedOperationException();
-  }
-
-  private static String getLevelId(JpsElementReference<? extends JpsCompositeElement> reference) {
-    JpsCompositeElement element = reference.resolve();
-    if (element instanceof JpsProject) {
-      return PROJECT_LEVEL;
-    }
-    else if (element instanceof JpsGlobal) {
-      return APPLICATION_LEVEL;
-    }
-    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
-      String levelId = extension.getLibraryTableLevelId(reference);
-      if (levelId != null) {
-        return levelId;
-      }
-    }
-    return null;
-  }
 }
index cffd93202c47016aca6fefe5c58a06c7397aea9b..6d7acf03dcae17d9b4a5bcbfd3b636c4c4ce4ee5 100644 (file)
@@ -6,14 +6,11 @@ import com.intellij.util.ArrayUtil;
 import org.jdom.Element;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.DummyJpsElementProperties;
-import org.jetbrains.jps.model.JpsElementFactory;
-import org.jetbrains.jps.model.JpsElementProperties;
-import org.jetbrains.jps.model.JpsProject;
+import org.jetbrains.jps.model.*;
 import org.jetbrains.jps.model.java.JpsJavaModuleType;
 import org.jetbrains.jps.model.library.JpsSdkType;
 import org.jetbrains.jps.model.module.JpsModule;
-import org.jetbrains.jps.model.serialization.artifact.JpsArtifactLoader;
+import org.jetbrains.jps.model.serialization.artifact.JpsArtifactSerializer;
 import org.jetbrains.jps.model.serialization.facet.JpsFacetLoader;
 
 import java.io.File;
@@ -98,7 +95,7 @@ public class JpsProjectLoader extends JpsLoaderBase {
   }
 
   private void loadArtifacts(Element artifactManagerComponent) {
-    JpsArtifactLoader.loadArtifacts(myProject, artifactManagerComponent);
+    JpsArtifactSerializer.loadArtifacts(myProject, artifactManagerComponent);
   }
 
   @Nullable
@@ -166,7 +163,7 @@ public class JpsProjectLoader extends JpsLoaderBase {
     return expander;
   }
 
-  private static <P extends JpsElementProperties> JpsModule createModule(String name, Element moduleRoot, JpsModulePropertiesSerializer<P> loader) {
+  private static <P extends JpsElement> JpsModule createModule(String name, Element moduleRoot, JpsModulePropertiesSerializer<P> loader) {
     return JpsElementFactory.getInstance().createModule(name, loader.getType(), loader.loadProperties(moduleRoot));
   }
 
@@ -178,10 +175,10 @@ public class JpsProjectLoader extends JpsLoaderBase {
         }
       }
     }
-    return new JpsModulePropertiesSerializer<DummyJpsElementProperties>(JpsJavaModuleType.INSTANCE, "JAVA_MODULE") {
+    return new JpsModulePropertiesSerializer<JpsDummyElement>(JpsJavaModuleType.INSTANCE, "JAVA_MODULE") {
       @Override
-      public DummyJpsElementProperties loadProperties(@Nullable Element moduleRootElement) {
-        return DummyJpsElementProperties.INSTANCE;
+      public JpsDummyElement loadProperties(@Nullable Element moduleRootElement) {
+        return JpsElementFactory.getInstance().createDummyElement();
       }
     };
   }
diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsArtifactLoader.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsArtifactLoader.java
deleted file mode 100644 (file)
index e8e117a..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.jetbrains.jps.model.serialization.artifact;
-
-import com.intellij.openapi.util.JDOMUtil;
-import com.intellij.util.xmlb.XmlSerializer;
-import org.jdom.Element;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.JpsCompositeElement;
-import org.jetbrains.jps.model.JpsElementFactory;
-import org.jetbrains.jps.model.JpsElementReference;
-import org.jetbrains.jps.model.JpsProject;
-import org.jetbrains.jps.model.artifact.*;
-import org.jetbrains.jps.model.artifact.elements.JpsCompositePackagingElement;
-import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
-import org.jetbrains.jps.model.artifact.elements.JpsPackagingElementFactory;
-import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
-import org.jetbrains.jps.model.serialization.JpsModuleSerializer;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author nik
- */
-public class JpsArtifactLoader {
-  private static List<? extends JpsPackagingElementLoader<?>> STANDARD_LOADERS = Arrays.asList();
-  
-  public static void loadArtifacts(@NotNull JpsProject project, @Nullable Element componentElement) {
-    JpsArtifactService service = JpsArtifactService.getInstance();
-    for (Element artifactElement : JDOMUtil.getChildren(componentElement, "artifact")) {
-      ArtifactState state = XmlSerializer.deserialize(artifactElement, ArtifactState.class);
-      if (state == null) continue;
-      JpsArtifactType artifactType = getArtifactType(state.getArtifactType());
-      JpsPackagingElement rootElement = loadPackagingElement(state.getRootElement());
-      if (rootElement != null) {
-        JpsArtifact artifact = service.addArtifact(project, state.getName(), (JpsCompositePackagingElement)rootElement, artifactType);
-        artifact.setOutputPath(state.getOutputPath());
-      }
-    }
-  }
-
-  @Nullable
-  private static JpsPackagingElement loadPackagingElement(Element element) {
-    JpsPackagingElement packagingElement = createPackagingElement(element);
-    if (packagingElement instanceof JpsCompositePackagingElement) {
-      for (Element childElement : JDOMUtil.getChildren(element, "element")) {
-        JpsPackagingElement child = loadPackagingElement(childElement);
-        if (child != null) {
-          ((JpsCompositePackagingElement)packagingElement).addChild(child);
-        }
-      }
-    }
-    return packagingElement;
-  }
-
-  @Nullable
-  private static JpsPackagingElement createPackagingElement(Element element) {
-    String typeId = element.getAttributeValue("id");
-    JpsPackagingElementFactory factory = JpsPackagingElementFactory.getInstance();
-    if (typeId.equals("root")) {
-      return factory.createArtifactRoot();
-    }
-    if (typeId.equals("directory")) {
-      return factory.createDirectory(element.getAttributeValue("name"));
-    }
-    if (typeId.equals("archive")) {
-      return factory.createArchive(element.getAttributeValue("name"));
-    }
-    if (typeId.equals("file-copy")) {
-      return factory.createFileCopy(element.getAttributeValue("path"),
-                                     element.getAttributeValue("output-file-name"));
-    }
-    if (typeId.equals("dir-copy")) {
-      return factory.createDirectoryCopy(element.getAttributeValue("path"));
-    }
-    if (typeId.equals("extracted-dir")) {
-      return factory.createExtractedDirectory(element.getAttributeValue("path"),
-                                               element.getAttributeValue("path-in-jar"));
-    }
-    if (typeId.equals("library")) {
-      String level = element.getAttributeValue("level");
-      String libraryName = element.getAttributeValue("name");
-      String moduleName = element.getAttributeValue("module-name");
-      JpsElementReference<? extends JpsCompositeElement> parentReference;
-      if (moduleName != null) {
-        parentReference = JpsElementFactory.getInstance().createModuleReference(moduleName);
-      }
-      else {
-        parentReference = JpsModuleSerializer.createLibraryTableReference(level);
-      }
-      return factory.createLibraryElement(JpsElementFactory.getInstance().createLibraryReference(libraryName, parentReference));
-    }
-    if (typeId.equals("artifact")) {
-      return factory.createArtifactOutput(JpsArtifactService.getInstance().createReference(element.getAttributeValue("artifact-name")));
-    }
-    JpsPackagingElementLoader<?> loader = findElementLoader(typeId);
-    if (loader != null) {
-      return loader.load(element);
-    }
-    return null;
-  }
-
-  private static JpsArtifactType getArtifactType(@Nullable String typeId) {
-    if (typeId == null || "plain".equals(typeId)) {
-      return DirectoryArtifactType.INSTANCE;
-    }
-    if (typeId.equals("jar")) {
-      return JarArtifactType.INSTANCE;
-    }
-    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
-      JpsArtifactType type = extension.getArtifactType(typeId);
-      if (type != null) {
-        return type;
-      }
-    }
-    return DirectoryArtifactType.INSTANCE;
-  }
-
-  @Nullable 
-  private static JpsPackagingElementLoader<?> findElementLoader(@NotNull String typeId) {
-    for (JpsPackagingElementLoader<?> loader : STANDARD_LOADERS) {
-      if (loader.getTypeId().equals(typeId)) {
-        return loader;
-      }
-    }
-    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
-      for (JpsPackagingElementLoader<?> loader : extension.getPackagingElementLoaders()) {
-        if (loader.getTypeId().equals(typeId)) {
-          return loader;
-        }
-      }
-    }
-    return null;
-  }
-}
diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsArtifactSerializer.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsArtifactSerializer.java
new file mode 100644 (file)
index 0000000..4582825
--- /dev/null
@@ -0,0 +1,325 @@
+package org.jetbrains.jps.model.serialization.artifact;
+
+import com.intellij.openapi.util.JDOMUtil;
+import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
+import com.intellij.util.xmlb.XmlSerializer;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jps.model.JpsCompositeElement;
+import org.jetbrains.jps.model.JpsElementFactory;
+import org.jetbrains.jps.model.JpsElementReference;
+import org.jetbrains.jps.model.JpsProject;
+import org.jetbrains.jps.model.artifact.*;
+import org.jetbrains.jps.model.artifact.elements.*;
+import org.jetbrains.jps.model.library.JpsLibraryReference;
+import org.jetbrains.jps.model.module.JpsModuleReference;
+import org.jetbrains.jps.model.serialization.JpsLibraryTableSerializer;
+import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
+
+/**
+ * @author nik
+ */
+public class JpsArtifactSerializer {
+  private static JpsPackagingElementSerializer<?>[] STANDARD_SERIALIZERS = {
+    new ArtifactRootElementSerializer(),
+    new DirectoryElementSerializer(),
+    new ArchiveElementSerializer(),
+    new FileCopyElementSerializer(),
+    new DirectoryCopyElementSerializer(),
+    new ExtractedDirectoryElementSerializer(),
+    new LibraryFilesElementSerializer(),
+    new ArtifactOutputElementSerializer()
+  };
+  private static final JpsArtifactTypeSerializer[] STANDARD_TYPE_SERIALIZERS = {
+    new JpsArtifactTypeSerializer("plain", DirectoryArtifactType.INSTANCE),
+    new JpsArtifactTypeSerializer("jar", JarArtifactType.INSTANCE)
+  };
+  private static final String ELEMENT_TAG = "element";
+  private static final String ID_ATTRIBUTE = "id";
+  private static final SkipDefaultValuesSerializationFilters SERIALIZATION_FILTERS = new SkipDefaultValuesSerializationFilters();
+
+
+  public static void loadArtifacts(@NotNull JpsProject project, @Nullable Element componentElement) {
+    JpsArtifactService service = JpsArtifactService.getInstance();
+    for (Element artifactElement : JDOMUtil.getChildren(componentElement, "artifact")) {
+      ArtifactState state = XmlSerializer.deserialize(artifactElement, ArtifactState.class);
+      if (state == null) continue;
+      JpsArtifactType artifactType = getTypeSerializer(state.getArtifactType()).getType();
+      JpsPackagingElement rootElement = loadPackagingElement(state.getRootElement());
+      if (rootElement != null) {
+        JpsArtifact artifact = service.addArtifact(project, state.getName(), (JpsCompositePackagingElement)rootElement, artifactType);
+        artifact.setBuildOnMake(state.isBuildOnMake());
+        artifact.setOutputPath(state.getOutputPath());
+      }
+    }
+  }
+
+  public static void saveArtifact(@NotNull JpsArtifact artifact, Element componentElement) {
+    ArtifactState state = new ArtifactState();
+    state.setName(artifact.getName());
+    state.setBuildOnMake(artifact.isBuildOnMake());
+    state.setOutputPath(artifact.getOutputPath());
+    state.setArtifactType(getTypeSerializer(artifact.getArtifactType()).getTypeId());
+    state.setRootElement(savePackagingElement(artifact.getRootElement()));
+    componentElement.addContent(XmlSerializer.serialize(state, SERIALIZATION_FILTERS));
+  }
+
+  private static <P extends JpsPackagingElement> Element savePackagingElement(P element) {
+    //noinspection unchecked
+    JpsPackagingElementSerializer<P> serializer = findElementSerializer((Class<P>)element.getClass());
+    Element tag = new Element(ELEMENT_TAG).setAttribute(ID_ATTRIBUTE, serializer.getTypeId());
+    serializer.save(element, tag);
+    if (element instanceof JpsCompositePackagingElement) {
+      for (JpsPackagingElement child : ((JpsCompositePackagingElement)element).getChildren()) {
+        tag.addContent(savePackagingElement(child));
+      }
+    }
+    return tag;
+  }
+
+  @Nullable
+  private static JpsPackagingElement loadPackagingElement(Element element) {
+    JpsPackagingElement packagingElement = createPackagingElement(element);
+    if (packagingElement instanceof JpsCompositePackagingElement) {
+      for (Element childElement : JDOMUtil.getChildren(element, ELEMENT_TAG)) {
+        JpsPackagingElement child = loadPackagingElement(childElement);
+        if (child != null) {
+          ((JpsCompositePackagingElement)packagingElement).addChild(child);
+        }
+      }
+    }
+    return packagingElement;
+  }
+
+  @Nullable
+  private static JpsPackagingElement createPackagingElement(Element element) {
+    String typeId = element.getAttributeValue(ID_ATTRIBUTE);
+    JpsPackagingElementSerializer<?> serializer = findElementSerializer(typeId);
+    if (serializer != null) {
+      return serializer.load(element);
+    }
+    return null;
+  }
+
+  @Nullable 
+  private static JpsPackagingElementSerializer<?> findElementSerializer(@NotNull String typeId) {
+    for (JpsPackagingElementSerializer<?> serializer : STANDARD_SERIALIZERS) {
+      if (serializer.getTypeId().equals(typeId)) {
+        return serializer;
+      }
+    }
+    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+      for (JpsPackagingElementSerializer<?> serializer : extension.getPackagingElementSerializers()) {
+        if (serializer.getTypeId().equals(typeId)) {
+          return serializer;
+        }
+      }
+    }
+    return null;
+  }
+
+  @NotNull
+  private static <E extends JpsPackagingElement> JpsPackagingElementSerializer<E> findElementSerializer(@NotNull Class<E> elementClass) {
+    for (JpsPackagingElementSerializer<?> serializer : STANDARD_SERIALIZERS) {
+      if (serializer.getElementClass().isAssignableFrom(elementClass)) {
+        //noinspection unchecked
+        return (JpsPackagingElementSerializer<E>)serializer;
+      }
+    }
+    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+      for (JpsPackagingElementSerializer<?> serializer : extension.getPackagingElementSerializers()) {
+        if (serializer.getElementClass().isAssignableFrom(elementClass)) {
+          //noinspection unchecked
+          return (JpsPackagingElementSerializer<E>)serializer;
+        }
+      }
+    }
+    throw new IllegalArgumentException("Serializer not found for " + elementClass);
+  }
+
+  private static JpsArtifactTypeSerializer getTypeSerializer(String typeId) {
+    for (JpsArtifactTypeSerializer serializer : STANDARD_TYPE_SERIALIZERS) {
+      if (serializer.getTypeId().equals(typeId)) {
+        return serializer;
+      }
+    }
+    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+      for (JpsArtifactTypeSerializer serializer : extension.getArtifactTypeSerializers()) {
+        if (serializer.getTypeId().equals(typeId)) {
+          return serializer;
+        }
+      }
+    }
+    return STANDARD_TYPE_SERIALIZERS[0];
+  }
+
+  private static JpsArtifactTypeSerializer getTypeSerializer(JpsArtifactType type) {
+    for (JpsArtifactTypeSerializer serializer : STANDARD_TYPE_SERIALIZERS) {
+      if (serializer.getType().equals(type)) {
+        return serializer;
+      }
+    }
+    for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+      for (JpsArtifactTypeSerializer serializer : extension.getArtifactTypeSerializers()) {
+        if (serializer.getType().equals(type)) {
+          return serializer;
+        }
+      }
+    }
+    return null;
+  }
+
+  private static class ArtifactRootElementSerializer extends JpsPackagingElementSerializer<JpsArtifactRootElement> {
+    public ArtifactRootElementSerializer() {
+      super("root", JpsArtifactRootElement.class);
+    }
+
+    @Override
+    public JpsArtifactRootElement load(Element element) {
+      return JpsPackagingElementFactory.getInstance().createArtifactRoot();
+    }
+
+    @Override
+    public void save(JpsArtifactRootElement element, Element tag) {
+    }
+  }
+
+  private static class DirectoryElementSerializer extends JpsPackagingElementSerializer<JpsDirectoryPackagingElement> {
+    public DirectoryElementSerializer() {
+      super("directory", JpsDirectoryPackagingElement.class);
+    }
+
+    @Override
+    public JpsDirectoryPackagingElement load(Element element) {
+      return JpsPackagingElementFactory.getInstance().createDirectory(element.getAttributeValue("name"));
+    }
+
+    @Override
+    public void save(JpsDirectoryPackagingElement element, Element tag) {
+      tag.setAttribute("name", element.getDirectoryName());
+    }
+  }
+
+  private static class ArchiveElementSerializer extends JpsPackagingElementSerializer<JpsArchivePackagingElement> {
+    public ArchiveElementSerializer() {
+      super("archive", JpsArchivePackagingElement.class);
+    }
+
+    @Override
+    public JpsArchivePackagingElement load(Element element) {
+      return JpsPackagingElementFactory.getInstance().createArchive(element.getAttributeValue("name"));
+    }
+
+    @Override
+    public void save(JpsArchivePackagingElement element, Element tag) {
+      tag.setAttribute("name", element.getArchiveName());
+    }
+  }
+
+  private static class FileCopyElementSerializer extends JpsPackagingElementSerializer<JpsFileCopyPackagingElement> {
+    public FileCopyElementSerializer() {
+      super("file-copy", JpsFileCopyPackagingElement.class);
+    }
+
+    @Override
+    public JpsFileCopyPackagingElement load(Element element) {
+      return JpsPackagingElementFactory.getInstance().createFileCopy(element.getAttributeValue("path"),
+                                                                     element.getAttributeValue("output-file-name"));
+    }
+
+    @Override
+    public void save(JpsFileCopyPackagingElement element, Element tag) {
+      tag.setAttribute("path", element.getFilePath());
+      String outputFileName = element.getRenamedOutputFileName();
+      if (outputFileName != null) {
+        tag.setAttribute("output-path-name", outputFileName);
+      }
+    }
+  }
+
+  private static class DirectoryCopyElementSerializer extends JpsPackagingElementSerializer<JpsDirectoryCopyPackagingElement> {
+    public DirectoryCopyElementSerializer() {
+      super("dir-copy", JpsDirectoryCopyPackagingElement.class);
+    }
+
+    @Override
+    public JpsDirectoryCopyPackagingElement load(Element element) {
+      return JpsPackagingElementFactory.getInstance().createDirectoryCopy(element.getAttributeValue("path"));
+    }
+
+    @Override
+    public void save(JpsDirectoryCopyPackagingElement element, Element tag) {
+      tag.setAttribute("path", element.getDirectoryPath());
+    }
+  }
+
+  private static class ExtractedDirectoryElementSerializer
+    extends JpsPackagingElementSerializer<JpsExtractedDirectoryPackagingElement> {
+    public ExtractedDirectoryElementSerializer() {
+      super("extracted-dir", JpsExtractedDirectoryPackagingElement.class);
+    }
+
+    @Override
+    public JpsExtractedDirectoryPackagingElement load(Element element) {
+      return JpsPackagingElementFactory.getInstance().createExtractedDirectory(element.getAttributeValue("path"),
+                                                                               element.getAttributeValue("path-in-jar"));
+    }
+
+    @Override
+    public void save(JpsExtractedDirectoryPackagingElement element, Element tag) {
+      tag.setAttribute("path", element.getFilePath());
+      tag.setAttribute("path-in-jar", element.getPathInJar());
+    }
+  }
+
+  private static class LibraryFilesElementSerializer extends JpsPackagingElementSerializer<JpsLibraryFilesPackagingElement> {
+    public LibraryFilesElementSerializer() {
+      super("library", JpsLibraryFilesPackagingElement.class);
+    }
+
+    @Override
+    public JpsLibraryFilesPackagingElement load(Element element) {
+      String level = element.getAttributeValue("level");
+      String libraryName = element.getAttributeValue("name");
+      String moduleName = element.getAttributeValue("module-name");
+      JpsElementReference<? extends JpsCompositeElement> parentReference;
+      if (moduleName != null) {
+        parentReference = JpsElementFactory.getInstance().createModuleReference(moduleName);
+      }
+      else {
+        parentReference = JpsLibraryTableSerializer.createLibraryTableReference(level);
+      }
+      return JpsPackagingElementFactory.getInstance()
+        .createLibraryElement(JpsElementFactory.getInstance().createLibraryReference(libraryName, parentReference));
+    }
+
+    @Override
+    public void save(JpsLibraryFilesPackagingElement element, Element tag) {
+      JpsLibraryReference reference = element.getLibraryReference();
+      JpsElementReference<? extends JpsCompositeElement> parentReference = reference.getParentReference();
+      tag.setAttribute("level", JpsLibraryTableSerializer.getLevelId(parentReference));
+      tag.setAttribute("name", reference.getLibraryName());
+      if (parentReference instanceof JpsModuleReference) {
+        tag.setAttribute("module-name", ((JpsModuleReference)parentReference).getModuleName());
+      }
+    }
+  }
+
+  private static class ArtifactOutputElementSerializer extends JpsPackagingElementSerializer<JpsArtifactOutputPackagingElement> {
+    public ArtifactOutputElementSerializer() {
+      super("artifact", JpsArtifactOutputPackagingElement.class);
+    }
+
+    @Override
+    public JpsArtifactOutputPackagingElement load(Element element) {
+      return JpsPackagingElementFactory.getInstance()
+        .createArtifactOutput(JpsArtifactService.getInstance().createReference(element.getAttributeValue("artifact-name")));
+    }
+
+    @Override
+    public void save(JpsArtifactOutputPackagingElement element, Element tag) {
+      tag.setAttribute("artifact-name", element.getArtifactReference().getArtifactName());
+    }
+  }
+}
diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsArtifactTypeSerializer.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsArtifactTypeSerializer.java
new file mode 100644 (file)
index 0000000..d694b86
--- /dev/null
@@ -0,0 +1,24 @@
+package org.jetbrains.jps.model.serialization.artifact;
+
+import org.jetbrains.jps.model.artifact.JpsArtifactType;
+
+/**
+ * @author nik
+ */
+public class JpsArtifactTypeSerializer {
+  private final String myTypeId;
+  private final JpsArtifactType myType;
+
+  public JpsArtifactTypeSerializer(String typeId, JpsArtifactType type) {
+    myTypeId = typeId;
+    myType = type;
+  }
+
+  public String getTypeId() {
+    return myTypeId;
+  }
+
+  public JpsArtifactType getType() {
+    return myType;
+  }
+}
diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsPackagingElementLoader.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsPackagingElementLoader.java
deleted file mode 100644 (file)
index 3aca2b9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.jetbrains.jps.model.serialization.artifact;
-
-import org.jdom.Element;
-import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
-
-/**
- * @author nik
- */
-public abstract class JpsPackagingElementLoader<E extends JpsPackagingElement> {
-  private final String myTypeId;
-
-  protected JpsPackagingElementLoader(String typeId) {
-    myTypeId = typeId;
-  }
-
-  public String getTypeId() {
-    return myTypeId;
-  }
-
-  public abstract E load(Element element);
-}
diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsPackagingElementSerializer.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/artifact/JpsPackagingElementSerializer.java
new file mode 100644 (file)
index 0000000..0969831
--- /dev/null
@@ -0,0 +1,29 @@
+package org.jetbrains.jps.model.serialization.artifact;
+
+import org.jdom.Element;
+import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
+
+/**
+ * @author nik
+ */
+public abstract class JpsPackagingElementSerializer<E extends JpsPackagingElement> {
+  private final String myTypeId;
+  private final Class<? extends E> myElementClass;
+
+  protected JpsPackagingElementSerializer(String typeId, Class<? extends E> elementClass) {
+    myTypeId = typeId;
+    myElementClass = elementClass;
+  }
+
+  public String getTypeId() {
+    return myTypeId;
+  }
+
+  public Class<? extends E> getElementClass() {
+    return myElementClass;
+  }
+
+  public abstract E load(Element element);
+
+  public abstract void save(E element, Element tag);
+}
index a9255e6f348233a37a9eb0dc483bd7f0347a564e..56168d4f6289e17ccf929ae3fc69958ca8e48751 100644 (file)
@@ -13,7 +13,7 @@ import org.jetbrains.jps.model.module.JpsModule;
 import org.jetbrains.jps.model.module.JpsModuleReference;
 import org.jetbrains.jps.model.serialization.JpsLibraryRootTypeSerializer;
 import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
-import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementLoader;
+import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementSerializer;
 
 import java.util.Arrays;
 import java.util.List;
@@ -119,8 +119,8 @@ public class JpsJavaModelSerializerExtension extends JpsModelSerializerExtension
   }
 
   @Override
-  public List<? extends JpsPackagingElementLoader<?>> getPackagingElementLoaders() {
-    return Arrays.asList(new JpsModuleOutputPackagingElementLoader(), new JpsTestModuleOutputPackagingElementLoader());
+  public List<? extends JpsPackagingElementSerializer<?>> getPackagingElementSerializers() {
+    return Arrays.asList(new JpsModuleOutputPackagingElementSerializer(), new JpsTestModuleOutputPackagingElementSerializer());
   }
 
   private static void loadExplodedDirectoryExtension(JpsModule module, Element rootModelComponent) {
@@ -212,9 +212,10 @@ public class JpsJavaModelSerializerExtension extends JpsModelSerializerExtension
     return JpsJavaExtensionService.getInstance();
   }
 
-  private static class JpsModuleOutputPackagingElementLoader extends JpsPackagingElementLoader<JpsProductionModuleOutputPackagingElement> {
-    private JpsModuleOutputPackagingElementLoader() {
-      super("module-output");
+  private static class JpsModuleOutputPackagingElementSerializer
+    extends JpsPackagingElementSerializer<JpsProductionModuleOutputPackagingElement> {
+    private JpsModuleOutputPackagingElementSerializer() {
+      super("module-output", JpsProductionModuleOutputPackagingElement.class);
     }
 
     @Override
@@ -222,11 +223,16 @@ public class JpsJavaModelSerializerExtension extends JpsModelSerializerExtension
       JpsModuleReference reference = JpsElementFactory.getInstance().createModuleReference(element.getAttributeValue("name"));
       return getService().createProductionModuleOutput(reference);
     }
+
+    @Override
+    public void save(JpsProductionModuleOutputPackagingElement element, Element tag) {
+      tag.setAttribute("name", element.getModuleReference().getModuleName());
+    }
   }
 
-  private static class JpsTestModuleOutputPackagingElementLoader extends JpsPackagingElementLoader<JpsTestModuleOutputPackagingElement> {
-    private JpsTestModuleOutputPackagingElementLoader() {
-      super("module-test-output");
+  private static class JpsTestModuleOutputPackagingElementSerializer extends JpsPackagingElementSerializer<JpsTestModuleOutputPackagingElement> {
+    private JpsTestModuleOutputPackagingElementSerializer() {
+      super("module-test-output", JpsTestModuleOutputPackagingElement.class);
     }
 
     @Override
@@ -234,5 +240,10 @@ public class JpsJavaModelSerializerExtension extends JpsModelSerializerExtension
       JpsModuleReference reference = JpsElementFactory.getInstance().createModuleReference(element.getAttributeValue("name"));
       return getService().createTestModuleOutput(reference);
     }
+
+    @Override
+    public void save(JpsTestModuleOutputPackagingElement element, Element tag) {
+      tag.setAttribute("name", element.getModuleReference().getModuleName());
+    }
   }
 }
diff --git a/jps/model-serialization/testData/sampleProject/.idea/artifacts/dir.xml b/jps/model-serialization/testData/sampleProject/.idea/artifacts/dir.xml
new file mode 100644 (file)
index 0000000..bbaca16
--- /dev/null
@@ -0,0 +1,17 @@
+<component name="ArtifactManager">
+  <artifact build-on-make="true" name="dir">
+    <output-path>$PROJECT_DIR$/out/artifacts/dir</output-path>
+    <root id="root">
+      <element id="archive" name="x.jar">
+        <element id="module-output" name="util" />
+      </element>
+      <element id="directory" name="lib">
+        <element id="library" level="module" name="log4j" module-name="util" />
+        <element id="library" level="project" name="junit" />
+        <element id="file-copy" path="$PROJECT_DIR$/main.iml" />
+        <element id="dir-copy" path="$PROJECT_DIR$/lib/junit-anno" />
+        <element id="extracted-dir" path="$PROJECT_DIR$/lib/junit.jar" path-in-jar="/junit/" />
+      </element>
+    </root>
+  </artifact>
+</component>
\ No newline at end of file
diff --git a/jps/model-serialization/testData/sampleProject/.idea/artifacts/jar.xml b/jps/model-serialization/testData/sampleProject/.idea/artifacts/jar.xml
new file mode 100644 (file)
index 0000000..7e19ac5
--- /dev/null
@@ -0,0 +1,10 @@
+<component name="ArtifactManager">
+  <artifact type="jar" name="jar">
+    <output-path>$PROJECT_DIR$/out/artifacts/jar</output-path>
+    <root id="archive" name="jar.jar">
+      <element id="module-output" name="main" />
+      <element id="module-output" name="util" />
+      <element id="artifact" artifact-name="dir" />
+    </root>
+  </artifact>
+</component>
\ No newline at end of file
diff --git a/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsArtifactSerializationTest.java b/jps/model-serialization/testSrc/org/jetbrains/jps/model/serialization/JpsArtifactSerializationTest.java
new file mode 100644 (file)
index 0000000..354c7db
--- /dev/null
@@ -0,0 +1,58 @@
+package org.jetbrains.jps.model.serialization;
+
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.testFramework.PlatformTestUtil;
+import org.jdom.Element;
+import org.jetbrains.jps.model.artifact.JpsArtifact;
+import org.jetbrains.jps.model.artifact.JpsArtifactService;
+import org.jetbrains.jps.model.serialization.artifact.JpsArtifactSerializer;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import static org.jetbrains.jps.model.serialization.JpsProjectSerializationTest.SAMPLE_PROJECT_PATH;
+import static org.jetbrains.jps.model.serialization.JpsProjectSerializationTest.getFileInSampleProject;
+
+/**
+ * @author nik
+ */
+public class JpsArtifactSerializationTest extends JpsSerializationTestCase {
+  public void testLoadProject() {
+    loadProject(SAMPLE_PROJECT_PATH);
+    List<JpsArtifact> artifacts = getService().getArtifacts(myModel.getProject());
+    assertEquals(2, artifacts.size());
+    assertEquals("dir", artifacts.get(0).getName());
+    assertEquals("jar", artifacts.get(1).getName());
+  }
+
+  public void testSaveProject() {
+    loadProject(SAMPLE_PROJECT_PATH);
+    File[] artifactFiles = getFileInSampleProject(".idea/artifacts").listFiles();
+    assertNotNull(artifactFiles);
+    for (File file : artifactFiles) {
+      JpsArtifact artifact = getService().createReference(FileUtil.getNameWithoutExtension(file)).asExternal(myModel).resolve();
+      assertNotNull(artifact);
+      doTestSaveArtifact(artifact, file);
+    }
+  }
+
+  private static void doTestSaveArtifact(JpsArtifact artifact, File expectedFile) {
+    try {
+      Element actual = new Element("component").setAttribute("name", "ArtifactManager");
+      JpsArtifactSerializer.saveArtifact(artifact, actual);
+      JpsMacroExpander
+        expander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), getFileInSampleProject(""));
+      Element expected = JpsLoaderBase.loadRootElement(expectedFile, expander);
+      PlatformTestUtil.assertElementsEqual(expected, actual);
+    }
+    catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private static JpsArtifactService getService() {
+    return JpsArtifactService.getInstance();
+  }
+}
index 0465d1dedd2c36f5a27e3e71927588f78b9ca5bf..0a48048cbbd7edbcbf26afd45156f36a85ea4fdb 100644 (file)
@@ -18,7 +18,7 @@ import java.util.List;
  * @author nik
  */
 public class JpsProjectSerializationTest extends JpsSerializationTestCase {
-  private static final String SAMPLE_PROJECT_PATH = "/jps/model-serialization/testData/sampleProject";
+  public static final String SAMPLE_PROJECT_PATH = "/jps/model-serialization/testData/sampleProject";
 
   public void testLoadProject() {
     loadProject(SAMPLE_PROJECT_PATH);
@@ -89,8 +89,8 @@ public class JpsProjectSerializationTest extends JpsSerializationTestCase {
     }
   }
 
-  private static File getFileInSampleProject(String moduleFilePath) {
-    return new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH + "/" + moduleFilePath));
+  public static File getFileInSampleProject(String relativePath) {
+    return new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH + "/" + relativePath));
   }
 
   public void _testLoadIdeaProject() {
index d4a385f1ab252dda7ed26b3f54fd3b4e73080247..17a134c0cdb9fabd1d577823f7b16d67882b2bac 100644 (file)
@@ -46,7 +46,7 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> {
     return key.getID();
   }
 
-  @Nullable
+  @SuppressWarnings("ConstantConditions")
   public T forLanguage(@NotNull Language l) {
     T cached = l.getUserData(IN_LANGUAGE_CACHE);
     if (cached != null) return cached;
index 3e52254bfe42d89da7d6004c3dc3698ae27707dd..176878b07f86f98de46ee5a7b5e92d02c60f399e 100644 (file)
@@ -81,7 +81,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
   private final Object myStubLock = new Object();
   private SoftReference<StubTree> myStub;
   protected final PsiManagerEx myManager;
-  private volatile Object myTreeElementPointer; // SoftReference/WeakReference to RepositoryTreeElement when has repository id, RepositoryTreeElement otherwise
+  private volatile Object myTreeElementPointer; // SoftReference/WeakReference to ASTNode or a strong reference to a tree if the file is a DummyHolder
   public static final Key<Boolean> BUILDING_STUB = new Key<Boolean>("Don't use stubs mark!");
 
   protected PsiFileImpl(@NotNull IElementType elementType, IElementType contentElementType, @NotNull FileViewProvider provider) {
index 7583b47bed5e198c5ada55adb37acae7001dd448..7d3fece73bca2502b02cd1307e9f9ae6085b040f 100644 (file)
@@ -50,9 +50,9 @@ public class StubTreeBuilder {
       if (builder != null) {
         data = builder.buildStubTree(inputData.getFile(), inputData.getContent(), inputData.getProject());
       }
-      else {
-        final LanguageFileType filetype = (LanguageFileType)fileType;
-        Language l = filetype.getLanguage();
+      else if (!fileType.isBinary()) {
+        final LanguageFileType languageFileType = (LanguageFileType)fileType;
+        Language l = languageFileType.getLanguage();
         final IFileElementType type = LanguageParserDefinitions.INSTANCE.forLanguage(l).getFileNodeType();
 
         PsiFile psi = inputData.getPsiFile();
@@ -63,11 +63,13 @@ public class StubTreeBuilder {
           if (type instanceof IStubFileElementType) {
             data = ((IStubFileElementType)type).getBuilder().buildStubTree(psi);
           }
-          else if (filetype instanceof SubstitutedFileType) {
-            SubstitutedFileType substituted = (SubstitutedFileType) filetype;
+          else if (languageFileType instanceof SubstitutedFileType) {
+            SubstitutedFileType substituted = (SubstitutedFileType) languageFileType;
             LanguageFileType original = (LanguageFileType)substituted.getOriginalFileType();
             final IFileElementType originalType = LanguageParserDefinitions.INSTANCE.forLanguage(original.getLanguage()).getFileNodeType();
-            data = ((IStubFileElementType)originalType).getBuilder().buildStubTree(psi);
+            if (originalType instanceof IStubFileElementType) {
+              data = ((IStubFileElementType)originalType).getBuilder().buildStubTree(psi);
+            }
           }
         }
         finally {
index 8a028395c6ae43102ea6bd7f4074212d3d83797a..f4f46f150d5b7554932890d0c77e8decc2fda00a 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.codeInsight.lookup;
 
 import com.intellij.codeInsight.completion.InsertHandler;
 import com.intellij.codeInsight.completion.InsertionContext;
+import com.intellij.openapi.util.Iconable;
 import com.intellij.psi.PsiNamedElement;
 import com.intellij.util.ObjectUtils;
 import gnu.trove.THashSet;
@@ -67,6 +68,10 @@ public final class LookupElementBuilder extends LookupElement {
     return new LookupElementBuilder(ObjectUtils.assertNotNull(element.getName()), element);
   }
 
+  public static LookupElementBuilder createWithIcon(@NotNull PsiNamedElement element) {
+    return create(element).withIcon(element.getIcon(Iconable.ICON_FLAG_CLOSED));
+  }
+
   public static LookupElementBuilder create(@NotNull Object lookupObject, @NotNull String lookupString) {
     return new LookupElementBuilder(lookupString, lookupObject);
   }
index 7269465e093a4a89fc3c4d29d303892aba2c6b1f..d5f2df00fcc62d9f1228bf3f9956c9c4b150709b 100644 (file)
@@ -50,7 +50,7 @@ public interface DocumentationProvider {
    * @return                 target element's documentation (if any)
    */
   @Nullable
-  String generateDoc(PsiElement element, PsiElement originalElement);
+  String generateDoc(PsiElement element, @Nullable PsiElement originalElement);
 
   @Nullable
   PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element);
index b0d1c3142d1f711e188b02712a510139077c039e..6347d742ba3e9efcb16a339e4ced74f430c4e07a 100644 (file)
@@ -25,16 +25,13 @@ import com.intellij.psi.search.scope.packageSet.NamedScope;
 import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
 import com.intellij.ui.Colored;
 import com.intellij.util.ArrayUtil;
-import org.intellij.lang.annotations.RegExp;
 
 /**
  * @author Konstantin Bulenkov
  */
-@Colored(color = NonProjectFilesScope.DEFAULT_COLOR)
+@Colored(color = "ffffe4", darkVariant = "000029")
 public class NonProjectFilesScope extends NamedScope {
   public static final String NAME = "Non-Project Files";
-  @RegExp(prefix = "[0-9a-f]{6}")
-  public static final String DEFAULT_COLOR = "ffffe4";
 
   public NonProjectFilesScope() {
     super(NAME, new AbstractPackageSet("NonProject") {
index 42e31d5a88029760975e5d9ff2a52977352e8bc1..05a90802d3ffe715494e63a111e952c03424c9af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * 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.
@@ -27,7 +27,7 @@ import com.intellij.ui.Colored;
 /**
  * @author Konstantin Bulenkov
  */
-@Colored(color = "e7fadb")
+@Colored(color = "e7fadb", darkVariant = "777777")
 public class TestsScope extends NamedScope {
   public static final String NAME = IdeBundle.message("predefined.scope.tests.name");
   public TestsScope() {
index dadc02bcc06e917ed91b2e21a0a4a77c5e1281d2..b3a2e02f3eaf44c499e02beafc6ae416ff00ea1c 100644 (file)
@@ -219,7 +219,7 @@ public class CompletionData {
     return findPrefixStatic(insertedElement, offsetInFile, NOT_JAVA_ID);
   }
 
-  protected static String findPrefixDefault(final PsiElement insertedElement, final int offset, @NotNull final ElementPattern trimStart) {
+  public static String findPrefixDefault(final PsiElement insertedElement, final int offset, @NotNull final ElementPattern trimStart) {
     String substr = insertedElement.getText().substring(0, offset - insertedElement.getTextRange().getStartOffset());
     if (substr.length() == 0 || Character.isWhitespace(substr.charAt(substr.length() - 1))) return "";
 
index 2bb9c4139e928fbea05117ca7cfcef4ec57a8ee3..6fb74673d6c04be249e5e01b83e9d8e4b398a64a 100644 (file)
@@ -363,7 +363,7 @@ public abstract class CompletionPhase implements Disposable {
     @Override
     public int newCompletionStarted(int time, boolean repeated) {
       CompletionServiceImpl.setCompletionPhase(NoCompletion);
-      return time + 1;
+      return repeated ? time + 1 : time;
     }
   }
 
index 25d09df49ddea45b4f50f7011d623f42984bb0a4..c37f7840faa2d16fc4b3e2b096fda145d445ec89 100644 (file)
@@ -71,6 +71,7 @@ import com.intellij.psi.search.searches.DefinitionsSearch;
 import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.ui.HintListener;
 import com.intellij.ui.LightweightHint;
+import com.intellij.ui.ScreenUtil;
 import com.intellij.usageView.UsageViewShortNameLocation;
 import com.intellij.usageView.UsageViewTypeLocation;
 import com.intellij.util.Alarm;
@@ -168,7 +169,8 @@ public class CtrlMouseHandler extends AbstractProjectComponent {
       }
       MouseEvent mouseEvent = e.getMouseEvent();
 
-      if (isMouseOverTooltip(mouseEvent.getLocationOnScreen()) || isMouseMovedTowardTooltip(mouseEvent.getLocationOnScreen())) {
+      if (isMouseOverTooltip(mouseEvent.getLocationOnScreen())
+          || ScreenUtil.isMovementTowards(myPrevMouseLocation, mouseEvent.getLocationOnScreen(), getHintBounds())) {
         myPrevMouseLocation = mouseEvent.getLocationOnScreen();
         return;
       }
@@ -247,63 +249,6 @@ public class CtrlMouseHandler extends AbstractProjectComponent {
     return bounds != null && bounds.contains(mouseLocationOnScreen);
   }
 
-  private boolean isMouseMovedTowardTooltip(@NotNull Point mouseLocationOnScreen) {
-    Rectangle bounds = getHintBounds();
-    if (bounds == null) {
-      return false;
-    }
-
-    Point prevLocation = myPrevMouseLocation;
-    if (prevLocation == null) {
-      myPrevMouseLocation = mouseLocationOnScreen;
-      return true;
-    }
-    else if (prevLocation.equals(mouseLocationOnScreen)) {
-      return true;
-    }
-
-    int dx = prevLocation.x - mouseLocationOnScreen.x;
-    int dy = prevLocation.y - mouseLocationOnScreen.y;
-
-    // Check if the mouse goes out of the control.
-    if (dx > 0 && bounds.x >= prevLocation.x) return false;
-    if (dx < 0 && bounds.x + bounds.width <= prevLocation.x) return false;
-    if (dy > 0 && bounds.y + bounds.height >= prevLocation.y) return false;
-    if (dy < 0 && bounds.y <= prevLocation.y) return false;
-    if (dx == 0) {
-      return (mouseLocationOnScreen.x >= bounds.x && mouseLocationOnScreen.x < bounds.x + bounds.width)
-             && (dy > 0 ^ bounds.y > mouseLocationOnScreen.y);
-    }
-    if (dy == 0) {
-      return (mouseLocationOnScreen.y >= bounds.y && mouseLocationOnScreen.y < bounds.y + bounds.height)
-             && (dx > 0 ^ bounds.x > mouseLocationOnScreen.x);
-    }
-    
-
-    // Calculate line equation parameters - y = a * x + b
-    float a = (float)dy / dx;
-    float b = mouseLocationOnScreen.y - a * mouseLocationOnScreen.x;
-
-    // Check if crossing point with any tooltip border line is within bounds. Don't bother with floating point inaccuracy here.
-    
-    // Left border.
-    float crossY = a * bounds.x + b;
-    if (crossY >= bounds.y && crossY < bounds.y + bounds.height) return true;
-    
-    // Right border.
-    crossY = a * (bounds.x + bounds.width) + b;
-    if (crossY >= bounds.y && crossY < bounds.y + bounds.height) return true;
-    
-    // Top border.
-    float crossX = (bounds.y - b) / a;
-    if (crossX >= bounds.x && crossX < bounds.x + bounds.width) return true;
-    
-    // Bottom border
-    crossX = (bounds.y + bounds.height - b) / a;
-    if (crossX >= bounds.x && crossX < bounds.x + bounds.width) return true;
-    return false;
-  }
-
   @Nullable
   private Rectangle getHintBounds() {
     LightweightHint hint = myHint;
index 52af5959de8ac29cbc1ab58801197cc138ead1c9..0aa9634d9045e9f1593cdccfc715339e812ab0e1 100644 (file)
@@ -50,9 +50,8 @@ import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 /**
  * @author dyoma
@@ -65,7 +64,7 @@ public class ExecutionManagerImpl extends ExecutionManager implements ProjectCom
   private RunContentManagerImpl myContentManager;
   private final Alarm awaitingTerminationAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
   private final List<Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor>> myRunningConfigurations =
-    Collections.synchronizedList(new ArrayList<Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor>>());
+    new CopyOnWriteArrayList<Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor>>();
 
   /**
    * reflection
@@ -315,12 +314,9 @@ public class ExecutionManagerImpl extends ExecutionManager implements ProjectCom
   }
 
   private void forgetRunContentDescriptor(RunContentDescriptor runContentDescriptor) {
-    for (
-      Iterator<Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor>> iterator = myRunningConfigurations.iterator();
-      iterator.hasNext(); ) {
-      Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor> trinity = iterator.next();
+    for (Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor> trinity : myRunningConfigurations) {
       if (trinity.getFirst() == runContentDescriptor) {
-        iterator.remove();
+        myRunningConfigurations.remove(trinity);
         return;
       }
     }
index eaf692e445bd4d1ead1eef8813bbc9154fb22134..be2f995a02403909cca4d8c0b0f179b85f3a8028 100644 (file)
@@ -37,7 +37,6 @@ import com.intellij.ui.PanelWithAnchor;
 import com.intellij.ui.RawCommandLineEditor;
 import com.intellij.ui.components.JBList;
 import com.intellij.util.ArrayUtil;
-import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.awt.*;
@@ -86,8 +85,8 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc
       }
     }) {
       @Override
-      protected void installPathCompletion(@Nullable Project project, FileChooserDescriptor fileChooserDescriptor) {
-        super.installPathCompletion(project, FileChooserDescriptorFactory.createSingleFolderDescriptor());
+      protected void installPathCompletion(FileChooserDescriptor fileChooserDescriptor) {
+        super.installPathCompletion(FileChooserDescriptorFactory.createSingleFolderDescriptor());
       }
     };
     panel.add(myWorkingDirectoryField, BorderLayout.CENTER);
index 112b70c17b3b6f9c220f7641975293ca1b9a9ddf..16aef7a300c4d6b3aa045bc535513abed428d54b 100644 (file)
@@ -30,6 +30,7 @@ import com.intellij.ui.ColorUtil;
 import com.intellij.ui.FileColorManager;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.containers.HashMap;
+import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -169,7 +170,9 @@ public class FileColorConfigurationEditDialog extends DialogWrapper {
     inner.setLayout(new BoxLayout(inner, BoxLayout.X_AXIS));
     inner.setBorder(
       BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
-    inner.setBackground(Color.WHITE);
+    if (!UIUtil.isUnderDarcula()) {
+      inner.setBackground(Color.WHITE);
+    }
     result.add(inner, BorderLayout.CENTER);
 
     final ButtonGroup group = new ButtonGroup();
@@ -243,7 +246,8 @@ public class FileColorConfigurationEditDialog extends DialogWrapper {
           doPerformAction(e);
         }
       });
-      setBackground(Color.WHITE);
+
+      setBackground(UIUtil.isUnderDarcula() ? UIUtil.getControlColor() : Color.WHITE);
       setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
     }
 
@@ -262,7 +266,7 @@ public class FileColorConfigurationEditDialog extends DialogWrapper {
     @Override
     public Color getForeground() {
       if (getModel().isSelected()) {
-        return Color.BLACK;
+        return UIUtil.isUnderDarcula() ? Color.WHITE : Color.BLACK;
       } else if (getModel().isRollover()) {
         return Color.GRAY;
       } else {
index 4cf9631194b6db7f3cad3dd8bb05932c895f5910..e1ba9fb8c622e878c9aabd72b8011f59170c9e4d 100644 (file)
@@ -28,6 +28,7 @@ import com.intellij.ui.ColorUtil;
 import com.intellij.ui.FileColorManager;
 import com.intellij.ui.LightColors;
 import com.intellij.util.containers.hash.LinkedHashMap;
+import com.intellij.util.ui.UIUtil;
 import org.jdom.Element;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -52,6 +53,7 @@ public class FileColorManagerImpl extends FileColorManager implements Persistent
   private FileColorSharedConfigurationManager mySharedConfigurationManager;
 
   private static final Map<String, Color> ourDefaultColors;
+  private static final Map<String, Color> ourDefaultDarkColors;
 
   static {
     ourDefaultColors = new LinkedHashMap<String, Color>();
@@ -61,6 +63,13 @@ public class FileColorManagerImpl extends FileColorManager implements Persistent
     ourDefaultColors.put("Rose", new Color(242, 206, 202));
     ourDefaultColors.put("Violet", new Color(222, 213, 241));
     ourDefaultColors.put("Yellow", new Color(255, 255, 228));
+    ourDefaultDarkColors = new LinkedHashMap<String, Color>();
+    ourDefaultDarkColors.put("Blue", new Color(255-220, 255-240, 255-255));
+    ourDefaultDarkColors.put("Green", new Color(255-231, 255-250, 255-219));
+    ourDefaultDarkColors.put("Orange", new Color(255-246, 255-224, 255-202));
+    ourDefaultDarkColors.put("Rose", new Color(255-242, 255-206, 255-202));
+    ourDefaultDarkColors.put("Violet", new Color(255-222, 255-213, 255-241));
+    ourDefaultDarkColors.put("Yellow", new Color(255-255, 255-255, 255-228));
   }
 
   public FileColorManagerImpl(@NotNull final Project project) {
@@ -136,7 +145,7 @@ public class FileColorManagerImpl extends FileColorManager implements Persistent
   @SuppressWarnings({"MethodMayBeStatic"})
   @Nullable
   public Color getColor(@NotNull final String name) {
-    final Color color = ourDefaultColors.get(name);
+    final Color color = UIUtil.isUnderDarcula() ? ourDefaultDarkColors.get(name) : ourDefaultColors.get(name);
     return color == null ? ColorUtil.fromHex(name, null) : color;
   }
 
index 1b2eb71e9af4cf39c2029cca17a07296d01d0084..995efc9140c8e012c7da42dd3f6816dd9e108eea 100644 (file)
@@ -15,9 +15,7 @@
  */
 package com.intellij.openapi.ui;
 
-import com.intellij.ide.DataManager;
 import com.intellij.openapi.Disposable;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.application.Application;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.fileChooser.FileChooserDescriptor;
@@ -42,11 +40,7 @@ public class TextFieldWithBrowseButton extends ComponentWithBrowseButton<JTextFi
   public TextFieldWithBrowseButton(JTextField field, @Nullable ActionListener browseActionListener) {
     super(field, browseActionListener);
     if (ApplicationManager.getApplication() != null) {
-      final DataManager manager = DataManager.getInstance();
-      if (manager != null) {
-        installPathCompletion(PlatformDataKeys.PROJECT.getData(manager.getDataContext()),
-                              FileChooserDescriptorFactory.createSingleLocalFileDescriptor());
-      }
+      installPathCompletion(FileChooserDescriptorFactory.createSingleLocalFileDescriptor());
     }
   }
 
@@ -56,14 +50,15 @@ public class TextFieldWithBrowseButton extends ComponentWithBrowseButton<JTextFi
 
   public void addBrowseFolderListener(@Nullable String title, @Nullable String description, @Nullable Project project, FileChooserDescriptor fileChooserDescriptor) {
     addBrowseFolderListener(title, description, project, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
-    installPathCompletion(project, fileChooserDescriptor);
+    installPathCompletion(fileChooserDescriptor);
   }
 
-  protected void installPathCompletion(final @Nullable Project project, final FileChooserDescriptor fileChooserDescriptor) {
-    installPathCompletion(project, fileChooserDescriptor, null);
+  protected void installPathCompletion(final FileChooserDescriptor fileChooserDescriptor) {
+    installPathCompletion(fileChooserDescriptor, null);
   }
 
-  protected void installPathCompletion(final @Nullable Project project, final FileChooserDescriptor fileChooserDescriptor, @Nullable Disposable parent) {
+  protected void installPathCompletion(final FileChooserDescriptor fileChooserDescriptor,
+                                       @Nullable Disposable parent) {
     final Application application = ApplicationManager.getApplication();
      if (application == null || application.isUnitTestMode() || application.isHeadlessEnvironment()) return;
      FileChooserFactory.getInstance().installFileCompletion(getChildComponent(), fileChooserDescriptor, true, parent);
@@ -111,7 +106,7 @@ public class TextFieldWithBrowseButton extends ComponentWithBrowseButton<JTextFi
       super(browseActionListener);
     }
 
-    protected void installPathCompletion(final Project project, final FileChooserDescriptor fileChooserDescriptor) {
+    protected void installPathCompletion(final FileChooserDescriptor fileChooserDescriptor) {
     }
   }
 }
index 2ded3ab17f65134b7dfed898bc32a52fac3419fc..ade5f47d9b26889e66c1e701c74d8925eb8b5fff 100644 (file)
@@ -234,4 +234,62 @@ public class ScreenUtil {
       rect.y = (int)screen.getMinY();
     }
   }
+
+  /**
+   *
+   * @param prevLocation - previous location on screen
+   * @param location - current location on screen
+   * @param bounds - area to check if location shifted towards or not. Also in screen coordinates
+   * @return true if movement from prevLocation to location is towards specified rectangular area
+   */
+  public static boolean isMovementTowards(final Point prevLocation, final Point location, final Rectangle bounds) {
+    if (bounds == null) {
+      return false;
+    }
+    if (prevLocation == null || prevLocation.equals(location)) {
+      return true;
+    }
+
+    int dx = prevLocation.x - location.x;
+    int dy = prevLocation.y - location.y;
+
+    // Check if the mouse goes out of the control.
+    if (dx > 0 && bounds.x >= prevLocation.x) return false;
+    if (dx < 0 && bounds.x + bounds.width <= prevLocation.x) return false;
+    if (dy > 0 && bounds.y + bounds.height >= prevLocation.y) return false;
+    if (dy < 0 && bounds.y <= prevLocation.y) return false;
+    if (dx == 0) {
+      return (location.x >= bounds.x && location.x < bounds.x + bounds.width)
+             && (dy > 0 ^ bounds.y > location.y);
+    }
+    if (dy == 0) {
+      return (location.y >= bounds.y && location.y < bounds.y + bounds.height)
+             && (dx > 0 ^ bounds.x > location.x);
+    }
+
+
+    // Calculate line equation parameters - y = a * x + b
+    float a = (float)dy / dx;
+    float b = location.y - a * location.x;
+
+    // Check if crossing point with any tooltip border line is within bounds. Don't bother with floating point inaccuracy here.
+
+    // Left border.
+    float crossY = a * bounds.x + b;
+    if (crossY >= bounds.y && crossY < bounds.y + bounds.height) return true;
+
+    // Right border.
+    crossY = a * (bounds.x + bounds.width) + b;
+    if (crossY >= bounds.y && crossY < bounds.y + bounds.height) return true;
+
+    // Top border.
+    float crossX = (bounds.y - b) / a;
+    if (crossX >= bounds.x && crossX < bounds.x + bounds.width) return true;
+
+    // Bottom border
+    crossX = (bounds.y + bounds.height - b) / a;
+    if (crossX >= bounds.x && crossX < bounds.x + bounds.width) return true;
+
+    return false;
+  }
 }
index 414ddc1014d1f2119d83a7b68007e9b0f5dacc93..35b4fda7bbc8505c0187747f80c15440e5ba4f5c 100644 (file)
 package com.intellij.ide.ui;
 
 import com.intellij.ide.IdeBundle;
-import com.intellij.ide.ui.laf.IdeaDarkLookAndFeelInfo;
-import com.intellij.openapi.application.ex.ApplicationManagerEx;
-import com.intellij.openapi.editor.colors.EditorColorsManager;
-import com.intellij.openapi.editor.colors.EditorColorsScheme;
+import com.intellij.ide.ui.laf.DarculaInstaller;
 import com.intellij.openapi.options.BaseConfigurable;
 import com.intellij.openapi.options.SearchableConfigurable;
 import com.intellij.openapi.ui.ComboBox;
-import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.wm.ex.WindowManagerEx;
 import com.intellij.ui.ListCellRendererWrapper;
@@ -162,23 +158,12 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
       final UIManager.LookAndFeelInfo lafInfo = (UIManager.LookAndFeelInfo)myComponent.myLafComboBox.getSelectedItem();
       if (lafManager.checkLookAndFeel(lafInfo)) {
         update = shouldUpdateUI = true;
+        boolean wasDarcula = UIUtil.isUnderDarcula();
         lafManager.setCurrentLookAndFeel(lafInfo);
-        if (lafInfo instanceof IdeaDarkLookAndFeelInfo && !lafInfo.getName().equals(
-          EditorColorsManager.getInstance().getGlobalScheme().getName())) {
-          final EditorColorsScheme scheme = EditorColorsManager.getInstance().getScheme(lafInfo.getName());
-
-          if (scheme != null) {
-            final int answer = Messages.showOkCancelDialog("Set " + lafInfo.getName() + " editor scheme as well?",
-                                                           "Setup Editor Color Scheme",
-                                                           Messages.getQuestionIcon());
-            if (answer == Messages.OK) {
-              EditorColorsManager.getInstance().setGlobalScheme(scheme);
-              if (Messages.showOkCancelDialog("Restart now?", "Restart", Messages.getQuestionIcon()) == Messages.OK) {
-                ApplicationManagerEx.getApplicationEx().restart();
-              }
-            }
-
-          }
+        if (UIUtil.isUnderDarcula()) {
+          DarculaInstaller.install();
+        } else if (wasDarcula) {
+          DarculaInstaller.uninstall();
         }
       }
     }
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/DarculaInstaller.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/DarculaInstaller.java
new file mode 100644 (file)
index 0000000..cc31d0e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+package com.intellij.ide.ui.laf;
+
+import com.intellij.openapi.application.ex.ApplicationManagerEx;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
+import com.intellij.openapi.editor.colors.EditorColorsScheme;
+import com.intellij.openapi.ui.Messages;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class DarculaInstaller {
+
+  public static void uninstall() {
+  }
+
+  public static void install() {
+    if (!DarculaLaf.NAME.equals(EditorColorsManager.getInstance().getGlobalScheme().getName())) {
+      final EditorColorsScheme scheme = EditorColorsManager.getInstance().getScheme(DarculaLaf.NAME);
+      if (scheme != null) {
+        EditorColorsManager.getInstance().setGlobalScheme(scheme);
+      }
+    }
+
+    if (Messages.showOkCancelDialog("Restart now?", "Restart", Messages.getQuestionIcon()) == Messages.OK) {
+      ApplicationManagerEx.getApplicationEx().restart();
+    }
+  }
+}
similarity index 97%
rename from platform/platform-impl/src/com/intellij/ide/ui/laf/DurculaLaf.java
rename to platform/platform-impl/src/com/intellij/ide/ui/laf/DarculaLaf.java
index 7b798cd9bc4803bc06920afd5f626cc20abedadf..84cde35fc34f6192382b5485be33e97092df400b 100644 (file)
@@ -36,9 +36,10 @@ import java.util.Properties;
 /**
  * @author Konstantin Bulenkov
  */
-final class DurculaLaf extends BasicLookAndFeel {
+public final class DarculaLaf extends BasicLookAndFeel {
+  public static final String NAME = "Darcula";
   BasicLookAndFeel base;
-  public DurculaLaf() {
+  public DarculaLaf() {
     try {
       if (SystemInfo.isWindows) {
         base = new IdeaLaf();
@@ -160,7 +161,7 @@ final class DurculaLaf extends BasicLookAndFeel {
       final Properties properties = new Properties();
       final String secondPart = postfix == null ? "" : "_" + postfix;
       final String name = "darcula" + secondPart + ".properties";
-      final InputStream stream = DurculaLaf.class.getResourceAsStream(name);
+      final InputStream stream = DarculaLaf.class.getResourceAsStream(name);
       properties.load(stream);
       for (String key : properties.stringPropertyNames()) {
         final String value = properties.getProperty(key);
@@ -203,7 +204,7 @@ final class DurculaLaf extends BasicLookAndFeel {
 
   @Override
   public String getName() {
-    return "Darcula";
+    return NAME;
   }
 
   @Override
similarity index 86%
rename from platform/platform-impl/src/com/intellij/ide/ui/laf/IdeaDarkLookAndFeelInfo.java
rename to platform/platform-impl/src/com/intellij/ide/ui/laf/DarculaLookAndFeelInfo.java
index 994abbafdfcbbb2c0cc6c3757d34a7c12ada7baf..8a86baa67ff718c50e56f565f8076e145018d917 100644 (file)
@@ -23,14 +23,14 @@ import javax.swing.*;
 /**
  * @author Konstantin Bulenkov
  */
-public class IdeaDarkLookAndFeelInfo extends UIManager.LookAndFeelInfo {
+public class DarculaLookAndFeelInfo extends UIManager.LookAndFeelInfo {
     @NonNls public static final String CLASS_NAME = "idea.dark.laf.classname";
-    public IdeaDarkLookAndFeelInfo(){
+    public DarculaLookAndFeelInfo(){
       super(IdeBundle.message("idea.dark.look.and.feel"), CLASS_NAME);
     }
 
     public boolean equals(Object obj){
-      return (obj instanceof IdeaDarkLookAndFeelInfo);
+      return (obj instanceof DarculaLookAndFeelInfo);
     }
 
     public int hashCode(){
index 727898a93808a97110aaef4dc8ba3e90f60613ef..baae945ca0314e34e8554e18f7db18cccc755b21 100644 (file)
@@ -120,7 +120,7 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
     myListenerList = new EventListenerList();
 
     IdeaLookAndFeelInfo ideaLaf = new IdeaLookAndFeelInfo();
-    IdeaDarkLookAndFeelInfo ideaDarkLaf = new IdeaDarkLookAndFeelInfo();
+    DarculaLookAndFeelInfo darculaLaf = new DarculaLookAndFeelInfo();
     UIManager.LookAndFeelInfo[] installedLafs = UIManager.getInstalledLookAndFeels();
 
     final boolean darculaAvailable = Registry.is("dark.laf.available");
@@ -128,7 +128,7 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
     myLafs = new UIManager.LookAndFeelInfo[(darculaAvailable ? 2 : 1) + installedLafs.length];
     myLafs[0] = ideaLaf;
     if (darculaAvailable) {
-      myLafs[1] = ideaDarkLaf;
+      myLafs[1] = darculaLaf;
     }
     System.arraycopy(installedLafs, 0, myLafs, darculaAvailable ? 2 : 1, installedLafs.length);
     Arrays.sort(myLafs, new Comparator<UIManager.LookAndFeelInfo>() {
@@ -321,8 +321,8 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
         return;
       }
     }
-    else if (IdeaDarkLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
-      DurculaLaf laf = new DurculaLaf();
+    else if (DarculaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
+      DarculaLaf laf = new DarculaLaf();
       MetalLookAndFeel.setCurrentTheme(new IdeaDarkMetalTheme());
       try {
         UIManager.setLookAndFeel(laf);
index 748fd7ed36a6e1ca5230f97f90cf12bde3a003d9..7cbff2d339060aacc5cf6e91323f55d9fd297968 100644 (file)
@@ -96,6 +96,7 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
 
   @Override
   public void disposeComponent() {
+    assertAllPointersDisposed();
   }
 
   @NotNull
@@ -373,7 +374,6 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
 
   @Override
   public void dispose() {
-    assertAllPointersDisposed();
   }
 
   private void incModificationCounter() {
index 7cbd2336fe4d1806c790cc0f64c866ff2b10c495..70ed1b4efa55703f2e798608ebcc5870d7a81a58 100644 (file)
@@ -357,20 +357,25 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
   }
 
   public void setRefreshVisible(final boolean visible) {
-    myRefreshAlarm.cancelAllRequests();
-    myRefreshAlarm.addRequest(new Runnable() {
+    UIUtil.invokeLaterIfNeeded(new Runnable() {
       @Override
       public void run() {
-        if (visible) {
-          myRefreshIcon.resume();
-        }
-        else {
-          myRefreshIcon.suspend();
-        }
-        myRefreshIcon.revalidate();
-        myRefreshIcon.repaint();
+        myRefreshAlarm.cancelAllRequests();
+        myRefreshAlarm.addRequest(new Runnable() {
+          @Override
+          public void run() {
+            if (visible) {
+              myRefreshIcon.resume();
+            }
+            else {
+              myRefreshIcon.suspend();
+            }
+            myRefreshIcon.revalidate();
+            myRefreshIcon.repaint();
+          }
+        }, visible ? 100 : 300);
       }
-    }, visible ? 100 : 300);
+    });
   }
 
   public void setRefreshToolTipText(final String tooltip) {
index 388f96ceea77d5764499c8e03f7889f578a99c65..a1381ddf053443cd3e1dce2e0dfdffa9acb51236 100644 (file)
@@ -24,6 +24,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.ex.AnActionListener;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.keymap.impl.IdeMouseEventDispatcher;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.GraphicsConfig;
 import com.intellij.openapi.ui.MessageType;
@@ -164,6 +165,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
   private boolean myShadow = false;
   private Layer myLayer;
   private boolean myBlockClicks;
+  private Point myPrevMousePoint = null;
 
   public boolean isInsideBalloon(MouseEvent me) {
     return isInside(new RelativePoint(me));
@@ -177,9 +179,15 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
     if (cmp == myCloseRec) return true;
     if (SwingUtilities.isDescendingFrom(cmp, myComp) || cmp == myComp) return true;
     if (myComp == null || !myComp.isShowing()) return false;
-    if (new Rectangle(myComp.getLocationOnScreen(), myComp.getSize()).contains(target.getScreenPoint())) return true;
+    Rectangle rectangleOnScreen = new Rectangle(myComp.getLocationOnScreen(), myComp.getSize());
+    if (rectangleOnScreen.contains(target.getScreenPoint())) return true;
 
-    return false;
+    try {
+      return ScreenUtil.isMovementTowards(myPrevMousePoint, target.getScreenPoint(), rectangleOnScreen);
+    }
+    finally {
+      myPrevMousePoint = target.getScreenPoint();
+    }
   }
 
   private final ComponentAdapter myComponentListener = new ComponentAdapter() {
index 3f338f89f01bc69ed345c6a2ae743753cb7028f1..69a25e3242ef7c7f2027a5b2cf0399920db8095d 100644 (file)
@@ -273,7 +273,7 @@ public class NameUtilTest extends UsefulTestCase {
     assertMatches("*Git", "BlaGitBla");
     assertFalse(firstLetterMatcher("*Git").matches("BlagitBla"));
     assertMatches("*git", "BlagitBla");
-    assertDoesntMatch("*Git*", "AtpGenerationItem");
+    assertMatches("*Git*", "AtpGenerationItem");
     assertMatches("Collec*Util*", "CollectionUtils");
     assertMatches("Collec*Util*", "CollectionUtilsTest");
     assertTrue(caseInsensitiveMatcher("*us").matches("usage"));
@@ -283,6 +283,7 @@ public class NameUtilTest extends UsefulTestCase {
     assertMatches(" File. sepa", "File._separator");
     assertMatches(" File. _sepa", "File._separator");
     assertMatches(" _fo", "_foo");
+    assertMatches("*BComp", "BaseComponent");
   }
 
   public void testMiddleMatchingFirstLetterSensitive() {
@@ -294,6 +295,7 @@ public class NameUtilTest extends UsefulTestCase {
     assertFalse(firstLetterMatcher(" _bl").matches("_top"));
     assertFalse(firstLetterMatcher("*Ch").matches("char"));
     assertTrue(firstLetterMatcher("*codes").matches("CFLocaleCopyISOCountryCodes"));
+    assertTrue(firstLetterMatcher("*Bcomp").matches("BaseComponent"));
   }
 
   private static Matcher firstLetterMatcher(String pattern) {
index 1c2d3f4cf6fb7a5df2b95615f986f44664e4b921..065f67de9eb00c6e5bf97472ed0839df2234a7bf 100644 (file)
@@ -355,6 +355,8 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture {
   @Nullable
   List<String> getLookupElementStrings();
 
+  void finishLookup();
+
   @NotNull
   PsiElement getElementAtCaret();
 
index 304816e59318ca4c827395f29db099bd400c4371..094dac59b953b481300765d92b28f562d2689a97 100644 (file)
@@ -33,6 +33,7 @@ import com.intellij.codeInsight.folding.CodeFoldingManager;
 import com.intellij.codeInsight.highlighting.actions.HighlightUsagesAction;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler;
+import com.intellij.codeInsight.lookup.Lookup;
 import com.intellij.codeInsight.lookup.LookupElement;
 import com.intellij.codeInsight.lookup.LookupManager;
 import com.intellij.codeInsight.lookup.impl.LookupImpl;
@@ -618,6 +619,16 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
     });
   }
 
+  @Override
+  public void finishLookup() {
+    CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
+      @Override
+      public void run() {
+        ((LookupImpl)LookupManager.getActiveLookup(getEditor())).finishLookup(Lookup.NORMAL_SELECT_CHAR);
+      }
+    }, null, null);
+  }
+
   @Override
   public void testRename(final String fileBefore, final String fileAfter, final String newName, final String... additionalFiles) {
     assertInitialized();
index 495cdb7d34fc961e908f2046907f3ee1e15844dd..fb20e59f3fe93d53283b1a937c8cbe1113bf8b06 100644 (file)
@@ -38,12 +38,15 @@ public class MinusculeMatcher implements Matcher {
   public MinusculeMatcher(String pattern, NameUtil.MatchingCaseSensitivity options) {
     myOptions = options;
     myPattern = StringUtil.trimEnd(pattern, "* ").toCharArray();
-    for (int i = 1; i < myPattern.length; i++) {
-      char c = myPattern[i];
-      if (Character.isUpperCase(c)) {
+    int i = 0;
+    while (isWildcard(i)) i++;
+    i++;
+    while (i < myPattern.length) {
+      if (Character.isUpperCase(myPattern[i])) {
         myHasHumps = true;
         return;
       }
+      i++;
     }
     myHasHumps = false;
   }
index 959650626e1a611bcfc467f64d8acd6e42154ec4..2e2339b984754cf12b8631724beafc3090ad510a 100644 (file)
@@ -19,6 +19,7 @@
  */
 package com.intellij.ui;
 
+import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -106,7 +107,8 @@ public class ColorUtil {
   public static Color getColor(@NotNull Class<?> cls) {
     final Annotation annotation = cls.getAnnotation(Colored.class);
     if (annotation instanceof Colored) {
-      return fromHex(((Colored)annotation).color(), null);
+      final Colored colored = (Colored)annotation;
+      return fromHex(UIUtil.isUnderDarcula() ? colored.darkVariant() : colored.color(), null);
     }
     return null;
   }
index bf1a48982bbf69f8f15eb693d32db5305d7fa256..aa0fa5d0005ee6e3d1125ac08050244266a618ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * 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.
@@ -36,4 +36,10 @@ public @interface Colored {
    */
   @RegExp(prefix = "[0-9a-f]{6}")
   String color();
+
+  /**
+   * @return color as hex-string
+   */
+  @RegExp(prefix = "[0-9a-f]{6}")
+  String darkVariant();
 }
index 90f19a45a8ca38902c97a3651df3d0071d814d3b..174be7afec1d435475b1afc6c592a8d43705ba8d 100644 (file)
@@ -46,7 +46,7 @@ public class ChangesBrowserManyUnversionedFilesNode extends ChangesBrowserNode {
     renderer.append(userObject.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
     final String s = " (" + (myDirsSize > 0 ? myDirsSize + " directories and " : "") + (myUnversionedSize - myDirsSize) + " files) ";
     renderer.append(s, SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);
-    renderer.append(" Click to browse", SimpleTextAttributes.LINK_ATTRIBUTES, myShower);
+    renderer.append("Click to browse", SimpleTextAttributes.LINK_ATTRIBUTES, myShower);
   }
 
   private static class MyUnversionedShower implements Runnable {
index 526a7266f64531c72858e8427d5b8742a0f32f0a..6250328e2fe4984550e7be3131767dca6640dbb6 100644 (file)
@@ -29,7 +29,6 @@ import com.intellij.designer.propertyTable.PropertyEditor;
 import com.intellij.designer.propertyTable.editors.ComboEditor;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.fileChooser.FileChooserDescriptor;
-import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.ComponentWithBrowseButton;
 import com.intellij.openapi.ui.TextFieldWithBrowseButton;
 import com.intellij.openapi.util.text.StringUtil;
@@ -123,8 +122,7 @@ public class ResourceEditor extends PropertyEditor {
     else {
       myEditor = new TextFieldWithBrowseButton() {
         @Override
-        protected void installPathCompletion(@Nullable Project project,
-                                             FileChooserDescriptor fileChooserDescriptor,
+        protected void installPathCompletion(FileChooserDescriptor fileChooserDescriptor,
                                              @Nullable Disposable parent) {
         }
 
index 2fcc18898106147be8f0cbcad10eb8bf00dccc9d..7da0fd11836e9059490366f2802fe817ee47733c 100644 (file)
@@ -19,7 +19,6 @@ import com.intellij.util.xmlb.annotations.AbstractCollection;
 import com.intellij.util.xmlb.annotations.Attribute;
 import com.intellij.util.xmlb.annotations.Tag;
 import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.jps.model.JpsElementProperties;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -27,7 +26,7 @@ import java.util.List;
 /**
  * @author nik
  */
-public class JpsAndroidModuleProperties extends JpsElementProperties {
+public class JpsAndroidModuleProperties {
   public String GEN_FOLDER_RELATIVE_PATH_APT;
   public String GEN_FOLDER_RELATIVE_PATH_AIDL;
 
index cba7665a158749aef0e9f9d71e0b711e09fed368..3f6226b52c0abb2a23fbfe1d8c043a90f0fd5cb5 100644 (file)
@@ -26,8 +26,9 @@ import org.jetbrains.jps.devkit.model.JpsIdeaSdkProperties;
 import org.jetbrains.jps.devkit.model.JpsIdeaSdkType;
 import org.jetbrains.jps.devkit.model.JpsPluginModuleProperties;
 import org.jetbrains.jps.incremental.artifacts.JpsSyntheticArtifactProvider;
-import org.jetbrains.jps.model.JpsElementProperties;
+import org.jetbrains.jps.model.JpsElement;
 import org.jetbrains.jps.model.JpsModel;
+import org.jetbrains.jps.model.JpsSimpleElement;
 import org.jetbrains.jps.model.artifact.DirectoryArtifactType;
 import org.jetbrains.jps.model.artifact.JpsArtifact;
 import org.jetbrains.jps.model.artifact.JpsArtifactService;
@@ -58,9 +59,10 @@ public class JpsPluginSyntheticArtifactProvider extends JpsSyntheticArtifactProv
   public List<JpsArtifact> createArtifacts(@NotNull JpsModel model) {
     List<JpsArtifact> artifacts = new ArrayList<JpsArtifact>();
     for (JpsModule module : model.getProject().getModules()) {
-      JpsElementProperties properties = module.getProperties();
-      if (properties instanceof JpsPluginModuleProperties) {
-        artifacts.add(createArtifact(module, (JpsPluginModuleProperties)properties));
+      JpsElement propertiesElement = module.getProperties();
+      if (propertiesElement instanceof JpsSimpleElement) {
+        JpsPluginModuleProperties properties = ((JpsSimpleElement<JpsPluginModuleProperties>)propertiesElement).getProperties();
+        artifacts.add(createArtifact(module, properties));
       }
     }
     return artifacts;
index 3d0c743ca410624785e0a436cea76c87c2a3db6a..edf0243eeb3df7b544867bcd170c80dad378d2a3 100644 (file)
  */
 package org.jetbrains.jps.devkit.model;
 
-import org.jetbrains.jps.model.JpsElementProperties;
-
 /**
  * @author nik
  */
-public class JpsPluginModuleProperties extends JpsElementProperties {
+public class JpsPluginModuleProperties {
   private final String myPluginXmlUrl;
 
   public JpsPluginModuleProperties(String pluginXmlUrl) {
index 29545021314364d297133e8c359693b4212561d3..2cc4166fbe109ff2e37a6f49cf8c469c99d25078 100644 (file)
  */
 package org.jetbrains.jps.devkit.model;
 
+import org.jetbrains.jps.model.JpsSimpleElement;
 import org.jetbrains.jps.model.module.JpsModuleType;
 
 /**
  * @author nik
  */
-public class JpsPluginModuleType extends JpsModuleType<JpsPluginModuleProperties> {
+public class JpsPluginModuleType extends JpsModuleType<JpsSimpleElement<JpsPluginModuleProperties>> {
   public static final JpsPluginModuleType INSTANCE = new JpsPluginModuleType();
 
-  @Override
-  public JpsPluginModuleProperties createCopy(JpsPluginModuleProperties properties) {
-    return new JpsPluginModuleProperties(properties);
-  }
 }
index 6249aa61f1b416d80b450bcb50863f4551d99a47..7eb16728c6a065fd97a28c027015b711df590b12 100644 (file)
@@ -23,6 +23,8 @@ import org.jetbrains.jps.devkit.model.JpsIdeaSdkProperties;
 import org.jetbrains.jps.devkit.model.JpsIdeaSdkType;
 import org.jetbrains.jps.devkit.model.JpsPluginModuleProperties;
 import org.jetbrains.jps.devkit.model.JpsPluginModuleType;
+import org.jetbrains.jps.model.JpsElementFactory;
+import org.jetbrains.jps.model.JpsSimpleElement;
 import org.jetbrains.jps.model.serialization.*;
 import org.jetbrains.jps.model.serialization.JpsModulePropertiesSerializer;
 import org.jetbrains.jps.model.serialization.JpsSdkPropertiesSerializer;
@@ -73,15 +75,16 @@ public class JpsDevKitModelSerializerExtension extends JpsModelSerializerExtensi
     }
   }
 
-  private static class JpsPluginModulePropertiesSerializer extends JpsModulePropertiesSerializer<JpsPluginModuleProperties> {
+  private static class JpsPluginModulePropertiesSerializer extends JpsModulePropertiesSerializer<JpsSimpleElement<JpsPluginModuleProperties>> {
     private JpsPluginModulePropertiesSerializer() {
       super(JpsPluginModuleType.INSTANCE, "PLUGIN_MODULE");
     }
 
     @Override
-    public JpsPluginModuleProperties loadProperties(@Nullable Element moduleRootElement) {
+    public JpsSimpleElement<JpsPluginModuleProperties> loadProperties(@Nullable Element moduleRootElement) {
       Element component = JpsLoaderBase.findComponent(moduleRootElement, "DevKit.ModuleBuildProperties");
-      return new JpsPluginModuleProperties(component != null ? component.getAttributeValue("url") : null);
+      String pluginXmlUrl = component != null ? component.getAttributeValue("url") : null;
+      return JpsElementFactory.getInstance().createSimpleElement(new JpsPluginModuleProperties(pluginXmlUrl));
     }
   }
 }
index 8acd4cddc090fb649a5ac47920604471335e8aec..96deeac6f017c07a757bdcb4f251256bef55d15e 100644 (file)
@@ -28,6 +28,7 @@ import com.intellij.psi.xml.XmlAttribute;
 import com.intellij.psi.xml.XmlTag;
 import com.intellij.psi.xml.XmlToken;
 import com.intellij.psi.xml.XmlTokenType;
+import org.jetbrains.annotations.Nullable;
 import org.jetbrains.idea.devkit.inspections.DevKitInspectionBase;
 
 import java.util.List;
@@ -47,7 +48,8 @@ public class ExtensionPointQuickDocProvider implements DocumentationProvider {
   }
 
   @Override
-  public String generateDoc(PsiElement element, PsiElement originalElement) {
+  public String generateDoc(PsiElement element, @Nullable PsiElement originalElement) {
+    if (originalElement == null) return null;
     if (originalElement.getLanguage() == XMLLanguage.INSTANCE || DevKitInspectionBase.isPluginXml(originalElement.getContainingFile())) {
       final PsiElement context = element.getContext();
       String fqn = null;
index f29b5c2e56717ab6f90b5625e21273a86388351e..a87b937bf614ca88e680cc1fa9caa80361214650 100644 (file)
@@ -18,7 +18,10 @@ package org.jetbrains.plugins.groovy.lang.completion;
 import com.intellij.codeInsight.completion.CompletionParameters;
 import com.intellij.codeInsight.completion.JavaCompletionUtil;
 import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.psi.*;
+import com.intellij.psi.PsiClassType;
+import com.intellij.psi.PsiField;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiType;
 import com.intellij.psi.filters.getters.MembersGetter;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.util.Consumer;
@@ -31,23 +34,19 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUt
 */
 class GroovyMembersGetter extends MembersGetter {
   private final PsiClassType myExpectedType;
-  private final GroovyPsiElement myContext;
-  private final CompletionParameters myParameters;
 
-  GroovyMembersGetter(PsiClassType expectedType, PsiElement context, CompletionParameters parameters) {
-    myParameters = parameters;
+  GroovyMembersGetter(PsiClassType expectedType, CompletionParameters parameters) {
+    super(GroovyCompletionContributor.completeStaticMembers(parameters), parameters.getPosition());
     myExpectedType = JavaCompletionUtil.originalize(expectedType);
-    myContext = (GroovyPsiElement)context;
   }
 
   public void processMembers(boolean searchInheritors, final Consumer<LookupElement> results) {
-    processMembers(myContext, results, myExpectedType.resolve(), PsiTreeUtil.getParentOfType(myContext, GrAnnotation.class) != null, searchInheritors,
-                   GroovyCompletionContributor.completeStaticMembers(myParameters));
+    processMembers(results, myExpectedType.resolve(), PsiTreeUtil.getParentOfType(myPlace, GrAnnotation.class) == null, searchInheritors);
   }
 
   @Override
   protected LookupElement createFieldElement(PsiField field) {
-    if (!TypesUtil.isAssignable(myExpectedType, field.getType(), myContext)) {
+    if (!isSuitableType(field.getType())) {
       return null;
     }
 
@@ -57,10 +56,14 @@ class GroovyMembersGetter extends MembersGetter {
   @Override
   protected LookupElement createMethodElement(PsiMethod method) {
     PsiType type = method.getReturnType();
-    if (type == null || !TypesUtil.isAssignable(myExpectedType, type, myContext)) {
+    if (!isSuitableType(type)) {
       return null;
     }
 
     return GroovyCompletionContributor.createGlobalMemberElement(method, method.getContainingClass(), false);
   }
+
+  private boolean isSuitableType(PsiType type) {
+    return type != null && TypesUtil.isAssignable(myExpectedType, type, (GroovyPsiElement)myPlace.getParent());
+  }
 }
index 0369903d6296aac4fe1cb385d248a453f0036ea9..79aea5267f865c84b5d7d6654f5a0ffdb770ab46 100644 (file)
@@ -208,10 +208,10 @@ public class GroovySmartCompletionContributor extends CompletionContributor {
       PsiType defType = info.getDefaultType();
       boolean searchInheritors = params.getInvocationCount() > 1;
       if (type instanceof PsiClassType) {
-        new GroovyMembersGetter((PsiClassType)type, reference, params).processMembers(searchInheritors, consumer);
+        new GroovyMembersGetter((PsiClassType)type, params).processMembers(searchInheritors, consumer);
       }
       if (!defType.equals(type) && defType instanceof PsiClassType) {
-        new GroovyMembersGetter((PsiClassType)defType, reference, params).processMembers(searchInheritors, consumer);
+        new GroovyMembersGetter((PsiClassType)defType, params).processMembers(searchInheritors, consumer);
       }
     }
   }
index 0ecc5f9e99f686452d7281e0a36d81b52ee18ac3..1f3455c70b401d167279c50f5327998f37319dcf 100644 (file)
@@ -353,7 +353,8 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
 
     @Override
     public GrParameterStub createStub(@NotNull GrParameter psi, StubElement parentStub) {
-      return new GrParameterStub(parentStub, StringRef.fromString(psi.getName()), GrStubUtils.getAnnotationNames(psi), GrStubUtils.getTypeText(psi));
+      return new GrParameterStub(parentStub, StringRef.fromString(psi.getName()), GrStubUtils.getAnnotationNames(psi), GrStubUtils.getTypeText(
+        psi.getTypeElementGroovy()));
     }
 
     @Override
index ab46c5ad2cfa5d033485dcd30180a9beadf8792d..18d447e1bb0359940f7b2ef1f32480a70a72f2de 100644 (file)
@@ -211,8 +211,7 @@ public class GrModifierListImpl extends GrStubElementBase<GrModifierListStub> im
   public boolean hasExplicitModifier(@NotNull @NonNls String name) {
     final GrModifierListStub stub = getStub();
     if (stub != null) {
-      final int flag = NAME_TO_MODIFIER_FLAG_MAP.get(name);
-      return (stub.getModifiersFlags() & flag) != 0;
+      return hasMaskExplicitModifier(name, stub.getModifiersFlags());
     }
 
     if (name.equals(GrModifier.PUBLIC)) return findChildByType(GroovyElementTypes.kPUBLIC) != null;
@@ -230,6 +229,11 @@ public class GrModifierListImpl extends GrStubElementBase<GrModifierListStub> im
     return name.equals(GrModifier.VOLATILE) && findChildByType(GroovyElementTypes.kVOLATILE) != null;
   }
 
+  public static boolean hasMaskExplicitModifier(String name, int mask) {
+    final int flag = NAME_TO_MODIFIER_FLAG_MAP.get(name);
+    return (mask & flag) != 0;
+  }
+
   public void setModifierProperty(@NotNull @NonNls String name, boolean doSet) throws IncorrectOperationException {
     if (hasModifierProperty(name) == doSet) return;
 
index cb4c8b8a7b696cf97e13f0ef65ecb840a09dec9e..294ec0d0b4416e73024b503383a36e56176828ed 100644 (file)
@@ -22,6 +22,7 @@ import com.intellij.psi.stubs.StubBase;
 import com.intellij.psi.stubs.StubElement;
 import com.intellij.util.io.StringRef;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEnumConstant;
 
@@ -44,7 +45,7 @@ public class GrFieldStub extends StubBase<GrField> implements NamedStub<GrField>
                          final String[] annotations,
                          String[] namedParameters,
                          final IStubElementType elemType,
-                         byte flags, String typeText) {
+                         byte flags, @Nullable String typeText) {
     super(parent, elemType);
     myName = name;
     myAnnotations = annotations;
@@ -79,6 +80,7 @@ public class GrFieldStub extends StubBase<GrField> implements NamedStub<GrField>
     return myFlags;
   }
 
+  @Nullable
   public String getTypeText() {
     return myTypeText;
   }
index 082ab480e959b67510c95b0c1d77b51f2c8bb30d..4e5454cebc79508da847277dab5271188f266664 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.psi.stubs.StubBase;
 import com.intellij.psi.stubs.StubElement;
 import com.intellij.util.io.StringRef;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
 import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.GrMethodElementType;
 
@@ -30,16 +31,18 @@ public class GrMethodStub extends StubBase<GrMethod> implements NamedStub<GrMeth
   private final StringRef myName;
   private final String[] myAnnotations;
   private final String[] myNamedParameters;
+  private final String myTypeText;
 
   public GrMethodStub(StubElement parent,
                       StringRef name,
                       final String[] annotations,
                       final @NotNull String[] namedParameters,
-                      final GrMethodElementType elementType) {
+                      final GrMethodElementType elementType, @Nullable String typeText) {
     super(parent, elementType);
     myName = name;
     myAnnotations = annotations;
     myNamedParameters = namedParameters;
+    myTypeText = typeText;
   }
 
   @NotNull public String getName() {
@@ -54,4 +57,9 @@ public class GrMethodStub extends StubBase<GrMethod> implements NamedStub<GrMeth
   public String[] getNamedParameters() {
     return myNamedParameters;
   }
+
+  @Nullable
+  public String getTypeText() {
+    return myTypeText;
+  }
 }
index 9c5f47941feb4833da4bfd0ab80c9a1b3f019fdf..f6024e8ee8ac687a782caa5303ded8d7f96ad702 100644 (file)
 package org.jetbrains.plugins.groovy.lang.psi.stubs;
 
 import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.PsiModifier;
 import com.intellij.psi.PsiModifierList;
 import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.PsiNameHelper;
+import com.intellij.psi.stubs.StubElement;
 import com.intellij.psi.stubs.StubInputStream;
 import com.intellij.psi.stubs.StubOutputStream;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.containers.CollectionFactory;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
 import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList;
 import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotation;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrMultiTypeParameter;
 import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
 import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
+import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.modifiers.GrModifierListImpl;
 
 import java.io.IOException;
 import java.util.List;
@@ -40,19 +44,6 @@ import java.util.List;
  */
 public class GrStubUtils {
 
-
-  private GrStubUtils() {
-  }
-
-  public static String[] getMultiTypes(GrMultiTypeParameter psi) {
-    final GrTypeElement[] typeElements = psi.getTypeElements();
-    final String[] types = new String[typeElements.length];
-    for (int i = 0; i < typeElements.length; i++) {
-      types[i] = typeElements[i].getText();
-    }
-    return types;
-  }
-
   public static void writeStringArray(StubOutputStream dataStream, String[] array) throws IOException {
     dataStream.writeByte(array.length);
     for (String s : array) {
@@ -83,8 +74,7 @@ public class GrStubUtils {
   }
 
   @Nullable
-  public static String getTypeText(GrVariable psi) {
-    final GrTypeElement typeElement = psi.getTypeElementGroovy();
+  public static String getTypeText(GrTypeElement typeElement) {
     return typeElement == null ? null : typeElement.getText();
   }
 
@@ -102,4 +92,24 @@ public class GrStubUtils {
     }
     return ArrayUtil.toStringArray(annoNames);
   }
+
+  public static boolean isGroovyStaticMemberStub(StubElement<?> stub) {
+    StubElement<GrModifierList> type = stub.findChildStubByType(GroovyElementTypes.MODIFIERS);
+    if (type instanceof GrModifierListStub) {
+      return GrModifierListImpl.hasMaskExplicitModifier(PsiModifier.STATIC, ((GrModifierListStub)type).getModifiersFlags());
+    }
+    return true;
+  }
+
+  @NotNull
+  public static String getShortTypeText(@Nullable String text) {
+    if (text == null) {
+      return "";
+    }
+    int i = text.length();
+    while (i - 2 >= 0 && text.charAt(i - 2) == '[' && text.charAt(i - 1) == ']') {
+      i -= 2;
+    }
+    return PsiNameHelper.getShortClassName(text.substring(0, i)) + text.substring(i);
+  }
 }
index b63adcd2653279c9ae9efc61cf8a0b6de2758250..d18be2ec1e7184e310e0aab5d8a42baefbea0c86 100644 (file)
@@ -15,6 +15,7 @@
  */
 package org.jetbrains.plugins.groovy.lang.psi.stubs.elements;
 
+import com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys;
 import com.intellij.psi.stubs.IndexSink;
 import com.intellij.psi.stubs.StubElement;
 import com.intellij.psi.stubs.StubInputStream;
@@ -57,7 +58,7 @@ public class GrFieldElementType extends GrStubElementType<GrFieldStub, GrField>
     }
 
     return new GrFieldStub(parentStub, StringRef.fromString(psi.getName()), annNames, namedParameters.toArray(new String[namedParameters.size()]), FIELD, GrFieldStub.buildFlags(psi),
-                           GrStubUtils.getTypeText(psi));
+                           GrStubUtils.getTypeText(psi.getTypeElementGroovy()));
   }
 
   public void serialize(GrFieldStub stub, StubOutputStream dataStream) throws IOException {
@@ -94,9 +95,14 @@ public class GrFieldElementType extends GrStubElementType<GrFieldStub, GrField>
                                flags, typeText);
   }
 
+
   static void indexFieldStub(GrFieldStub stub, IndexSink sink) {
     String name = stub.getName();
     sink.occurrence(GrFieldNameIndex.KEY, name);
+    if (GrStubUtils.isGroovyStaticMemberStub(stub)) {
+      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
+      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, GrStubUtils.getShortTypeText(stub.getTypeText()));
+    }
     for (String annName : stub.getAnnotations()) {
       if (annName != null) {
         sink.occurrence(GrAnnotatedMemberIndex.KEY, annName);
index 380a3a18e73989836f6e08840ec42b6eabc498e9..eee9a8aa72ba3800556390f2ff34c8c6996434fe 100644 (file)
  */
 package org.jetbrains.plugins.groovy.lang.psi.stubs.elements;
 
+import com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys;
 import com.intellij.psi.stubs.IndexSink;
 import com.intellij.psi.stubs.StubElement;
 import com.intellij.psi.stubs.StubInputStream;
 import com.intellij.psi.stubs.StubOutputStream;
+import com.intellij.util.ArrayUtil;
 import com.intellij.util.io.StringRef;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
@@ -43,26 +45,31 @@ public abstract class GrMethodElementType extends GrStubElementType<GrMethodStub
 
     Set<String> namedParameters = psi.getNamedParameters().keySet();
     return new GrMethodStub(parentStub, StringRef.fromString(psi.getName()), GrStubUtils.getAnnotationNames(psi),
-                            namedParameters.toArray(new String[namedParameters.size()]), this);
+                            ArrayUtil.toStringArray(namedParameters), this,
+                            GrStubUtils.getTypeText(psi.getReturnTypeElementGroovy()));
   }
 
   public void serialize(GrMethodStub stub, StubOutputStream dataStream) throws IOException {
     dataStream.writeName(stub.getName());
     GrStubUtils.writeStringArray(dataStream, stub.getAnnotations());
     GrStubUtils.writeStringArray(dataStream, stub.getNamedParameters());
+    GrStubUtils.writeNullableString(dataStream, stub.getTypeText());
   }
 
   public GrMethodStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
     StringRef ref = dataStream.readName();
     final String[] annNames = GrStubUtils.readStringArray(dataStream);
     String[] namedParameters = GrStubUtils.readStringArray(dataStream);
-    return new GrMethodStub(parentStub, ref, annNames, namedParameters, this);
+    String typeText = GrStubUtils.readNullableString(dataStream);
+    return new GrMethodStub(parentStub, ref, annNames, namedParameters, this, typeText);
   }
 
   public void indexStub(GrMethodStub stub, IndexSink sink) {
     String name = stub.getName();
-    if (name != null) {
-      sink.occurrence(GrMethodNameIndex.KEY, name);
+    sink.occurrence(GrMethodNameIndex.KEY, name);
+    if (GrStubUtils.isGroovyStaticMemberStub(stub)) {
+      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
+      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, GrStubUtils.getShortTypeText(stub.getTypeText()));
     }
     for (String annName : stub.getAnnotations()) {
       if (annName != null) {
index 1fd9a185609d7c358371088b33adb6b83a7f1bf3..06fe87ee7f86438cdb11afee523b9cc8c1678829 100644 (file)
@@ -54,7 +54,7 @@ public class GrStubFileElementType extends IStubFileElementType<GrFileStub> {
 
   @Override
   public int getStubVersion() {
-    return super.getStubVersion() + 11;
+    return super.getStubVersion() + 12;
   }
 
   public String getExternalId() {
index f2e75d6a39c5acb5fd762c76852966cac62ae868..9c0fb710500f4695a022c922c080208f239fe194 100644 (file)
@@ -16,6 +16,7 @@
 
 package org.jetbrains.plugins.groovy.lang.resolve;
 
+import com.intellij.lang.java.JavaLanguage;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.ProjectRootManager;
 import com.intellij.openapi.util.Key;
@@ -96,8 +97,18 @@ public class ResolveUtil {
     PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
     
     boolean doProcessNonCodeMembers = false;
-
+    boolean isJavaResolver = false;
     while (run != null) {
+
+      //hack for walking up in java code
+      //java's processDeclarations don't check names so we should do it manually
+      if (!isJavaResolver && run.getLanguage() == JavaLanguage.INSTANCE) {
+        isJavaResolver = true;
+        if (processor.getHint(NameHint.KEY) != null) {
+          processor = new JavaResolverProcessor(processor);
+        }
+      }
+
       if (!run.processDeclarations(processor, ResolveState.initial(), lastParent, place)) return false;
       if (processNonCodeMethods) {
         if (!doProcessNonCodeMembers) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/processors/JavaResolverProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/processors/JavaResolverProcessor.java
new file mode 100644 (file)
index 0000000..c864f93
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+package org.jetbrains.plugins.groovy.lang.resolve.processors;
+
+import com.intellij.openapi.util.Key;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiNamedElement;
+import com.intellij.psi.ResolveState;
+import com.intellij.psi.scope.NameHint;
+import com.intellij.psi.scope.PsiScopeProcessor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Checks names of processed element because our Groovy processors don't do it
+ *
+ * @author Max Medvedev
+ */
+public class JavaResolverProcessor implements PsiScopeProcessor {
+  private final PsiScopeProcessor myDelegate;
+  private final NameHint myHint;
+
+
+  public JavaResolverProcessor(PsiScopeProcessor delegate) {
+    myDelegate = delegate;
+    myHint = delegate.getHint(NameHint.KEY);
+  }
+
+  @Override
+  public boolean execute(@NotNull PsiElement element, ResolveState state) {
+    if (myHint != null && element instanceof PsiNamedElement) {
+      final String expectedName = myHint.getName(state);
+      final String elementName = ((PsiNamedElement)element).getName();
+      if (expectedName != null && !expectedName.equals(elementName)) {
+        return true;
+      }
+    }
+
+
+    return myDelegate.execute(element, state);
+  }
+
+  @Override
+  public <T> T getHint(@NotNull Key<T> hintKey) {
+    return myDelegate.getHint(hintKey);
+  }
+
+  @Override
+  public void handleEvent(Event event, @Nullable Object associated) {
+    myDelegate.handleEvent(event, associated);
+  }
+}
similarity index 65%
rename from plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/introduceParameter/IntroduceParameterTest.java
rename to plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/introduceParameter/IntroduceParameterTest.groovy
index 1a3166b0216fe6e593f5d241b10d7e3ecef94edd..c98d9c8573496476436c1e54e538cd8ca59b043a 100644 (file)
  *  limitations under the License.
  */
 
-package org.jetbrains.plugins.groovy.refactoring.introduceParameter;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.command.CommandProcessor;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Pass;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.source.PostprocessReformattingAspect;
-import com.intellij.refactoring.HelpID;
-import com.intellij.refactoring.IntroduceParameterRefactoring;
-import com.intellij.refactoring.introduceField.ElementToWorkOn;
-import com.intellij.refactoring.introduceParameter.IntroduceParameterProcessor;
-import com.intellij.refactoring.introduceParameter.Util;
-import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
-import gnu.trove.TIntArrayList;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.groovy.util.TestUtils;
-
+package org.jetbrains.plugins.groovy.refactoring.introduceParameter
+
+import com.intellij.openapi.application.ApplicationManager
+import com.intellij.openapi.command.CommandProcessor
+import com.intellij.openapi.editor.Editor
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.util.Pass
+import com.intellij.psi.*
+import com.intellij.psi.impl.source.PostprocessReformattingAspect
+import com.intellij.refactoring.HelpID
+import com.intellij.refactoring.IntroduceParameterRefactoring
+import com.intellij.refactoring.introduceField.ElementToWorkOn
+import com.intellij.refactoring.introduceParameter.IntroduceParameterProcessor
+import com.intellij.refactoring.introduceParameter.Util
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+import gnu.trove.TIntArrayList
+import org.jetbrains.annotations.NonNls
+import org.jetbrains.annotations.Nullable
+import org.jetbrains.plugins.groovy.util.TestUtils
 /**
  * @author Maxim.Medvedev
  *         Date: Apr 17, 2009 5:49:35 PM
  */
 public class IntroduceParameterTest extends LightCodeInsightFixtureTestCase {
-  @Override
-  protected String getBasePath() {
-    return TestUtils.getTestDataPath() + "refactoring/introduceParameter/" + getTestName(true) + '/';
-  }
-
-  private void doTest(int replaceFieldsWithGetters, boolean removeUnusedParameters, boolean searchForSuper, boolean declareFinal)
-    throws Throwable {
-    doTest(replaceFieldsWithGetters, removeUnusedParameters, searchForSuper, declareFinal, null);
+  final String getBasePath() {
+    return TestUtils.testDataPath + 'refactoring/introduceParameter/' + getTestName(true) + '/';
   }
 
-  private void doTest(int replaceFieldsWithGetters, boolean removeUnusedParameters, boolean searchForSuper, boolean declareFinal,
-                      @Nullable String conflicts)
-    throws Throwable {
+  private void doTest(int replaceFieldsWithGetters, boolean removeUnusedParameters, boolean searchForSuper, boolean declareFinal, @Nullable String conflicts = null) {
     final String beforeGroovy = getTestName(false)+"Before.groovy";
     final String afterGroovy = getTestName(false) + "After.groovy";
     final String javaClass = getTestName(false) + "MyClass.java";
     myFixture.configureByFiles(javaClass, beforeGroovy);
     executeRefactoring(true, replaceFieldsWithGetters, "anObject", searchForSuper, declareFinal, removeUnusedParameters, conflicts);
-    PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
+    PostprocessReformattingAspect.getInstance(project).doPostponedFormatting();
     myFixture.checkResultByFile(beforeGroovy, afterGroovy, true);
   }
 
@@ -69,12 +60,11 @@ public class IntroduceParameterTest extends LightCodeInsightFixtureTestCase {
                                      final boolean removeUnusedParameters,
                                      final String conflicts) {
     boolean generateDelegate = false;
-    Editor editor = myFixture.getEditor();
+    Editor editor = myFixture.editor;
 
-    final PsiFile myFile = myFixture.getFile();
+    final PsiFile myFile = myFixture.file;
     final ElementToWorkOn[] elementToWorkOn = new ElementToWorkOn[1];
-    ElementToWorkOn
-          .processElementToWorkOn(editor, myFile, "INtr param", HelpID.INTRODUCE_PARAMETER, getProject(), new Pass<ElementToWorkOn>() {
+    ElementToWorkOn.processElementToWorkOn(editor, myFile, "INtr param", HelpID.INTRODUCE_PARAMETER, project, new Pass<ElementToWorkOn>() {
             @Override
             public void pass(final ElementToWorkOn e) {
               if (e == null) return;
@@ -83,8 +73,8 @@ public class IntroduceParameterTest extends LightCodeInsightFixtureTestCase {
             }
           });
 
-    final PsiExpression expr = elementToWorkOn[0].getExpression();
-    final PsiLocalVariable localVar = elementToWorkOn[0].getLocalVariable();
+    final PsiExpression expr = elementToWorkOn[0].expression;
+    final PsiLocalVariable localVar = elementToWorkOn[0].localVariable;
 
     PsiElement context = expr == null ? localVar : expr;
     PsiMethod method = Util.getContainingMethod(context);
@@ -99,19 +89,19 @@ public class IntroduceParameterTest extends LightCodeInsightFixtureTestCase {
       methodToSearchFor = method;
     }
 
-    PsiExpression initializer = expr == null ? localVar.getInitializer() : expr;
+    PsiExpression initializer = expr == null ? localVar.initializer : expr;
     assert initializer != null;
     TIntArrayList parametersToRemove = removeUnusedParameters ? Util.findParametersToRemove(method, initializer, null) : new TIntArrayList();
-    final Project project = myFixture.getProject();
+    final Project project = myFixture.project;
     final IntroduceParameterProcessor processor =
       new IntroduceParameterProcessor(project, method, methodToSearchFor, initializer, expr, localVar, true, parameterName,
                                       replaceAllOccurrences, replaceFieldsWithGetters, declareFinal, generateDelegate, null,
                                       parametersToRemove);
 
-    CommandProcessor.getInstance().executeCommand(project, new Runnable() {
+    CommandProcessor.instance.executeCommand(project, new Runnable() {
       @Override
       public void run() {
-        ApplicationManager.getApplication().runWriteAction(new Runnable() {
+        ApplicationManager.application.runWriteAction(new Runnable() {
           @Override
           public void run() {
             try {
@@ -123,7 +113,7 @@ public class IntroduceParameterTest extends LightCodeInsightFixtureTestCase {
                 e.printStackTrace();
                 fail("Conflicts were not expected");
               }
-              assertEquals(conflicts, e.getMessage());
+              assertEquals(conflicts, e.message);
             }
           }
         });
@@ -131,126 +121,130 @@ public class IntroduceParameterTest extends LightCodeInsightFixtureTestCase {
     }, "introduce Parameter", null);
 
 
-    editor.getSelectionModel().removeSelection();
+    editor.selectionModel.removeSelection();
     return true;
   }
 
 
-  public void testSimpleOverridedMethod() throws Throwable {
+  public void testSimpleOverridedMethod() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
 
-  public void testOverridedMethodWithRemoveUnusedParameters() throws Throwable {
+  public void testOverridedMethodWithRemoveUnusedParameters() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false);
   }
 
-  public void testSimpleUsage() throws Throwable {
+  public void testSimpleUsage() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
 
-  public void testMethodWithoutParams() throws Throwable {
+  public void testMethodWithoutParams() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
 
-  public void testParameterSubstitution() throws Throwable {
+  public void testParameterSubstitution() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
 
-  public void testThisSubstitution() throws Throwable {
+  public void testThisSubstitution() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
 
-  public void testThisSubstitutionInQualifier() throws Throwable {
+  public void testThisSubstitutionInQualifier() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, "field <b><code>Test.i</code></b> is not accessible from method <b><code>XTest.n()</code></b>. Value for introduced parameter in that method call will be incorrect.");
   }
 
-  public void testFieldAccess() throws Throwable {
+  public void testFieldAccess() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
 
-  public void testMethodAccess() throws Throwable {
+  public void testMethodAccess() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
 
-  public void testStaticFieldAccess() throws Throwable {
+  public void testStaticFieldAccess() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
 
-  public void testFieldWithGetterReplacement() throws Throwable {
+  public void testFieldWithGetterReplacement() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, false, false, false);
   }
 
-  public void testFieldWithInaccessibleGetterReplacement() throws Throwable {
+  public void testFieldWithInaccessibleGetterReplacement() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
   }
 
-  public void testWeirdQualifier() throws Throwable {
+  public void testWeirdQualifier() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
   }
 
-  public void testSuperInExpression() throws Throwable {
+  public void testSuperInExpression() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, "Parameter initializer contains <b><code>super</code></b>, but not all calls to method are in its class.");
   }
 
-  public void testWeirdQualifierAndParameter() throws Throwable {
+  public void testWeirdQualifierAndParameter() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
   }
 
-  public void testImplicitSuperCall() throws Throwable {
+  public void testImplicitSuperCall() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
   }
 
-  public void testImplicitDefaultConstructor() throws Throwable {
+  public void testImplicitDefaultConstructor() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
   }
 
-  public void testInternalSideEffect() throws Throwable {
+  public void testInternalSideEffect() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
   }
 
-/*  public void testAnonymousClass() throws Throwable {
+/*  public void testAnonymousClass() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
   }*/
 
-  public void testSuperWithSideEffect() throws Throwable {
+  public void testSuperWithSideEffect() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, "Parameter initializer contains <b><code>super</code></b>, but not all calls to method are in its class.");
   }
 
-  public void testConflictingField() throws Throwable {
+  public void testConflictingField() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, true, false);
   }
 
-  /*public void testParameterJavaDoc1() throws Throwable {
+  /*public void testParameterJavaDoc1() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true);
   }
 
-  public void testParameterJavaDoc2() throws Throwable {
+  public void testParameterJavaDoc2() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true);
   }
 
-  public void testParameterJavaDoc3() throws Throwable {
+  public void testParameterJavaDoc3() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true);
   }
 
-  public void testParameterJavaDocBeforeVararg() throws Throwable {
+  public void testParameterJavaDocBeforeVararg() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true);
   }*/
 
-  public void testRemoveParameterInHierarchy() throws Throwable {
+  public void testRemoveParameterInHierarchy() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false);
   }
 
-  /*public void testRemoveParameterWithJavadoc() throws Throwable {
+  /*public void testRemoveParameterWithJavadoc() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false);
   }*/
 
-  public void testVarargs() throws Throwable {   // IDEADEV-16828
+  public void testVarargs() {   // IDEADEV-16828
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
 
-  public void testMethodUsageInThisMethodInheritor() throws Throwable {
+  public void testMethodUsageInThisMethodInheritor() {
     doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
   }
+
+  public void testIntroduceConstantField() {
+    doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false)
+  }
 }
 
 
diff --git a/plugins/groovy/testdata/refactoring/introduceParameter/introduceConstantField/IntroduceConstantFieldAfter.groovy b/plugins/groovy/testdata/refactoring/introduceParameter/introduceConstantField/IntroduceConstantFieldAfter.groovy
new file mode 100644 (file)
index 0000000..9fa83f3
--- /dev/null
@@ -0,0 +1 @@
+Foo.func(MySingleton.INSTANCE)
diff --git a/plugins/groovy/testdata/refactoring/introduceParameter/introduceConstantField/IntroduceConstantFieldBefore.groovy b/plugins/groovy/testdata/refactoring/introduceParameter/introduceConstantField/IntroduceConstantFieldBefore.groovy
new file mode 100644 (file)
index 0000000..4740e4f
--- /dev/null
@@ -0,0 +1 @@
+Foo.func()
diff --git a/plugins/groovy/testdata/refactoring/introduceParameter/introduceConstantField/IntroduceConstantFieldMyClass.java b/plugins/groovy/testdata/refactoring/introduceParameter/introduceConstantField/IntroduceConstantFieldMyClass.java
new file mode 100644 (file)
index 0000000..24801a2
--- /dev/null
@@ -0,0 +1,9 @@
+class Foo {
+  static void func() {
+    System.out.println(<selection>MySingleton.INSTANCE</selection>);
+  }
+}
+
+public class MySingleton {
+  public static final MySingleton INSTANCE = new MySingleton();
+}
index bc39cb9fcf482ced7318dfa964981fddc645d6bc..c14446f2eda7a7112205afbe6c4059e1cb9833ae 100644 (file)
@@ -255,9 +255,11 @@ public class MavenModuleImporter {
         annotationProcessorDirectory = "target/generated-sources/annotations";
       }
 
+      Map<String, String> options = myMavenProject.getAnnotationProcessorOptions();
+
       List<String> processors = myMavenProject.getDeclaredAnnotationProcessors();
 
-      if (processors == null && "target/generated-sources/annotations".equals(annotationProcessorDirectory)) {
+      if (processors == null && options.isEmpty() && "target/generated-sources/annotations".equals(annotationProcessorDirectory)) {
         if (moduleProfile != null) {
           compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
         }
@@ -284,17 +286,21 @@ public class MavenModuleImporter {
         if (moduleProfile == null) {
           moduleProfile = new ProcessorConfigProfile(moduleProfileName);
           moduleProfile.setEnabled(true);
+          moduleProfile.setObtainProcessorsFromClasspath(true);
           moduleProfile.addModuleName(myModule.getName());
           compilerConfiguration.addModuleProcessorProfile(moduleProfile);
         }
 
         moduleProfile.setGeneratedSourcesDirectoryName(annotationProcessorDirectory);
 
-        if (processors == null) {
-          moduleProfile.setObtainProcessorsFromClasspath(true);
+        moduleProfile.clearProcessorOptions();
+        for (Map.Entry<String, String> entry : options.entrySet()) {
+          moduleProfile.setOption(entry.getKey(), entry.getValue());
         }
-        else {
-          moduleProfile.setObtainProcessorsFromClasspath(false);
+
+        moduleProfile.clearProcessors();
+
+        if (processors != null) {
           for (String processor : processors) {
             moduleProfile.addProcessor(processor);
           }
index 2a2aea64cb61e3779493f03589a3de1890a97ead..1629566e04cadaecac4245957983ccf3c86346ed 100644 (file)
@@ -15,6 +15,7 @@
  */
 package org.jetbrains.idea.maven.project;
 
+import com.intellij.execution.configurations.ParametersList;
 import com.intellij.openapi.module.ModuleType;
 import com.intellij.openapi.module.StdModuleTypes;
 import com.intellij.openapi.project.Project;
@@ -383,7 +384,52 @@ public class MavenProject {
   //private static Element getAnnotationProcessorsConfiguration(@Nullable Element compilerConfig) {
   //  return (compilerConfig == null) ? null : compilerConfig.getChild("annotationProcessors");
   //}
-  
+
+  public Map<String, String> getAnnotationProcessorOptions() {
+    Element compilerConfig = getCompilerConfig();
+
+    if (compilerConfig == null) return Collections.emptyMap();
+
+    Map<String, String> res = null;
+
+    String compilerArgument = compilerConfig.getChildText("compilerArgument");
+    if (!StringUtil.isEmptyOrSpaces(compilerArgument)) {
+      ParametersList parametersList = new ParametersList();
+      parametersList.addParametersString(compilerArgument);
+
+      for (String param : parametersList.getParameters()) {
+        if (param.startsWith("-A")) {
+          int idx = param.indexOf('=', 3);
+          if (idx >= 0) {
+            if (res == null) {
+              res = new LinkedHashMap<String, String>();
+            }
+
+            res.put(param.substring(2, idx), param.substring(idx + 1));
+          }
+        }
+      }
+    }
+
+    Element compilerArguments = compilerConfig.getChild("compilerArguments");
+    if (compilerArguments != null) {
+      for (Element e : (Collection<Element>)compilerArguments.getChildren()){
+        String name = e.getName();
+        if (name.length() > 1 && name.charAt(0) == 'A') {
+          if (res == null) {
+            res = new LinkedHashMap<String, String>();
+          }
+
+          res.put(name.substring(1), e.getTextTrim());
+        }
+      }
+    }
+
+    if (res == null) return Collections.emptyMap();
+
+    return res;
+  }
+
   //private String getCompilerArgument() {
   //  return MavenJDOMUtil.findChildValueByPath(getCompilerConfig(), "compilerArgument");
   //}
index 0ba88d7330a1929fa4ce5feaef1251bb34295f29..27a606901282b66da74a60725c5e5402791dba18 100644 (file)
@@ -21,6 +21,8 @@
 package org.jetbrains.idea.maven.wizards;
 
 import com.intellij.ide.util.projectWizard.WizardContext;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.projectImport.ProjectOpenProcessorBase;
 import org.jetbrains.annotations.NotNull;
@@ -33,13 +35,45 @@ import java.util.Arrays;
 import java.util.List;
 
 public class MavenProjectOpenProcessor extends ProjectOpenProcessorBase<MavenProjectBuilder> {
+
+  private static final Logger LOG = Logger.getInstance(MavenProjectOpenProcessor.class);
+
+  public static final String[] POM_XML = new String[]{MavenConstants.POM_XML};
+
   public MavenProjectOpenProcessor(@NotNull MavenProjectBuilder builder) {
     super(builder);
   }
 
   @Nullable
   public String[] getSupportedExtensions() {
-    return new String[]{MavenConstants.POM_XML};
+    return POM_XML;
+  }
+
+  @Override
+  public boolean canOpenProject(VirtualFile file) {
+    if (file.isDirectory()) {
+      long startTime = System.currentTimeMillis();
+
+      try {
+        return file.findChild(MavenConstants.POM_XML) != null;
+      }
+      finally {
+        long now = System.currentTimeMillis();
+
+        int limit = ApplicationManager.getApplication().isInternal() ? 100 : 500;
+
+        if (now - startTime > limit) {
+          LOG.error("Finding pom.xml got " + (now - startTime) + "ms. See IDEA-71265. " + file.getPath(), new Exception());
+        }
+      }
+    }
+    else {
+      if (MavenConstants.POM_XML.equals(file.getName())) {
+        return true;
+      }
+    }
+
+    return false;
   }
 
   public boolean doQuickImport(VirtualFile file, WizardContext wizardContext) {
index 5b7dfd7e16dbc1eb2875661c4542e752ab5c9a5b..07280e0d8dfa451c4c7d7c2d86d3594f43726388 100644 (file)
@@ -68,15 +68,35 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
   </build>
 """)
 
+    createModulePom("module4", """
+<groupId>test</groupId>
+<artifactId>module4</artifactId>
+<version>1</version>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <annotationProcessors>
+          </annotationProcessors>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+""")
+
     importProject """
 <groupId>test</groupId>
 <artifactId>project</artifactId>
 <version>1</version>
+<packaging>pom</packaging>
 
 <modules>
   <module>module1</module>
   <module>module2</module>
   <module>module3</module>
+  <module>module4</module>
 </modules>
 
 """;
@@ -84,8 +104,8 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
     def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
 
     assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE).getModuleNames() == new HashSet<String>(["project", "module1"])
-    assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + 'module2').isObtainProcessorsFromClasspath() == false
     assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + 'module2').getProcessors() == new HashSet<String>(["com.test.SourceCodeGeneratingAnnotationProcessor2"])
+    assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + 'module3') == null
   }
 
   public void testOverrideGeneratedOutputDir() {
@@ -109,7 +129,35 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
     def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
 
     assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
-    assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project").getGeneratedSourcesDirectoryName().endsWith("out/generated")
+    assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project").getGeneratedSourcesDirectoryName().replace('\\', '/').endsWith("out/generated")
+  }
+
+  public void testImportAnnotationProcessorOptions() {
+    importProject """
+<groupId>test</groupId>
+<artifactId>project</artifactId>
+<version>1</version>
+
+<build>
+  <plugins>
+    <plugin>
+      <artifactId>maven-compiler-plugin</artifactId>
+      <configuration>
+        <compilerArgument>-Aopt1=111 -Xmx512Mb -Aopt2=222</compilerArgument>
+        <compilerArguments>
+          <Aopt3>333</Aopt3>
+          <opt>666</opt>
+        </compilerArguments>
+      </configuration>
+    </plugin>
+  </plugins>
+</build>
+""";
+
+    def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
+
+    assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
+    assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project").getProcessorOptions() == ['opt1': '111', 'opt2': '222', 'opt3': '333']
   }
 
 }
index 7117306ba4430a93f01cea1eb0d1558129c6a648..d87bb24b4d1af962d789cacd227c5695579aea7d 100644 (file)
@@ -29,10 +29,6 @@ import java.io.IOException;
 import java.util.Arrays;
 
 public class ResourceFilteringTest extends MavenImportingTestCase {
-  @Override
-  protected boolean runInDispatchThread() {
-    return false;
-  }
 
   @Override
   protected boolean runInWriteAction() {
index f8532fc473631f468c973e1b05c72010a5cbc790..d1d2aa87e312f0514f2cb556676001fee2aeac2d 100644 (file)
@@ -61,13 +61,9 @@ public final class TreeContentProvider extends AbstractTreeStructure {
   @NotNull
   @Override
   public NodeDescriptor createDescriptor(Object element, NodeDescriptor parentDescriptor) {
-    if (element == myTreeRoot) {
-      return new TreeNodeDescriptor(parentDescriptor, element);
-    }
-    if (element instanceof RadComponent) {
-      RadComponent component = (RadComponent)element;
+    if (element == myTreeRoot || element instanceof RadComponent) {
       TreeNodeDescriptor descriptor = new TreeNodeDescriptor(parentDescriptor, element);
-      descriptor.setWasDeclaredAlwaysLeaf(component.getTreeChildren().length == 0);
+      descriptor.setWasDeclaredAlwaysLeaf(isAlwaysLeaf(element));
       return descriptor;
     }
     throw new IllegalArgumentException("Unknown element: " + element);
@@ -75,7 +71,7 @@ public final class TreeContentProvider extends AbstractTreeStructure {
 
   @Override
   public boolean isAlwaysLeaf(Object element) {
-    return element instanceof RadComponent && ((RadComponent)element).getChildren().isEmpty();
+    return element instanceof RadComponent && ((RadComponent)element).getTreeChildren().length == 0;
   }
 
   @Override
index 26aa7483d4f86b3cf7887d6bfcdbaffff457e044..98125dce5e3c1da6c102f56d3979a061768781ab 100644 (file)
@@ -159,6 +159,7 @@ public final class TreeEditableArea implements EditableArea, FeedbackTreeLayer,
       }
     }
 
+    myTreeBuilder.queueUpdate();
     hookSelection();
     fireSelectionChanged();
   }
index 2b5ee9669df277a45554529564af8b36ca477e71..8f0426889c3fa7cb42931689229bc632ec1e0c5d 100644 (file)
@@ -241,7 +241,9 @@ public abstract class ContextProvider {
               public void run() {
                 if (file.getUserData(XML_FILE_WITH_XPATH_INJECTTION) == null) {
                   file.putUserData(XML_FILE_WITH_XPATH_INJECTTION, Boolean.TRUE);
-                  DaemonCodeAnalyzer.getInstance(file.getProject()).restart(file);
+                  if (!ApplicationManager.getApplication().isUnitTestMode()) { // TODO workaround for highlighting tests
+                    DaemonCodeAnalyzer.getInstance(file.getProject()).restart(file);
+                  }
                 }
               }
             });
index 4cbf8f2708c511324f6813d292eb03ee8d809346..cf0158946985e3850b46e7e9826506fe69fe12c5 100644 (file)
     <stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaFieldNameIndex"/>
     <stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaFullClassNameIndex"/>
     <stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaMethodNameIndex"/>
+    <stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaStaticMemberNameIndex"/>
+    <stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaStaticMemberTypeIndex"/>
     <stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaShortClassNameIndex"/>
     <stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaSuperClassNameOccurenceIndex"/>
 
diff --git a/xml/dom-tests/testData/performance.xml b/xml/dom-tests/testData/performance.xml
new file mode 100644 (file)
index 0000000..49f57b1
--- /dev/null
@@ -0,0 +1,1182 @@
+<component>
+  <actions>
+    <action id="CaptureMemorySnapShot" class="xcom.intellij.util.CaptureMemorySnapshotAction" text="Capture memory snapshot" description="Capture memory snapshot" icon="/actions/profileMemory.png" />
+    <action id="CaptureCPUUsageData" class="xcom.intellij.util.CaptureCPUUsageDataAction" text="Capture cpu usage data" description="Capture cpu usage data" icon="/actions/profuleCPU.png" />
+    <action id="ContextHelp" class="xcom.intellij.ide.actions.ContextHelpAction" text="Conte_xt Help" description="Show context help"/>
+    <action id="RunConfiguration" text="Select Run/Debug Configuration" description="Select Run/Debug Configuration" class="xcom.intellij.execution.actions.RunConfigurationAction"/>
+    <action id="ShowIntentionActions" text="Show Intention Actions" class="xcom.intellij.codeInsight.intention.actions.ShowIntentionActionsAction"/>
+    <action id="ToggleReadOnlyAttribute" text="Toggle Read-Only Attribute" description="Toggle read-only attribute of current file" class="xcom.intellij.ide.actions.ToggleReadOnlyAttributeAction"/>
+    <action id="TogglePopupHints" text="Toggle Popup Hints for Current File" class="xcom.intellij.ide.actions.TogglePopupHintsAction"/>
+    <action id="RunGc" text="Run Garbage Collector" class="xcom.intellij.ide.actions.RunGcAction"/>
+    <action id="ShowPopupMenu" text="Show Context Menu" class="xcom.intellij.ide.actions.ShowPopupMenuAction"/>
+    <action id="CloseWindow" text="Close Active Window" class="xcom.intellij.ide.actions.CloseWindowAction"/>
+
+    <action id="Vcs.ShowHistory" class="xcom.intellij.openapi.vcs.actions.FileHistoryAction" text="Show File History" description="Show history of file"/>
+    <action id="Vcs.ShowHistoryForBlock" class="xcom.intellij.openapi.vcs.actions.SelectedBlockHistoryAction" text="Show History _for Selection" description="Show history for editor selection"/>
+    <action id="Vcs.ShowTabbedFileHistory" class="xcom.intellij.openapi.vcs.actions.TabbedShowHistoryAction" text="_Show History" description="Show history of file"/>
+
+    <group id="RunContextGroup" popup="false">
+      <action id="CreateRunConfiguration" text="Create Run Configuration" description="Create run configuration from context" class="xcom.intellij.execution.actions.CreateAction"/>
+    </group>
+    <group id="RunContextPopupGroup" popup="false" text="Run Configurations">
+      <reference ref="RunContextGroup"/>
+    </group>
+    <!--Editor -->
+    <group id="EditorActions" text="Editor Actions">
+
+      <action id="EditorChooseLookupItem" class="xcom.intellij.codeInsight.lookup.impl.actions.ChooseItemAction" text="Choose Lookup Item"/>
+      <action id="EditorChooseLookupItemReplace" class="xcom.intellij.codeInsight.lookup.impl.actions.ChooseItemReplaceAction" text="Choose Lookup Item Replace"/>
+
+      <action id="NextTemplateVariable" text="Next Template Variable" class="xcom.intellij.codeInsight.template.impl.actions.NextVariableAction"/>
+      <action id="PreviousTemplateVariable" text="Previous Template Variable" class="xcom.intellij.codeInsight.template.impl.actions.PreviousVariableAction"/>
+
+      <action id="NextParameter" text="Next Parameter" class="xcom.intellij.codeInsight.hint.actions.NextParameterAction"/>
+      <action id="PrevParameter" text="Prev Parameter" class="xcom.intellij.codeInsight.hint.actions.PrevParameterAction"/>
+
+      <action id="EditorPageUp" class="xcom.intellij.openapi.editor.actions.PageUpAction" text="Page Up"/>
+      <action id="EditorPageDown" class="xcom.intellij.openapi.editor.actions.PageDownAction" text="Page Down"/>
+      <action id="EditorPageUpWithSelection" class="xcom.intellij.openapi.editor.actions.PageUpWithSelectionAction" text="Page Up with Selection"/>
+      <action id="EditorPageDownWithSelection" class="xcom.intellij.openapi.editor.actions.PageDownWithSelectionAction" text="Page Up with Selection"/>
+      <action id="EditorCopy" class="xcom.intellij.openapi.editor.actions.CopyAction" text="Copy"/>
+      <action id="EditorCut" class="xcom.intellij.openapi.editor.actions.CutAction" text="Cut"/>
+      <action id="EditorPaste" class="xcom.intellij.openapi.editor.actions.PasteAction" text="Paste"/>
+      <action id="EditorPasteFromX11" class="xcom.intellij.openapi.editor.actions.PasteFromX11Action" text="Paste from X clipboard"/>
+      <action id="EditorDelete" class="xcom.intellij.openapi.editor.actions.DeleteAction" text="Delete"/>
+      <action id="EditorBackSpace" class="xcom.intellij.openapi.editor.actions.BackspaceAction" text="Backspace"/>
+      <action id="EditorMoveToPageTop" class="xcom.intellij.openapi.editor.actions.PageTopAction" text="Move Caret to Page Top"/>
+      <action id="EditorMoveToPageBottom" class="xcom.intellij.openapi.editor.actions.PageBottomAction" text="Move Caret to Page Bottom"/>
+      <action id="EditorMoveToPageTopWithSelection" class="xcom.intellij.openapi.editor.actions.PageTopWithSelectionAction" text="Move Caret to Page Top with Selection"/>
+      <action id="EditorMoveToPageBottomWithSelection" class="xcom.intellij.openapi.editor.actions.PageBottomWithSelectionAction" text="Move Caret to Page Bottom with Selection"/>
+      <action id="EditorEnter" class="xcom.intellij.openapi.editor.actions.EnterAction" text="Enter"/>
+      <action id="EditorEscape" class="xcom.intellij.openapi.editor.actions.EscapeAction" text="Escape"/>
+      <action id="EditorUp" class="xcom.intellij.openapi.editor.actions.MoveCaretUpAction" text="Up"/>
+      <action id="EditorDown" class="xcom.intellij.openapi.editor.actions.MoveCaretDownAction" text="Down"/>
+      <action id="EditorLeft" class="xcom.intellij.openapi.editor.actions.MoveCaretLeftAction" text="Left"/>
+      <action id="EditorRight" class="xcom.intellij.openapi.editor.actions.MoveCaretRightAction" text="Right"/>
+      <action id="EditorUpWithSelection" class="xcom.intellij.openapi.editor.actions.MoveCaretUpWithSelectionAction" text="Up with Selection"/>
+      <action id="EditorDownWithSelection" class="xcom.intellij.openapi.editor.actions.MoveCaretDownWithSelectionAction" text="Down with Selection"/>
+      <action id="EditorLeftWithSelection" class="xcom.intellij.openapi.editor.actions.MoveCaretLeftWithSelectionAction" text="Left with Selection"/>
+      <action id="EditorRightWithSelection" class="xcom.intellij.openapi.editor.actions.MoveCaretRightWithSelectionAction" text="Right with Selection"/>
+      <action id="EditorIndentSelection" class="xcom.intellij.openapi.editor.actions.IndentSelectionAction" text="Indent Selection"/>
+      <action id="EditorUnindentSelection" class="xcom.intellij.openapi.editor.actions.UnindentSelectionAction" text="Unindent Selection"/>
+      <action id="EditorTab" class="xcom.intellij.openapi.editor.actions.TabAction" text="Tab"/>
+      <action id="EmacsStyleIndent" class="xcom.intellij.openapi.editor.actions.EmacsStyleIndentAction" text="Emacs Tab"/>
+      <action id="EditorScrollUp" class="xcom.intellij.openapi.editor.actions.ScrollUpAction" text="Scroll Up"/>
+      <action id="EditorScrollDown" class="xcom.intellij.openapi.editor.actions.ScrollDownAction" text="Scroll Down"/>
+      <action id="EditorMoveUpAndScroll" class="xcom.intellij.openapi.editor.actions.MoveUpAndScrollAction" text="Move Up and Scroll"/>
+      <action id="EditorMoveDownAndScroll" class="xcom.intellij.openapi.editor.actions.MoveDownAndScrollAction" text="Move Down and Scroll"/>
+      <action id="EditorMoveUpAndScrollWithSelection" class="xcom.intellij.openapi.editor.actions.MoveUpWithSelectionAndScrollAction" text="Move Up and Scroll with Selection"/>
+      <action id="EditorMoveDownAndScrollWithSelection" class="xcom.intellij.openapi.editor.actions.MoveDownWithSelectionAndScrollAction" text="Move Down and Scroll with Selection"/>
+      <action id="EditorLineStart" class="xcom.intellij.openapi.editor.actions.LineStartAction" text="Move Caret to Line Start"/>
+      <action id="EditorLineEnd" class="xcom.intellij.openapi.editor.actions.LineEndAction" text="Move Caret to Line End"/>
+      <action id="EditorCutLineEnd" class="xcom.intellij.openapi.editor.actions.CutLineEndAction" text="Cut up to Line End"/>
+      <action id="EditorTextStart" class="xcom.intellij.openapi.editor.actions.TextStartAction" text="Move Caret to Text Start"/>
+      <action id="EditorTextEnd" class="xcom.intellij.openapi.editor.actions.TextEndAction" text="Move Caret to Text End"/>
+      <action id="EditorLineStartWithSelection" class="xcom.intellij.openapi.editor.actions.LineStartWithSelectionAction" text="Move Caret to Line Start with Selection"/>
+      <action id="EditorLineEndWithSelection" class="xcom.intellij.openapi.editor.actions.LineEndWithSelectionAction" text="Move Caret to Line End with Selection"/>
+      <action id="EditorTextStartWithSelection" class="xcom.intellij.openapi.editor.actions.TextStartWithSelectionAction" text="Move Caret to Text Start with Selection"/>
+      <action id="EditorTextEndWithSelection" class="xcom.intellij.openapi.editor.actions.TextEndWithSelectionAction" text="Move Caret to Text End with Selection"/>
+      <action id="EditorNextWord" class="xcom.intellij.openapi.editor.actions.NextWordAction" text="Move Caret to Next Word"/>
+      <action id="EditorPreviousWord" class="xcom.intellij.openapi.editor.actions.PreviousWordAction" text="Move Caret to Previous Word"/>
+      <action id="EditorNextWordWithSelection" class="xcom.intellij.openapi.editor.actions.NextWordWithSelectionAction" text="Move Caret to Next Word with Selection"/>
+      <action id="EditorPreviousWordWithSelection" class="xcom.intellij.openapi.editor.actions.PreviousWordWithSelectionAction" text="Move Caret to Previous Word with Selection"/>
+      <action id="EditorCodeBlockStart" class="xcom.intellij.codeInsight.editorActions.CodeBlockStartAction" text="Move Caret to Code Block Start"/>
+      <action id="EditorCodeBlockEnd" class="xcom.intellij.codeInsight.editorActions.CodeBlockEndAction" text="Move Caret to Code Block End"/>
+      <action id="EditorCodeBlockStartWithSelection" class="xcom.intellij.codeInsight.editorActions.CodeBlockStartWithSelectionAction" text="Move Caret to Code Block Start with Selection"/>
+      <action id="EditorCodeBlockEndWithSelection" class="xcom.intellij.codeInsight.editorActions.CodeBlockEndWithSelectionAction" text="Move Caret to Code Block End with Selection"/>
+      <action id="EditorDeleteToWordStart" class="xcom.intellij.openapi.editor.actions.DeleteToWordStartAction" text="Delete to Word Start"/>
+      <action id="EditorDeleteToWordEnd" class="xcom.intellij.openapi.editor.actions.DeleteToWordEndAction" text="Delete to Word End"/>
+      <action id="EditorDeleteLine" class="xcom.intellij.openapi.editor.actions.DeleteLineAtCaretAction" text="Delete Line at Caret"/>
+      <action id="EditorDuplicate" class="xcom.intellij.openapi.editor.actions.DuplicateAction" text="Duplicate Line or Block"/>
+      <action id="EditorSelectWord" class="xcom.intellij.openapi.editor.actions.SelectWordAtCaretAction" text="Select Word at Caret"/>
+      <action id="EditorUnSelectWord" class="xcom.intellij.openapi.editor.actions.UnselectWordAtCaretAction" text="Unselect Word at Caret"/>
+      <action id="EditorToggleInsertState" class="xcom.intellij.openapi.editor.actions.ToggleInsertStateAction" text="Toggle Insert/Overwrite"/>
+      <action id="EditorToggleColumnMode" class="xcom.intellij.openapi.editor.actions.ToggleColumnModeAction" text="Column Mode" description="Toggle editor column mode"/>
+      <action id="EditorToggleShowWhitespaces" class="xcom.intellij.openapi.editor.actions.ToggleShowWhitespacesAction" text="Sh_ow Whitespaces" description="Toggle display whitespaces in current editor"/>
+      <action id="EditorToggleShowLineNumbers" class="xcom.intellij.openapi.editor.actions.ToggleShowLineNumbersAction" text="Show Line _Numbers" description="Toggle display line numbers in current editor"/>
+      <action id="EditorScrollToCenter" class="xcom.intellij.openapi.editor.actions.ScrollToCenterAction" text="Scroll to Center"/>
+      <action id="EditorToggleCase" class="xcom.intellij.openapi.editor.actions.ToggleCaseAction" text="Toggle Case"/>
+      <action id="EditorJoinLines" class="xcom.intellij.openapi.editor.actions.JoinLinesAction" text="Join Lines"/>
+      <action id="EditorSelectLine" class="xcom.intellij.openapi.editor.actions.SelectLineAction" text="Select Line at Caret"/>
+      <action id="EditorSplitLine" class="xcom.intellij.openapi.editor.actions.SplitLineAction" text="Split Line"/>
+      <action id="EditorStartNewLine" class="xcom.intellij.openapi.editor.actions.StartNewLineAction" text="Start New Line"/>
+      <action id="EditorCompleteStatement" class="xcom.intellij.codeInsight.editorActions.smartEnter.SmartEnterAction" text="Complete Current Statement"/>
+    </group>
+
+    <action id="ExpandAll" class="xcom.intellij.ide.actions.ExpandAllAction" text="Expand All" icon="/actions/expandall.png"/>
+    <action id="CollapseAll" class="xcom.intellij.ide.actions.CollapseAllAction" text="Collapse All" icon="/actions/collapseall.png"/>
+    <action id="ExportToTextFile" class="xcom.intellij.ide.actions.ExportToTextFileAction" text="Export to Text File" icon="/actions/export.png"/>
+    <action id="ExpandTreeNode" text="Expand Tree Node" class="xcom.intellij.ide.actions.tree.ExpandTreeNodeAction"/>
+    <action id="CollapseTreeNode" text="Collapse Tree Node" class="xcom.intellij.ide.actions.tree.CollapseTreeNodeAction"/>
+    <action id="FullyExpandTreeNode" text="Fully Expand Tree Node" class="xcom.intellij.ide.actions.tree.FullyExpandTreeNodeAction"/>
+
+    <group id="J2EEGenerateGroup">
+      <action id="CreateSessionBean" text="_Session Bean" class="xcom.intellij.javaee.module.view.ejb.actions.CreateSessionBeanAction" icon="/nodes/ejbSession.png"/>
+      <action id="CreateContainerManagedEntityBeanAction" text="_CMP Entity Bean" class="xcom.intellij.javaee.module.view.ejb.actions.CreateCMPEntityBeanAction" icon="/nodes/ejbEntity.png"/>
+      <action id="CreateBeanManagedEntityBeanAction" text="_BMP Entity Bean" class="xcom.intellij.javaee.module.view.ejb.actions.CreateBMPEntityBeanAction" icon="/nodes/ejbEntity.png"/>
+      <action id="CreateMessageBean" text="_Message Bean" class="xcom.intellij.javaee.module.view.ejb.actions.CreateMessageBeanAction" icon="/nodes/ejbMessage.png"/>
+      <action id="CreateTransferObject" text="_Transfer Object" class="xcom.intellij.javaee.module.view.ejb.actions.CreateTransferObjectAction" icon="/nodes/class.png"/>
+      <action id="CreateCMPField" text="_CMP Field" class="xcom.intellij.javaee.module.view.ejb.actions.CreateCmpFieldAction" icon="/nodes/ejbCmpField.png"/>
+      <action id="CreateEJBRelationship" text="EJB _Relationship" class="xcom.intellij.javaee.module.view.ejb.actions.CreateEjbRelationshipAction" icon="/nodes/ejbCmrField.png"/>
+
+      <action id="CreateJSPAction" text="_Jsp" class="xcom.intellij.javaee.module.view.web.CreateJspAction" description="Create new JSP file in this directory" icon="/fileTypes/jsp.png"/>
+      <action id="CreateServletAction" text="_Servlet" class="xcom.intellij.javaee.module.view.web.servlet.CreateServletAction" description="Create new Servlet" icon="/nodes/servlet.png"/>
+      <action id="CreateFilterAction" text="_Filter" class="xcom.intellij.javaee.module.view.web.filter.CreateFilterAction" description="Create new Servlet Filter" icon="/ant/filter.png"/>
+    </group>
+    <group id="GenerateGroup" text="_Generate">
+      <action id="GenerateConstructor" text="Constructor" class="xcom.intellij.codeInsight.generation.actions.GenerateConstructorAction"/>
+      <action id="GenerateGetter" text="Getter" class="xcom.intellij.codeInsight.generation.actions.GenerateGetterAction"/>
+      <action id="GenerateSetter" text="Setter" class="xcom.intellij.codeInsight.generation.actions.GenerateSetterAction"/>
+      <action id="GenerateGetterAndSetter" text="Getter and Setter" class="xcom.intellij.codeInsight.generation.actions.GenerateGetterAndSetterAction"/>
+      <action id="GenerateEquals" text="equals() and hashCode()" class="xcom.intellij.codeInsight.generation.actions.GenerateEqualsAction"/>
+      <action id="OverrideMethods" class="xcom.intellij.codeInsight.generation.actions.OverrideMethodsAction" text="_Override Methods..." description="Override base class methods in the current class"/>
+      <action id="ImplementMethods" class="xcom.intellij.codeInsight.generation.actions.ImplementMethodsAction" text="_Implement Methods..." description="Implement base interface/class methods in the current class"/>
+      <action id="GenerateSuperMethodCall" text="super method call" class="xcom.intellij.codeInsight.generation.actions.GenerateSuperMethodCallAction"/>
+    </group>
+
+    <action id="NextDiff" class="xcom.intellij.openapi.diff.actions.NextDiffAction" text="Move to the next difference" description="Move to the next difference" icon="/actions/moveDown.png"/>
+    <action id="PreviousDiff" class="xcom.intellij.openapi.diff.actions.PreviousDiffAction" text="Move to the previous difference" description="Move to the previous difference" icon="/actions/moveUp.png"/>
+
+    <action id="CheckinProject" class="xcom.intellij.openapi.vcs.actions.CommonCheckinProjectAction" text="Check In Project">
+      <keyboard-shortcut first-keystroke="control K" keymap="$default"/>
+    </action>
+    <action id="CheckinFiles" class="xcom.intellij.openapi.vcs.actions.CommonCheckinFilesAction" text="Check In"/>
+    <action id="UpdateFiles" class="xcom.intellij.openapi.vcs.update.CommonUpdateFileOrDirectoryAction" text="Update"/>
+    <action id="CheckStatusForFiles" class="xcom.intellij.openapi.vcs.update.CommonStatusFileOrDirectoryAction" text="Check Status"/>
+
+    <group id="NewGroup" text="New" popup="true">
+      <action id="NewClass" text="Class" class="xcom.intellij.ide.actions.CreateClassAction"/>
+      <action id="NewInterface" text="Interface" class="xcom.intellij.ide.actions.CreateInterfaceAction"/>
+      <action id="NewEnum" text="Enum" class="xcom.intellij.ide.actions.CreateEnumAction"/>
+      <action id="NewAnnotationType" text="@Interface" class="xcom.intellij.ide.actions.CreateAnnotationTypeAction"/>
+      <action id="NewFile" text="File" class="xcom.intellij.ide.actions.CreateFileAction"/>
+      <action id="NewDir" text="Directory/Package" class="xcom.intellij.ide.actions.CreateDirectoryOrPackageAction"/>
+      <separator/>
+      <action id="NewFromTemplate" text="From Template" class="xcom.intellij.ide.fileTemplates.actions.CreateFromTemplateGroup"/>
+      <separator/>
+      <action id="NewDialog" text="Dialog" class="xcom.intellij.uiDesigner.actions.CreateDialogAction"/>
+      <separator/>
+      <reference ref="J2EEGenerateGroup"/>
+    </group>
+
+    <action id="CompareTwoFiles" class="xcom.intellij.openapi.diff.actions.CompareFiles" text="Compare Two _Files" description="Compare two selected files"/>
+    <action id="CompareFileWithEditor" class="xcom.intellij.openapi.diff.actions.CompareFileWithEditor" text="Co_mpare File with Editor" description="Compare selected file with editor"/>
+
+    <group id="VcsGroups" class="xcom.intellij.openapi.vcs.actions.VcsActionGroup" text="Version Control" popup="true">
+
+      <group class="xcom.intellij.openapi.vcs.actions.VcsActionGroup" id="VcsGlobalGroup" test="Version Control" text="Version Control">
+        <action id="Vcs.FileView" class="xcom.intellij.openapi.vcs.actions.FileViewAction" text="Show File _View" description="Show version control related information for all local files"/>
+        <reference ref="CheckinProject"/>
+        <action id="Vcs.UpdateProject" class="xcom.intellij.openapi.vcs.update.CommonUpdateProjectAction" text="Update Project">
+          <keyboard-shortcut first-keystroke="control T" keymap="$default"/>
+        </action>
+        <action id="Vcs.ProjectStatus" class="xcom.intellij.openapi.vcs.update.CommonStatusProjectAction" text="Check Project Status">
+        </action>
+      </group>
+
+      <separator/>
+      <action id="Vcs.MarkSourcesAsCurrent" class="xcom.intellij.openapi.vcs.actions.MarkSourcesAsCurrent" text="Mark Project as Current" description="Mark sources as up-to-date"/>
+    </group>
+    <group class="xcom.intellij.openapi.vcs.actions.VcsActionGroup" id="VcsGroup" test="Version Control" text="Version Control"/>
+
+    <group id="VssGlobalGroup"
+      class="xcom.intellij.vssSupport.actions.VssGroup"
+      text="SourceSa_fe"
+      test="SourceSafe"
+      popup="true" >
+      <add-to-group group-id="VcsGroups" anchor="last"/>
+      <action id="Vss.RunExplorer" class="xcom.intellij.vssSupport.actions.RunExplorerAction" text="Open SourceSafe _Explorer" description="Open SourceSafe explorer"/>
+    </group>
+
+    <group id="VssFilePopupGroup"
+      class="xcom.intellij.vssSupport.actions.VssGroup"
+      text="SourceSa_fe"
+      test="SourceSafe"
+      popup="true" >
+      <add-to-group group-id="VcsGroup" anchor="last"/>
+    </group>
+
+
+    <group id="VssGroup">
+      <add-to-group group-id="VssGlobalGroup" anchor="last"/>
+      <add-to-group group-id="VssFilePopupGroup" anchor="last"/>
+      <action id="Vss.Checkout" class="xcom.intellij.vssSupport.actions.CheckoutAction" text="Check _Out..." description="Check out the file(s) from SourceSafe database for editing"/>
+      <action id="Vss.Checkin" class="xcom.intellij.vssSupport.actions.CheckinAction" text="Check _In..." description="Update SourceSafe database with changes made to the checked out file(s)"/>
+      <action id="Vss.Add" class="xcom.intellij.vssSupport.actions.AddAction" text="_Add File..." description="Add new file to the SourceSafe database"/>
+      <action id="Vss.Undocheckout" class="xcom.intellij.vssSupport.actions.UndocheckoutAction" text="_Undo Check Out..." description="Cancel a check out, voiding all changes"/>
+      <separator/>
+      <action id="Vss.Diff" class="xcom.intellij.vssSupport.actions.DiffAction"
+        text="_Compare with SourceSafe Version..."
+        description="Compare SourceSafe and local version of file"/>
+
+      <action id="Vss.Get"
+        class="xcom.intellij.vssSupport.actions.GetAction"
+        text="_Get Latest Version..."
+        description="Retrieve the most recent version of the file(s)"/>
+    </group>
+
+    <group class="xcom.intellij.openapi.vcs.actions.VcsGroupsWrapper" id="VcsFileGroupPopup" test="Version Control"
+      text="Version Control" popup="true">
+    </group>
+
+    <group id="VersionControlsGroup">
+      <group id="LocalVcsGroup" class="xcom.intellij.localVcs.actions.LocalVcsGroup" text="Local _History" popup="true">
+        <action id="LocalVcs.ShowHistory" class="xcom.intellij.localVcs.actions.ShowHistoryAction" text="Show _History" description="Show local history"/>
+        <action id="LocalVcs.HistoryForBlock" class="xcom.intellij.localVcs.actions.HistoryForSelectedBlockAction" text="Show History for _Selection" description="Show local history for editor selection"/>
+        <action id="LocalVcs.AddLabel" class="xcom.intellij.localVcs.actions.AddLabelAction" text="Add _Label..." description="Add label"/>
+      </group>
+      <reference ref="VcsFileGroupPopup"/>
+    </group>
+
+    <group id="MainMenu">
+
+      <!-- File  -->
+      <group text="_File" id="FileMenu">
+        <action id="NewProject" class="xcom.intellij.ide.actions.NewProjectAction" text="_New Project..." description="Create a new project"/>
+        <action id="NewModule" class="xcom.intellij.openapi.roots.ui.configuration.actions.NewModuleAction" text="New _Module..." description="Add new module to the project"/>
+        <action id="OpenProject" class="xcom.intellij.ide.actions.OpenProjectAction" text="_Open Project..." description="Open an existing project"/>
+        <action id="OpenFile" class="xcom.intellij.ide.actions.OpenFileAction" text="_Open File..." icon="/actions/menu-open.png" description="Open file in editor"/>
+        <group id="$LRU" class="xcom.intellij.ide.actions.RecentProjectsGroup" text="_Reopen" popup="true" description="List of recently opened projects"/>
+        <action id="CloseProject" class="xcom.intellij.ide.actions.CloseProjectAction" text="Close Pro_ject" description="Close current project"/>
+
+        <separator/>
+        <action id="ShowSettings" class="xcom.intellij.ide.actions.ShowSettingsAction" text="Se_ttings" icon="/general/ideOptions.png" description="Configure application and current project settings"/>
+        <action id="TemplateProjectProperties" class="xcom.intellij.ide.actions.TemplateProjectPropertiesAction" text="Templ_ate Project Settings" description="Configure template settings for all new projects"/>
+        <separator/>
+        <action id="SaveAll" class="xcom.intellij.ide.actions.SaveAllAction" text="_Save All" icon="/actions/menu-saveall.png" description="Save all files and settings"/>
+        <action id="ExportSettings" class="xcom.intellij.ide.actions.ExportSettingsAction" text="_Export Settings..." description="Export global settings"/>
+        <action id="ImportSettings" class="xcom.intellij.ide.actions.ImportSettingsAction" text="_Import Settings..." description="Import global settings"/>
+        <action id="Synchronize" class="xcom.intellij.ide.actions.SynchronizeAction" text="S_ynchronize" icon="/actions/sync.png" description="Detect all externally changed files and reload them from disk"/>
+        <action id="ReloadFromDisk" class="xcom.intellij.ide.actions.ReloadFromDiskAction" text="Reload from Dis_k" description="Reload current file from disk and lose all changes"/>
+        <separator/>
+        <action id="ExportToHTML" class="xcom.intellij.codeEditor.printing.ExportToHTMLAction" text="Export to _HTML..." description="Save file content in HTML format with syntax coloring"/>
+        <action id="Print" class="xcom.intellij.codeEditor.printing.PrintAction" text="_Print..." description="Print file"/>
+        <separator/>
+        <action id="Exit" class="xcom.intellij.ide.actions.ExitAction" text="E_xit" description="Quit IDEA"/>
+      </group>
+
+      <!-- Edit -->
+      <group text="_Edit" id="EditMenu">
+        <action id="$Undo" class="xcom.intellij.ide.actions.UndoAction" text="_Undo" icon="/actions/undo.png" description="Undo last operation"/>
+        <action id="$Redo" class="xcom.intellij.ide.actions.RedoAction" text="_Redo" icon="/actions/redo.png" description="Redo last undone operation"/>
+        <separator/>
+        <group id="CutCopyPasteGroup">
+          <action id="$Cut" class="xcom.intellij.ide.actions.CutAction" text="Cu_t" icon="/actions/menu-cut.png" description="Cut to clipboard"/>
+          <action id="$Copy" class="xcom.intellij.ide.actions.CopyAction" text="_Copy" icon="/actions/copy.png" description="Copy to clipboard"/>
+          <action id="CopyPaths" class="xcom.intellij.ide.actions.CopyPathsAction" text="C_opy Paths" description="Copy paths corresponding to selected files or directories to clipboard"/>
+          <action id="$Paste" class="xcom.intellij.ide.actions.PasteAction" text="_Paste" icon="/actions/menu-paste.png" description="Paste from clipboard"/>
+          <action id="PasteMultiple" class="xcom.intellij.openapi.editor.actions.MultiplePasteAction" text="Past_e..." description="Paste from recent clipboards"/>
+          <reference ref="EditorToggleColumnMode"/>
+        </group>
+        <separator/>
+        <action id="$SelectAll" class="xcom.intellij.ide.actions.SelectAllAction" text="Select _All" description="Select all"/>
+        <separator/>
+        <action id="NewElement" class="xcom.intellij.ide.actions.NewElementAction" text="_New..." description="Create new class, interface, file or directory"/>
+        <action id="$Delete" class="xcom.intellij.ide.actions.DeleteAction" text="_Delete" description="Delete selected item"/>
+        <separator/>
+        <action id="ToggleBookmark" class="xcom.intellij.ide.bookmarks.actions.ToggleBookmarkAction" text="Toggle _Bookmark" description="Toggle bookmark at the current location"/>
+        <action id="ShowBookmarks" class="xcom.intellij.ide.bookmarks.actions.ShowBookmarksAction" text="_Show Bookmarks" description="Show list of all bookmarks"/>
+      </group>
+
+      <!-- Search -->
+      <group text="_Search" id="SearchMenu">
+        <action id="Find" class="xcom.intellij.openapi.editor.actions.FindAction" text="_Find..." icon="/actions/menu-find.png" description="Find a string in active editor"/>
+        <action id="Replace" class="xcom.intellij.openapi.editor.actions.ReplaceAction" text="_Replace..." icon="/actions/menu-replace.png" description="Replace a string in active editor with another string"/>
+        <action id="FindNext" class="xcom.intellij.ide.actions.SearchAgainAction" text="Find _Next" description="Repeat the last Find/Replace operation"/>
+        <action id="FindPrevious" class="xcom.intellij.ide.actions.SearchBackAction" text="Find Pre_vious" description="Repeat the last Find/Replace operation in reverse direction"/>
+        <action id="FindWordAtCaret" class="xcom.intellij.openapi.editor.actions.FindWordAtCaretAction" text="Find _Word at Caret" description="Find next occurrence of the word at caret"/>
+        <action id="IncrementalSearch" class="xcom.intellij.codeInsight.navigation.actions.IncrementalSearchAction" text="Incrementa_l Search" description="Start incremental search (searches string as you type)"/>
+        <separator/>
+        <action id="FindUsages" class="xcom.intellij.find.actions.FindUsagesAction" text="Find _Usages..." description="Find usages of the symbol at caret"/>
+        <action id="FindUsagesInFile" class="xcom.intellij.find.actions.FindUsagesInFileAction" text="F_ind Usages in File..." description="Find usages of the symbol at caret in active editor"/>
+        <action id="HighlightUsagesInFile" class="xcom.intellij.codeInsight.highlighting.actions.HighlightUsagesAction" text="_Highlight Usages in File" description="Highlight usages of the symbol at caret in active editor"/>
+        <separator/>
+        <action id="FindInPath" class="xcom.intellij.find.actions.FindInPathAction" text="Find in _Path..." description="Find a string in multiple files"/>
+        <action id="ReplaceInPath" class="xcom.intellij.find.actions.ReplaceInPathAction" text="Repl_ace in Path..." description="Replace a string in multiple files with another string"/>
+      </group>
+
+      <!-- View -->
+      <group text="_View" id="ViewMenu">
+        <action id="ViewToolBar" class="xcom.intellij.ide.actions.ViewToolbarAction" text="_Toolbar" description="Show/hide the main toolbar"/>
+        <action id="ViewStatusBar" class="xcom.intellij.ide.actions.ViewStatusBarAction" text="_Status Bar" description="Show/hide the status bar"/>
+        <reference ref="EditorToggleShowWhitespaces"/>
+        <reference ref="EditorToggleShowLineNumbers"/>
+        <separator/>
+        <action id="ToggleFullScreenMode" class="xcom.intellij.ide.actions.ToggleFullScreenModeAction" text="F_ull Screen" description="Maximize window to full screen"/>
+        <separator/>
+        <group id="CodeEditorViewGroup" class="xcom.intellij.ide.actions.CodeEditorActionGroup">
+          <action id="FileStructurePopup" class="xcom.intellij.ide.actions.ViewStructureAction" text="_File Structure Popup" description="Popup structure of the current file for quick navigation"/>
+          <action id="SelectIn" class="xcom.intellij.ide.actions.SelectInAction" text="Se_lect In..." description="Select the current class or method in any view"/>
+          <action id="QuickJavaDoc" class="xcom.intellij.codeInsight.javadoc.actions.ShowQuickDocInfoAction" text="_Quick JavaDoc" description="Show a popup window with JavaDoc for the symbol at caret"/>
+          <action id="QuickImplementations" class="xcom.intellij.codeInsight.hint.actions.ShowImplementationsAction" text="Quick _Implementations" description="Show a popup window with the symbol (and its implementations) code"/>
+          <action id="ParameterInfo" class="xcom.intellij.codeInsight.hint.actions.ShowParameterInfoAction" text="_Parameter Info" description="Show parameters of the method call at caret"/>
+          <action id="EditorContextInfo" class="xcom.intellij.codeInsight.hint.actions.ShowContainerInfoAction" text="_Context Info" description="Show the current method or class declaration when it is not visible"/>
+          <action id="ShowErrorDescription" class="xcom.intellij.codeInsight.daemon.impl.actions.ShowErrorDescriptionAction" text="E_rror Description" description="Show description of error or warning at caret"/>
+        </group>
+        <separator/>
+        <group id="CommanderViewGroup" class="xcom.intellij.ide.actions.CommanderViewActionGroup">
+          <action id="CommanderSyncViews" class="xcom.intellij.ide.actions.SyncViewsAction" text="S_ynchronize Views" description="Synchronize both panels"/>
+          <action id="CommanderSwapPanels" class="xcom.intellij.ide.actions.SwapPanelsAction" text="Swap _Panels" description="Swap the panels"/>
+          <reference ref="CompareTwoFiles"/>
+          <reference ref="CompareFileWithEditor"/>
+        </group>
+        <separator/>
+        <group id="ProjectViewGroup" class="xcom.intellij.ide.projectView.actions.ProjectViewActionGroup">
+          <action id="ProjectViewChangeView" class="xcom.intellij.ide.projectView.actions.ChangeProjectViewAction" text="Change View" description="Choose Project, Sourcepath or Classpath tree in the Project View window"/>
+        </group>
+        <separator/>
+        <action id="EditSource" class="xcom.intellij.ide.actions.EditSourceAction" text="_Jump to Source" description="Open editor for the selected item and give focus to it"/>
+        <action id="ViewSource" class="xcom.intellij.ide.actions.ViewSourceAction" text="Sho_w Source" description="Open editor for the selected item"/>
+        <separator/>
+        <action id="ExternalJavaDoc" class="xcom.intellij.ide.actions.ExternalJavaDocAction" text="External Java_Doc" description="Open browser with JavaDoc for the selected item"/>
+        <action id="RecentFiles" class="xcom.intellij.ide.actions.ShowRecentFilesAction" text="Rece_nt Files..." description="Show list of recently edited files"/>
+
+        <action id="QuickChangeScheme" class="xcom.intellij.ide.actions.QuickChangeSchemesAction" text="_Quick Switch Scheme..." description="Change current code style scheme, color&amp;fonts scheme, keymap or Look&amp;Feel"/>
+        <separator/>
+        <action id="TypeHierarchy" class="xcom.intellij.ide.hierarchy.actions.BrowseTypeHierarchyAction" text="Type _Hierarchy" description="Browse hierarchy for the selected class"/>
+        <action id="MethodHierarchy" class="xcom.intellij.ide.hierarchy.actions.BrowseMethodHierarchyAction" text="_Method Hierarchy" description="Browse method hierarchy for the selected method"/>
+        <action id="CallHierarchy" class="xcom.intellij.ide.hierarchy.actions.BrowseCallHierarchyAction" text="Call Hierarch_y" description="Browse call hierarchy for the selected method"/>
+        <separator/>
+        <group id="FoldingGroup" class="xcom.intellij.codeInsight.folding.impl.actions.FoldingGroup" text="Foldin_g" popup="true">
+          <action id="ExpandRegion" class="xcom.intellij.codeInsight.folding.impl.actions.ExpandRegionAction" text="E_xpand" description="Expand folding region at caret"/>
+          <action id="CollapseRegion" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseRegionAction" text="_Collapse" description="Collapse folding region at caret"/>
+          <separator/>
+          <action id="ExpandAllRegions" class="xcom.intellij.codeInsight.folding.impl.actions.ExpandAllRegionsAction" text="_Expand All" description="Expand all folding regions"/>
+          <action id="CollapseAllRegions" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseAllRegionsAction" text="Collapse _All" description="Collapse all folding regions"/>
+          <separator/>
+          <action id="ExpandJavadocs" class="xcom.intellij.codeInsight.folding.impl.actions.ExpandJavadocsAction" text="Expand Java_docs" description="Expand all javadoc comments"/>
+          <action id="CollapseJavadocs" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseJavadocsAction" text="Collapse _Javadocs" description="Collapse all javadoc comments"/>
+          <separator/>
+          <action id="CollapseSelection" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseSelectionAction" text="Fold _Selection / Remove region" description="Fold selected block"/>
+          <action id="CollapseBlock" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseBlockAction" text="Fold Code Block" description="Fold current code block"/>
+        </group>
+      </group>
+
+      <!-- Go to -->
+      <group text="_Go To" id="GoToMenu">
+        <action id="GotoClass" class="xcom.intellij.ide.actions.GotoClassAction" text="_Class..." description="Quickly navigate to a class by name"/>
+        <action id="GotoFile" class="xcom.intellij.ide.actions.GotoFileAction" text="_File..." description="Quickly navigate to a file by name"/>
+        <action id="GotoSymbol" class="xcom.intellij.ide.actions.GotoSymbolAction" text="_Symbol..." description="Quickly navigate to any symbol by name"/>
+        <action id="GotoLine" class="xcom.intellij.ide.actions.GotoLineAction" text="_Line..." description="Navigate to a line in editor by its number"/>
+        <separator/>
+        <action id="GotoDeclaration" class="xcom.intellij.codeInsight.navigation.actions.GotoDeclarationAction" text="_Declaration" description="Navigate to the declaration of the symbol at caret"/>
+        <action id="GotoDefinition" class="xcom.intellij.codeInsight.navigation.actions.GotoDefinitionAction" text="_Definition" description="Navigate to the definitions of the current value"/>
+        <action id="GotoUsage" class="xcom.intellij.codeInsight.navigation.actions.GotoUsageAction" text="_Usage" description="Navigate to the usages of the current value"/>
+        <action id="GotoImplementation" class="xcom.intellij.codeInsight.navigation.actions.GotoImplementationAction" text="I_mplementation(s)" description="Navigate to the implementation(s) of the selected class or method"/>
+        <action id="SmartGotoImplementation" class="xcom.intellij.codeInsight.navigation.actions.SmartGotoImplementationAction" text="_Called Implementation(s)" description="Navigate to the implementation(s) of the selected method"/>
+        <action id="GotoTypeDeclaration" class="xcom.intellij.codeInsight.navigation.actions.GotoTypeDeclarationAction" text="_Type Declaration" description="Navigate to the declaration of the symbol's type at caret"/>
+        <action id="GotoSuperMethod" class="xcom.intellij.codeInsight.navigation.actions.GotoSuperAction" text="S_uper Method" description="Navigate to the declaration of the method that current method overrides or implements"/>
+        <action id="GotoAspect" class="xcom.intellij.codeInsight.navigation.actions.GotoAspectAction" text="_Aspect" description="Navigate to the declaration of the advice, error or warning declaration that affects a join point at caret"/>
+        <separator/>
+        <action id="GotoNextError" class="xcom.intellij.codeInsight.daemon.impl.actions.GotoNextErrorAction" text="_Next Highlighted Error" description="Navigate to the next highlighted error in the active editor"/>
+        <action id="GotoPreviousError" class="xcom.intellij.codeInsight.daemon.impl.actions.GotoPreviousErrorAction" text="_Previous Highlighted Error" description="Navigate to the previous highlighted error in the active editor"/>
+        <separator/>
+        <action id="MethodDown" class="xcom.intellij.codeInsight.navigation.actions.MethodDownAction" text="N_ext Method" description="Navigate to the next method in the active editor"/>
+
+
+        <action id="MethodUp" class="xcom.intellij.codeInsight.navigation.actions.MethodUpAction" text="Prev_ious Method" description="Navigate to the previous method in the active editor"/>
+        <separator/>
+        <action id="GotoNextBookmark" class="xcom.intellij.ide.bookmarks.actions.NextBookmarkAction" text="Ne_xt Bookmark" description="Navigate to the next bookmark in the active editor"/>
+        <action id="GotoPreviousBookmark" class="xcom.intellij.ide.bookmarks.actions.PreviousBookmarkAction" text="P_revious Bookmark" description="Navigate to the previous bookmark in the active editor"/>
+        <separator/>
+        <action id="Back" class="xcom.intellij.ide.actions.BackAction" text="_Back" icon="/actions/back.png" description="Undo last navigation operation"/>
+        <action id="Forward" class="xcom.intellij.ide.actions.ForwardAction" text="For_ward" icon="/actions/forward.png" description="Redo last undone navigation operation"/>
+        <action id="JumpToLastChange" class="xcom.intellij.ide.actions.JumpToLastEditAction" text="La_st Edit Location" description="Move through the most recent change points"/>
+        <separator/>
+        <action id="PreviousOccurence" class="xcom.intellij.ide.actions.PreviousOccurenceAction" text="Previ_ous Occurrence" icon="/actions/previousOccurence.png" description="Navigate to the previous occurrence"/>
+        <action id="NextOccurence" class="xcom.intellij.ide.actions.NextOccurenceAction" text="Ne_xt Occurrence" icon="/actions/nextOccurence.png" description="Navigate to the next occurrence"/>
+        <separator/>
+        <action id="VcsShowNextChangeMarker" class="xcom.intellij.openapi.vcs.actions.ShowNextChangeMarkerAction" text="Go To Next Change" description="Next change" icon="/actions/nextOccurence.png"/>
+        <action id="VcsShowPrevChangeMarker" class="xcom.intellij.openapi.vcs.actions.ShowPrevChangeMarkerAction" text="Go To Prev Change" description="Prev change" icon="/actions/previousOccurence.png"/>
+      </group>
+
+      <!--  Code  -->
+      <group id="CodeMenu" class="xcom.intellij.codeInsight.actions.CodeGroup" text="Co_de">
+        <reference ref="OverrideMethods"/>
+        <reference ref="ImplementMethods"/>
+        <action id="DelegateMethod" class="xcom.intellij.codeInsight.generation.actions.GenerateDelegateAction" text="_Delegate Methods..." description="Generate delegate method to a field/getter"/>
+        <separator/>
+        <action id="SurroundWith" class="xcom.intellij.codeInsight.generation.actions.SurroundWithAction" text="_Surround With..." description="Surround selected code fragment with if, while, try/catch or other construct"/>
+        <!-- Alt-Ins in Java code-->
+        <action id="Generate" text="_Generate..." description="Generate constructor, getter or setter method, or EJB components" class="xcom.intellij.codeInsight.generation.actions.GenerateAction"/>
+        <separator/>
+        <group id="CodeCompletionGroup" class="xcom.intellij.codeInsight.completion.actions.CodeCompletionGroup" text="_Complete Code" popup="true">
+          <action id="CodeCompletion" class="xcom.intellij.codeInsight.completion.actions.CodeCompletionAction" text="Basic" description="Complete code"/>
+          <action id="WordCompletion" class="xcom.intellij.codeInsight.completion.actions.WordCompletionAction" text="Complete Word" description="Complete word"/>
+          <action id="SmartTypeCompletion" class="xcom.intellij.codeInsight.completion.actions.SmartCodeCompletionAction" text="SmartType" description="Complete code basing on expected type"/>
+          <action id="ClassNameCompletion" class="xcom.intellij.codeInsight.completion.actions.ClassNameCompletionAction" text="Class Name" description="Complete class name and add import for it"/>
+        </group>
+        <separator/>
+        <action id="InsertLiveTemplate" class="xcom.intellij.codeInsight.template.impl.actions.ListTemplatesAction" text="Insert Live _Template..." description="Show popup list of live templates starting with the specified prefix"/>
+        <action id="SurroundWithLiveTemplate" class="xcom.intellij.codeInsight.template.impl.actions.SurroundWithTemplateAction" text="Surround with Live Tem_plate..." description="Surrounds the selection with one of the template"/>
+        <separator/>
+        <action id="CommentByLineComment" class="xcom.intellij.codeInsight.generation.actions.CommentByLineCommentAction" text="Comment with _Line Comment" description="Comment/uncomment current line or selected block with line comments"/>
+        <action id="CommentByBlockComment" class="xcom.intellij.codeInsight.generation.actions.CommentByBlockCommentAction" text="Comment with _Block Comment" description="Comment/uncomment code with block comments"/>
+        <action id="AutoIndentLines" class="xcom.intellij.codeInsight.generation.actions.AutoIndentLinesAction" text="_Auto-Indent Lines" description="Indent current line or selected block according to the code style settings"/>
+      </group>
+
+      <group id="AnalyzeMenu" text="Analy_ze" popup="true">
+        <action id="InspectCode" class="xcom.intellij.codeInspection.actions.CodeInspectionAction" text="_Inspect Code..." description="Inspect code"/>
+        <action id="ViewOfflineInspection" class="xcom.intellij.codeInspection.actions.ViewOfflineResultsAction" text="View _Offline Inspection Results..." description="Load offline inspection results"/>
+        <action id="ShowPackageDeps" class="xcom.intellij.packageDependencies.actions.AnalyzeDependenciesAction" text="Analyze _Dependencies..." description="Browse code choosen analysis item depends on" />
+        <action id="DupLocate" class="xcom.intellij.dupLocator.DuplocateAction" text="_Locate Duplicates..." description="Locate duplicate code in project" />
+      </group>
+
+      <!-- Refactor -->
+      <group id="RefactoringMenu" class="xcom.intellij.refactoring.actions.RefactoringGroup" text="_Refactor" popup="true">
+        <action id="RenameElement" class="xcom.intellij.refactoring.actions.RenameElementAction" text="_Rename..." description="Rename the selected symbol and correct all references"/>
+        <action id="ChangeSignature" class="xcom.intellij.refactoring.actions.ChangeSignatureAction" text="Change _Signature..." description="Change signature of the selected method or class and correct all references"/>
+        <action id="MakeMethodStatic" class="xcom.intellij.refactoring.actions.MakeStaticAction" text="Make Method S_tatic..." description="Convert method to static and correct all references"/>
+        <action id="ConvertToInstanceMethod" class="xcom.intellij.refactoring.actions.ConvertToInstanceMethodAction" text="C_onvert To Instance Method..." description="Convert static method to instance method and correct all references"/>
+        <separator/>
+        <action id="Move" class="xcom.intellij.refactoring.actions.MoveAction" text="_Move..." description="Move the selected class, package or static member to another package or class and correct all references"/>
+        <action id="CopyElement" class="xcom.intellij.ide.actions.CopyElementAction" text="C_opy..." description="Create a copy of the selected class, file(s) or directory(es)"/>
+        <action id="CloneElement" class="xcom.intellij.ide.actions.CloneElementAction" text="Clo_ne..." description="Create a copy of the selected class, file or directory in the same package/directory"/>
+        <action id="SafeDelete" class="xcom.intellij.refactoring.actions.SafeDeleteAction" text="Safe _Delete..." description="Delete the selected class, method or field, checking for usages"/>
+        <separator/>
+        <action id="ExtractMethod" class="xcom.intellij.refactoring.actions.ExtractMethodAction" text="E_xtract Method..." description="Turn the selected code fragment into a method"/>
+        <action id="MethodDuplicates" class="xcom.intellij.refactoring.actions.MethodDuplicatesAction" text="Replace Method Code Duplicates..." description="Finds code in current file that can be transformed into a call of selected method"/>
+        <action id="IntroduceVariable" class="xcom.intellij.refactoring.actions.IntroduceVariableAction" text="Introduce _Variable..." description="Put a result of the selected expression into a variable"/>
+        <action id="IntroduceField" class="xcom.intellij.refactoring.actions.IntroduceFieldAction" text="Introduce _Field..." description="Put a result of the selected expression into a field"/>
+        <action id="IntroduceConstant" class="xcom.intellij.refactoring.actions.IntroduceConstantAction" text="Introduce _Constant..." description="Replace selected expression with a constant (static final field)"/>
+        <action id="IntroduceParameter" class="xcom.intellij.refactoring.actions.IntroduceParameterAction" text="Introduce _Parameter..." description="Turn the selected expression into method parameter"/>
+        <separator/>
+        <action id="ExtractModule" class="xcom.intellij.refactoring.actions.ExtractModuleAction" text="Extract _Interface..." description="Extract interface from the selected class"/>
+        <action id="ExtractSuperclass" class="xcom.intellij.refactoring.actions.ExtractSuperclassAction" text="Extract S_uperclass..." description="Extract superclass from the selected class"/>
+        <action id="TurnRefsToSuper" class="xcom.intellij.refactoring.actions.TurnRefsToSuperAction" text="Use Interface _Where Possible..." description="Change usages of a class to those of its superclass or interface"/>
+        <action id="MembersPullUp" class="xcom.intellij.refactoring.actions.PullUpAction" text="Pu_ll Members Up..." description="Pull class members to superclass or implemented interface"/>
+        <action id="MemberPushDown" class="xcom.intellij.refactoring.actions.PushDownAction" text="Pus_h Members Down..." description="Push class members down to directly inheriting subclasses"/>
+        <action id="InheritanceToDelegation" class="xcom.intellij.refactoring.actions.InheritanceToDelegationAction" text="Replace Inheritance with Dele_gation..." description="Replace inheritance with delegation"/>
+        <separator/>
+        <action id="Inline" class="xcom.intellij.refactoring.actions.InlineAction" text="Inli_ne..." description="Inline the selected method or variable"/>
+        <action id="AnonymousToInner" class="xcom.intellij.refactoring.actions.AnonymousToInnerAction" text="Convert Anon_ymous to Inner..." description="Convert anonymous class into an inner class"/>
+        <action id="EncapsulateFields" class="xcom.intellij.refactoring.actions.EncapsulateFieldsAction" text="_Encapsulate Fields..." description="Replace direct access to fields in the selected class with use of accessor methods"/>
+        <action id="ReplaceTempWithQuery" class="xcom.intellij.refactoring.actions.TempWithQueryAction" text="Replace Temp with _Query..." description="Turn the selected variable into a method"/>
+        <action id="ReplaceConstructorWithFactory" class="xcom.intellij.refactoring.actions.ReplaceConstructorWithFactoryAction" text="Replace Constructor with F_actory Method..." description="Create a static factory method and use it instead of a constructor"/>
+        <separator/>
+        <action id="Generify" class="xcom.intellij.refactoring.actions.TypeCookAction" text="Generify..." description="Convert your code to use generic types"/>
+        <action id="Type Migration" class="xcom.intellij.refactoring.actions.TypeMigrationAction" text="Type Migration..." description="Migrate one type to another"/>
+        <separator/>
+        <action id="ExtractInclude" class="xcom.intellij.refactoring.actions.ExtractIncludeAction" text="Extract Include File..." description="Turn the selected code fragment into included file"/>
+      </group>
+
+      <!-- Build -->
+      <group text="_Build" id="BuildMenu">
+        <action id="CompileProject" class="xcom.intellij.compiler.actions.CompileProjectAction" text="_Rebuild Project" description="Recompile all files in the project"/>
+        <action id="CompileDirty" class="xcom.intellij.compiler.actions.CompileDirtyAction" text="Make _Project" icon="/actions/compile.png" description="Compile all modified and dependent files in the project"/>
+        <action id="MakeModule" class="xcom.intellij.compiler.actions.MakeModuleAction" text="Make _Module" description="Compile all modified and dependent files in the module"/>
+        <action id="Compile" class="xcom.intellij.compiler.actions.CompileAction" text="_Compile" description="Compile the selected file or package"/>
+        <separator/>
+        <action id="GenerateAntBuild" class="xcom.intellij.compiler.actions.GenerateAntBuildAction" text="_Generate Ant Build" description="Generate Ant Build File from the Project"/>
+        <separator/>
+        <group id="AntBuildGroup" class="xcom.intellij.ant.actions.AntBuildGroup"/>
+      </group>
+
+
+      <group text="R_un" id="RunMenu">
+        <group id="RunnerActions" text="Run/Debug" />
+        <action id="editRunConfigurations" text="Edit Configurations" class="xcom.intellij.execution.actions.EditRunConfigurationsAction" description="Open edit Run/Debug configurations dialog"/>
+        <action id="Stop" text="Stop" class="xcom.intellij.execution.actions.StopAction" description="Stop process" icon="/actions/suspend.png"/>
+        <action id="Hotswap" class="xcom.intellij.debugger.actions.HotSwapAction" text="_Reload Changed Classes" description="Reload all changed classes into application being debugged (HotSwap)"/>
+        <separator/>
+        <action id="StepOver" class="xcom.intellij.debugger.actions.StepOverAction" text="Step _Over" icon="/actions/traceOver.png" description="Step to the next line in this file"/>
+        <action id="StepInto" class="xcom.intellij.debugger.actions.StepIntoAction" text="Step _Into" icon="/actions/traceInto.png" description="Step to the next line executed"/>
+        <action id="StepOut" class="xcom.intellij.debugger.actions.StepOutAction" text="Step Ou_t" icon="/actions/stepOut.png" description="Step to the first line executed after returning from this method"/>
+        <action id="ForceStepOver" class="xcom.intellij.debugger.actions.ForceStepOverAction" text="Fo_rce Step Over" icon="/actions/traceOver.png" description="Step over, disable all breakpoints before stepping."/>
+        <action id="ForceStepInto" class="xcom.intellij.debugger.actions.ForceStepIntoAction" text="Fo_rce Step Into" icon="/actions/forceStepInto.png" description="Step into, ignore stepping filters for libraries, constructors, etc."/>
+        <action id="RunToCursor" class="xcom.intellij.debugger.actions.RunToCursorAction" text="Run to _Cursor" icon="/actions/runToCursor.png" description="Run to the line where the caret is"/>
+        <action id="ForceRunToCursor" class="xcom.intellij.debugger.actions.ForceRunToCursorAction" text="Force Run to C_ursor" description="Run to the line where the caret is, ignoring any breakpoints"/>
+        <action id="Debugger.PopFrame" class="xcom.intellij.debugger.actions.PopFrameAction" text="Pop Frame" icon="/actions/popFrame.png" description="Moves execution point back to the method call dropping current method frames from the stack"/>
+        <action id="Pause" class="xcom.intellij.debugger.actions.PauseAction" text="_Pause Program" icon="/actions/pause.png" description="Suspend program execution and enable debugging"/>
+        <action id="Resume" class="xcom.intellij.debugger.actions.ResumeAction" text="Resume Pro_gram" icon="/actions/resume.png" description="Resume program execution"/>
+        <separator/>
+        <action id="EvaluateExpression" class="xcom.intellij.debugger.actions.EvaluateAction" text="_Evaluate Expression..." icon="/debugger/evaluateExpression.png" description="Evaluate arbitrary expression"/>
+        <action id="QuickEvaluateExpression" class="xcom.intellij.debugger.actions.QuickEvaluateAction" text="_Quick Evaluate Expression" description="Evaluate selected expression"/>
+        <action id="ShowExecutionPoint" class="xcom.intellij.debugger.actions.ShowExecutionPointAction" text="Show E_xecution Point" icon="/debugger/showCurrentFrame.png" description="Show the current program execution point"/>
+        <separator/>
+        <action id="ToggleLineBreakpoint" class="xcom.intellij.debugger.actions.ToggleLineBreakpointAction" text="Toggle  _Line Breakpoint" description="Toggle line breakpoint at caret"/>
+        <action id="ToggleMethodBreakpoint" class="xcom.intellij.debugger.actions.ToggleMethodBreakpointAction" text="Toggle  _Method Breakpoint" description="Toggle method breakpoint for the method at caret"/>
+        <action id="ToggleFieldBreakpoint" class="xcom.intellij.debugger.actions.ToggleFieldBreakpointAction" text="Toggle  _Field Watchpoint" description="Toggle field watchpoint for the field at caret"/>
+        <action id="ToggleBreakpointEnabled" class="xcom.intellij.debugger.actions.ToggleBreakpointEnabledAction" text="Toggle Breakpoint Enabled" icon="/actions/toggleBreakpoint.png" description="Enable/disable breakpoint at the current line"/>
+        <action id="ViewBreakpoints" class="xcom.intellij.debugger.actions.ViewBreakpointsAction" text="_View Breakpoints" icon="/debugger/viewBreakpoints.png" description="View and manage all breakpoints and watchpoints"/>
+        <separator/>
+        <action id="ExportThreads" class="xcom.intellij.debugger.actions.ExportThreadsAction" text="Export T_hreads..." description="Save all threads information to a text file or clipboard"/>
+      </group>
+
+      <!-- Tools -->
+      <group text="_Tools" id="ToolsMenu" configurable="true">
+        <action id="ReformatCode" class="xcom.intellij.codeInsight.actions.ReformatCodeAction" text="_Reformat Code..." description="Reformat code"/>
+        <action id="OptimizeImports" class="xcom.intellij.codeInsight.actions.OptimizeImportsAction" text="_Optimize Imports..." description="Remove unused imports and reorder/reorganize imports"/>
+        <action id="SaveAsTemplate" class="xcom.intellij.codeInsight.template.actions.SaveAsTemplateAction" text="Save as L_ive Template..." description="Save the selected text as live template"/>
+        <action id="SaveFileAsTemplate" class="xcom.intellij.ide.actions.SaveFileAsTemplateAction" text="Save File as Temp_late..." description="Save current file as template"/>
+        <action id="GenerateJavadoc" class="xcom.intellij.javadoc.actions.GenerateJavadocAction" text="Generate Java_Doc..." description="Run the JavaDoc tool"/>
+        <separator/>
+        <group id="Macros" text="_Macros" description="View, Change, Record, Play Macros" popup="true">
+          <group id="StanardMacroActions">
+            <action id="PlaybackLastMacro" class="xcom.intellij.ide.actionMacro.actions.PlaybackLastMacroAction" text="Playback _Last Macro" description="Playback last used macro"/>
+            <action id="StartStopMacroRecording" class="xcom.intellij.ide.actionMacro.actions.StartStopMacroRecordingAction" text="Start/Stop Macro _Recording" description="Start/Stop recording of a new macro"/>
+            <action id="EditMacros" class="xcom.intellij.ide.actionMacro.actions.EditMacrosAction" text="_Edit Macros..." description="Configure existing macros"/>
+          </group>
+          <separator/>
+          <group id="PlaySavedMacroActions" class="xcom.intellij.ide.actionMacro.actions.MacrosGroup"/>
+        </group>
+        <separator/>
+        <action id="Migrate" class="xcom.intellij.refactoring.actions.MigrateAction" text="Mi_grate..." description="Open migration dialog"/>
+        <separator/>
+        <group>
+          <action id="ValidateXml" class="xcom.intellij.xml.actions.ValidateXmlAction" text="_Validate" description="Validate the current xml file"/>
+          <action id="AddAntBuildFile" class="xcom.intellij.ant.actions.AddAntBuildFile" text="Add as Ant Build File" description="Add current XML file to the list of project's Ant build files"/>
+        </group>
+        <separator/>
+        <reference ref="LocalVcsGroup"/>
+        <separator/>
+        <action id="GenerateDTD" class="xcom.intellij.codeInsight.actions.GenerateDTDAction" text="Generate DTD from XML file"/>
+
+        <separator/>
+        <group id="ExternalToolsGroup" text="External Tools" class="xcom.intellij.tools.ExternalToolsGroup"/>
+        <separator/>
+        <action id="DataSources" class="xcom.intellij.javaee.dataSource.DataSourcesManagementAction" text="Data Sources..." description="Manage JDBC Data Sources"/>
+        <separator/>
+
+        <group text="Unscramble" popup="true">
+          <action id="Unscramble" class="xcom.intellij.unscramble.UnscrambleAction" text="_Unscramble Stacktrace..."/>
+          <action id="UnscrambleFromClipboard" class="xcom.intellij.unscramble.UnscrambleFromClipboardAction" text="Unscramble Stacktrace From Clipboard..."/>
+        </group>
+
+        <group text="Internal Actions" internal="true" popup="true">
+          <action id="PsiViewer" internal="true" class="xcom.intellij.internal.psiView.PsiViewerAction" text="View PSI Structure"/>
+          <action id="DebugListen" internal="true" class="xcom.intellij.debugger.actions.ThrowDebugExceptionAction" text="Throw Debug Exception"/>
+          <action id="VirtualFileInfo" internal="true" class="xcom.intellij.openapi.vfs.impl.local.VirtualFileInfoAction" text="Virtual File Info"/>
+          <action id="Merge3Files" internal="true" class="xcom.intellij.openapi.diff.actions.MergeFilesAction" text="Merge"/>
+<!--
+<action class="xcom.intellij.localVcs.CheckFileContentProviderAction" id="CheckFileContentProvider" text="Check File Content Provider"></action>
+-->
+          <separator/>
+          <group text="Memory Management" id="MemoryManagement" popup="true">
+            <action id="ScanRefs" internal="true" class="xcom.intellij.internal.scanReferences.actions.ScanRefsAction" text="Scan Refs..."/>
+            <action id="ScanRefsByList" internal="true" class="xcom.intellij.internal.scanReferences.actions.ScanRefsByListAction" text="Scan Refs by List"/>
+            <action id="PrintRefsDump" internal="true" class="xcom.intellij.internal.scanReferences.actions.PrintRefsDumpAction" text="Print Refs Dump"/>
+            <action id="ClearDocumentHistory" internal="true" class="xcom.intellij.internal.scanReferences.actions.ClearDocumentHistoryAction" text="Clear Undo Queue"/>
+            <action id="SaveDump" internal="true" class="xcom.intellij.internal.saveDump.SaveDumpAction" text="Save Dump" description=""/>
+            <action id="DumpPsiMemoryCaches" internal="true" class="xcom.intellij.psi.impl.DumpPsiMemoryCaches" text="Dump what is cached in PSI"/>
+            <action id="AllocationsHistoryAction" internal="true" class="xcom.intellij.internal.scanReferences.allocations.ShowAllocationsAction" text="View Allocations History"/>
+          </group>
+          <action internal="true" id="DecodeBytesAction" class="xcom.intellij.internal.encodings.DecodeBytesAction" text="Decode Bytes"/>
+          <separator/>
+          <action id="LocalVcs.ShowStatistics" class="xcom.intellij.localVcs.actions.ShowStatistics" text="Show Local VCS Statistics..." description="Show Local VCS statistics" internal="true"/>
+          <action id="LocalVcs.ShowRepHistory" class="xcom.intellij.localVcs.actions.PringRepositoryHistoryAction" text="Repository History" internal="true"/>
+          <separator/>
+          <action id="Compile2" class="xcom.intellij.intellijac.CompileAction" te