Merge remote-tracking branch 'origin/master'
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Mon, 22 Dec 2014 18:34:36 +0000 (19:34 +0100)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Mon, 22 Dec 2014 18:34:36 +0000 (19:34 +0100)
174 files changed:
build/scripts/utils.gant
images/src/org/intellij/images/thumbnail/actions/EnterAction.java
java/java-psi-api/src/com/intellij/psi/augment/PsiAugmentProvider.java
java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiFacadeImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/PsiElementFinderImpl.java [new file with mode: 0644]
jps/jps-builders/src/org/jetbrains/jps/javac/JavacMain.java
platform/core-api/src/com/intellij/openapi/project/DumbService.java
platform/core-impl/src/com/intellij/mock/MockDumbService.java
platform/icons/src/javaee/JavaeeAppModule.png [changed mode: 0644->0755]
platform/icons/src/javaee/JavaeeAppModule@2x.png [new file with mode: 0755]
platform/icons/src/javaee/JavaeeAppModule@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/JavaeeAppModule_dark.png [new file with mode: 0755]
platform/icons/src/javaee/WebService.png [changed mode: 0644->0755]
platform/icons/src/javaee/WebService2.png [new file with mode: 0755]
platform/icons/src/javaee/WebService2@2x.png [new file with mode: 0755]
platform/icons/src/javaee/WebService2@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/WebService@2x.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient.png [changed mode: 0644->0755]
platform/icons/src/javaee/WebServiceClient2.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient2@2x.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient2@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient2_dark.png [new file with mode: 0755]
platform/icons/src/javaee/WebServiceClient@2x.png [new file with mode: 0755]
platform/icons/src/javaee/WebService_dark.png [new file with mode: 0755]
platform/icons/src/javaee/application_xml.png [changed mode: 0644->0755]
platform/icons/src/javaee/application_xml@2x.png [new file with mode: 0755]
platform/icons/src/javaee/application_xml@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/application_xml_dark.png [new file with mode: 0755]
platform/icons/src/javaee/buildOnFrameDeactivation.png [changed mode: 0644->0755]
platform/icons/src/javaee/dataSourceImport.png [changed mode: 0644->0755]
platform/icons/src/javaee/dataSourceImport@2x.png [new file with mode: 0755]
platform/icons/src/javaee/databaseSchemaImportLegend.png [changed mode: 0644->0755]
platform/icons/src/javaee/dbSchemaImportBig.png [changed mode: 0644->0755]
platform/icons/src/javaee/dbSchemaImportBig@2x.png [new file with mode: 0755]
platform/icons/src/javaee/ejb-jar_xml.png [changed mode: 0644->0755]
platform/icons/src/javaee/ejb-jar_xml@2x.png [new file with mode: 0755]
platform/icons/src/javaee/ejbClass.png [changed mode: 0644->0755]
platform/icons/src/javaee/ejbClass@2x.png [new file with mode: 0755]
platform/icons/src/javaee/ejbModule.png [changed mode: 0644->0755]
platform/icons/src/javaee/ejbModule@2x.png [new file with mode: 0755]
platform/icons/src/javaee/embeddedAttributeOverlay.png [changed mode: 0644->0755]
platform/icons/src/javaee/embeddedAttributeOverlay@2x.png [new file with mode: 0755]
platform/icons/src/javaee/embeddedAttributeOverlay@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/embeddedAttributeOverlay_dark.png [new file with mode: 0755]
platform/icons/src/javaee/entityBean.png [changed mode: 0644->0755]
platform/icons/src/javaee/entityBean@2x.png [new file with mode: 0755]
platform/icons/src/javaee/entityBean@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/entityBeanBig.png [changed mode: 0644->0755]
platform/icons/src/javaee/entityBeanBig@2x.png [new file with mode: 0755]
platform/icons/src/javaee/entityBeanBig@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/entityBeanBig_dark.png [new file with mode: 0755]
platform/icons/src/javaee/entityBean_dark.png [new file with mode: 0755]
platform/icons/src/javaee/home.png [changed mode: 0644->0755]
platform/icons/src/javaee/home@2x.png [new file with mode: 0755]
platform/icons/src/javaee/inheritedAttributeOverlay.png [changed mode: 0644->0755]
platform/icons/src/javaee/inheritedAttributeOverlay@2x.png [new file with mode: 0755]
platform/icons/src/javaee/inheritedAttributeOverlay@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/inheritedAttributeOverlay_dark.png [new file with mode: 0755]
platform/icons/src/javaee/interceptorClass.png [changed mode: 0644->0755]
platform/icons/src/javaee/interceptorClass@2x.png [new file with mode: 0755]
platform/icons/src/javaee/interceptorMethod.png [changed mode: 0644->0755]
platform/icons/src/javaee/interceptorMethod@2x.png [new file with mode: 0755]
platform/icons/src/javaee/jpaFacet.png [changed mode: 0644->0755]
platform/icons/src/javaee/jpaFacet@2x.png [new file with mode: 0755]
platform/icons/src/javaee/local.png [changed mode: 0644->0755]
platform/icons/src/javaee/local@2x.png [new file with mode: 0755]
platform/icons/src/javaee/local@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/localHome.png [changed mode: 0644->0755]
platform/icons/src/javaee/localHome@2x.png [new file with mode: 0755]
platform/icons/src/javaee/localHome@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/localHome_dark.png [new file with mode: 0755]
platform/icons/src/javaee/local_dark.png [new file with mode: 0755]
platform/icons/src/javaee/messageBean.png [changed mode: 0644->0755]
platform/icons/src/javaee/messageBean@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceAttribute.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceAttribute@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEmbeddable.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceEmbeddable@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEmbeddable@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEmbeddable_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEntity.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceEntity@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEntity@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEntityListener.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceEntityListener@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceEntity_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceId.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceId@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceId@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceIdRelationship.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceIdRelationship@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceIdRelationship@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceIdRelationship_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceId_dark.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceMappedSuperclass.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceMappedSuperclass@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceRelationship.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceRelationship@2x.png [new file with mode: 0755]
platform/icons/src/javaee/persistenceUnit.png [changed mode: 0644->0755]
platform/icons/src/javaee/persistenceUnit@2x.png [new file with mode: 0755]
platform/icons/src/javaee/remote.png [changed mode: 0644->0755]
platform/icons/src/javaee/remote@2x.png [new file with mode: 0755]
platform/icons/src/javaee/remote@2x_dark.png [new file with mode: 0755]
platform/icons/src/javaee/remote_dark.png [new file with mode: 0755]
platform/icons/src/javaee/sessionBean.png [changed mode: 0644->0755]
platform/icons/src/javaee/sessionBean@2x.png [new file with mode: 0755]
platform/icons/src/javaee/updateRunningApplication.png [changed mode: 0644->0755]
platform/icons/src/javaee/updateRunningApplication@2x.png [changed mode: 0644->0755]
platform/icons/src/javaee/webModule.png [changed mode: 0644->0755]
platform/icons/src/javaee/webModule@2x.png [new file with mode: 0755]
platform/icons/src/javaee/webModuleGroup.png [changed mode: 0644->0755]
platform/icons/src/javaee/webModuleGroup@2x.png [new file with mode: 0755]
platform/icons/src/javaee/web_xml.png [changed mode: 0644->0755]
platform/icons/src/javaee/web_xml@2x.png [changed mode: 0644->0755]
platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java
platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java
platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java
platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoTypeDeclarationAction.java
platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java
platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.form
platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java
platform/platform-api/src/com/intellij/openapi/ui/Messages.java
platform/platform-api/src/com/intellij/ui/MessageException.java [moved from platform/platform-impl/src/com/intellij/ui/mac/MacMessageException.java with 82% similarity]
platform/platform-impl/src/com/intellij/ide/actions/ToggleDistractionFreeModeAction.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java
platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java
platform/platform-impl/src/com/intellij/util/ui/ReloadableComboBoxPanel.form [new file with mode: 0644]
platform/platform-impl/src/com/intellij/util/ui/ReloadableComboBoxPanel.java [new file with mode: 0644]
platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewManagerTest.java [new file with mode: 0644]
platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java
platform/util/src/com/intellij/icons/AllIcons.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy JUnit SetUp Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy JUnit TearDown Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy JUnit Test Case.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy JUnit Test Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Groovy New Method Body.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Spock Test Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Spock cleanup Method.groovy.html
plugins/groovy/groovy-psi/resources/fileTemplates/code/Spock_SetUp_Method.groovy.html
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/groovydoc/lexer/GroovyDocLexer.java
plugins/groovy/test/org/jetbrains/plugins/groovy/GroovyActionsTest.groovy
plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java
plugins/hg4idea/src/org/zmlx/hg4idea/branch/HgBranchPopup.java
plugins/hg4idea/src/org/zmlx/hg4idea/branch/HgBranchPopupActions.java
plugins/hg4idea/src/org/zmlx/hg4idea/command/HgCommitCommand.java
plugins/hg4idea/src/org/zmlx/hg4idea/command/HgUpdateCommand.java
plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java
plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCloseBranchExecutor.java [new file with mode: 0644]
plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java
plugins/junit/src/fileTemplates/code/JUnit3 SetUp Method.java.html
plugins/junit/src/fileTemplates/code/JUnit3 TearDown Method.java.html
plugins/junit/src/fileTemplates/code/JUnit3 Test Class.java.html
plugins/junit/src/fileTemplates/code/JUnit3 Test Method.java.html
plugins/junit/src/fileTemplates/code/JUnit4 Parameters Method.java.html
plugins/junit/src/fileTemplates/code/JUnit4 SetUp Method.java.html
plugins/junit/src/fileTemplates/code/JUnit4 TearDown Method.java.html
plugins/junit/src/fileTemplates/code/JUnit4 Test Class.java.html
plugins/junit/src/fileTemplates/code/JUnit4 Test Method.java.html
plugins/terminal/resources/icons/OpenTerminal_13x13@2x_dark.png
plugins/terminal/resources/icons/OpenTerminal_13x13_dark.png
plugins/testng/src/fileTemplates/code/TestNG Parameters Method.java.html
plugins/testng/src/fileTemplates/code/TestNG SetUp Method.java.html
plugins/testng/src/fileTemplates/code/TestNG TearDown Method.java.html
plugins/testng/src/fileTemplates/code/TestNG Test Class.java.html
plugins/testng/src/fileTemplates/code/TestNG Test Method.java.html
python/helpers/pydev/_pydev_imps/_pydev_django_oscar_patch.py [deleted file]
python/helpers/pydev/_pydev_imps/_pydev_pluginbase.py
python/helpers/pydev/pydev_monkey_qt.py
python/helpers/pydev/pydevd.py
resources/src/META-INF/IdeaPlugin.xml

index ba22ca404a99f83490c2e1b3a9ebc9c58d59884a..fca3be9c9fbb5e506a36b250dbbf46c10f3c7ea2 100644 (file)
@@ -628,13 +628,12 @@ binding.setVariable("zipSources", { String home, String targetDir ->
   notifyArtifactBuilt(sources)
 })
 
-binding.setVariable("zipSourcesOfModules", { String home, String targetDir, Collection<String> modules ->
-  String sources = "$targetDir/sources.zip"
-  projectBuilder.stage("zip sources of ${modules.size()} modules to $sources")
+binding.setVariable("zipSourcesOfModules", { String home, String targetFilePath, Collection<String> modules ->
+  projectBuilder.stage("zip sources of ${modules.size()} modules to $targetFilePath")
 
-  ant.mkdir(dir: targetDir)
-  ant.delete(file: sources)
-  ant.zip(destfile: sources) {
+  ant.mkdir(dir: new File(targetFilePath).getParent())
+  ant.delete(file: targetFilePath)
+  ant.zip(destfile: targetFilePath) {
     modules.each {
       JpsModule module = findModule(it)
       module.getSourceRoots(JavaSourceRootType.SOURCE).flatten().collect {it.file}.each { File srcRoot ->
@@ -643,7 +642,7 @@ binding.setVariable("zipSourcesOfModules", { String home, String targetDir, Coll
     }
   }
 
-  notifyArtifactBuilt(sources)
+  notifyArtifactBuilt(targetFilePath)
 })
 
 /**
index b608b82f97c76b05a7fff59405426869d694db16..d0cb098f33a45bb10e148ad34ca21ddc415989d2 100644 (file)
@@ -57,7 +57,7 @@ public final class EnterAction extends AnAction {
             if (selection.length > 0) {
                 if (selection.length == 1 && selection[0].isDirectory()) {
                     presentation.setVisible(true);
-                } else if (selection.length > 0) {
+                } else {
                     boolean notImages = false;
                     ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
                     for (VirtualFile file : selection) {
@@ -65,9 +65,6 @@ public final class EnterAction extends AnAction {
                     }
                     presentation.setEnabled(!notImages);
                     presentation.setVisible(false);
-                } else {
-                    presentation.setVisible(false);
-                    presentation.setEnabled(false);
                 }
             } else {
                 presentation.setVisible(false);
index 98df2e44e4c790c005427be1dd737e3eaa190770..3a0824a3f114a0fb2701e79f7637a3fa63d099f8 100644 (file)
@@ -57,6 +57,8 @@ public abstract class PsiAugmentProvider {
    * @param typeElement place where inference takes place, 
    *                    also nested PsiTypeElement-s (e.g. for List<String> PsiTypeElements corresponding to both List and String would be suggested)
    * @return inferred type or null, if inference is not applicable
+   * 
+   * @since 14.1
    */
   @Nullable
   protected PsiType inferType(PsiTypeElement typeElement) {
index bf75430563edd348755aad9783c1269913e9ef25..e623f0714debbc37630877bf7de45d954d0c7d73 100644 (file)
 package com.intellij.psi.impl;
 
 import com.intellij.openapi.Disposable;
-import com.intellij.openapi.application.ReadActionProcessor;
 import com.intellij.openapi.progress.ProgressIndicatorProvider;
-import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.FileIndexFacade;
-import com.intellij.openapi.roots.PackageIndex;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileFilter;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.file.impl.JavaFileManager;
@@ -34,19 +29,15 @@ import com.intellij.psi.impl.source.JavaDummyHolder;
 import com.intellij.psi.impl.source.JavaDummyHolderFactory;
 import com.intellij.psi.impl.source.resolve.FileContextUtil;
 import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.stubs.StubTreeLoader;
 import com.intellij.psi.util.PsiModificationTracker;
-import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.reference.SoftReference;
 import com.intellij.util.ConcurrencyUtil;
 import com.intellij.util.Processor;
 import com.intellij.util.SmartList;
 import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.HashMap;
 import com.intellij.util.messages.MessageBus;
 import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.TestOnly;
 
 import java.util.*;
@@ -94,7 +85,7 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
   public PsiClass findClass(@NotNull final String qualifiedName, @NotNull GlobalSearchScope scope) {
     ProgressIndicatorProvider.checkCanceled(); // We hope this method is being called often enough to cancel daemon processes smoothly
 
-    if (DumbService.getInstance(getProject()).isDumb()) {
+    if (shouldUseSlowResolve()) {
       PsiClass[] classes = findClassesInDumbMode(qualifiedName, scope);
       if (classes.length != 0) {
         return classes[0];
@@ -134,7 +125,7 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
   @Override
   @NotNull
   public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
-    if (DumbService.getInstance(getProject()).isDumb()) {
+    if (shouldUseSlowResolve()) {
       return findClassesInDumbMode(qualifiedName, scope);
     }
 
@@ -147,6 +138,11 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
     return classes.toArray(new PsiClass[classes.size()]);
   }
 
+  private boolean shouldUseSlowResolve() {
+    DumbService dumbService = DumbService.getInstance(getProject());
+    return dumbService.isDumb() && dumbService.isAlternativeResolveEnabled();
+  }
+
   @NotNull
   private PsiElementFinder[] finders() {
     PsiElementFinder[] answer = myElementFinders;
@@ -161,7 +157,6 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
   @NotNull
   private PsiElementFinder[] calcFinders() {
     List<PsiElementFinder> elementFinders = new ArrayList<PsiElementFinder>();
-    elementFinders.add(new PsiElementFinderImpl());
     ContainerUtil.addAll(elementFinders, myProject.getExtensions(PsiElementFinder.EP_NAME));
     return elementFinders.toArray(new PsiElementFinder[elementFinders.size()]);
   }
@@ -274,146 +269,6 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
     return result.values().toArray(new PsiPackage[result.size()]);
   }
 
-  public PsiClass[] findClassByShortName(String name, PsiPackage psiPackage, GlobalSearchScope scope) {
-    List<PsiClass> result = null;
-    for (PsiElementFinder finder : filteredFinders()) {
-      PsiClass[] classes = finder.getClasses(name, psiPackage, scope);
-      if (classes.length == 0) continue;
-      if (result == null) result = new ArrayList<PsiClass>();
-      ContainerUtil.addAll(result, classes);
-    }
-
-    return result == null ? PsiClass.EMPTY_ARRAY : result.toArray(new PsiClass[result.size()]);
-  }
-
-  private class PsiElementFinderImpl extends PsiElementFinder implements DumbAware {
-    @Override
-    public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
-      return myFileManager.findClass(qualifiedName, scope);
-    }
-
-    @Override
-    @NotNull
-    public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
-      return myFileManager.findClasses(qualifiedName, scope);
-    }
-
-    @Override
-    public PsiPackage findPackage(@NotNull String qualifiedName) {
-      return myFileManager.findPackage(qualifiedName);
-    }
-
-    @Override
-    @NotNull
-    public PsiPackage[] getSubPackages(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
-      final Map<String, PsiPackage> packagesMap = new HashMap<String, PsiPackage>();
-      final String qualifiedName = psiPackage.getQualifiedName();
-      for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
-        PsiDirectory[] subDirs = dir.getSubdirectories();
-        for (PsiDirectory subDir : subDirs) {
-          final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(subDir);
-          if (aPackage != null) {
-            final String subQualifiedName = aPackage.getQualifiedName();
-            if (subQualifiedName.startsWith(qualifiedName) && !packagesMap.containsKey(subQualifiedName)) {
-              packagesMap.put(aPackage.getQualifiedName(), aPackage);
-            }
-          }
-        }
-      }
-
-      packagesMap.remove(qualifiedName);    // avoid SOE caused by returning a package as a subpackage of itself
-      return packagesMap.values().toArray(new PsiPackage[packagesMap.size()]);
-    }
-
-    @Override
-    @NotNull
-    public PsiClass[] getClasses(@NotNull PsiPackage psiPackage, @NotNull final GlobalSearchScope scope) {
-      return getClasses(null, psiPackage, scope);
-    }
-
-    @Override
-    @NotNull
-    public PsiClass[] getClasses(@Nullable String shortName, @NotNull PsiPackage psiPackage, @NotNull final GlobalSearchScope scope) {
-      List<PsiClass> list = null;
-      String packageName = psiPackage.getQualifiedName();
-      for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
-        PsiClass[] classes = JavaDirectoryService.getInstance().getClasses(dir);
-        if (classes.length == 0) continue;
-        if (list == null) list = new ArrayList<PsiClass>();
-        for (PsiClass aClass : classes) {
-          // class file can be located in wrong place inside file system
-          String qualifiedName = aClass.getQualifiedName();
-          if (qualifiedName != null) qualifiedName = StringUtil.getPackageName(qualifiedName);
-          if (Comparing.strEqual(qualifiedName, packageName)) {
-            if (shortName == null || shortName.equals(aClass.getName())) list.add(aClass);
-          }
-        }
-      }
-      if (list == null) {
-        return PsiClass.EMPTY_ARRAY;
-      }
-
-      if (list.size() > 1) {
-        ContainerUtil.quickSort(list, new Comparator<PsiClass>() {
-          @Override
-          public int compare(PsiClass o1, PsiClass o2) {
-            VirtualFile file1 = PsiUtilCore.getVirtualFile(o1);
-            VirtualFile file2 = PsiUtilCore.getVirtualFile(o2);
-            return file1 == null ? file2 == null ? 0 : -1 : file2 == null ? 1 : scope.compare(file2, file1);
-          }
-        });
-      }
-
-      return list.toArray(new PsiClass[list.size()]);
-    }
-
-    @NotNull
-    @Override
-    public Set<String> getClassNames(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
-      Set<String> names = null;
-      FileIndexFacade facade = FileIndexFacade.getInstance(myProject);
-      for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
-        for (PsiFile file : dir.getFiles()) {
-          if (file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1) {
-            VirtualFile vFile = file.getVirtualFile();
-            if (vFile != null &&
-                !(file instanceof PsiCompiledElement) &&
-                !facade.isInSourceContent(vFile) &&
-                (!scope.isForceSearchingInLibrarySources() ||
-                 !StubTreeLoader.getInstance().canHaveStub(vFile))) {
-              continue;
-            }
-
-            Set<String> inFile = file instanceof PsiClassOwnerEx ? ((PsiClassOwnerEx)file).getClassNames() : getClassNames(((PsiClassOwner)file).getClasses());
-
-            if (inFile.isEmpty()) continue;
-            if (names == null) names = new HashSet<String>();
-            names.addAll(inFile);
-          }
-        }
-
-      }
-      return names == null ? Collections.<String>emptySet() : names;
-    }
-
-    @Override
-    public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
-                                             @NotNull final GlobalSearchScope scope,
-                                             @NotNull final Processor<PsiDirectory> consumer,
-                                             boolean includeLibrarySources) {
-      final PsiManager psiManager = PsiManager.getInstance(getProject());
-      return PackageIndex.getInstance(getProject()).getDirsByPackageName(psiPackage.getQualifiedName(), includeLibrarySources)
-        .forEach(new ReadActionProcessor<VirtualFile>() {
-          @Override
-          public boolean processInReadAction(final VirtualFile dir) {
-            if (!scope.contains(dir)) return true;
-            PsiDirectory psiDir = psiManager.findDirectory(dir);
-            return psiDir == null || consumer.process(psiDir);
-          }
-        });
-    }
-  }
-
   @Override
   public boolean isPartOfPackagePrefix(@NotNull String packageName) {
     final Collection<String> packagePrefixes = myFileManager.getNonTrivialPackagePrefixes();
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiElementFinderImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiElementFinderImpl.java
new file mode 100644 (file)
index 0000000..2c48236
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2000-2014 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.psi.impl;
+
+import com.intellij.openapi.application.ReadActionProcessor;
+import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.FileIndexFacade;
+import com.intellij.openapi.roots.PackageIndex;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.file.impl.JavaFileManager;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.stubs.StubTreeLoader;
+import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.util.Processor;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.HashMap;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+
+/**
+ * Created by kosyakov on 05.12.14.
+ */
+public class PsiElementFinderImpl extends PsiElementFinder implements DumbAware {
+
+  private final Project myProject;
+  private final JavaFileManager myFileManager;
+
+  public PsiElementFinderImpl(Project project, JavaFileManager javaFileManager) {
+    this.myProject = project;
+    this.myFileManager = javaFileManager;
+  }
+
+  @Override
+  public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
+    return myFileManager.findClass(qualifiedName, scope);
+  }
+
+  @Override
+  @NotNull
+  public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
+    return myFileManager.findClasses(qualifiedName, scope);
+  }
+
+  @Override
+  public PsiPackage findPackage(@NotNull String qualifiedName) {
+    return myFileManager.findPackage(qualifiedName);
+  }
+
+  @Override
+  @NotNull
+  public PsiPackage[] getSubPackages(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    final Map<String, PsiPackage> packagesMap = new HashMap<String, PsiPackage>();
+    final String qualifiedName = psiPackage.getQualifiedName();
+    for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
+      PsiDirectory[] subDirs = dir.getSubdirectories();
+      for (PsiDirectory subDir : subDirs) {
+        final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(subDir);
+        if (aPackage != null) {
+          final String subQualifiedName = aPackage.getQualifiedName();
+          if (subQualifiedName.startsWith(qualifiedName) && !packagesMap.containsKey(subQualifiedName)) {
+            packagesMap.put(aPackage.getQualifiedName(), aPackage);
+          }
+        }
+      }
+    }
+
+    packagesMap.remove(qualifiedName);    // avoid SOE caused by returning a package as a subpackage of itself
+    return packagesMap.values().toArray(new PsiPackage[packagesMap.size()]);
+  }
+
+  @Override
+  @NotNull
+  public PsiClass[] getClasses(@NotNull PsiPackage psiPackage, @NotNull final GlobalSearchScope scope) {
+    return getClasses(null, psiPackage, scope);
+  }
+
+  @Override
+  @NotNull
+  public PsiClass[] getClasses(@Nullable String shortName, @NotNull PsiPackage psiPackage, @NotNull final GlobalSearchScope scope) {
+    List<PsiClass> list = null;
+    String packageName = psiPackage.getQualifiedName();
+    for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
+      PsiClass[] classes = JavaDirectoryService.getInstance().getClasses(dir);
+      if (classes.length == 0) continue;
+      if (list == null) list = new ArrayList<PsiClass>();
+      for (PsiClass aClass : classes) {
+        // class file can be located in wrong place inside file system
+        String qualifiedName = aClass.getQualifiedName();
+        if (qualifiedName != null) qualifiedName = StringUtil.getPackageName(qualifiedName);
+        if (Comparing.strEqual(qualifiedName, packageName)) {
+          if (shortName == null || shortName.equals(aClass.getName())) list.add(aClass);
+        }
+      }
+    }
+    if (list == null) {
+      return PsiClass.EMPTY_ARRAY;
+    }
+
+    if (list.size() > 1) {
+      ContainerUtil.quickSort(list, new Comparator<PsiClass>() {
+        @Override
+        public int compare(PsiClass o1, PsiClass o2) {
+          VirtualFile file1 = PsiUtilCore.getVirtualFile(o1);
+          VirtualFile file2 = PsiUtilCore.getVirtualFile(o2);
+          return file1 == null ? file2 == null ? 0 : -1 : file2 == null ? 1 : scope.compare(file2, file1);
+        }
+      });
+    }
+
+    return list.toArray(new PsiClass[list.size()]);
+  }
+
+  @NotNull
+  @Override
+  public Set<String> getClassNames(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    Set<String> names = null;
+    FileIndexFacade facade = FileIndexFacade.getInstance(myProject);
+    for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
+      for (PsiFile file : dir.getFiles()) {
+        if (file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1) {
+          VirtualFile vFile = file.getVirtualFile();
+          if (vFile != null &&
+              !(file instanceof PsiCompiledElement) &&
+              !facade.isInSourceContent(vFile) &&
+              (!scope.isForceSearchingInLibrarySources() || !StubTreeLoader.getInstance().canHaveStub(vFile))) {
+            continue;
+          }
+
+          Set<String> inFile =
+            file instanceof PsiClassOwnerEx ? ((PsiClassOwnerEx)file).getClassNames() : getClassNames(((PsiClassOwner)file).getClasses());
+
+          if (inFile.isEmpty()) continue;
+          if (names == null) names = new HashSet<String>();
+          names.addAll(inFile);
+        }
+      }
+
+    }
+    return names == null ? Collections.<String>emptySet() : names;
+  }
+
+  @Override
+  public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
+                                           @NotNull final GlobalSearchScope scope,
+                                           @NotNull final Processor<PsiDirectory> consumer,
+                                           boolean includeLibrarySources) {
+    final PsiManager psiManager = PsiManager.getInstance(myProject);
+    return PackageIndex.getInstance(myProject).getDirsByPackageName(psiPackage.getQualifiedName(), includeLibrarySources)
+      .forEach(new ReadActionProcessor<VirtualFile>() {
+        @Override
+        public boolean processInReadAction(final VirtualFile dir) {
+          if (!scope.contains(dir)) return true;
+          PsiDirectory psiDir = psiManager.findDirectory(dir);
+          return psiDir == null || consumer.process(psiDir);
+        }
+      });
+  }
+}
index ed5bf0270f5f1b85f9d6ca22757b93b87ef91545..c880924ea2326a01eecf10bec393e08fc7b832f5 100644 (file)
@@ -193,8 +193,7 @@ public class JavacMain {
 
   private static boolean canUseOptimizedFileManager(JavaCompilingTool compilingTool) {
     // since java 9 internal API's used by the optimizedFileManager have changed
-    return compilingTool instanceof JavacCompilerTool && 
-           (JAVA_VERSION.contains("1.6") || JAVA_VERSION.contains("1.7") || JAVA_VERSION.contains("1.8"));
+    return compilingTool instanceof JavacCompilerTool && !SystemInfo.isJavaVersionAtLeast("1.9");
   }
 
   private static void handleCancelException(DiagnosticOutputConsumer diagnosticConsumer) {
index a0f5b43ce308e68ca0954e6861eed8232a9e566d..ac3edf55d89017fbe5dded37436a594f9821ac0d 100644 (file)
@@ -34,7 +34,7 @@ import java.util.List;
 
 /**
  * A service managing IDEA's 'dumb' mode: when indices are updated in background and the functionality is very much limited.
- * Only the explicitly allowed functionality is available. Usually it's allowed by implementing {@link com.intellij.openapi.project.DumbAware} interface.
+ * Only the explicitly allowed functionality is available. Usually it's allowed by implementing {@link DumbAware} interface.
  *
  * If you want to register a toolwindow, which will be enabled during the dumb mode, please use {@link com.intellij.openapi.wm.ToolWindowManager}'s
  * registration methods which have 'canWorkInDumMode' parameter. 
@@ -45,7 +45,7 @@ public abstract class DumbService {
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.project.DumbService");
 
   /**
-   * @see com.intellij.openapi.project.Project#getMessageBus()
+   * @see Project#getMessageBus()
    */
   public static final Topic<DumbModeListener> DUMB_MODE = new Topic<DumbModeListener>("dumb mode", DumbModeListener.class);
 
@@ -210,6 +210,26 @@ public abstract class DumbService {
     return o instanceof DumbAware;
   }
 
+  /**
+   * Enables or disables alternative resolve strategies for the current thread.<p/> 
+   * 
+   * Normally reference resolution uses index, and hence is not available in dumb mode. In some cases, alternative ways
+   * of performing resolve are available, although much slower. It's impractical to always use these ways because it'll
+   * lead to overloaded CPU (especially given there's also indexing in progress). But for some explicit user actions
+   * (e.g. explicit Goto Declaration) turning these slower methods is beneficial.<p/>
+   * 
+   * A typical usage would involve try-finally, where the alternative resolution is first enabled, then an action is performed,
+   * and then alternative resolution is turned off in the finally block.
+   */
+  public abstract void setAlternativeResolveEnabled(boolean enabled);
+
+  /**
+   * @return whether alternative resolution is enabled for the current thread.
+   * 
+   * @see #setAlternativeResolveEnabled(boolean) 
+   */
+  public abstract boolean isAlternativeResolveEnabled();
+
   /**
    * @see #DUMB_MODE
    */
index 1e1179cc5ee8e50fad2f1e78dfd0f71d21e32a02..b1fe7ae2a727892d6ad06851780967a19f8c0837 100644 (file)
@@ -74,6 +74,15 @@ public class MockDumbService extends DumbService {
     return myProject;
   }
 
+  @Override
+  public void setAlternativeResolveEnabled(boolean enabled) {
+  }
+
+  @Override
+  public boolean isAlternativeResolveEnabled() {
+    return false;
+  }
+
   public void smartInvokeLater(@NotNull final Runnable runnable) {
     runnable.run();
   }
old mode 100644 (file)
new mode 100755 (executable)
index 0a67d92..ba55aac
Binary files a/platform/icons/src/javaee/JavaeeAppModule.png and b/platform/icons/src/javaee/JavaeeAppModule.png differ
diff --git a/platform/icons/src/javaee/JavaeeAppModule@2x.png b/platform/icons/src/javaee/JavaeeAppModule@2x.png
new file mode 100755 (executable)
index 0000000..92f2fb0
Binary files /dev/null and b/platform/icons/src/javaee/JavaeeAppModule@2x.png differ
diff --git a/platform/icons/src/javaee/JavaeeAppModule@2x_dark.png b/platform/icons/src/javaee/JavaeeAppModule@2x_dark.png
new file mode 100755 (executable)
index 0000000..79201c6
Binary files /dev/null and b/platform/icons/src/javaee/JavaeeAppModule@2x_dark.png differ
diff --git a/platform/icons/src/javaee/JavaeeAppModule_dark.png b/platform/icons/src/javaee/JavaeeAppModule_dark.png
new file mode 100755 (executable)
index 0000000..d96b253
Binary files /dev/null and b/platform/icons/src/javaee/JavaeeAppModule_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 9961daa..6e6a162
Binary files a/platform/icons/src/javaee/WebService.png and b/platform/icons/src/javaee/WebService.png differ
diff --git a/platform/icons/src/javaee/WebService2.png b/platform/icons/src/javaee/WebService2.png
new file mode 100755 (executable)
index 0000000..590f3a5
Binary files /dev/null and b/platform/icons/src/javaee/WebService2.png differ
diff --git a/platform/icons/src/javaee/WebService2@2x.png b/platform/icons/src/javaee/WebService2@2x.png
new file mode 100755 (executable)
index 0000000..2e7a3bc
Binary files /dev/null and b/platform/icons/src/javaee/WebService2@2x.png differ
diff --git a/platform/icons/src/javaee/WebService2@2x_dark.png b/platform/icons/src/javaee/WebService2@2x_dark.png
new file mode 100755 (executable)
index 0000000..46daeb4
Binary files /dev/null and b/platform/icons/src/javaee/WebService2@2x_dark.png differ
diff --git a/platform/icons/src/javaee/WebService@2x.png b/platform/icons/src/javaee/WebService@2x.png
new file mode 100755 (executable)
index 0000000..516a1b7
Binary files /dev/null and b/platform/icons/src/javaee/WebService@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 63df7e0..a5a951a
Binary files a/platform/icons/src/javaee/WebServiceClient.png and b/platform/icons/src/javaee/WebServiceClient.png differ
diff --git a/platform/icons/src/javaee/WebServiceClient2.png b/platform/icons/src/javaee/WebServiceClient2.png
new file mode 100755 (executable)
index 0000000..114cdda
Binary files /dev/null and b/platform/icons/src/javaee/WebServiceClient2.png differ
diff --git a/platform/icons/src/javaee/WebServiceClient2@2x.png b/platform/icons/src/javaee/WebServiceClient2@2x.png
new file mode 100755 (executable)
index 0000000..839131b
Binary files /dev/null and b/platform/icons/src/javaee/WebServiceClient2@2x.png differ
diff --git a/platform/icons/src/javaee/WebServiceClient2@2x_dark.png b/platform/icons/src/javaee/WebServiceClient2@2x_dark.png
new file mode 100755 (executable)
index 0000000..c473459
Binary files /dev/null and b/platform/icons/src/javaee/WebServiceClient2@2x_dark.png differ
diff --git a/platform/icons/src/javaee/WebServiceClient2_dark.png b/platform/icons/src/javaee/WebServiceClient2_dark.png
new file mode 100755 (executable)
index 0000000..eaad417
Binary files /dev/null and b/platform/icons/src/javaee/WebServiceClient2_dark.png differ
diff --git a/platform/icons/src/javaee/WebServiceClient@2x.png b/platform/icons/src/javaee/WebServiceClient@2x.png
new file mode 100755 (executable)
index 0000000..30a584a
Binary files /dev/null and b/platform/icons/src/javaee/WebServiceClient@2x.png differ
diff --git a/platform/icons/src/javaee/WebService_dark.png b/platform/icons/src/javaee/WebService_dark.png
new file mode 100755 (executable)
index 0000000..118fb9b
Binary files /dev/null and b/platform/icons/src/javaee/WebService_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 8bd86a3..c7772fe
Binary files a/platform/icons/src/javaee/application_xml.png and b/platform/icons/src/javaee/application_xml.png differ
diff --git a/platform/icons/src/javaee/application_xml@2x.png b/platform/icons/src/javaee/application_xml@2x.png
new file mode 100755 (executable)
index 0000000..d41ea77
Binary files /dev/null and b/platform/icons/src/javaee/application_xml@2x.png differ
diff --git a/platform/icons/src/javaee/application_xml@2x_dark.png b/platform/icons/src/javaee/application_xml@2x_dark.png
new file mode 100755 (executable)
index 0000000..f2c6e61
Binary files /dev/null and b/platform/icons/src/javaee/application_xml@2x_dark.png differ
diff --git a/platform/icons/src/javaee/application_xml_dark.png b/platform/icons/src/javaee/application_xml_dark.png
new file mode 100755 (executable)
index 0000000..0d20c5b
Binary files /dev/null and b/platform/icons/src/javaee/application_xml_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 417055d..b882c72
Binary files a/platform/icons/src/javaee/dataSourceImport.png and b/platform/icons/src/javaee/dataSourceImport.png differ
diff --git a/platform/icons/src/javaee/dataSourceImport@2x.png b/platform/icons/src/javaee/dataSourceImport@2x.png
new file mode 100755 (executable)
index 0000000..1e9697c
Binary files /dev/null and b/platform/icons/src/javaee/dataSourceImport@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index e7b85f7..1e9697c
Binary files a/platform/icons/src/javaee/dbSchemaImportBig.png and b/platform/icons/src/javaee/dbSchemaImportBig.png differ
diff --git a/platform/icons/src/javaee/dbSchemaImportBig@2x.png b/platform/icons/src/javaee/dbSchemaImportBig@2x.png
new file mode 100755 (executable)
index 0000000..af52813
Binary files /dev/null and b/platform/icons/src/javaee/dbSchemaImportBig@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 4fa3a36..a2761bf
Binary files a/platform/icons/src/javaee/ejb-jar_xml.png and b/platform/icons/src/javaee/ejb-jar_xml.png differ
diff --git a/platform/icons/src/javaee/ejb-jar_xml@2x.png b/platform/icons/src/javaee/ejb-jar_xml@2x.png
new file mode 100755 (executable)
index 0000000..471aa6c
Binary files /dev/null and b/platform/icons/src/javaee/ejb-jar_xml@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 5b3ab29..c296e7b
Binary files a/platform/icons/src/javaee/ejbClass.png and b/platform/icons/src/javaee/ejbClass.png differ
diff --git a/platform/icons/src/javaee/ejbClass@2x.png b/platform/icons/src/javaee/ejbClass@2x.png
new file mode 100755 (executable)
index 0000000..a7e22c5
Binary files /dev/null and b/platform/icons/src/javaee/ejbClass@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 03ec8e1..95dc2be
Binary files a/platform/icons/src/javaee/ejbModule.png and b/platform/icons/src/javaee/ejbModule.png differ
diff --git a/platform/icons/src/javaee/ejbModule@2x.png b/platform/icons/src/javaee/ejbModule@2x.png
new file mode 100755 (executable)
index 0000000..da59cea
Binary files /dev/null and b/platform/icons/src/javaee/ejbModule@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index e2d0da4..475c2ed
Binary files a/platform/icons/src/javaee/embeddedAttributeOverlay.png and b/platform/icons/src/javaee/embeddedAttributeOverlay.png differ
diff --git a/platform/icons/src/javaee/embeddedAttributeOverlay@2x.png b/platform/icons/src/javaee/embeddedAttributeOverlay@2x.png
new file mode 100755 (executable)
index 0000000..e7fb7f3
Binary files /dev/null and b/platform/icons/src/javaee/embeddedAttributeOverlay@2x.png differ
diff --git a/platform/icons/src/javaee/embeddedAttributeOverlay@2x_dark.png b/platform/icons/src/javaee/embeddedAttributeOverlay@2x_dark.png
new file mode 100755 (executable)
index 0000000..942f4cb
Binary files /dev/null and b/platform/icons/src/javaee/embeddedAttributeOverlay@2x_dark.png differ
diff --git a/platform/icons/src/javaee/embeddedAttributeOverlay_dark.png b/platform/icons/src/javaee/embeddedAttributeOverlay_dark.png
new file mode 100755 (executable)
index 0000000..e59fa89
Binary files /dev/null and b/platform/icons/src/javaee/embeddedAttributeOverlay_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 6bd91f2..fa15277
Binary files a/platform/icons/src/javaee/entityBean.png and b/platform/icons/src/javaee/entityBean.png differ
diff --git a/platform/icons/src/javaee/entityBean@2x.png b/platform/icons/src/javaee/entityBean@2x.png
new file mode 100755 (executable)
index 0000000..3b527da
Binary files /dev/null and b/platform/icons/src/javaee/entityBean@2x.png differ
diff --git a/platform/icons/src/javaee/entityBean@2x_dark.png b/platform/icons/src/javaee/entityBean@2x_dark.png
new file mode 100755 (executable)
index 0000000..0a946c2
Binary files /dev/null and b/platform/icons/src/javaee/entityBean@2x_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index fa59d64..4d81661
Binary files a/platform/icons/src/javaee/entityBeanBig.png and b/platform/icons/src/javaee/entityBeanBig.png differ
diff --git a/platform/icons/src/javaee/entityBeanBig@2x.png b/platform/icons/src/javaee/entityBeanBig@2x.png
new file mode 100755 (executable)
index 0000000..6f5a16f
Binary files /dev/null and b/platform/icons/src/javaee/entityBeanBig@2x.png differ
diff --git a/platform/icons/src/javaee/entityBeanBig@2x_dark.png b/platform/icons/src/javaee/entityBeanBig@2x_dark.png
new file mode 100755 (executable)
index 0000000..6762894
Binary files /dev/null and b/platform/icons/src/javaee/entityBeanBig@2x_dark.png differ
diff --git a/platform/icons/src/javaee/entityBeanBig_dark.png b/platform/icons/src/javaee/entityBeanBig_dark.png
new file mode 100755 (executable)
index 0000000..5edeaaa
Binary files /dev/null and b/platform/icons/src/javaee/entityBeanBig_dark.png differ
diff --git a/platform/icons/src/javaee/entityBean_dark.png b/platform/icons/src/javaee/entityBean_dark.png
new file mode 100755 (executable)
index 0000000..e62a2ec
Binary files /dev/null and b/platform/icons/src/javaee/entityBean_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 5ab0f92..5d6e70e
Binary files a/platform/icons/src/javaee/home.png and b/platform/icons/src/javaee/home.png differ
diff --git a/platform/icons/src/javaee/home@2x.png b/platform/icons/src/javaee/home@2x.png
new file mode 100755 (executable)
index 0000000..bbdc01b
Binary files /dev/null and b/platform/icons/src/javaee/home@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index dd829d5..8e04255
Binary files a/platform/icons/src/javaee/inheritedAttributeOverlay.png and b/platform/icons/src/javaee/inheritedAttributeOverlay.png differ
diff --git a/platform/icons/src/javaee/inheritedAttributeOverlay@2x.png b/platform/icons/src/javaee/inheritedAttributeOverlay@2x.png
new file mode 100755 (executable)
index 0000000..2cb2c27
Binary files /dev/null and b/platform/icons/src/javaee/inheritedAttributeOverlay@2x.png differ
diff --git a/platform/icons/src/javaee/inheritedAttributeOverlay@2x_dark.png b/platform/icons/src/javaee/inheritedAttributeOverlay@2x_dark.png
new file mode 100755 (executable)
index 0000000..f61fe95
Binary files /dev/null and b/platform/icons/src/javaee/inheritedAttributeOverlay@2x_dark.png differ
diff --git a/platform/icons/src/javaee/inheritedAttributeOverlay_dark.png b/platform/icons/src/javaee/inheritedAttributeOverlay_dark.png
new file mode 100755 (executable)
index 0000000..398e25c
Binary files /dev/null and b/platform/icons/src/javaee/inheritedAttributeOverlay_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index cee6081..f543e27
Binary files a/platform/icons/src/javaee/interceptorClass.png and b/platform/icons/src/javaee/interceptorClass.png differ
diff --git a/platform/icons/src/javaee/interceptorClass@2x.png b/platform/icons/src/javaee/interceptorClass@2x.png
new file mode 100755 (executable)
index 0000000..01837fb
Binary files /dev/null and b/platform/icons/src/javaee/interceptorClass@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 689653e..146cefb
Binary files a/platform/icons/src/javaee/interceptorMethod.png and b/platform/icons/src/javaee/interceptorMethod.png differ
diff --git a/platform/icons/src/javaee/interceptorMethod@2x.png b/platform/icons/src/javaee/interceptorMethod@2x.png
new file mode 100755 (executable)
index 0000000..ca01ef3
Binary files /dev/null and b/platform/icons/src/javaee/interceptorMethod@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 5bc6a74..b96a2d2
Binary files a/platform/icons/src/javaee/jpaFacet.png and b/platform/icons/src/javaee/jpaFacet.png differ
diff --git a/platform/icons/src/javaee/jpaFacet@2x.png b/platform/icons/src/javaee/jpaFacet@2x.png
new file mode 100755 (executable)
index 0000000..d317d01
Binary files /dev/null and b/platform/icons/src/javaee/jpaFacet@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index ed4ace4..3675414
Binary files a/platform/icons/src/javaee/local.png and b/platform/icons/src/javaee/local.png differ
diff --git a/platform/icons/src/javaee/local@2x.png b/platform/icons/src/javaee/local@2x.png
new file mode 100755 (executable)
index 0000000..477284e
Binary files /dev/null and b/platform/icons/src/javaee/local@2x.png differ
diff --git a/platform/icons/src/javaee/local@2x_dark.png b/platform/icons/src/javaee/local@2x_dark.png
new file mode 100755 (executable)
index 0000000..d067e38
Binary files /dev/null and b/platform/icons/src/javaee/local@2x_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 87c66c4..9889c0a
Binary files a/platform/icons/src/javaee/localHome.png and b/platform/icons/src/javaee/localHome.png differ
diff --git a/platform/icons/src/javaee/localHome@2x.png b/platform/icons/src/javaee/localHome@2x.png
new file mode 100755 (executable)
index 0000000..fe5706f
Binary files /dev/null and b/platform/icons/src/javaee/localHome@2x.png differ
diff --git a/platform/icons/src/javaee/localHome@2x_dark.png b/platform/icons/src/javaee/localHome@2x_dark.png
new file mode 100755 (executable)
index 0000000..44d95fe
Binary files /dev/null and b/platform/icons/src/javaee/localHome@2x_dark.png differ
diff --git a/platform/icons/src/javaee/localHome_dark.png b/platform/icons/src/javaee/localHome_dark.png
new file mode 100755 (executable)
index 0000000..684bfdf
Binary files /dev/null and b/platform/icons/src/javaee/localHome_dark.png differ
diff --git a/platform/icons/src/javaee/local_dark.png b/platform/icons/src/javaee/local_dark.png
new file mode 100755 (executable)
index 0000000..f42e1ed
Binary files /dev/null and b/platform/icons/src/javaee/local_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 37f84fc..a249445
Binary files a/platform/icons/src/javaee/messageBean.png and b/platform/icons/src/javaee/messageBean.png differ
diff --git a/platform/icons/src/javaee/messageBean@2x.png b/platform/icons/src/javaee/messageBean@2x.png
new file mode 100755 (executable)
index 0000000..b5e73fe
Binary files /dev/null and b/platform/icons/src/javaee/messageBean@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index d77b780..293f978
Binary files a/platform/icons/src/javaee/persistenceAttribute.png and b/platform/icons/src/javaee/persistenceAttribute.png differ
diff --git a/platform/icons/src/javaee/persistenceAttribute@2x.png b/platform/icons/src/javaee/persistenceAttribute@2x.png
new file mode 100755 (executable)
index 0000000..58ffb22
Binary files /dev/null and b/platform/icons/src/javaee/persistenceAttribute@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index e8ada10..03f46d9
Binary files a/platform/icons/src/javaee/persistenceEmbeddable.png and b/platform/icons/src/javaee/persistenceEmbeddable.png differ
diff --git a/platform/icons/src/javaee/persistenceEmbeddable@2x.png b/platform/icons/src/javaee/persistenceEmbeddable@2x.png
new file mode 100755 (executable)
index 0000000..0d4858b
Binary files /dev/null and b/platform/icons/src/javaee/persistenceEmbeddable@2x.png differ
diff --git a/platform/icons/src/javaee/persistenceEmbeddable@2x_dark.png b/platform/icons/src/javaee/persistenceEmbeddable@2x_dark.png
new file mode 100755 (executable)
index 0000000..85dd10a
Binary files /dev/null and b/platform/icons/src/javaee/persistenceEmbeddable@2x_dark.png differ
diff --git a/platform/icons/src/javaee/persistenceEmbeddable_dark.png b/platform/icons/src/javaee/persistenceEmbeddable_dark.png
new file mode 100755 (executable)
index 0000000..94a876d
Binary files /dev/null and b/platform/icons/src/javaee/persistenceEmbeddable_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index cf9264f..9f942f9
Binary files a/platform/icons/src/javaee/persistenceEntity.png and b/platform/icons/src/javaee/persistenceEntity.png differ
diff --git a/platform/icons/src/javaee/persistenceEntity@2x.png b/platform/icons/src/javaee/persistenceEntity@2x.png
new file mode 100755 (executable)
index 0000000..8da8fa5
Binary files /dev/null and b/platform/icons/src/javaee/persistenceEntity@2x.png differ
diff --git a/platform/icons/src/javaee/persistenceEntity@2x_dark.png b/platform/icons/src/javaee/persistenceEntity@2x_dark.png
new file mode 100755 (executable)
index 0000000..830e28e
Binary files /dev/null and b/platform/icons/src/javaee/persistenceEntity@2x_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index cee6081..f543e27
Binary files a/platform/icons/src/javaee/persistenceEntityListener.png and b/platform/icons/src/javaee/persistenceEntityListener.png differ
diff --git a/platform/icons/src/javaee/persistenceEntityListener@2x.png b/platform/icons/src/javaee/persistenceEntityListener@2x.png
new file mode 100755 (executable)
index 0000000..01837fb
Binary files /dev/null and b/platform/icons/src/javaee/persistenceEntityListener@2x.png differ
diff --git a/platform/icons/src/javaee/persistenceEntity_dark.png b/platform/icons/src/javaee/persistenceEntity_dark.png
new file mode 100755 (executable)
index 0000000..10c8b59
Binary files /dev/null and b/platform/icons/src/javaee/persistenceEntity_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index b1e9983..f4d960e
Binary files a/platform/icons/src/javaee/persistenceId.png and b/platform/icons/src/javaee/persistenceId.png differ
diff --git a/platform/icons/src/javaee/persistenceId@2x.png b/platform/icons/src/javaee/persistenceId@2x.png
new file mode 100755 (executable)
index 0000000..a19c74f
Binary files /dev/null and b/platform/icons/src/javaee/persistenceId@2x.png differ
diff --git a/platform/icons/src/javaee/persistenceId@2x_dark.png b/platform/icons/src/javaee/persistenceId@2x_dark.png
new file mode 100755 (executable)
index 0000000..21ada90
Binary files /dev/null and b/platform/icons/src/javaee/persistenceId@2x_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 8889522..565399d
Binary files a/platform/icons/src/javaee/persistenceIdRelationship.png and b/platform/icons/src/javaee/persistenceIdRelationship.png differ
diff --git a/platform/icons/src/javaee/persistenceIdRelationship@2x.png b/platform/icons/src/javaee/persistenceIdRelationship@2x.png
new file mode 100755 (executable)
index 0000000..0b37bf0
Binary files /dev/null and b/platform/icons/src/javaee/persistenceIdRelationship@2x.png differ
diff --git a/platform/icons/src/javaee/persistenceIdRelationship@2x_dark.png b/platform/icons/src/javaee/persistenceIdRelationship@2x_dark.png
new file mode 100755 (executable)
index 0000000..9dd16bd
Binary files /dev/null and b/platform/icons/src/javaee/persistenceIdRelationship@2x_dark.png differ
diff --git a/platform/icons/src/javaee/persistenceIdRelationship_dark.png b/platform/icons/src/javaee/persistenceIdRelationship_dark.png
new file mode 100755 (executable)
index 0000000..2b0a5db
Binary files /dev/null and b/platform/icons/src/javaee/persistenceIdRelationship_dark.png differ
diff --git a/platform/icons/src/javaee/persistenceId_dark.png b/platform/icons/src/javaee/persistenceId_dark.png
new file mode 100755 (executable)
index 0000000..1be9a7b
Binary files /dev/null and b/platform/icons/src/javaee/persistenceId_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index f51d41d..c65f565
Binary files a/platform/icons/src/javaee/persistenceMappedSuperclass.png and b/platform/icons/src/javaee/persistenceMappedSuperclass.png differ
diff --git a/platform/icons/src/javaee/persistenceMappedSuperclass@2x.png b/platform/icons/src/javaee/persistenceMappedSuperclass@2x.png
new file mode 100755 (executable)
index 0000000..84231ab
Binary files /dev/null and b/platform/icons/src/javaee/persistenceMappedSuperclass@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 3953728..6ce6b65
Binary files a/platform/icons/src/javaee/persistenceRelationship.png and b/platform/icons/src/javaee/persistenceRelationship.png differ
diff --git a/platform/icons/src/javaee/persistenceRelationship@2x.png b/platform/icons/src/javaee/persistenceRelationship@2x.png
new file mode 100755 (executable)
index 0000000..71494e4
Binary files /dev/null and b/platform/icons/src/javaee/persistenceRelationship@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 4198f3f..6e7c376
Binary files a/platform/icons/src/javaee/persistenceUnit.png and b/platform/icons/src/javaee/persistenceUnit.png differ
diff --git a/platform/icons/src/javaee/persistenceUnit@2x.png b/platform/icons/src/javaee/persistenceUnit@2x.png
new file mode 100755 (executable)
index 0000000..b8fea64
Binary files /dev/null and b/platform/icons/src/javaee/persistenceUnit@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 7261ae4..20a16df
Binary files a/platform/icons/src/javaee/remote.png and b/platform/icons/src/javaee/remote.png differ
diff --git a/platform/icons/src/javaee/remote@2x.png b/platform/icons/src/javaee/remote@2x.png
new file mode 100755 (executable)
index 0000000..134bce3
Binary files /dev/null and b/platform/icons/src/javaee/remote@2x.png differ
diff --git a/platform/icons/src/javaee/remote@2x_dark.png b/platform/icons/src/javaee/remote@2x_dark.png
new file mode 100755 (executable)
index 0000000..e697b4f
Binary files /dev/null and b/platform/icons/src/javaee/remote@2x_dark.png differ
diff --git a/platform/icons/src/javaee/remote_dark.png b/platform/icons/src/javaee/remote_dark.png
new file mode 100755 (executable)
index 0000000..520a42d
Binary files /dev/null and b/platform/icons/src/javaee/remote_dark.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 2b3cc8d..61a4509
Binary files a/platform/icons/src/javaee/sessionBean.png and b/platform/icons/src/javaee/sessionBean.png differ
diff --git a/platform/icons/src/javaee/sessionBean@2x.png b/platform/icons/src/javaee/sessionBean@2x.png
new file mode 100755 (executable)
index 0000000..a5a1fd2
Binary files /dev/null and b/platform/icons/src/javaee/sessionBean@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index b7f806f..9265129
Binary files a/platform/icons/src/javaee/updateRunningApplication.png and b/platform/icons/src/javaee/updateRunningApplication.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 6c5e3f7..5acea70
Binary files a/platform/icons/src/javaee/updateRunningApplication@2x.png and b/platform/icons/src/javaee/updateRunningApplication@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 7e93bff..0263085
Binary files a/platform/icons/src/javaee/webModule.png and b/platform/icons/src/javaee/webModule.png differ
diff --git a/platform/icons/src/javaee/webModule@2x.png b/platform/icons/src/javaee/webModule@2x.png
new file mode 100755 (executable)
index 0000000..14a4980
Binary files /dev/null and b/platform/icons/src/javaee/webModule@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 6e81e1e..61fa404
Binary files a/platform/icons/src/javaee/webModuleGroup.png and b/platform/icons/src/javaee/webModuleGroup.png differ
diff --git a/platform/icons/src/javaee/webModuleGroup@2x.png b/platform/icons/src/javaee/webModuleGroup@2x.png
new file mode 100755 (executable)
index 0000000..b204e4e
Binary files /dev/null and b/platform/icons/src/javaee/webModuleGroup@2x.png differ
old mode 100644 (file)
new mode 100755 (executable)
index fc32397..b750aaf
Binary files a/platform/icons/src/javaee/web_xml.png and b/platform/icons/src/javaee/web_xml.png differ
old mode 100644 (file)
new mode 100755 (executable)
index 1b9d158..2b2bf2d
Binary files a/platform/icons/src/javaee/web_xml@2x.png and b/platform/icons/src/javaee/web_xml@2x.png differ
index 1c3d265e4c86de8a8cef556440224c82de689642..cb2c3225e83f190b7befe868217bd052a85106df 100644 (file)
@@ -23,6 +23,7 @@ import com.intellij.execution.process.ProcessNotCreatedException;
 import com.intellij.execution.ui.RunContentDescriptor;
 import com.intellij.ide.DataManager;
 import com.intellij.ide.util.PropertiesComponent;
+import com.intellij.notification.Notification;
 import com.intellij.notification.NotificationGroup;
 import com.intellij.notification.NotificationListener;
 import com.intellij.notification.NotificationType;
@@ -34,7 +35,6 @@ import com.intellij.openapi.ui.MessageType;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.wm.ToolWindowManager;
 import com.intellij.ui.content.Content;
-import com.intellij.util.ObjectUtils;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -124,7 +124,12 @@ public class ExecutionUtil {
         else {
           Messages.showErrorDialog(project, UIUtil.toHtml(fullMessage), "");
         }
-        NotificationListener notificationListener = ObjectUtils.tryCast(finalListener, NotificationListener.class);
+        NotificationListener notificationListener = finalListener == null ? null : new NotificationListener() {
+          @Override
+          public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
+            finalListener.hyperlinkUpdate(event);
+          }
+        };
         ourNotificationGroup.createNotification(title, finalDescription, NotificationType.ERROR, notificationListener).notify(project);
       }
     });
index a64917f88e4ec7e373802b86f1b26c4bd45d8857..d923262be097a78d00766f9f31c74c63281a6f0a 100644 (file)
@@ -37,7 +37,6 @@ import org.jetbrains.annotations.Nullable;
 
 import java.io.*;
 import java.net.URL;
-import java.net.URLConnection;
 import java.util.Locale;
 import java.util.concurrent.Future;
 import java.util.jar.JarFile;
@@ -243,34 +242,27 @@ public abstract class AbstractExternalFilter {
     });
   }
 
+  @Nullable
   private static String guessEncoding(URL url) {
-    String result = null;
-    BufferedReader reader = null;
-    try {
-      URLConnection connection = url.openConnection();
-      result = connection.getContentEncoding();
-      if (result != null) return result;
-      //noinspection IOResourceOpenedButNotSafelyClosed
-      reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
-      for (String htmlLine = reader.readLine(); htmlLine != null; htmlLine = reader.readLine()) {
-        result = parseContentEncoding(htmlLine);
-        if (result != null) {
-          break;
-        }
-      }
-    }
-    catch (IOException ignored) {
-    }
-    finally {
-      if (reader != null) {
+    return HttpRequests.request(url.toExternalForm()).connect(new HttpRequests.RequestProcessor<String>() {
+      @Override
+      public String process(@NotNull HttpRequests.Request request) throws IOException {
+        String result = request.getConnection().getContentEncoding();
+        BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
         try {
-          reader.close();
+          for (String htmlLine = reader.readLine(); htmlLine != null; htmlLine = reader.readLine()) {
+            result = parseContentEncoding(htmlLine);
+            if (result != null) {
+              break;
+            }
+          }
         }
-        catch (IOException ignored) {
+        finally {
+          reader.close();
         }
+        return result;
       }
-    }
-    return result;
+    }, null, null);
   }
 
   @Nullable
@@ -475,11 +467,9 @@ public abstract class AbstractExternalFilter {
     if (!htmlLine.contains("charset")) {
       return null;
     }
-    final Matcher matcher = CHARSET_META_PATTERN.matcher(htmlLine);
-    if (matcher.find()) {
-      return matcher.group(1);
-    }
-    return null;
+
+    Matcher matcher = CHARSET_META_PATTERN.matcher(htmlLine);
+    return matcher.find() ? matcher.group(1) : null;
   }
 
   private static void appendLine(StringBuilder buffer, final String read) {
index d34cbf4cfa09d7fa24a1bd096c4027dc3c3c48c7..a633b302c9697087bb9be60d63988b4546058c65 100644 (file)
@@ -76,6 +76,7 @@ public class GotoDeclarationAction extends BaseCodeInsightAction implements Code
   public void invoke(@NotNull final Project project, @NotNull Editor editor, @NotNull PsiFile file) {
     PsiDocumentManager.getInstance(project).commitAllDocuments();
 
+    DumbService.getInstance(project).setAlternativeResolveEnabled(true);
     try {
       int offset = editor.getCaretModel().getOffset();
       PsiElement[] elements = findAllTargetElements(project, editor, offset);
@@ -105,6 +106,9 @@ public class GotoDeclarationAction extends BaseCodeInsightAction implements Code
     catch (IndexNotReadyException e) {
       DumbService.getInstance(project).showDumbModeNotification("Navigation is not available here during index update");
     }
+    finally {
+      DumbService.getInstance(project).setAlternativeResolveEnabled(false);
+    }
   }
 
   public static PsiNameIdentifierOwner findElementToShowUsagesOf(@NotNull Editor editor, @NotNull PsiFile file, int offset) {
index 190ce1d913bd4b1c3c4518e72d8eb6501a1fac6a..eb4861f733ff8fe11ef26d7b7dd04d7d35169650 100644 (file)
@@ -27,6 +27,8 @@ import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.fileEditor.FileEditorManager;
 import com.intellij.openapi.fileEditor.OpenFileDescriptor;
 import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.DumbService;
+import com.intellij.openapi.project.IndexNotReadyException;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
@@ -64,14 +66,23 @@ public class GotoTypeDeclarationAction extends BaseCodeInsightAction implements
   public void invoke(@NotNull final Project project, @NotNull Editor editor, @NotNull PsiFile file) {
     PsiDocumentManager.getInstance(project).commitAllDocuments();
 
-    int offset = editor.getCaretModel().getOffset();
-    PsiElement[] symbolTypes = findSymbolTypes(editor, offset);
-    if (symbolTypes == null || symbolTypes.length == 0) return;
-    if (symbolTypes.length == 1) {
-      navigate(project, symbolTypes[0]);
+    DumbService.getInstance(project).setAlternativeResolveEnabled(true);
+    try {
+      int offset = editor.getCaretModel().getOffset();
+      PsiElement[] symbolTypes = findSymbolTypes(editor, offset);
+      if (symbolTypes == null || symbolTypes.length == 0) return;
+      if (symbolTypes.length == 1) {
+        navigate(project, symbolTypes[0]);
+      }
+      else {
+        NavigationUtil.getPsiElementPopup(symbolTypes, CodeInsightBundle.message("choose.type.popup.title")).showInBestPositionFor(editor);
+      }
     }
-    else {
-      NavigationUtil.getPsiElementPopup(symbolTypes, CodeInsightBundle.message("choose.type.popup.title")).showInBestPositionFor(editor);
+    catch (IndexNotReadyException e) {
+      DumbService.getInstance(project).showDumbModeNotification("Navigation is not available here during index update");
+    }
+    finally {
+      DumbService.getInstance(project).setAlternativeResolveEnabled(false);
     }
   }
 
index 718b830f8c7d2ba89f8958ae0aa012b9bf604dec..3d064e69cc9e39f6fae975c95f84d1514f86af92 100644 (file)
@@ -448,7 +448,9 @@ public class FindInProjectUtil {
     VirtualFile directory = psiDir == null ? null : psiDir.getVirtualFile();
     Module module = findModel.getModuleName() == null ? null : ModuleManager.getInstance(project).findModuleByName(findModel.getModuleName());
     return findModel.isCustomScope() && customScope != null ? customScope :
-           directory != null ? GlobalSearchScopesCore.directoryScope(project, directory, true) :
+           // we don't have to check for myProjectFileIndex.isExcluded(file) here like FindInProjectTask.collectFilesInScope() does
+           // because all found usages are guaranteed to be not in excluded dir
+           directory != null ? GlobalSearchScopesCore.directoryScope(project, directory, findModel.isWithSubdirectories()) :
            module != null ? GlobalSearchScope.moduleScope(module) :
            findModel.isProjectScope() ? GlobalSearchScope.projectScope(project) :
            GlobalSearchScope.allScope(project);
index 1772de9816800af2f0369dc6c80cdae608f53b7c..2a2fa91b28b59310cb6b523f34dcb678a2375402 100644 (file)
           <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
         </constraints>
       </vspacer>
-      <grid id="55618" binding="myVersionPanel" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+      <grid id="55618" binding="myVersionPanel" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
         <margin top="0" left="0" bottom="0" right="0"/>
         <constraints>
           <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties/>
         <border type="none"/>
-        <children>
-          <component id="7379c" class="javax.swing.JComboBox" binding="myComboBox">
-            <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
-                <minimum-size width="150" height="-1"/>
-              </grid>
-            </constraints>
-            <properties/>
-          </component>
-          <hspacer id="cb5b0">
-            <constraints>
-              <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-            </constraints>
-          </hspacer>
-          <grid id="8f5fd" binding="myActionPanel" layout-manager="CardLayout" hgap="0" vgap="0">
-            <constraints>
-              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties/>
-            <border type="none"/>
-            <children/>
-          </grid>
-        </children>
+        <children/>
       </grid>
       <component id="7efaf" class="javax.swing.JLabel">
         <constraints>
           <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties>
-          <labelFor value="7379c"/>
           <text value="&amp;Version:"/>
         </properties>
       </component>
index 2a94fdb527786bb5b3fe45597bbce9651faf375c..7c069b566d13eb34243cdfdad9578436d9cc6bb1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
  */
 package com.intellij.lang.javascript.boilerplate;
 
-import com.google.common.collect.ImmutableCollection;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
-import com.intellij.icons.AllIcons;
 import com.intellij.ide.util.projectWizard.SettingsStep;
-import com.intellij.openapi.actionSystem.ActionToolbar;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.impl.ActionButton;
 import com.intellij.openapi.ui.ValidationInfo;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.platform.WebProjectGenerator;
 import com.intellij.platform.templates.github.GithubTagInfo;
-import com.intellij.ui.JBColor;
 import com.intellij.ui.ListCellRendererWrapper;
 import com.intellij.util.ObjectUtils;
 import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.ui.AsyncProcessIcon;
-import com.intellij.util.ui.UIUtil;
+import com.intellij.util.ui.ReloadableComboBoxPanel;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
-import java.awt.*;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  * @author Sergey Simonchik
  */
 public class GithubProjectGeneratorPeer implements WebProjectGenerator.GeneratorPeer<GithubTagInfo> {
+  private void createUIComponents() {
+    myReloadableComboBoxPanel = new ReloadableComboBoxPanel<GithubTagInfo>() {
 
-  private static final String CONTROL_PLACE = "Github.Project.Generator.Reload";
+      @SuppressWarnings("unchecked")
+      @Override
+      protected void doUpdateValues(@NotNull Set<GithubTagInfo> tags) {
+        if (!shouldUpdate(tags)) {
+          return;
+        }
 
-  private enum UpdateStatus {
-    UPDATING, IDLE
+        List<GithubTagInfo> sortedTags = createSortedTagList(tags);
+        GithubTagInfo selectedItem = getSelectedValue();
+        if (selectedItem == null && sortedTags.size() > 0) {
+          selectedItem = sortedTags.get(0);
+        }
+        myComboBox.removeAllItems();
+        myComboBox.addItem(myMasterTag);
+        for (GithubTagInfo tag : sortedTags) {
+          myComboBox.addItem(tag);
+        }
+        if (selectedItem != null) {
+          // restore previously selected item
+          for (int i = 0; i < myComboBox.getItemCount(); i++) {
+            GithubTagInfo item = GithubTagInfo.tryCast(myComboBox.getItemAt(i));
+            if (item != null && item.getName().equals(selectedItem.getName())) {
+              myComboBox.setSelectedIndex(i);
+              break;
+            }
+          }
+        }
+        myComboBox.updateUI();
+        fireStateChanged();
+      }
+
+      private boolean shouldUpdate(Set<GithubTagInfo> newTags) {
+        if (myComboBox.getItemCount() == 0) {
+          return true;
+        }
+        int count = myComboBox.getItemCount();
+        Set<GithubTagInfo> oldTags = Sets.newHashSet();
+        for (int i = 1; i < count; i++) {
+          GithubTagInfo item = ObjectUtils.tryCast(myComboBox.getItemAt(i), GithubTagInfo.class);
+          if (item != null) {
+            oldTags.add(item);
+          }
+        }
+        return !oldTags.equals(newTags);
+      }
+
+      @SuppressWarnings("unchecked")
+      @NotNull
+      @Override
+      protected JComboBox createValuesComboBox() {
+        JComboBox box = super.createValuesComboBox();
+        box.setRenderer(new ListCellRendererWrapper<GithubTagInfo>() {
+          @Override
+          public void customize(JList list, GithubTagInfo tag, int index, boolean selected, boolean hasFocus) {
+            final String text;
+            if (tag == null) {
+              text = isBackgroundJobRunning() ? "Loading..." : "Unavailable";
+            }
+            else {
+              text = tag.getName();
+            }
+            setText(text);
+          }
+        });
+
+        return box;
+      }
+    };
+
+    myVersionPanel = myReloadableComboBoxPanel.getMainPanel();
   }
 
   private final List<WebProjectGenerator.SettingsStateListener> myListeners = ContainerUtil.newArrayList();
   private final GithubTagInfo myMasterTag;
   private final GithubTagListProvider myTagListProvider;
-  private final AsyncProcessIcon myLoadingVersionIcon = new AsyncProcessIcon("Getting github tags");
-  private final JLabel myErrorMessage = new JLabel();
-  private JComboBox myComboBox;
   private JComponent myComponent;
   private JPanel myVersionPanel;
-  private JPanel myActionPanel;
-  private UpdateStatus myUpdateStatus;
+  private ReloadableComboBoxPanel<GithubTagInfo> myReloadableComboBoxPanel;
 
   public GithubProjectGeneratorPeer(@NotNull AbstractGithubTagDownloadedProjectGenerator generator) {
-    myErrorMessage.setForeground(JBColor.RED);
     String ghUserName = generator.getGithubUserName();
     String ghRepoName = generator.getGithubRepositoryName();
     myMasterTag = new GithubTagInfo(
@@ -75,87 +126,33 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator
       String.format("https://github.com/%s/%s/zipball/master", ghUserName, ghRepoName)
     );
 
-    myComboBox.setRenderer(new ListCellRendererWrapper<GithubTagInfo>() {
+    myTagListProvider = new GithubTagListProvider(ghUserName, ghRepoName);
+
+    myReloadableComboBoxPanel.setDataProvider(new ReloadableComboBoxPanel.DataProvider<GithubTagInfo>() {
       @Override
-      public void customize(JList list, GithubTagInfo tag, int index, boolean selected, boolean hasFocus) {
-        final String text;
-        if (tag == null) {
-          text = isBackgroundJobRunning() ? "Loading..." : "Unavailable";
-        }
-        else {
-          text = tag.getName();
-        }
-        setText(text);
+      public Set<GithubTagInfo> getCachedValues() {
+        return myTagListProvider.getCachedTags();
+      }
+
+      @Override
+      public void updateValuesAsynchronously() {
+        myTagListProvider.updateTagListAsynchronously(GithubProjectGeneratorPeer.this);
       }
     });
 
-    myTagListProvider = new GithubTagListProvider(ghUserName, ghRepoName);
-    fillActionPanel();
-    ImmutableSet<GithubTagInfo> cachedTags = myTagListProvider.getCachedTags();
-    if (cachedTags != null) {
-      onTagsUpdated(cachedTags);
-    }
-    reloadTagsInBackground();
+    myReloadableComboBoxPanel.reloadValuesInBackground();
   }
 
   void onTagsUpdated(@NotNull ImmutableSet<GithubTagInfo> tags) {
-    changeUpdateStatus(UpdateStatus.IDLE);
-    if (!shouldUpdate(tags)) {
-      return;
-    }
-    List<GithubTagInfo> sortedTags = createSortedTagList(tags);
-    GithubTagInfo selectedItem = getSelectedTag();
-    if (selectedItem == null && sortedTags.size() > 0) {
-      selectedItem = sortedTags.get(0);
-    }
-    myComboBox.removeAllItems();
-    myComboBox.addItem(myMasterTag);
-    for (GithubTagInfo tag : sortedTags) {
-      myComboBox.addItem(tag);
-    }
-    if (selectedItem != null) {
-      // restore previously selected item
-      for (int i = 0; i < myComboBox.getItemCount(); i++) {
-        GithubTagInfo item = GithubTagInfo.tryCast(myComboBox.getItemAt(i));
-        if (item != null && item.getName().equals(selectedItem.getName())) {
-          myComboBox.setSelectedIndex(i);
-          break;
-        }
-      }
-    }
-    myComboBox.updateUI();
-    fireStateChanged();
+    myReloadableComboBoxPanel.onUpdateValues(tags);
   }
 
   void onTagsUpdateError(@NotNull final String errorMessage) {
-    UIUtil.invokeLaterIfNeeded(new Runnable() {
-      @Override
-      public void run() {
-        if (getSelectedTag() == null) {
-          myErrorMessage.setText(errorMessage);
-        }
-        changeUpdateStatus(UpdateStatus.IDLE);
-      }
-    });
-  }
-
-  private boolean shouldUpdate(@NotNull ImmutableSet<GithubTagInfo> newTags) {
-    if (myComboBox.getItemCount() == 0) {
-      return true;
-    }
-    int count = myComboBox.getItemCount();
-    Set<GithubTagInfo> oldTags = Sets.newHashSet();
-    for (int i = 1; i < count; i++) {
-      GithubTagInfo item = ObjectUtils.tryCast(myComboBox.getItemAt(i), GithubTagInfo.class);
-      if (item != null) {
-        oldTags.add(item);
-      }
-    }
-    return !oldTags.equals(newTags);
+    myReloadableComboBoxPanel.onValuesUpdateError(errorMessage);
   }
 
   @NotNull
-  private static List<GithubTagInfo> createSortedTagList(@NotNull ImmutableCollection<GithubTagInfo> tags) {
+  private static List<GithubTagInfo> createSortedTagList(@NotNull Collection<GithubTagInfo> tags) {
     List<GithubTagInfo> sortedTags = ContainerUtil.newArrayList(tags);
     Collections.sort(sortedTags, new Comparator<GithubTagInfo>() {
       @Override
@@ -184,13 +181,13 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator
   @Override
   public void buildUI(@NotNull SettingsStep settingsStep) {
     settingsStep.addSettingsField("\u001BVersion:", myVersionPanel);
-    settingsStep.addSettingsComponent(myErrorMessage);
+    settingsStep.addSettingsComponent(myReloadableComboBoxPanel.getErrorComponent());
   }
 
   @NotNull
   @Override
   public GithubTagInfo getSettings() {
-    GithubTagInfo tag = getSelectedTag();
+    GithubTagInfo tag = myReloadableComboBoxPanel.getSelectedValue();
     if (tag == null) {
       throw new RuntimeException("[internal error] No versions available.");
     }
@@ -200,11 +197,11 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator
   @Override
   @Nullable
   public ValidationInfo validate() {
-    GithubTagInfo tag = getSelectedTag();
+    GithubTagInfo tag = myReloadableComboBoxPanel.getSelectedValue();
     if (tag != null) {
       return null;
     }
-    String errorMessage = StringUtil.notNullize(myErrorMessage.getText());
+    String errorMessage = StringUtil.notNullize(myReloadableComboBoxPanel.getErrorComponent().getText());
     if (errorMessage.isEmpty()) {
       errorMessage = "Versions have not been loaded yet.";
     }
@@ -213,7 +210,7 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator
 
   @Override
   public boolean isBackgroundJobRunning() {
-    return myUpdateStatus == UpdateStatus.UPDATING;
+    return myReloadableComboBoxPanel.isBackgroundJobRunning();
   }
 
   @Override
@@ -221,78 +218,11 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator
     myListeners.add(listener);
   }
 
-  @Nullable
-  private GithubTagInfo getSelectedTag() {
-    return GithubTagInfo.tryCast(myComboBox.getSelectedItem());
-  }
 
   private void fireStateChanged() {
-    GithubTagInfo tag = getSelectedTag();
+    GithubTagInfo tag = myReloadableComboBoxPanel.getSelectedValue();
     for (WebProjectGenerator.SettingsStateListener listener : myListeners) {
       listener.stateChanged(tag != null);
     }
   }
-
-  private void reloadTagsInBackground() {
-    changeUpdateStatus(UpdateStatus.UPDATING);
-    myErrorMessage.setText(null);
-    myTagListProvider.updateTagListAsynchronously(this);
-  }
-
-  private void changeUpdateStatus(@NotNull UpdateStatus status) {
-    CardLayout cardLayout = (CardLayout) myActionPanel.getLayout();
-    cardLayout.show(myActionPanel, status.name());
-    if (status == UpdateStatus.UPDATING) {
-      myLoadingVersionIcon.resume();
-    }
-    else {
-      myLoadingVersionIcon.suspend();
-    }
-    myUpdateStatus = status;
-  }
-
-  private void fillActionPanel() {
-    myActionPanel.add(createReloadButtonPanel(), UpdateStatus.IDLE.name());
-    myActionPanel.add(createReloadInProgressPanel(), UpdateStatus.UPDATING.name());
-    changeUpdateStatus(UpdateStatus.IDLE);
-  }
-
-  @NotNull
-  private JPanel createReloadButtonPanel() {
-    ReloadAction reloadAction = new ReloadAction();
-    ActionButton reloadButton = new ActionButton(
-      reloadAction,
-      reloadAction.getTemplatePresentation().clone(),
-      CONTROL_PLACE,
-      ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE
-    );
-    JPanel panel = new JPanel(new BorderLayout(0, 0));
-    panel.add(reloadButton, BorderLayout.WEST);
-    return panel;
-  }
-
-  @NotNull
-  private JPanel createReloadInProgressPanel() {
-    JPanel panel = new JPanel();
-    panel.add(myLoadingVersionIcon);
-    return panel;
-  }
-
-  private class ReloadAction extends AnAction {
-
-    private ReloadAction() {
-      super("Reload versions", null, AllIcons.Actions.Refresh);
-    }
-
-    @Override
-    public void actionPerformed(AnActionEvent e) {
-      GithubProjectGeneratorPeer.this.reloadTagsInBackground();
-    }
-
-    @Override
-    public void update(AnActionEvent e) {
-      e.getPresentation().setEnabled(true);
-    }
-  }
-
 }
index 5a181694c5dba463578c77fca67413a8962d8d87..8e43717da3cca61303130fdc8c7fc85e7ed51354 100644 (file)
@@ -33,6 +33,7 @@ import com.intellij.ui.BrowserHyperlinkListener;
 import com.intellij.ui.DocumentAdapter;
 import com.intellij.ui.InsertPathAction;
 import com.intellij.ui.ScrollPaneFactory;
+import com.intellij.ui.MessageException;
 import com.intellij.ui.components.JBScrollPane;
 import com.intellij.ui.mac.MacMessages;
 import com.intellij.ui.mac.foundation.MacUtil;
@@ -485,6 +486,9 @@ public class Messages {
         return MacMessages.getInstance().showYesNoDialog(title, message, yesText, noText, null, doNotAskOption);
       }
     }
+    catch (MessageException messageException) {
+      // just show a dialog instead
+    }
     catch (Exception exception) {
       LOG.error(exception);
     }
similarity index 82%
rename from platform/platform-impl/src/com/intellij/ui/mac/MacMessageException.java
rename to platform/platform-api/src/com/intellij/ui/MessageException.java
index a6609cda40de925747d926d38ec8b673c71972e1..8e3da8b693b5052ade215b9c52246b0d81f00fe1 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.ui.mac;
+package com.intellij.ui;
 
 /**
  * Created by denis on 28/01/14.
  */
-public class MacMessageException extends RuntimeException {
-  public MacMessageException(final String message) {
+public class MessageException extends RuntimeException {
+  public MessageException(final String message) {
     super(message);
   }
 }
index 196d36ea5a6b8e45354fc7a4d32c4b8455bafd20..ba932e1d5d6a175354ff7aa07655581464098ac2 100644 (file)
@@ -20,12 +20,11 @@ import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
 import com.intellij.ide.ui.LafManager;
 import com.intellij.ide.ui.UISettings;
 import com.intellij.ide.util.PropertiesComponent;
-import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.editor.EditorFactory;
 import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
 import com.intellij.openapi.editor.ex.util.EditorUtil;
-import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.util.registry.RegistryValue;
@@ -33,7 +32,9 @@ import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
 
-public class ToggleDistractionFreeModeAction extends AnAction implements DumbAware {
+import static java.lang.String.valueOf;
+
+public class ToggleDistractionFreeModeAction extends DumbAwareAction {
   private static final String key = "editor.distraction.free.mode";
 
   @Override
@@ -51,49 +52,24 @@ public class ToggleDistractionFreeModeAction extends AnAction implements DumbAwa
   public void actionPerformed(@NotNull AnActionEvent e) {
     Project project = e.getProject();
     RegistryValue value = Registry.get(key);
-    boolean v = !value.asBoolean();
-    value.setValue(v);
+    boolean enter = !value.asBoolean();
+    value.setValue(enter);
 
     if (project == null) return;
 
-    PropertiesComponent p = PropertiesComponent.getInstance(project);
+    PropertiesComponent p = PropertiesComponent.getInstance();
     UISettings ui = UISettings.getInstance();
     EditorSettingsExternalizable.OptionSet eo = EditorSettingsExternalizable.getInstance().getOptions();
     DaemonCodeAnalyzerSettings ds = DaemonCodeAnalyzerSettings.getInstance();
 
     String before = "BEFORE.DISTRACTION.MODE.";
-    if (v) {
-      p.setValue(before + "SHOW_STATUS_BAR", String.valueOf(ui.SHOW_STATUS_BAR)); ui.SHOW_STATUS_BAR = false; 
-      p.setValue(before + "SHOW_MAIN_TOOLBAR", String.valueOf(ui.SHOW_MAIN_TOOLBAR)); ui.SHOW_MAIN_TOOLBAR = false; 
-      p.setValue(before + "SHOW_NAVIGATION_BAR", String.valueOf(ui.SHOW_NAVIGATION_BAR)); ui.SHOW_NAVIGATION_BAR = false; 
-      p.setValue(before + "HIDE_TOOL_STRIPES", String.valueOf(ui.HIDE_TOOL_STRIPES)); ui.HIDE_TOOL_STRIPES = true;
-      p.setValue(before + "EDITOR_TAB_PLACEMENT", String.valueOf(ui.EDITOR_TAB_PLACEMENT)); ui.EDITOR_TAB_PLACEMENT = UISettings.TABS_NONE;
-
-      p.setValue(before + "IS_FOLDING_OUTLINE_SHOWN", String.valueOf(eo.IS_FOLDING_OUTLINE_SHOWN)); eo.IS_FOLDING_OUTLINE_SHOWN = false; 
-      p.setValue(before + "IS_WHITESPACES_SHOWN", String.valueOf(eo.IS_WHITESPACES_SHOWN)); eo.IS_WHITESPACES_SHOWN = false; 
-      p.setValue(before + "ARE_LINE_NUMBERS_SHOWN", String.valueOf(eo.ARE_LINE_NUMBERS_SHOWN)); eo.ARE_LINE_NUMBERS_SHOWN = false; 
-      //p.setValue(before + "IS_RIGHT_MARGIN_SHOWN", String.valueOf(eo.IS_RIGHT_MARGIN_SHOWN)); eo.IS_RIGHT_MARGIN_SHOWN = false; 
-      p.setValue(before + "IS_INDENT_GUIDES_SHOWN", String.valueOf(eo.IS_INDENT_GUIDES_SHOWN)); eo.IS_INDENT_GUIDES_SHOWN = false; 
-      
-      p.setValue(before + "SHOW_METHOD_SEPARATORS", String.valueOf(ds.SHOW_METHOD_SEPARATORS)); ds.SHOW_METHOD_SEPARATORS = false; 
-      
+    String after = "AFTER.DISTRACTION.MODE.";
+    if (enter) {
+      applyAndSave(p, ui, eo, ds, before, after, false);
       TogglePresentationModeAction.storeToolWindows(project);
     }
     else {
-      ui.SHOW_STATUS_BAR = p.getBoolean(before + "SHOW_STATUS_BAR", true);
-      ui.SHOW_MAIN_TOOLBAR = p.getBoolean(before + "SHOW_MAIN_TOOLBAR", true);
-      ui.SHOW_NAVIGATION_BAR = p.getBoolean(before + "SHOW_NAVIGATION_BAR", true);
-      ui.HIDE_TOOL_STRIPES = p.getBoolean(before + "HIDE_TOOL_STRIPES", true);
-      ui.EDITOR_TAB_PLACEMENT = p.getOrInitInt(before + "EDITOR_TAB_PLACEMENT", SwingConstants.TOP);
-
-      eo.IS_FOLDING_OUTLINE_SHOWN = p.getBoolean(before + "IS_FOLDING_OUTLINE_SHOWN", true);
-      eo.IS_WHITESPACES_SHOWN = p.getBoolean(before + "IS_WHITESPACES_SHOWN", false);
-      eo.ARE_LINE_NUMBERS_SHOWN = p.getBoolean(before + "ARE_LINE_NUMBERS_SHOWN", false);
-      //eo.IS_RIGHT_MARGIN_SHOWN = p.getBoolean(before + "IS_RIGHT_MARGIN_SHOWN", true);
-      eo.IS_INDENT_GUIDES_SHOWN = p.getBoolean(before + "IS_INDENT_GUIDES_SHOWN", false);
-      
-      ds.SHOW_METHOD_SEPARATORS = p.getBoolean(before + "SHOW_METHOD_SEPARATORS", false);
-
+      applyAndSave(p, ui, eo, ds, after, before, true);    
       TogglePresentationModeAction.restoreToolWindows(project, true, false);
     }
 
@@ -103,4 +79,27 @@ public class ToggleDistractionFreeModeAction extends AnAction implements DumbAwa
     DaemonCodeAnalyzer.getInstance(project).settingsChanged();
     EditorFactory.getInstance().refreshAllEditors();
   }
+
+  public static void applyAndSave(@NotNull PropertiesComponent p,
+                                  @NotNull UISettings ui,
+                                  @NotNull EditorSettingsExternalizable.OptionSet eo,
+                                  @NotNull DaemonCodeAnalyzerSettings ds,
+                                  String before, String after, boolean value) {
+    // @formatter:off
+    p.setValue(before + "SHOW_STATUS_BAR",          valueOf(ui.SHOW_STATUS_BAR));           ui.SHOW_STATUS_BAR          = p.getBoolean(after + "SHOW_STATUS_BAR",  value); 
+    p.setValue(before + "SHOW_MAIN_TOOLBAR",        valueOf(ui.SHOW_MAIN_TOOLBAR));         ui.SHOW_MAIN_TOOLBAR        = p.getBoolean(after + "SHOW_MAIN_TOOLBAR", value); 
+    p.setValue(before + "SHOW_NAVIGATION_BAR",      valueOf(ui.SHOW_NAVIGATION_BAR));       ui.SHOW_NAVIGATION_BAR      = p.getBoolean(after + "SHOW_NAVIGATION_BAR", value); 
+
+    p.setValue(before + "IS_FOLDING_OUTLINE_SHOWN", valueOf(eo.IS_FOLDING_OUTLINE_SHOWN));  eo.IS_FOLDING_OUTLINE_SHOWN = p.getBoolean(after + "IS_FOLDING_OUTLINE_SHOWN", value); 
+    p.setValue(before + "IS_WHITESPACES_SHOWN",     valueOf(eo.IS_WHITESPACES_SHOWN));      eo.IS_WHITESPACES_SHOWN     = p.getBoolean(after + "IS_WHITESPACES_SHOWN", value); 
+    p.setValue(before + "ARE_LINE_NUMBERS_SHOWN",   valueOf(eo.ARE_LINE_NUMBERS_SHOWN));    eo.ARE_LINE_NUMBERS_SHOWN   = p.getBoolean(after + "ARE_LINE_NUMBERS_SHOWN", value); 
+    p.setValue(before + "IS_RIGHT_MARGIN_SHOWN",    valueOf(eo.IS_RIGHT_MARGIN_SHOWN));     eo.IS_RIGHT_MARGIN_SHOWN    = p.getBoolean(after + "IS_RIGHT_MARGIN_SHOWN", value); 
+    p.setValue(before + "IS_INDENT_GUIDES_SHOWN",   valueOf(eo.IS_INDENT_GUIDES_SHOWN));    eo.IS_INDENT_GUIDES_SHOWN   = p.getBoolean(after + "IS_INDENT_GUIDES_SHOWN", value); 
+
+    p.setValue(before + "SHOW_METHOD_SEPARATORS",   valueOf(ds.SHOW_METHOD_SEPARATORS));    ds.SHOW_METHOD_SEPARATORS   = p.getBoolean(after + "SHOW_METHOD_SEPARATORS", value);
+    
+    p.setValue(before + "HIDE_TOOL_STRIPES",        valueOf(ui.HIDE_TOOL_STRIPES));         ui.HIDE_TOOL_STRIPES        = p.getBoolean(after + "HIDE_TOOL_STRIPES", !value);
+    p.setValue(before + "EDITOR_TAB_PLACEMENT",     valueOf(ui.EDITOR_TAB_PLACEMENT));      ui.EDITOR_TAB_PLACEMENT     = p.getOrInitInt(after + "EDITOR_TAB_PLACEMENT", value ? SwingConstants.TOP : UISettings.TABS_NONE);
+    // @formatter:on
+  }
 }
index 7d9d231cd6d88801739c389c0e13d3ce1b9c194a..52cdc8c558e291bdf6d7000aa6d03072aa15c833 100644 (file)
@@ -134,7 +134,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
   private static final boolean HONOR_CAMEL_HUMPS_ON_TRIPLE_CLICK =
     Boolean.parseBoolean(System.getProperty("idea.honor.camel.humps.on.triple.click"));
   private static final Key<BufferedImage> BUFFER = Key.create("buffer");
-  public static final JBColor CURSOR_FOREGROUND = new JBColor(Gray._255, Gray._0);
+  public static final Color CURSOR_FOREGROUND_LIGHT = Gray._255;
+  public static final Color CURSOR_FOREGROUND_DARK = Gray._0;
   @NotNull private final DocumentEx myDocument;
 
   private final JPanel myPanel;
@@ -250,6 +251,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
   private boolean myEmbeddedIntoDialogWrapper;
   @Nullable private CachedFontContent myLastCache;
   private int myDragOnGutterSelectionStartLine = -1;
+  private RangeMarker myDraggedRange;
 
   private boolean mySoftWrapsChanged;
 
@@ -4344,10 +4346,12 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
             if (caretShift != 0) {
               if (myMousePressedEvent != null) {
                 if (mySettings.isDndEnabled()) {
-                  boolean isCopy = UIUtil.isControlKeyDown(e) || isViewer() || !getDocument().isWritable();
-                  mySavedCaretOffsetForDNDUndoHack = oldCaretOffset;
-                  getContentComponent().getTransferHandler()
-                    .exportAsDrag(getContentComponent(), e, isCopy ? TransferHandler.COPY : TransferHandler.MOVE);
+                  if (myDraggedRange == null) {
+                    boolean isCopy = UIUtil.isControlKeyDown(e) || isViewer() || !getDocument().isWritable();
+                    mySavedCaretOffsetForDNDUndoHack = oldCaretOffset;
+                    getContentComponent().getTransferHandler()
+                      .exportAsDrag(getContentComponent(), e, isCopy ? TransferHandler.COPY : TransferHandler.MOVE);
+                  }
                 }
                 else {
                   selectionModel.removeSelection();
@@ -4364,6 +4368,13 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
     }
   }
 
+  private void clearDraggedRange() {
+    if (myDraggedRange != null) {
+      myDraggedRange.dispose();
+      myDraggedRange = null;
+    }
+  }
+
   private void createSelectionTill(@NotNull LogicalPosition targetPosition) {
     List<CaretState> caretStates = new ArrayList<CaretState>(myCaretStateBeforeLastPress);
     if (myRectangularSelectionInProgress) {
@@ -4737,7 +4748,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
           //todo[kb]
           //in case of italic style we paint out of the cursor block. Painting the symbol to a dedicated buffered image
           //solves the problem, but still looks weird because it leaves colored pixels at right.
-          g.setColor(CURSOR_FOREGROUND);
+          g.setColor(ColorUtil.isDark(caretColor) ? CURSOR_FOREGROUND_LIGHT : CURSOR_FOREGROUND_DARK);
           g.drawChars(new char[]{ch}, 0, 1, x, y + getAscent());
         }
       }
@@ -5587,6 +5598,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
       myLastMousePressedLocation = xyToLogicalPosition(e.getPoint());
       myCaretStateBeforeLastPress = isToggleCaretEvent(e) ? myCaretModel.getCaretsAndSelections() : Collections.<CaretState>emptyList();
       myCurrentDragIsSubstantial = false;
+      clearDraggedRange();
 
       final int clickOffset = logicalPositionToOffset(myLastMousePressedLocation);
       putUserData(EditorActionUtil.EXPECTED_CARET_OFFSET, clickOffset);
@@ -6240,16 +6252,14 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
   }
 
   private static class MyTransferHandler extends TransferHandler {
-    private RangeMarker myDraggedRange = null;
-
-    private static Editor getEditor(@NotNull JComponent comp) {
+    private static EditorImpl getEditor(@NotNull JComponent comp) {
       EditorComponentImpl editorComponent = (EditorComponentImpl)comp;
       return editorComponent.getEditor();
     }
 
     @Override
     public boolean importData(@NotNull final JComponent comp, @NotNull final Transferable t) {
-      final EditorImpl editor = (EditorImpl)getEditor(comp);
+      final EditorImpl editor = getEditor(comp);
 
       final EditorDropHandler dropHandler = editor.getDropHandler();
       if (dropHandler != null && dropHandler.canHandleDrop(t.getTransferDataFlavors())) {
@@ -6258,11 +6268,12 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
       }
 
       final int caretOffset = editor.getCaretModel().getOffset();
-      if (myDraggedRange != null && myDraggedRange.getStartOffset() <= caretOffset && caretOffset < myDraggedRange.getEndOffset()) {
+      if (editor.myDraggedRange != null
+          && editor.myDraggedRange.getStartOffset() <= caretOffset && caretOffset < editor.myDraggedRange.getEndOffset()) {
         return false;
       }
 
-      if (myDraggedRange != null) {
+      if (editor.myDraggedRange != null) {
         editor.getCaretModel().moveToOffset(editor.mySavedCaretOffsetForDNDUndoHack);
       }
 
@@ -6276,7 +6287,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
                 editor.getSelectionModel().removeSelection();
 
                 final int offset;
-                if (myDraggedRange != null) {
+                if (editor.myDraggedRange != null) {
                   editor.getCaretModel().moveToOffset(caretOffset);
                   offset = caretOffset;
                 }
@@ -6337,12 +6348,12 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
     @Override
     @Nullable
     protected Transferable createTransferable(JComponent c) {
-      Editor editor = getEditor(c);
+      EditorImpl editor = getEditor(c);
       String s = editor.getSelectionModel().getSelectedText();
       if (s == null) return null;
       int selectionStart = editor.getSelectionModel().getSelectionStart();
       int selectionEnd = editor.getSelectionModel().getSelectionEnd();
-      myDraggedRange = editor.getDocument().createRangeMarker(selectionStart, selectionEnd);
+      editor.myDraggedRange = editor.getDocument().createRangeMarker(selectionStart, selectionEnd);
 
       return new StringSelection(s);
     }
@@ -6360,8 +6371,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
 
       if (last != null && !(last instanceof EditorComponentImpl)) return;
 
-      final Editor editor = getEditor(source);
-      if (action == MOVE && !editor.isViewer() && myDraggedRange != null) {
+      final EditorImpl editor = getEditor(source);
+      if (action == MOVE && !editor.isViewer() && editor.myDraggedRange != null) {
         if (!FileDocumentManager.getInstance().requestWriting(editor.getDocument(), editor.getProject())) {
           return;
         }
@@ -6374,7 +6385,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
                 Document doc = editor.getDocument();
                 doc.startGuardedBlockChecking();
                 try {
-                  doc.deleteString(myDraggedRange.getStartOffset(), myDraggedRange.getEndOffset());
+                  doc.deleteString(editor.myDraggedRange.getStartOffset(), editor.myDraggedRange.getEndOffset());
                 }
                 catch (ReadOnlyFragmentModificationException e) {
                   EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e);
@@ -6388,7 +6399,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
         }, EditorBundle.message("move.selection.command.name"), DND_COMMAND_KEY, UndoConfirmationPolicy.DEFAULT, editor.getDocument());
       }
 
-      myDraggedRange = null;
+      editor.clearDraggedRange();
     }
   }
 
index 7b3bd2198cf91a20d1bc78046c0f718c50366fd7..42d88cf5a4a00170ca5be14ee23834395285542a 100644 (file)
@@ -63,6 +63,7 @@ public class DumbServiceImpl extends DumbService implements Disposable {
   
   private final Queue<Runnable> myRunWhenSmartQueue = new Queue<Runnable>(5);
   private final Project myProject;
+  private ThreadLocal<Boolean> myAlternativeResolution = new ThreadLocal<Boolean>();
 
   public DumbServiceImpl(Project project) {
     myProject = project;
@@ -104,6 +105,17 @@ public class DumbServiceImpl extends DumbService implements Disposable {
     return myProject;
   }
 
+  @Override
+  public boolean isAlternativeResolveEnabled() {
+    return Boolean.TRUE.equals(myAlternativeResolution.get());
+  }
+
+  @Override
+  public void setAlternativeResolveEnabled(boolean enabled) {
+    assert isAlternativeResolveEnabled() != enabled : "Nested alternative resolution mode is not supported";
+    myAlternativeResolution.set(enabled);
+  }
+
   @Override
   public boolean isDumb() {
     return myDumb;
index 1ffa4e261858229993bcdc1b3a00069b7d2d9239..ce1d3b51407a1983ca09bfd2b9d2681b7840f629 100644 (file)
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.wm.IdeFocusManager;
 import com.intellij.openapi.wm.WindowManager;
 import com.intellij.openapi.wm.impl.ModalityHelper;
+import com.intellij.ui.MessageException;
 import com.intellij.ui.mac.foundation.ID;
 import com.intellij.ui.mac.foundation.MacUtil;
 import com.intellij.util.ui.UIUtil;
@@ -332,7 +333,7 @@ public class MacMessagesImpl extends MacMessages {
           method.invoke(theQueue, event);
         }
       }
-      catch (MacMessageException mme) {
+      catch (MessageException mme) {
         throw mme;
       }
       catch (Throwable e) {
@@ -428,7 +429,7 @@ public class MacMessagesImpl extends MacMessages {
 
     private ID getParamsAsID() {
       if (window == null) {
-        throw new MacMessageException("Window should be in the list.");
+        throw new MessageException("Window should be in the list.");
       }
       params.put(COMMON_DIALOG_PARAM_TYPE.nativeFocusedWindow, window);
 
@@ -598,7 +599,7 @@ public class MacMessagesImpl extends MacMessages {
         //}
         queuesFromDocumentRoot.remove(documentRoot);
         if (blockedDocumentRoots.remove(documentRoot) != null) {
-          throw new MacMessageException("Owner window has been removed");
+          throw new MessageException("Owner window has been removed");
         }
       }
     });
@@ -732,7 +733,7 @@ public class MacMessagesImpl extends MacMessages {
     if (SystemInfo.isAppleJvm && MacUtil.getWindowTitle(_window) == null) {
       // With Apple JDK we cannot find a window if it does not have a title
       // Let's show a dialog instead of the message.
-      throw new MacMessageException("MacMessage parent does not have a title.");
+      throw new MessageException("MacMessage parent does not have a title.");
     }
     while (_window != null && MacUtil.getWindowTitle(_window) == null) {
       _window = _window.getOwner();
index fcc0d5667ec4fcae67fe103765f085c4b9e55064..b1ca220609aa125afd8f63d6c5af9600bc36ba13 100644 (file)
@@ -22,7 +22,7 @@ import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.wm.IdeFocusManager;
 import com.intellij.openapi.wm.WindowManager;
 import com.intellij.openapi.wm.impl.ModalityHelper;
-import com.intellij.ui.mac.MacMessageException;
+import com.intellij.ui.MessageException;
 import com.intellij.ui.mac.MacMessagesEmulation;
 import com.intellij.ui.mac.foundation.MacUtil;
 import com.intellij.util.ui.UIUtil;
@@ -149,7 +149,7 @@ public class JBMacMessages extends MacMessagesEmulation {
     if (SystemInfo.isAppleJvm && MacUtil.getWindowTitle(_window) == null) {
       // With Apple JDK we cannot find a window if it does not have a title
       // Let's show a dialog instead of the message.
-      throw new MacMessageException("MacMessage parent does not have a title.");
+      throw new MessageException("MacMessage parent does not have a title.");
     }
     while (_window != null && MacUtil.getWindowTitle(_window) == null) {
       _window = _window.getOwner();
diff --git a/platform/platform-impl/src/com/intellij/util/ui/ReloadableComboBoxPanel.form b/platform/platform-impl/src/com/intellij/util/ui/ReloadableComboBoxPanel.form
new file mode 100644 (file)
index 0000000..3f7b568
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.util.ui.ReloadableComboBoxPanel">
+  <grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+    <margin top="0" left="0" bottom="0" right="0"/>
+    <constraints>
+      <xy x="20" y="20" width="500" height="31"/>
+    </constraints>
+    <properties/>
+    <border type="none"/>
+    <children>
+      <component id="78550" class="javax.swing.JComboBox" binding="myComboBox" custom-create="true">
+        <constraints>
+          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
+            <minimum-size width="150" height="-1"/>
+          </grid>
+        </constraints>
+        <properties/>
+      </component>
+      <hspacer id="e0811">
+        <constraints>
+          <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+        </constraints>
+      </hspacer>
+      <grid id="c8f68" binding="myActionPanel" layout-manager="CardLayout" hgap="0" vgap="0">
+        <constraints>
+          <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties/>
+        <border type="none"/>
+        <children/>
+      </grid>
+    </children>
+  </grid>
+</form>
diff --git a/platform/platform-impl/src/com/intellij/util/ui/ReloadableComboBoxPanel.java b/platform/platform-impl/src/com/intellij/util/ui/ReloadableComboBoxPanel.java
new file mode 100644 (file)
index 0000000..fb6849a
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2000-2014 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.util.ui;
+
+import com.intellij.icons.AllIcons;
+import com.intellij.openapi.actionSystem.ActionToolbar;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.impl.ActionButton;
+import com.intellij.openapi.ui.ComboBox;
+import com.intellij.ui.JBColor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Set;
+
+public abstract class ReloadableComboBoxPanel<T> {
+  public interface DataProvider<T> {
+
+    /**
+     * returns init cached values
+     */
+    @Nullable
+    Set<T> getCachedValues();
+
+    /**
+     * After getting values method must call #onUpdateValues or #onValuesUpdateError
+     */
+    void updateValuesAsynchronously();
+  }
+
+  private static final String CONTROL_PLACE = "UI.Configuration.Component.Reload.Panel";
+
+  private final AsyncProcessIcon myLoadingVersionIcon = new AsyncProcessIcon("Getting possible values");
+
+  private final JLabel myErrorMessage = new JLabel();
+  @Nullable
+  private volatile DataProvider<T> myDataProvider;
+  @Nullable
+  private volatile UpdateStatus myUpdateStatus;
+  protected JComboBox myComboBox;
+
+  protected JPanel myActionPanel;
+  protected JPanel myMainPanel;
+  public ReloadableComboBoxPanel() {
+    myErrorMessage.setForeground(JBColor.RED);
+    fillActionPanel();
+  }
+
+  public final void setDataProvider(@NotNull DataProvider<T> dataProvider) {
+    myDataProvider = dataProvider;
+
+    Set<T> cachedValues = dataProvider.getCachedValues();
+    if (cachedValues != null) {
+      onUpdateValues(cachedValues);
+    }
+  }
+
+  protected abstract void doUpdateValues(@NotNull Set<T> values);
+
+  @SuppressWarnings("unchecked")
+  public T getSelectedValue() {
+    return (T)myComboBox.getSelectedItem();
+  }
+
+  @NotNull
+  public final JLabel getErrorComponent() {
+    return myErrorMessage;
+  }
+
+  public final boolean isBackgroundJobRunning() {
+    return myUpdateStatus == UpdateStatus.UPDATING;
+  }
+
+  public final void onUpdateValues(@NotNull Set<T> values) {
+    changeUpdateStatus(UpdateStatus.IDLE);
+    doUpdateValues(values);
+  }
+
+  public final void reloadValuesInBackground() {
+    if (myUpdateStatus == UpdateStatus.UPDATING) return;
+    changeUpdateStatus(UpdateStatus.UPDATING);
+    myErrorMessage.setText(null);
+    DataProvider<T> provider = myDataProvider;
+    assert provider != null;
+    provider.updateValuesAsynchronously();
+  }
+
+  private void changeUpdateStatus(@NotNull UpdateStatus status) {
+    CardLayout cardLayout = (CardLayout)myActionPanel.getLayout();
+    cardLayout.show(myActionPanel, status.name());
+    if (status == UpdateStatus.UPDATING) {
+      myLoadingVersionIcon.resume();
+    }
+    else {
+      myLoadingVersionIcon.suspend();
+    }
+    myUpdateStatus = status;
+  }
+
+  private void fillActionPanel() {
+    myActionPanel.add(createReloadButtonPanel(), UpdateStatus.IDLE.name());
+    myActionPanel.add(createReloadInProgressPanel(), UpdateStatus.UPDATING.name());
+    changeUpdateStatus(UpdateStatus.IDLE);
+  }
+
+  public final void onValuesUpdateError(@NotNull final String errorMessage) {
+    UIUtil.invokeLaterIfNeeded(new Runnable() {
+      @Override
+      public void run() {
+        if (getSelectedValue() == null) {
+          myErrorMessage.setText(errorMessage);
+        }
+        changeUpdateStatus(UpdateStatus.IDLE);
+      }
+    });
+  }
+
+
+  @NotNull
+  private JPanel createReloadButtonPanel() {
+    ReloadAction reloadAction = new ReloadAction();
+    ActionButton reloadButton = new ActionButton(
+      reloadAction,
+      reloadAction.getTemplatePresentation().clone(),
+      CONTROL_PLACE,
+      ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE
+    );
+    JPanel panel = new JPanel(new BorderLayout(0, 0));
+    panel.add(reloadButton, BorderLayout.WEST);
+    return panel;
+  }
+
+  @NotNull
+  public final JPanel getMainPanel() {
+    return myMainPanel;
+  }
+
+  @NotNull
+  private JPanel createReloadInProgressPanel() {
+    JPanel panel = new JPanel();
+    panel.add(myLoadingVersionIcon);
+    return panel;
+  }
+
+  private final class ReloadAction extends AnAction {
+
+    private ReloadAction() {
+      super("Reload list", null, AllIcons.Actions.Refresh);
+    }
+
+    @Override
+    public void actionPerformed(AnActionEvent e) {
+      reloadValuesInBackground();
+    }
+
+    @Override
+    public void update(AnActionEvent e) {
+      e.getPresentation().setEnabled(true);
+    }
+  }
+
+  private enum UpdateStatus {
+    UPDATING, IDLE
+  }
+
+  @NotNull
+  protected JComboBox createValuesComboBox() {
+    return new ComboBox();
+  }
+
+  private void createUIComponents() {
+    myComboBox = createValuesComboBox();
+  }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewManagerTest.java b/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewManagerTest.java
new file mode 100644 (file)
index 0000000..3e38bd2
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2014 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.usages.impl;
+
+import com.intellij.find.FindModel;
+import com.intellij.find.impl.FindInProjectUtil;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.search.GlobalSearchScopesCore;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.testFramework.PlatformTestCase;
+import com.intellij.usages.UsageTarget;
+import com.intellij.usages.UsageViewManager;
+
+public class UsageViewManagerTest extends PlatformTestCase {
+  public void testScopeCreatedForFindInDirectory() {
+    VirtualFile dir = getProject().getBaseDir();
+    FindModel findModel = new FindModel();
+    findModel.setDirectoryName(dir.getPath());
+    findModel.setWithSubdirectories(true);
+    findModel.setProjectScope(false);
+    UsageTarget target = new FindInProjectUtil.StringUsageTarget(getProject(), findModel);
+    UsageViewManagerImpl manager = (UsageViewManagerImpl)UsageViewManager.getInstance(getProject());
+    SearchScope scope = manager.getMaxSearchScopeToWarnOfFallingOutOf(new UsageTarget[]{target});
+    assertEquals(scope, GlobalSearchScopesCore.directoryScope(getProject(), dir, true));
+  }
+}
index 04cce1726d389e9c2d612dcc46ddb0b643ec4282..455718c1160d4899d6b4a89f913d468cf159b523 100644 (file)
@@ -122,16 +122,7 @@ public class UsageViewManagerImpl extends UsageViewManager {
                                     @NotNull final UsageViewPresentation presentation,
                                     @NotNull final FindUsagesProcessPresentation processPresentation,
                                     @Nullable final UsageViewStateListener listener) {
-    final SearchScope searchScope = getMaxSearchScopeToWarnOfFallingOutOf(searchFor);
-    return doSearchAndShow(searchFor, searcherFactory, presentation, processPresentation, listener, searchScope);
-  }
-
-  private UsageView doSearchAndShow(@NotNull final UsageTarget[] searchFor,
-                                    @NotNull final Factory<UsageSearcher> searcherFactory,
-                                    @NotNull final UsageViewPresentation presentation,
-                                    @NotNull final FindUsagesProcessPresentation processPresentation,
-                                    @Nullable final UsageViewStateListener listener,
-                                    @NotNull final SearchScope searchScopeToWarnOfFallingOutOf) {
+    final SearchScope searchScopeToWarnOfFallingOutOf = getMaxSearchScopeToWarnOfFallingOutOf(searchFor);
     final AtomicReference<UsageViewImpl> usageViewRef = new AtomicReference<UsageViewImpl>();
 
     Task.Backgroundable task = new Task.Backgroundable(myProject, getProgressTitle(presentation), true, new SearchInBackgroundOption()) {
@@ -159,7 +150,7 @@ public class UsageViewManagerImpl extends UsageViewManager {
   }
 
   @NotNull
-  private SearchScope getMaxSearchScopeToWarnOfFallingOutOf(@NotNull UsageTarget[] searchFor) {
+  SearchScope getMaxSearchScopeToWarnOfFallingOutOf(@NotNull UsageTarget[] searchFor) {
     UsageTarget target = searchFor[0];
     if (target instanceof TypeSafeDataProvider) {
       final SearchScope[] scope = new SearchScope[1];
index b34b7bd4aeabd84da061c2b2ed44b3d803bdbd2d..2e3233570e37911e5d097546279c88b847cdaf9f 100644 (file)
@@ -700,7 +700,9 @@ public class AllIcons {
     public static final Icon WebModule = IconLoader.getIcon("/javaee/webModule.png"); // 16x16
     public static final Icon WebModuleGroup = IconLoader.getIcon("/javaee/webModuleGroup.png"); // 16x16
     public static final Icon WebService = IconLoader.getIcon("/javaee/WebService.png"); // 16x16
+    public static final Icon WebService2 = IconLoader.getIcon("/javaee/WebService2.png"); // 16x16
     public static final Icon WebServiceClient = IconLoader.getIcon("/javaee/WebServiceClient.png"); // 16x16
+    public static final Icon WebServiceClient2 = IconLoader.getIcon("/javaee/WebServiceClient2.png"); // 16x16
 
   }
   
index 779260b26f0df61eed93b15f4cc22329d2b01236..73334983a268b2931f0e8b5c9dcbf510045b6159 100644 (file)
@@ -142,9 +142,27 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
 
   private final MyUpdateButtonsRunnable myUpdateButtonsRunnable = new MyUpdateButtonsRunnable(this);
 
-  public static boolean commitChanges(final Project project, final List<Change> changes, final LocalChangeList initialSelection,
-                                      final List<CommitExecutor> executors, final boolean showVcsCommit, final String comment,
-                                      @Nullable CommitResultHandler customResultHandler, boolean cancelIfNoChanges) {
+  public static boolean commitChanges(final Project project,
+                                      final List<Change> changes,
+                                      final LocalChangeList initialSelection,
+                                      final List<CommitExecutor> executors,
+                                      final boolean showVcsCommit,
+                                      final String comment,
+                                      @Nullable CommitResultHandler customResultHandler,
+                                      boolean cancelIfNoChanges) {
+    return commitChanges(project, changes, initialSelection, executors, showVcsCommit, null, comment, customResultHandler,
+                         cancelIfNoChanges);
+  }
+
+  public static boolean commitChanges(final Project project,
+                                      final List<Change> changes,
+                                      final LocalChangeList initialSelection,
+                                      final List<CommitExecutor> executors,
+                                      final boolean showVcsCommit,
+                                      @Nullable final AbstractVcs singleVcs,
+                                      final String comment,
+                                      @Nullable CommitResultHandler customResultHandler,
+                                      boolean cancelIfNoChanges) {
     if (cancelIfNoChanges && changes.isEmpty() && !ApplicationManager.getApplication().isUnitTestMode()) {
       Messages.showInfoMessage(project, VcsBundle.message("commit.dialog.no.changes.detected.text"),
                                VcsBundle.message("commit.dialog.no.changes.detected.title"));
@@ -159,8 +177,10 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
     }
 
     final ChangeListManager manager = ChangeListManager.getInstance(project);
-    CommitChangeListDialog dialog = new CommitChangeListDialog(project, changes, initialSelection, executors, showVcsCommit, manager.getDefaultChangeList(), manager.getChangeListsCopy(), null,
-                                                               false, comment, customResultHandler);
+    CommitChangeListDialog dialog =
+      new CommitChangeListDialog(project, changes, initialSelection, executors, showVcsCommit, manager.getDefaultChangeList(),
+                                 manager.getChangeListsCopy(), singleVcs,
+                                 false, comment, customResultHandler);
     if (!ApplicationManager.getApplication().isUnitTestMode()) {
       dialog.show();
     }
@@ -990,7 +1010,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
     if (myIsAlien) {
       helper.doAlienCommit(myVcs);
     } else {
-      helper.doCommit();
+      helper.doCommit(myVcs);
     }
   }
 
index 3f0747e80b309b25fd65c7358841eccbf827ff30..b64d5ac1997cac01b868becf2390ca3c77038831 100644 (file)
@@ -101,7 +101,11 @@ public class CommitHelper {
   }
 
   public boolean doCommit() {
-    return doCommit(new CommitProcessor());
+    return doCommit((AbstractVcs)null);
+  }
+
+  public boolean doCommit(@Nullable AbstractVcs vcs) {
+    return doCommit(new CommitProcessor(vcs));
   }
 
   public boolean doAlienCommit(final AbstractVcs vcs) {
@@ -374,8 +378,10 @@ public class CommitHelper {
     private LocalHistoryAction myAction;
     private ChangeListsModificationAfterCommit myAfterVcsRefreshModification;
     private boolean myCommitSuccess;
+    @Nullable private final AbstractVcs myVcs;
 
-    private CommitProcessor() {
+    private CommitProcessor(@Nullable AbstractVcs vcs) {
+      myVcs = vcs;
       myAfterVcsRefreshModification = ChangeListsModificationAfterCommit.NOTHING;
       if (myChangeList instanceof LocalChangeList) {
         final LocalChangeList localList = (LocalChangeList) myChangeList;
@@ -391,6 +397,9 @@ public class CommitHelper {
     }
 
     public void callSelf() {
+      if (myVcs != null && myIncludedChanges.isEmpty()) {
+        process(myVcs, myIncludedChanges);
+      }
       ChangesUtil.processChangesByVcs(myProject, myIncludedChanges, this);
     }
 
index 02c3b66e19d759c27ea7cfa20af79eb5fc525a88..59bf56df03e5cdc0b0af350c7c3d6ab5754d5395 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 046d8efa5b4fc97071028ebb02628fda6a564fdd..b31948642b2311e6362b7ed525683a33b6682e79 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index bfdc7bd7bbcb928675b52467978b7c3c41617307..d5fe228ec24e86dc3f582085f69fd24f6479dc69 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created class.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated class body.</font></td>
   </tr>
index 0278d7b081318d341a72af7a123a584ae0490c5e..2f27795254f2ec41bdede279be648a220ee9fb2c 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 5a4cbfb7f3c7638fc64a214f0be6b0fd2bf4be27..a98243ef53ce7e1dc9063a0c76254a99667bd0d4 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${RETURN_TYPE}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${RETURN_TYPE}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">a return type of a created method</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${DEFAULT_RETURN_VALUE}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${DEFAULT_RETURN_VALUE}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">a value returned by the method by default</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${METHOD_NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${METHOD_NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${CLASS_NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${CLASS_NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">qualified name of the class where method is created</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${SIMPLE_CLASS_NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${SIMPLE_CLASS_NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">non-qualified name of the class where method is implemented</font></td>
   </tr>
index f9789fc6a2c4907df45b29ce2d59a23156447a86..8a162f4ad3a8d0b1666bb9473768e2eaaec0d168 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 0517d8d4bc17c11f5380533b7a2d2b438d81db38..538317fa6376ff73cffc6dc3b82f2ff3837425e5 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 379785f36c3f099085a6672f86078c1f595c4cf2..0ae62ac4e8b8bc8c692aaf0633f5792e04e9da5a 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 128e8498ea5a37985b53d44d48588855842cc20e..1c86d5ab35896fd21ac55dbe6a8de737a0c61d3a 100644 (file)
 
 package org.jetbrains.plugins.groovy.lang.groovydoc.lexer;
 
-import com.intellij.lexer.Lexer;
-import com.intellij.lexer.LexerBase;
-import com.intellij.lexer.LookAheadLexer;
-import com.intellij.lexer.MergingLexerAdapter;
+import com.intellij.lexer.*;
 import com.intellij.psi.TokenType;
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.tree.TokenSet;
@@ -100,7 +97,7 @@ public class GroovyDocLexer extends MergingLexerAdapter {
 
     @Override
     public int getState() {
-      return myState;
+      return getTokenStart() == 0 ? 0 : myState;
     }
 
     @Override
index dff034d8744301d8d8f2aa4c7fdb0459d23a03a5..31b20cd633e3e40044759e26de004f40576f0894 100644 (file)
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.jetbrains.plugins.groovy;
+package org.jetbrains.plugins.groovy
 
-
-import com.intellij.ide.DataManager
 import com.intellij.openapi.actionSystem.IdeActions
-import com.intellij.openapi.editor.Editor
-import com.intellij.openapi.editor.actionSystem.EditorActionHandler
-import com.intellij.openapi.editor.actionSystem.EditorActionManager
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
 import org.jetbrains.plugins.groovy.util.TestUtils
-
 /**
  * @author peter
  */
@@ -117,6 +111,22 @@ this.allOptions = [:];
 ''')
   }
 
+  public void "test hippie completion in groovydoc"() {
+    myFixture.configureByText 'a.groovy', '''
+class A {
+
+  /** long<caret>
+  */
+  void longName() {}
+  void example() {}
+}
+'''
+    performEditorAction(IdeActions.ACTION_HIPPIE_COMPLETION)
+    assert myFixture.editor.document.text.contains('** longName\n')
+    performEditorAction(IdeActions.ACTION_HIPPIE_COMPLETION)
+    assert myFixture.editor.document.text.contains('** longName\n')
+  }
+
   void testSWforMemberWithDoc() {
     doTestForSelectWord(4, '''\
 class A {
@@ -159,9 +169,7 @@ class A {
   }
 
   private void performEditorAction(final String actionId) {
-    final EditorActionHandler handler = EditorActionManager.instance.getActionHandler(actionId);
-    final Editor editor = myFixture.editor;
-    handler.execute(editor, DataManager.instance.getDataContext(editor.contentComponent));
+    myFixture.performEditorAction(actionId)
   }
 
 }
index 02655cffa3aea9d5c097a5fa64e23c9a037a916c..9c496969a3bb701eda32d136782d0e7b323f520c 100644 (file)
@@ -53,6 +53,7 @@ import org.jetbrains.annotations.Nullable;
 import org.zmlx.hg4idea.provider.*;
 import org.zmlx.hg4idea.provider.annotate.HgAnnotationProvider;
 import org.zmlx.hg4idea.provider.commit.HgCheckinEnvironment;
+import org.zmlx.hg4idea.provider.commit.HgCloseBranchExecutor;
 import org.zmlx.hg4idea.provider.commit.HgCommitAndPushExecutor;
 import org.zmlx.hg4idea.provider.update.HgUpdateEnvironment;
 import org.zmlx.hg4idea.roots.HgIntegrationEnabler;
@@ -104,7 +105,8 @@ public class HgVcs extends AbstractVcs<CommittedChangeList> {
   private HgExecutableValidator myExecutableValidator;
   private final Object myExecutableValidatorLock = new Object();
   private File myPromptHooksExtensionFile;
-  private CommitExecutor myCommitAndPushExecutor;
+  private final CommitExecutor myCommitAndPushExecutor;
+  private final HgCloseBranchExecutor myCloseBranchExecutor;
 
   private HgRemoteStatusUpdater myHgRemoteStatusUpdater;
   private HgStatusWidget myStatusWidget;
@@ -130,6 +132,7 @@ public class HgVcs extends AbstractVcs<CommittedChangeList> {
     committedChangesProvider = new HgCachingCommittedChangesProvider(project, this);
     myMergeProvider = new HgMergeProvider(myProject);
     myCommitAndPushExecutor = new HgCommitAndPushExecutor(checkinEnvironment);
+    myCloseBranchExecutor = new HgCloseBranchExecutor(checkinEnvironment);
   }
 
   public String getDisplayName() {
@@ -396,6 +399,11 @@ public class HgVcs extends AbstractVcs<CommittedChangeList> {
     return Collections.singletonList(myCommitAndPushExecutor);
   }
 
+  @NotNull
+  public HgCloseBranchExecutor getCloseBranchExecutor() {
+    return myCloseBranchExecutor;
+  }
+
   public static VcsKey getKey() {
     return ourKey;
   }
@@ -468,13 +476,11 @@ public class HgVcs extends AbstractVcs<CommittedChangeList> {
         final String reason = (e.getCause() != null ? e.getCause() : e).getMessage();
         String message = HgVcsMessages.message("hg4idea.unable.to.run.hg", executable);
         vcsNotifier.notifyError(message,
-                                  String.format(
-                                    reason +
-                                    "<br/> Please check your hg executable path in <a href='" +
-                                    SETTINGS_LINK +
-                                    "'> settings </a>"
-                                  ),
-                                  linkAdapter
+                                reason +
+                                "<br/> Please check your hg executable path in <a href='" +
+                                SETTINGS_LINK +
+                                "'> settings </a>",
+                                linkAdapter
         );
       }
     }
index 3dcaf6dee161a6d9b06a77e87c9b98194191f0c1..dc73c36ee503ecfe1023082d107adc61103f8a10 100644 (file)
@@ -81,6 +81,7 @@ public class HgBranchPopup extends DvcsBranchPopup<HgRepository> {
     List<HgRepository> allRepositories = repositoryManager.getRepositories();
     popupGroup.add(new HgBranchPopupActions.HgNewBranchAction(myProject, allRepositories, myCurrentRepository));
     popupGroup.addAction(new HgBranchPopupActions.HgNewBookmarkAction(allRepositories, myCurrentRepository));
+    popupGroup.addAction(new HgBranchPopupActions.HgCloseBranchAction(allRepositories, myCurrentRepository));
     popupGroup.addAction(new HgBranchPopupActions.HgShowUnnamedHeadsForCurrentBranchAction(myCurrentRepository));
     popupGroup.addAll(createRepositoriesActions());
 
index 633fe1cf87d9598eb99f35608051c3915f75e816..9de49d560b65a798932f3fbd1df2a5e0411ddec2 100644 (file)
@@ -23,9 +23,15 @@ import com.intellij.openapi.actionSystem.ActionGroup;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.DefaultActionGroup;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vcs.VcsBundle;
+import com.intellij.openapi.vcs.changes.*;
+import com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.Function;
 import com.intellij.util.PlatformIcons;
@@ -35,15 +41,19 @@ import com.intellij.vcs.log.impl.HashImpl;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.zmlx.hg4idea.HgNameWithHashInfo;
+import org.zmlx.hg4idea.HgVcs;
 import org.zmlx.hg4idea.action.HgCommandResultNotifier;
 import org.zmlx.hg4idea.command.HgBookmarkCommand;
 import org.zmlx.hg4idea.command.HgBranchCreateCommand;
 import org.zmlx.hg4idea.execution.HgCommandException;
 import org.zmlx.hg4idea.execution.HgCommandResult;
 import org.zmlx.hg4idea.execution.HgCommandResultHandler;
+import org.zmlx.hg4idea.provider.commit.HgCloseBranchExecutor;
 import org.zmlx.hg4idea.repo.HgRepository;
+import org.zmlx.hg4idea.repo.HgRepositoryManager;
 import org.zmlx.hg4idea.ui.HgBookmarkDialog;
 import org.zmlx.hg4idea.util.HgErrorUtil;
+import org.zmlx.hg4idea.util.HgUtil;
 
 import java.util.*;
 
@@ -64,6 +74,7 @@ public class HgBranchPopupActions {
     DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
     popupGroup.addAction(new HgNewBranchAction(myProject, Collections.singletonList(myRepository), myRepository));
     popupGroup.addAction(new HgNewBookmarkAction(Collections.singletonList(myRepository), myRepository));
+    popupGroup.addAction(new HgBranchPopupActions.HgCloseBranchAction(Collections.singletonList(myRepository), myRepository));
     popupGroup.addAction(new HgShowUnnamedHeadsForCurrentBranchAction(myRepository));
     if (toInsert != null) {
       popupGroup.addAll(toInsert);
@@ -129,6 +140,60 @@ public class HgBranchPopupActions {
     }
   }
 
+  public static class HgCloseBranchAction extends DumbAwareAction {
+    @NotNull private final List<HgRepository> myRepositories;
+    @NotNull final HgRepository myPreselectedRepo;
+
+    HgCloseBranchAction(@NotNull List<HgRepository> repositories, @NotNull HgRepository preselectedRepo) {
+      super("Close " + StringUtil.pluralize("branch", repositories.size()),
+            "Close current " + StringUtil.pluralize("branch", repositories.size()), AllIcons.Actions.Delete);
+      myRepositories = repositories;
+      myPreselectedRepo = preselectedRepo;
+    }
+
+    @Override
+    public void actionPerformed(AnActionEvent e) {
+      final Project project = myPreselectedRepo.getProject();
+      ApplicationManager.getApplication().saveAll();
+      ChangeListManager.getInstance(project).invokeAfterUpdate(new Runnable() {
+                                                                 @Override
+                                                                 public void run() {
+                                                                   commitAndCloseBranch(project);
+                                                                 }
+                                                               }, InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, VcsBundle
+                                                                 .message("waiting.changelists.update.for.show.commit.dialog.message"),
+                                                               ModalityState.current());
+    }
+
+    private void commitAndCloseBranch(@NotNull final Project project) {
+      final LocalChangeList activeChangeList = ChangeListManager.getInstance(project).getDefaultChangeList();
+      HgVcs vcs = HgVcs.getInstance(project);
+      assert vcs != null;
+      final HgRepositoryManager repositoryManager = HgUtil.getRepositoryManager(project);
+      List<Change> changesForRepositories = ContainerUtil.filter(activeChangeList.getChanges(), new Condition<Change>() {
+        @Override
+        public boolean value(Change change) {
+          return myRepositories.contains(repositoryManager.getRepositoryForFile(ChangesUtil.getFilePath(change)));
+        }
+      });
+      HgCloseBranchExecutor closeBranchExecutor = vcs.getCloseBranchExecutor();
+      closeBranchExecutor.setRepositories(myRepositories);
+      CommitChangeListDialog.commitChanges(project, changesForRepositories, activeChangeList,
+                                           Collections.<CommitExecutor>singletonList(closeBranchExecutor),
+                                           false, vcs, "Close Branch", null, false);
+    }
+
+    @Override
+    public void update(AnActionEvent e) {
+      e.getPresentation().setEnabledAndVisible(ContainerUtil.and(myRepositories, new Condition<HgRepository>() {
+        @Override
+        public boolean value(HgRepository repository) {
+          return repository.getOpenedBranches().contains(repository.getCurrentBranch());
+        }
+      }));
+    }
+  }
+
   public static class HgNewBookmarkAction extends DumbAwareAction {
     @NotNull protected final List<HgRepository> myRepositories;
     @NotNull final HgRepository myPreselectedRepo;
index 794c7096d207de8257d67e3c0e67c0a5dfeed0fc..4ba12ee4add05994cd061eea43478515d40550ec 100644 (file)
@@ -12,6 +12,7 @@
 // limitations under the License.
 package org.zmlx.hg4idea.command;
 
+import com.intellij.dvcs.repo.Repository;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.io.FileUtil;
@@ -28,6 +29,7 @@ import org.zmlx.hg4idea.HgVcs;
 import org.zmlx.hg4idea.HgVcsMessages;
 import org.zmlx.hg4idea.execution.HgCommandException;
 import org.zmlx.hg4idea.execution.HgCommandExecutor;
+import org.zmlx.hg4idea.repo.HgRepository;
 import org.zmlx.hg4idea.repo.HgRepositoryManager;
 import org.zmlx.hg4idea.util.HgEncodingUtil;
 import org.zmlx.hg4idea.util.HgUtil;
@@ -51,16 +53,22 @@ public class HgCommitCommand {
   private final String myMessage;
   @NotNull private final Charset myCharset;
   private final boolean myAmend;
+  private final boolean myCloseBranch;
 
   private Set<HgFile> myFiles = Collections.emptySet();
   @NotNull private List<String> mySubrepos = Collections.emptyList();
 
-  public HgCommitCommand(Project project, @NotNull VirtualFile root, String message, boolean amend) {
+  public HgCommitCommand(@NotNull Project project, @NotNull VirtualFile root, String message, boolean amend, boolean closeBranch) {
     myProject = project;
     myRoot = root;
     myMessage = message;
     myCharset = HgEncodingUtil.getDefaultCharset(myProject);
     myAmend = amend;
+    myCloseBranch = closeBranch;
+  }
+
+  public HgCommitCommand(@NotNull Project project, @NotNull VirtualFile root, String message, boolean amend) {
+    this(project, root, message, amend, false);
   }
 
   public HgCommitCommand(Project project, @NotNull VirtualFile root, String message) {
@@ -80,9 +88,9 @@ public class HgCommitCommand {
       throw new HgCommandException(HgVcsMessages.message("hg4idea.commit.error.messageEmpty"));
     }
     //if it's merge commit, so myFiles is Empty. Need to commit all files in changeList.
-    // see HgCheckinEnviroment->commit() method
+    // see HgCheckinEnvironment->commit() method
     if (myFiles.isEmpty()) {
-      commitChunkFiles(Collections.<String>emptyList(), myAmend);
+      commitChunkFiles(Collections.<String>emptyList(), myAmend, myCloseBranch);
     }
     else {
       List<String> relativePaths = ContainerUtil.map2List(myFiles, new Function<HgFile, String>() {
@@ -94,12 +102,12 @@ public class HgCommitCommand {
       List<List<String>> chunkedCommits = VcsFileUtil.chunkRelativePaths(relativePaths);
       int size = chunkedCommits.size();
       // commit with subrepo should be first, because it's not possible to amend with --subrepos argument;
-      commitChunkFiles(chunkedCommits.get(0), myAmend, !mySubrepos.isEmpty());
+      commitChunkFiles(chunkedCommits.get(0), myAmend, !mySubrepos.isEmpty(), myCloseBranch && size == 1);
       HgVcs vcs = HgVcs.getInstance(myProject);
       boolean amendCommit = vcs != null && vcs.getVersion().isAmendSupported();
       for (int i = 1; i < size; i++) {
         List<String> chunk = chunkedCommits.get(i);
-        commitChunkFiles(chunk, amendCommit);
+        commitChunkFiles(chunk, amendCommit, false, myCloseBranch && i == size - 1);
       }
     }
     if (!myProject.isDisposed()) {
@@ -111,11 +119,14 @@ public class HgCommitCommand {
     messageBus.syncPublisher(HgVcs.BRANCH_TOPIC).update(myProject, null);
   }
 
-  private void commitChunkFiles(@NotNull List<String> chunk, boolean amendCommit) throws VcsException {
-    commitChunkFiles(chunk, amendCommit, false);
+  private void commitChunkFiles(@NotNull List<String> chunk, boolean amendCommit, boolean closeBranch) throws VcsException {
+    commitChunkFiles(chunk, amendCommit, false, closeBranch);
   }
 
-  private void commitChunkFiles(@NotNull List<String> chunk, boolean amendCommit, boolean withSubrepos) throws VcsException {
+  private void commitChunkFiles(@NotNull List<String> chunk, boolean amendCommit, boolean withSubrepos, boolean closeBranch)
+    throws VcsException {
+    HgRepository repository = HgUtil.getRepositoryForFile(myProject, myRoot);
+    assert repository != null;
     List<String> parameters = new LinkedList<String>();
     parameters.add("--logfile");
     parameters.add(saveCommitMessage().getAbsolutePath());
@@ -127,6 +138,14 @@ public class HgCommitCommand {
     else if (amendCommit) {
       parameters.add("--amend");
     }
+    if (closeBranch) {
+      if (chunk.isEmpty() && repository.getState() != Repository.State.MERGING) {
+        //if there are changed files but nothing selected -> need to exclude all; if merge commit then nothing excluded
+        parameters.add("-X");
+        parameters.add("\"**\"");
+      }
+      parameters.add("--close-branch");
+    }
     parameters.addAll(chunk);
     HgCommandExecutor executor = new HgCommandExecutor(myProject);
     executor.setCharset(myCharset);
index 4cfe72f121f931ce5efb844cb749a1206d9ba635..f64b923959bb0de273f6d3e795aac18e2f6f7283 100644 (file)
@@ -103,7 +103,6 @@ public class HgUpdateCommand {
       DvcsUtil.workingTreeChangeFinished(project, token);
     }
 
-    project.getMessageBus().syncPublisher(HgVcs.BRANCH_TOPIC).update(project, null);
     VfsUtil.markDirtyAndRefresh(true, true, false, repo);
     return result;
   }
@@ -120,28 +119,28 @@ public class HgUpdateCommand {
     return exitCode.get();
   }
 
-  public static void updateTo(@NotNull final String taskName, @NotNull List<HgRepository> repos, @Nullable final Runnable callInAwtLater) {
+  public static void updateTo(@NotNull final String targetRevision, @NotNull List<HgRepository> repos, @Nullable final Runnable callInAwtLater) {
     FileDocumentManager.getInstance().saveAllDocuments();
     for (HgRepository repo : repos) {
       final VirtualFile repository = repo.getRoot();
       Project project = repo.getProject();
-      updateRepoTo(project, repository, taskName, callInAwtLater);
+      updateRepoTo(project, repository, targetRevision, callInAwtLater);
     }
   }
 
   public static void updateRepoTo(@NotNull final Project project,
                                   @NotNull final VirtualFile repository,
-                                  @NotNull final String taskName,
+                                  @NotNull final String targetRevision,
                                   @Nullable final Runnable callInAwtLater) {
-    updateRepoTo(project, repository, taskName, false, callInAwtLater);
+    updateRepoTo(project, repository, targetRevision, false, callInAwtLater);
   }
 
   public static void updateRepoTo(@NotNull final Project project,
                                   @NotNull final VirtualFile repository,
-                                  @NotNull final String taskName,
+                                  @NotNull final String targetRevision,
                                   final boolean clean,
                                   @Nullable final Runnable callInAwtLater) {
-    new Task.Backgroundable(project, HgVcsMessages.message("action.hg4idea.updateTo.description", taskName)) {
+    new Task.Backgroundable(project, HgVcsMessages.message("action.hg4idea.updateTo.description", targetRevision)) {
       @Override
       public void onSuccess() {
         if (callInAwtLater != null) {
@@ -151,17 +150,17 @@ public class HgUpdateCommand {
 
       @Override
       public void run(@NotNull ProgressIndicator indicator) {
-        updateRepoToInCurrentThread(project, repository, taskName, clean);
+        updateRepoToInCurrentThread(project, repository, targetRevision, clean);
       }
     }.queue();
   }
 
   public static boolean updateRepoToInCurrentThread(@NotNull final Project project,
                                                     @NotNull final VirtualFile repository,
-                                                    @NotNull final String taskName,
+                                                    @NotNull final String targetRevision,
                                                     final boolean clean) {
     final HgUpdateCommand hgUpdateCommand = new HgUpdateCommand(project, repository);
-    hgUpdateCommand.setRevision(taskName);
+    hgUpdateCommand.setRevision(targetRevision);
     hgUpdateCommand.setClean(clean);
     HgCommandResult result = hgUpdateCommand.execute();
     new HgConflictResolver(project).resolve(repository);
index cd46452f96f13038b76993e8d254d0752e24e368..fe13294ef8abab9f692156c453875f1632f64262 100644 (file)
@@ -60,6 +60,8 @@ public class HgCheckinEnvironment implements CheckinEnvironment {
   private boolean myNextCommitIsPushed;
   private boolean myNextCommitAmend; // If true, the next commit is amended
   private boolean myShouldCommitSubrepos;
+  private boolean myCloseBranch;
+  @Nullable private Collection<HgRepository> myRepos;
 
   public HgCheckinEnvironment(Project project) {
     myProject = project;
@@ -67,8 +69,15 @@ public class HgCheckinEnvironment implements CheckinEnvironment {
 
   public RefreshableOnComponent createAdditionalOptionsPanel(CheckinProjectPanel panel,
                                                              PairConsumer<Object, Object> additionalDataConsumer) {
+    reset();
+    return new HgCommitAdditionalComponent(myProject, panel);
+  }
+
+  public void reset() {
     myNextCommitIsPushed = false;
-    return new HgCommitAdditionalComponent(myProject,panel);
+    myShouldCommitSubrepos = false;
+    myCloseBranch = false;
+    myRepos = null;
   }
 
   public String getDefaultMessageFor(FilePath[] filesToCheckin) {
@@ -83,19 +92,19 @@ public class HgCheckinEnvironment implements CheckinEnvironment {
     return HgVcsMessages.message("hg4idea.commit");
   }
 
-  @SuppressWarnings({"ThrowableInstanceNeverThrown"})
   public List<VcsException> commit(List<Change> changes,
                                    String preparedComment,
                                    @NotNull NullableFunction<Object, Object> parametersHolder,
                                    Set<String> feedback) {
     List<VcsException> exceptions = new LinkedList<VcsException>();
     Map<HgRepository, Set<HgFile>> repositoriesMap = getFilesByRepository(changes);
+    addRepositoriesWithoutChanges(repositoriesMap);
     for (Map.Entry<HgRepository, Set<HgFile>> entry : repositoriesMap.entrySet()) {
 
       HgRepository repo = entry.getKey();
       Set<HgFile> selectedFiles = entry.getValue();
       HgCommitCommand command =
-        new HgCommitCommand(myProject, repo.getRoot(), preparedComment, myNextCommitAmend);
+        new HgCommitCommand(myProject, repo.getRoot(), preparedComment, myNextCommitAmend, myCloseBranch);
 
       if (isMergeCommit(repo.getRoot())) {
         //partial commits are not allowed during merges
@@ -255,7 +264,7 @@ public class HgCheckinEnvironment implements CheckinEnvironment {
 
   private void addFile(Map<HgRepository, Set<HgFile>> result, ContentRevision contentRevision) {
     FilePath filePath = contentRevision.getFile();
-    // try to find repository from hgFile from change
+    // try to find repository from hgFile from change: to be able commit sub repositories as expected
     HgRepository repo = HgUtil.getRepositoryForFile(myProject, contentRevision instanceof HgCurrentBinaryContentRevision
                                                                ? ((HgCurrentBinaryContentRevision)contentRevision).getRepositoryRoot()
                                                                : ChangesUtil.findValidParentAccurately(filePath));
@@ -276,6 +285,23 @@ public class HgCheckinEnvironment implements CheckinEnvironment {
     myNextCommitIsPushed = true;
   }
 
+  public void setCloseBranch(boolean closeBranch) {
+    myCloseBranch = closeBranch;
+  }
+
+  public void setRepos(@NotNull Collection<HgRepository> repos) {
+    myRepos = repos;
+  }
+
+  private void addRepositoriesWithoutChanges(@NotNull Map<HgRepository, Set<HgFile>> repositoryMap) {
+    if (myRepos == null) return;
+    for (HgRepository repository : myRepos) {
+      if (!repositoryMap.keySet().contains(repository)) {
+        repositoryMap.put(repository, Collections.<HgFile>emptySet());
+      }
+    }
+  }
+
   /**
    * Commit options for hg
    */
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCloseBranchExecutor.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCloseBranchExecutor.java
new file mode 100644 (file)
index 0000000..3aac41d
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2000-2014 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.zmlx.hg4idea.provider.commit;
+
+import com.intellij.openapi.vcs.changes.CommitExecutorBase;
+import com.intellij.openapi.vcs.changes.CommitSession;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.zmlx.hg4idea.repo.HgRepository;
+
+import java.util.Collection;
+
+public class HgCloseBranchExecutor extends CommitExecutorBase {
+
+  @NotNull private final HgCheckinEnvironment myCheckinEnvironment;
+  @NotNull private static final String CLOSE_BRANCH_TITLE = "Commit And &Close" ;
+
+
+  public HgCloseBranchExecutor(@NotNull HgCheckinEnvironment environment) {
+    myCheckinEnvironment = environment;
+  }
+
+  @Override
+  public boolean areChangesRequired() {
+    return false;
+  }
+
+  @Nls
+  @Override
+  public String getActionText() {
+    return CLOSE_BRANCH_TITLE;
+  }
+
+  @NotNull
+  @Override
+  public CommitSession createCommitSession() {
+    myCheckinEnvironment.setCloseBranch(true);
+    return CommitSession.VCS_COMMIT;
+  }
+
+  public void setRepositories(@NotNull Collection<HgRepository> repositories) {
+    myCheckinEnvironment.setRepos(repositories);
+  }
+}
index 5c4e5f6ce0cfa3d0b70cf22273246ba5f2263237..01c553f32d033f1f3797c2b5b8196125cb06a2fc 100644 (file)
@@ -60,13 +60,18 @@ class RunningTestTracker extends JUnitAdapter implements TestFrameworkPropertyLi
   public void onTestChanged(final TestEvent event) {
     if (event instanceof StateChangedEvent) {
       final TestProxy proxy = event.getSource();
-      if (proxy == myLastRan && !isRunningState(proxy)) {
-        if (myLastSelected == proxy){
+      final boolean isRunning = isRunningState(proxy);
+      if (isRunning) {
+        if (proxy.isLeaf()) {
+          myLastRan = proxy;
+        }
+        if (myLastSelected == proxy) {
           myLastSelected = null;
         }
+      }
+      else if (proxy == myLastRan) {
         myLastRan = null;
       }
-      if (proxy.isLeaf() && isRunningState(proxy)) myLastRan = proxy;
       myTrackingPolicy.applyTo(proxy);
     }
   }
index a22b80b884f3634d4768472aa64418a11ae753bc..d41bedc88e6667c4176d61e7336f17e1498e6d9d 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index da1d3ae9ce262fe78bcd745a7bd544fa67ee9007..a20a8a351f819531f1efba75d4f0a7d14eae4dec 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 845e8be9069fb8b3d9a9f66ee9ecfe8ebe18f185..a015267dedfdcffbb87101ab156d5cca897f136e 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created class.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated class body.</font></td>
   </tr>
index b718403b441767d48de3be391e1d0b42bfc5511b..738f32f0401fdb0776bdc04d8af11181fa22458f 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 51fd9c2f15ef8040c73d9fd829b5af65d7c0c858..7844aa2260b071869d5bda07c6b4db0a4e845348 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index e700267e9aa3101c988378ee4c65dd6da5b36236..b48a5a892f58bed91ffc231f384d3e629c601267 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 5a419263f69ad329a8256faf12cfc736d23b3660..199a4ec1e72214cf4bce622b4aadb825437dc66a 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 7a1542436cf2cda15a46932c41673cdc911c53da..c2ff42e4777c76c3ea6e2042732806fa93a3b76c 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created class.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated class body.</font></td>
   </tr>
index 7a04a90e35cd883c73bd84a988172163086f4e6a..1b7bde93b677451fe8aa9308d5c434ecb3f2dbb7 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 382b1e728685b3ac9ab02763ca942a36234755bb..3abc58e0740d1c1aad733a29ea12fcb63cdba364 100644 (file)
Binary files a/plugins/terminal/resources/icons/OpenTerminal_13x13@2x_dark.png and b/plugins/terminal/resources/icons/OpenTerminal_13x13@2x_dark.png differ
index d9ceedc74ae0ca7b6a0b742e31a9298254e36fd2..1a08ae5a77780bef484c9a3c466382004970a467 100644 (file)
Binary files a/plugins/terminal/resources/icons/OpenTerminal_13x13_dark.png and b/plugins/terminal/resources/icons/OpenTerminal_13x13_dark.png differ
index f6084e6774bb186e6b54ebfe31a5698e169088bc..da1766197222b2f3998227e95be8021a04b8df54 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 7f8b8e6488749509e70221c2e607410b7f941db3..9736ca8b96e174893e09e625122e447c30915d4f 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 8c6e6d6685d5fa8e6db8d6f1ea4fb74b22cf83e3..f7f3b58393d1512b147cad3b60989ee4024e751b 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
index 972b59a13ae867a24b79a2d8ac9f0d7ab707bf02..5b04f0197f7a6677883d4dbad05ce63863477ccd 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created class.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated class body.</font></td>
   </tr>
index b86268203ed89843073e85c866c0d35f66a52c8b..81b82b324de1a84d68ec1e48045613af6cb36744 100644 (file)
     <td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${NAME}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
   </tr>
   <tr>
-    <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+    <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
     <td width="10">&nbsp;</td>
     <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
   </tr>
diff --git a/python/helpers/pydev/_pydev_imps/_pydev_django_oscar_patch.py b/python/helpers/pydev/_pydev_imps/_pydev_django_oscar_patch.py
deleted file mode 100644 (file)
index e0a82f7..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-
-import sys
-import traceback
-
-
-def _import_module_patched(module_label, classnames):
-    """
-    Imports the module with the given name.
-    Returns None if the module doesn't exist, but propagates any import errors.
-    """
-    try:
-        return __import__(module_label, fromlist=classnames)
-    except ImportError:
-        # There are 2 reasons why there could be an ImportError:
-        #
-        #  1. Module does not exist. In that case, we ignore the import and
-        #     return None
-        #  2. Module exists but another ImportError occurred when trying to
-        #     import the module. In that case, it is important to propagate the
-        #     error.
-        #
-        # ImportError does not provide easy way to distinguish those two cases.
-        # Fortunately, the traceback of the ImportError starts at __import__
-        # statement. If the traceback has more than one frame, it means that
-        # application was found and ImportError originates within the local app
-        #
-        # Changes in patch: change 1 to 2 frames because of the frame, added by
-        # plugin_import.
-        #
-        __, __, exc_traceback = sys.exc_info()
-        frames = traceback.extract_tb(exc_traceback)
-        if len(frames) > 2:
-            raise
-
-
-def patch_oscar_loading():
-    module = sys.modules['oscar.core.loading']
-    setattr(module, '_import_module', _import_module_patched)
index dc1ab05907a126a8c8cd9724343282625617f858..41ece7191f62ef647645a4d8c232ec9b84c7e02b 100644 (file)
@@ -12,7 +12,7 @@
 import os
 import sys
 
-from pydevd_constants import IS_PY24, IS_PY3K, IS_JYTHON, DictContains, DictPop
+from pydevd_constants import IS_PY24, IS_PY3K, IS_JYTHON
 
 if IS_PY24:
     from _pydev_imps._pydev_uuid_old import uuid4
@@ -405,16 +405,6 @@ class _ImportHook(ModuleType):
         ModuleType.__init__(self, name)
         self._system_import = system_import
         self.enabled = True
-        self._modules_to_patch = {}
-        self._add_modules_for_patching()
-
-    def _add_modules_for_patching(self):
-        try:
-            from _pydev_imps._pydev_django_oscar_patch import \
-                patch_oscar_loading
-            self._modules_to_patch['oscar.core.loading'] = patch_oscar_loading
-        except:
-            sys.stderr.write("Adding modules to patch in pluginbase failed\n")
 
     def enable(self):
         """Enables the import hook which drives the plugin base system.
@@ -458,26 +448,29 @@ class _ImportHook(ModuleType):
                 level = -1
         if IS_JYTHON:
             import_name = name
-
-        activate_func = None
-        if name == import_name and DictContains(self._modules_to_patch, name):
-            activate_func = DictPop(self._modules_to_patch, name)
-
-        module = self._system_import(import_name, globals, locals, fromlist, level)
-        try:
-            if activate_func:
-                activate_func() #call activate function
-        except:
-            sys.stderr.write("Patching modules in pluginbase failed\n")
-        return module
-
+        return self._system_import(import_name, globals, locals,
+                                   fromlist, level)
 
 try:
     import __builtin__ as builtins
 except ImportError:
     import builtins
 
+
 import_hook = _ImportHook(__name__ + '.import_hook', builtins.__import__)
 builtins.__import__ = import_hook.plugin_import
 sys.modules[import_hook.__name__] = import_hook
 del builtins
+
+
+def patched_exc_info():
+    type, value, traceback = sys.system_exc_info()
+    if type == ImportError:
+        #we should not show frame added by plugin_import call
+        return type, value, traceback.tb_next
+    return type, value, traceback
+
+
+system_exc_info = sys.exc_info
+sys.exc_info = patched_exc_info
+sys.system_exc_info = system_exc_info
index 06a3f47b65ad6cf98aa7582680bde40cfcbfc061..2da5655f5dfffc734bc534168217bb2b3b829a8e 100644 (file)
@@ -57,10 +57,20 @@ def _patch_import_to_patch_pyqt_on_import(patch_qt_on_import):
     
     dotted = patch_qt_on_import + '.'
     original_import = __import__
+    import sys
+    original_exc_info = sys.exc_info
+
+    def patched_exc_info():
+        type, value, traceback = original_exc_info()
+        if type == ImportError:
+            #we should not show frame added by patched_import call
+            return type, value, traceback.tb_next
+        return type, value, traceback
     
     def patched_import(name, *args, **kwargs):
         if patch_qt_on_import == name or name.startswith(dotted):
             builtins.__import__ = original_import
+            sys.exc_info = original_exc_info
             _internal_patch_qt() # Patch it only when the user would import the qt module
         return original_import(name, *args, **kwargs)
     
@@ -68,7 +78,8 @@ def _patch_import_to_patch_pyqt_on_import(patch_qt_on_import):
         import builtins
     except ImportError:
         import __builtin__ as builtins
-    builtins.__import__ = patched_import 
+    builtins.__import__ = patched_import
+    sys.exc_info = patched_exc_info
     
     
 def _internal_patch_qt():
index 5aadbe1a19831fe6de3560fdfd69f0d02c925dc9..5c0106d4cbd1e2163451dacf68101c346be4e866 100644 (file)
@@ -122,7 +122,6 @@ DONT_TRACE = {
               '_pydev_pluginbase.py':1,
               '_pydev_pkgutil_old.py':1,
               '_pydev_uuid_old.py':1,
-              '_pydev_django_oscar_patch.py':1,
 
               #things from pydev that we don't want to trace
               '_pydev_execfile.py':1,
index e4ed2ce70673f629191874eddea810d45d2f4022..d51427bbd0014674071869b2a5f2440275c7c982 100644 (file)
@@ -1,3 +1,18 @@
+<!--
+  ~ Copyright 2000-2014 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.
+  -->
 <idea-plugin version="2" xmlns:xi="http://www.w3.org/2001/XInclude">
   <id>com.intellij</id>
   <name>IDEA CORE</name>
     <treeCopyHandler implementation="com.intellij.psi.impl.source.tree.JavaTreeCopyHandler"/>
     <treeGenerator implementation="com.intellij.psi.impl.source.tree.JavaTreeGenerator"/>
 
+    <java.elementFinder implementation="com.intellij.psi.impl.PsiElementFinderImpl" id="java" order="first"/>
     <java.elementFinder implementation="com.intellij.psi.impl.PackagePrefixElementFinder"/>
     <java.elementFinder implementation="com.intellij.psi.impl.migration.MigrationElementFinder"/>