diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java index 8f2079a7f155..f50585503449 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java @@ -162,10 +162,17 @@ public class CompilerManagerImpl extends CompilerManager { public final void addCompiler(@NotNull Compiler compiler) { if (compiler instanceof TranslatingCompiler) { myTranslators.add((TranslatingCompiler)compiler); - } else { myCompilers.add(compiler); + // supporting file instrumenting compilers and validators for external build + // Since these compilers are IDE-specific and use PSI, it is ok to run them before and after the build in the IDE + if (compiler instanceof SourceInstrumentingCompiler) { + addBeforeTask(new FileProcessingCompilerAdapterTask((FileProcessingCompiler)compiler)); + } + else if (compiler instanceof Validator) { + addAfterTask(new FileProcessingCompilerAdapterTask((FileProcessingCompiler)compiler)); + } } } @@ -174,7 +181,16 @@ public class CompilerManagerImpl extends CompilerManager { myTranslators.remove(compiler); } else { - myCompilers.remove(compiler); + if (myCompilers.remove(compiler)) { + for (List tasks : Arrays.asList(myBeforeTasks, myAfterTasks)) { + for (Iterator iterator = tasks.iterator(); iterator.hasNext(); ) { + CompileTask task = iterator.next(); + if (task instanceof FileProcessingCompilerAdapterTask && ((FileProcessingCompilerAdapterTask)task).getCompiler() == compiler) { + iterator.remove(); + } + } + } + } } myCompilerToInputTypes.remove(compiler); myCompilerToOutputTypes.remove(compiler); diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/make/SourceInstrumentationTask.java b/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java similarity index 90% rename from plugins/ui-designer/src/com/intellij/uiDesigner/make/SourceInstrumentationTask.java rename to java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java index 4c63db0dd23e..f53e4df68e67 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/make/SourceInstrumentationTask.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java @@ -13,12 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.uiDesigner.make; +package com.intellij.compiler.impl; import com.intellij.compiler.CompilerWorkspaceConfiguration; -import com.intellij.compiler.impl.CompilerCacheManager; -import com.intellij.compiler.impl.CompilerUtil; -import com.intellij.compiler.impl.FileProcessingCompilerStateCache; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.compiler.*; import com.intellij.openapi.project.DumbService; @@ -33,14 +30,22 @@ import java.util.ArrayList; import java.util.List; /** - * This is an adapter for Form2SourceCompiler to CompileTask interface + * This is an adapter for running any FileProcessingCompiler as a compiler task * * * @author Eugene Zhuravlev * Date: 9/5/12 */ -public class SourceInstrumentationTask implements CompileTask{ - private final Form2SourceCompiler myCompiler = new Form2SourceCompiler(); +public class FileProcessingCompilerAdapterTask implements CompileTask{ + private final FileProcessingCompiler myCompiler; + + public FileProcessingCompilerAdapterTask(FileProcessingCompiler compiler) { + myCompiler = compiler; + } + + public FileProcessingCompiler getCompiler() { + return myCompiler; + } @Override public boolean execute(CompileContext context) { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java index 45a003172bfd..6542ce7658d6 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java @@ -1395,5 +1395,28 @@ public class GenericsHighlightUtil { } return null; } + + /** + * http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.8 + */ + @Nullable + public static HighlightInfo checkRawOnParameterizedType(PsiReferenceParameterList list) { + if (list.getTypeArguments().length > 0) return null; + final PsiElement parent = list.getParent(); + if (parent instanceof PsiJavaCodeReferenceElement) { + final PsiElement qualifier = ((PsiJavaCodeReferenceElement)parent).getQualifier(); + if (qualifier instanceof PsiJavaCodeReferenceElement) { + if (((PsiJavaCodeReferenceElement)qualifier).getTypeParameters().length > 0) { + final PsiElement resolve = ((PsiJavaCodeReferenceElement)parent).resolve(); + if (resolve instanceof PsiTypeParameterListOwner + && ((PsiTypeParameterListOwner)resolve).hasTypeParameters() + && !((PsiTypeParameterListOwner)resolve).hasModifierProperty(PsiModifier.STATIC)) { + return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, parent, "Improper formed type; some type parameters are missing"); + } + } + } + } + return null; + } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java index d0366383464e..d9c90b1acd5c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java @@ -1014,6 +1014,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh public void visitReferenceParameterList(PsiReferenceParameterList list) { myHolder.add(GenericsHighlightUtil.checkParametersAllowed(list)); if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkParametersOnRaw(list)); + if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkRawOnParameterizedType(list)); } @Override public void visitReturnStatement(PsiReturnStatement statement) { diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/actions/GenerateGetterSetterBaseAction.java b/java/java-impl/src/com/intellij/codeInsight/generation/actions/GenerateGetterSetterBaseAction.java index e6056d84fad4..eb389cc12a70 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/actions/GenerateGetterSetterBaseAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/actions/GenerateGetterSetterBaseAction.java @@ -27,10 +27,4 @@ public abstract class GenerateGetterSetterBaseAction extends BaseGenerateAction public GenerateGetterSetterBaseAction(GenerateGetterSetterHandlerBase handler) { super(handler); } - - @Override - protected boolean isValidForClass(PsiClass targetClass) { - final GenerateGetterSetterHandlerBase handler = (GenerateGetterSetterHandlerBase)getHandler(); - return handler.canBeAppliedTo(targetClass); - } } diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/DestinationFolderComboBox.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/DestinationFolderComboBox.java index b836b0ea1f81..291a49df5b00 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/DestinationFolderComboBox.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/DestinationFolderComboBox.java @@ -15,8 +15,6 @@ */ package com.intellij.refactoring.move.moveClassesOrPackages; -import com.intellij.openapi.util.Comparing; -import com.intellij.ui.ListCellRendererWrapper; import com.intellij.ide.util.DirectoryChooser; import com.intellij.openapi.editor.event.DocumentAdapter; import com.intellij.openapi.editor.event.DocumentEvent; @@ -26,6 +24,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.ComboBoxWithWidePopup; +import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Pass; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; @@ -37,6 +36,7 @@ import com.intellij.ui.*; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; @@ -253,6 +253,14 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton } }); comboBox.setModel(new CollectionComboBoxModel(items, selection)); + + final Component root = SwingUtilities.getRoot(comboBox); + if (root instanceof Window) { + final Dimension preferredSize = root.getPreferredSize(); + if (preferredSize.getWidth() > root.getSize().getWidth()) { + root.setSize(preferredSize); + } + } } @Nullable diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/RawOnParameterized.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/RawOnParameterized.java new file mode 100644 index 000000000000..a4079e95b771 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/RawOnParameterized.java @@ -0,0 +1,29 @@ +class GenericOuter { + public class GenericInner { + } + + public static class StaticGenericInner { + } + + public class SimpleInner { + } +} + +class OuterClient { + public void context() { + GenericOuter.GenericInner v1 = null; + GenericOuter.GenericInner v2 = null; + GenericOuter.GenericInner v3 = null; + GenericOuter.GenericInner v4 = null; + + GenericOuter.StaticGenericInner sv1 = null; + GenericOuter.StaticGenericInner sv2 = null; + GenericOuter.StaticGenericInner sv3 = null; + GenericOuter.StaticGenericInner sv4 = null; + + GenericOuter.SimpleInner iv1 = null; + GenericOuter.SimpleInner iv2 = null; + GenericOuter.SimpleInner iv3 = null; + GenericOuter.SimpleInner iv4 = null; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/refactoring/moveInstanceMethod/OverloadingMethods1.java b/java/java-tests/testData/refactoring/moveInstanceMethod/OverloadingMethods1.java new file mode 100644 index 000000000000..e3b7902de3bc --- /dev/null +++ b/java/java-tests/testData/refactoring/moveInstanceMethod/OverloadingMethods1.java @@ -0,0 +1,11 @@ +class B extends A { + void n(C c){ + m(); + } +} + +class A { + void m(){} +} + +class C {} \ No newline at end of file diff --git a/java/java-tests/testData/refactoring/moveInstanceMethod/OverloadingMethods1.java.after b/java/java-tests/testData/refactoring/moveInstanceMethod/OverloadingMethods1.java.after new file mode 100644 index 000000000000..2b1770571be7 --- /dev/null +++ b/java/java-tests/testData/refactoring/moveInstanceMethod/OverloadingMethods1.java.after @@ -0,0 +1,12 @@ +class B extends A { +} + +class A { + void m(){} +} + +class C { + void n(B b){ + b.m(); + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java index dd7c0feddef5..424b6e677a81 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java @@ -194,6 +194,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase { public void testDifferentTypeParamsInOverloadedMethods() throws Exception { doTest(true); } public void testIDEA91626() throws Exception { doTest(true); } public void testIDEA92022() throws Exception { doTest(false); } + public void testRawOnParameterized() throws Exception { doTest(false); } public void testJavaUtilCollections_NoVerify() throws Exception { PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule())); diff --git a/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerByNameTest.groovy b/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerByNameTest.groovy index a16ef3024c7d..0b99392d0283 100644 --- a/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerByNameTest.groovy +++ b/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerByNameTest.groovy @@ -16,10 +16,12 @@ package com.intellij.psi.codeStyle.arrangement import com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier +import com.intellij.psi.codeStyle.arrangement.order.ArrangementEntryOrderType import org.junit.Before import static com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier.PROTECTED import static com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier.PUBLIC +import static com.intellij.psi.codeStyle.arrangement.order.ArrangementEntryOrderType.BY_NAME /** * @author Denis Zhdanov @@ -69,4 +71,24 @@ class Test { rules: [rule("get.*", PUBLIC), rule(PROTECTED)] ) } + + void "test name and sort"() { + doTest( + initial: '''\ +class Test { + private void getC() {} + public void test() {} + public void getA() {} + public void getB() {} +}''', + expected: '''\ +class Test { + public void getA() {} + public void getB() {} + private void getC() {} + public void test() {} +}''', + rules: [rule(BY_NAME, "get.*")] + ) + } } diff --git a/java/java-tests/testSrc/com/intellij/refactoring/moveMethod/MoveInstanceMethodTest.java b/java/java-tests/testSrc/com/intellij/refactoring/moveMethod/MoveInstanceMethodTest.java index da41d701a2f2..c2234a937ae6 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/moveMethod/MoveInstanceMethodTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/moveMethod/MoveInstanceMethodTest.java @@ -56,6 +56,7 @@ public class MoveInstanceMethodTest extends LightRefactoringTestCase { public void testThisInAnonymous() throws Exception { doTest(true, 0); } public void testOverloadingMethods() throws Exception { doTest(true, 0); } + public void testOverloadingMethods1() throws Exception { doTest(true, 0); } public void testPolyadicExpr() throws Exception { doTest(true, 0); } diff --git a/jps/jps-builders/src/org/jetbrains/jps/indices/impl/IgnoredFileIndexImpl.java b/jps/jps-builders/src/org/jetbrains/jps/indices/impl/IgnoredFileIndexImpl.java index e0d69982ee42..25413ee4e90e 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/indices/impl/IgnoredFileIndexImpl.java +++ b/jps/jps-builders/src/org/jetbrains/jps/indices/impl/IgnoredFileIndexImpl.java @@ -1,7 +1,6 @@ package org.jetbrains.jps.indices.impl; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.util.SystemInfoRt; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.jps.indices.IgnoredFileIndex; import org.jetbrains.jps.model.JpsModel; @@ -30,7 +29,7 @@ public class IgnoredFileIndexImpl implements IgnoredFileIndex { String pattern = tokenizer.nextToken(); if (!StringUtil.isEmptyOrSpaces(pattern)) { try { - myPatterns.add(Pattern.compile(convertToJavaPattern(pattern), SystemInfoRt.isFileSystemCaseSensitive? 0 : Pattern.CASE_INSENSITIVE)); + myPatterns.add(Pattern.compile(convertToJavaPattern(pattern))); } catch (PatternSyntaxException e) { LOG.info("Cannot load ignored file pattern " + pattern, e); diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/DefaultArrangementSettingsSerializer.java b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/DefaultArrangementSettingsSerializer.java index 4ef9b46790f6..90274028aae6 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/DefaultArrangementSettingsSerializer.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/DefaultArrangementSettingsSerializer.java @@ -121,7 +121,7 @@ public class DefaultArrangementSettingsSerializer implements ArrangementSettings return null; } - Element orderTypeElement = element.getChild(ORDER_TYPE_ELEMENT_NAME); + Element orderTypeElement = ruleElement.getChild(ORDER_TYPE_ELEMENT_NAME); ArrangementEntryOrderType orderType = ArrangementMatchRule.DEFAULT_ORDER_TYPE; if (orderTypeElement != null) { try { diff --git a/platform/lang-api/testSources/com/intellij/psi/codeStyle/arrangement/ArrangementSettingsSerializationTest.java b/platform/lang-api/testSources/com/intellij/psi/codeStyle/arrangement/ArrangementSettingsSerializationTest.java index eb51439e57fa..c816f59b1ef1 100644 --- a/platform/lang-api/testSources/com/intellij/psi/codeStyle/arrangement/ArrangementSettingsSerializationTest.java +++ b/platform/lang-api/testSources/com/intellij/psi/codeStyle/arrangement/ArrangementSettingsSerializationTest.java @@ -39,7 +39,7 @@ public class ArrangementSettingsSerializationTest { StdArrangementSettings settings = new StdArrangementSettings(); settings.addGrouping(new ArrangementGroupingRule(ArrangementGroupingType.OVERRIDDEN_METHODS, ArrangementEntryOrderType.BY_NAME)); ArrangementAtomMatchCondition condition = new ArrangementAtomMatchCondition(ArrangementSettingType.TYPE, ArrangementEntryType.FIELD); - settings.addRule(new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition), ArrangementEntryOrderType.KEEP)); + settings.addRule(new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition), ArrangementEntryOrderType.BY_NAME)); Element holder = new Element("holder"); ArrangementSettingsSerializer instance = DefaultArrangementSettingsSerializer.INSTANCE; diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java index c678fcc8a800..4abd8d4f6b08 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java @@ -28,13 +28,17 @@ import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CodeStyleSettingsManager; import com.intellij.psi.codeStyle.arrangement.ArrangementEntry; import com.intellij.psi.codeStyle.arrangement.ArrangementSettings; +import com.intellij.psi.codeStyle.arrangement.NameAwareArrangementEntry; import com.intellij.psi.codeStyle.arrangement.Rearranger; import com.intellij.psi.codeStyle.arrangement.match.ArrangementMatchRule; +import com.intellij.psi.codeStyle.arrangement.order.ArrangementEntryOrderType; import com.intellij.psi.codeStyle.arrangement.settings.ArrangementStandardSettingsAware; +import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.HashSet; import com.intellij.util.containers.Stack; import com.intellij.util.text.CharArrayUtil; import gnu.trove.TIntArrayList; +import gnu.trove.TObjectIntHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -228,9 +232,11 @@ public class ArrangementEngine { } Set matched = new HashSet(); - + + int startIndex; for (ArrangementMatchRule rule : rules) { matched.clear(); + startIndex = arranged.size(); for (E entry : unprocessed) { if (entry.canBeMatched() && rule.getMatcher().isMatched(entry)) { arranged.add(entry); @@ -238,6 +244,11 @@ public class ArrangementEngine { } } unprocessed.removeAll(matched); + + // Sort by name if necessary. + if (rule.getOrderType() == ArrangementEntryOrderType.BY_NAME) { + sortByName(arranged, startIndex); + } } arranged.addAll(unprocessed); @@ -256,6 +267,42 @@ public class ArrangementEngine { return arranged; } + private static void sortByName(@NotNull List entries, int startIndex) { + int entriesToSortNumber = entries.size() - startIndex; + if (entriesToSortNumber < 2) { + return; + } + List buffer = new ArrayList(entriesToSortNumber); + List subList = entries.subList(startIndex, entries.size()); + buffer.addAll(subList); + final TObjectIntHashMap weights = new TObjectIntHashMap(); + int i = 0; + for (E e : buffer) { + weights.put(e, ++i); + } + ContainerUtil.sort(buffer, new Comparator() { + @Override + public int compare(E e1, E e2) { + String name1 = e1 instanceof NameAwareArrangementEntry ? ((NameAwareArrangementEntry)e1).getName() : null; + String name2 = e2 instanceof NameAwareArrangementEntry ? ((NameAwareArrangementEntry)e2).getName() : null; + if (name1 != null && name2 != null) { + return name1.compareTo(name2); + } + else if (name1 == null && name2 == null) { + return weights.get(e1) - weights.get(e2); + } + else if (name2 == null) { + return -1; + } + else { + return 1; + } + } + }); + subList.clear(); + entries.addAll(buffer); + } + @SuppressWarnings("unchecked") private static void doArrange(@NotNull List> wrappers, @NotNull Context context) { diff --git a/platform/platform-impl/src/com/intellij/ide/ui/search/SearchUtil.java b/platform/platform-impl/src/com/intellij/ide/ui/search/SearchUtil.java index 446180c48170..71a9826f0f15 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/search/SearchUtil.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/search/SearchUtil.java @@ -181,21 +181,25 @@ public class SearchUtil { final GlassPanel glassPanel) { return new Runnable() { public void run() { - if (!SearchUtil.traverseComponentsTree(configurable, glassPanel, component, option, true)) { - SearchUtil.traverseComponentsTree(configurable, glassPanel, component, option, false); + if (!traverseComponentsTree(configurable, glassPanel, component, option, true)) { + traverseComponentsTree(configurable, glassPanel, component, option, false); } } }; } - public static int getSelection(String tabIdx, final JTabbedPane tabbedPane) { + private static int getSelection(String tabIdx, final JTabbedPane tabbedPane) { SearchableOptionsRegistrar searchableOptionsRegistrar = SearchableOptionsRegistrar.getInstance(); for (int i = 0; i < tabbedPane.getTabCount(); i++) { final Set pathWords = searchableOptionsRegistrar.getProcessedWords(tabIdx); final String title = tabbedPane.getTitleAt(i); - final Set titleWords = searchableOptionsRegistrar.getProcessedWords(title); - pathWords.removeAll(titleWords); - if (pathWords.isEmpty()) return i; + if (!pathWords.isEmpty()) { + final Set titleWords = searchableOptionsRegistrar.getProcessedWords(title); + pathWords.removeAll(titleWords); + if (pathWords.isEmpty()) return i; + } else if (tabIdx.equalsIgnoreCase(title)) { //e.g. only stop words + return i; + } } return -1; } @@ -252,7 +256,7 @@ public class SearchUtil { } else if (rootComponent instanceof JTabbedPane) { final JTabbedPane tabbedPane = (JTabbedPane)rootComponent; - final String path = SearchableOptionsRegistrarImpl.getInstance().getInnerPath(configurable, option); + final String path = SearchableOptionsRegistrar.getInstance().getInnerPath(configurable, option); if (path != null) { final int index = getSelection(path, tabbedPane); if (index > -1 && index < tabbedPane.getTabCount()) { @@ -318,7 +322,7 @@ public class SearchUtil { final boolean forceSelect) { return new Runnable() { public void run() { - SearchUtil.traverseComponentsTree(configurable, glassPanel, component, option, forceSelect); + traverseComponentsTree(configurable, glassPanel, component, option, forceSelect); } }; } @@ -365,7 +369,7 @@ public class SearchUtil { String cur = ""; final String s = textToMarkup.toLowerCase(); for (String part : filter.split(" ")) { - if (s.indexOf(part) != -1) { + if (s.contains(part)) { cur += "\"" + part + "\" "; } else { diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/PresentationFactory.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/PresentationFactory.java index e569d7673f07..378c8be6967d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/PresentationFactory.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/PresentationFactory.java @@ -30,7 +30,7 @@ public class PresentationFactory { public final Presentation getPresentation(@NotNull AnAction action){ Presentation presentation = myAction2Presentation.get(action); - if (presentation == null){ + if (presentation == null || !action.isDefaultIcon()){ presentation = action.getTemplatePresentation().clone(); myAction2Presentation.put(action, processPresentation(presentation)); } diff --git a/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.groovy b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.groovy index 9e0cb0d08ddf..d9df73b46e20 100644 --- a/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.groovy +++ b/platform/testFramework/testSrc/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.groovy @@ -70,6 +70,11 @@ abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFixtureTes @NotNull protected static StdArrangementMatchRule rule(@NotNull Object ... conditions) { + rule(ArrangementEntryOrderType.KEEP, conditions) + } + + @NotNull + protected static StdArrangementMatchRule rule(@NotNull ArrangementEntryOrderType orderType, @NotNull Object ... conditions) { def condition if (conditions.length == 1) { condition = atom(conditions[0]) @@ -78,7 +83,7 @@ abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFixtureTes condition = ArrangementUtil.combine(conditions.collect { atom(it) } as ArrangementMatchCondition[]) } - new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition)) + new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition), orderType) } @NotNull diff --git a/plugins/android-designer/src/com/intellij/android/designer/AndroidSelectedFileEditorProvider.java b/plugins/android-designer/src/com/intellij/android/designer/AndroidSelectedFileEditorProvider.java index ad58731aae30..778bad95af85 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/AndroidSelectedFileEditorProvider.java +++ b/plugins/android-designer/src/com/intellij/android/designer/AndroidSelectedFileEditorProvider.java @@ -23,6 +23,7 @@ import com.intellij.openapi.fileEditor.impl.EditorHistoryManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupManager; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.messages.MessageBusConnection; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -31,10 +32,13 @@ import org.jetbrains.annotations.Nullable; */ public class AndroidSelectedFileEditorProvider implements SelectedFileEditorProvider { private static final String KEY = "AndroidLayoutSelectedEditor"; + private static VirtualFile myCurrentOpenedFile; @Nullable @Override public FileEditorProvider getSelectedProvider(Project project, VirtualFile openedFile) { + myCurrentOpenedFile = null; + if (!AndroidDesignerEditorProvider.acceptLayout(project, openedFile)) { return null; } @@ -58,27 +62,33 @@ public class AndroidSelectedFileEditorProvider implements SelectedFileEditorProv public void projectOpened() { StartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable() { public void run() { - myProject.getMessageBus().connect(myProject) - .subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() { - @Override - public void fileOpened(FileEditorManager source, VirtualFile file) { - } + MessageBusConnection connection = myProject.getMessageBus().connect(myProject); + connection.subscribe(FileEditorManagerListener.Before.FILE_EDITOR_MANAGER, new FileEditorManagerListener.Before.Adapter() { + @Override + public void beforeFileOpened(FileEditorManager source, VirtualFile file) { + myCurrentOpenedFile = file; + } + }); + connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() { + @Override + public void fileOpened(FileEditorManager source, VirtualFile file) { + } - @Override - public void fileClosed(FileEditorManager source, VirtualFile file) { - } + @Override + public void fileClosed(FileEditorManager source, VirtualFile file) { + } - @Override - public void selectionChanged(FileEditorManagerEvent event) { - VirtualFile file = event.getNewFile(); - if (file != null && AndroidDesignerEditorProvider.acceptLayout(myProject, file)) { - FileEditorProvider provider = EditorHistoryManager.getInstance(myProject).getSelectedProvider(file); - if (provider != null) { - PropertiesComponent.getInstance(myProject).setValue(KEY, provider.getEditorTypeId()); - } + @Override + public void selectionChanged(FileEditorManagerEvent event) { + VirtualFile file = event.getNewFile(); + if (file != null && AndroidDesignerEditorProvider.acceptLayout(myProject, file)) { + FileEditorProvider provider = EditorHistoryManager.getInstance(myProject).getSelectedProvider(file); + if (provider != null && file != myCurrentOpenedFile) { + PropertiesComponent.getInstance(myProject).setValue(KEY, provider.getEditorTypeId()); } } - }); + } + }); } }); } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/UIDesignerToolWindowManager.java b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/UIDesignerToolWindowManager.java index e7ed3b70a7ea..82bff0979708 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/UIDesignerToolWindowManager.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/UIDesignerToolWindowManager.java @@ -18,7 +18,6 @@ package com.intellij.uiDesigner.propertyInspector; import com.intellij.openapi.actionSystem.DataProvider; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.compiler.CompilerManager; import com.intellij.openapi.components.ProjectComponent; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.FileEditorManager; @@ -40,7 +39,6 @@ import com.intellij.uiDesigner.componentTree.ComponentTree; import com.intellij.uiDesigner.componentTree.ComponentTreeBuilder; import com.intellij.uiDesigner.designSurface.GuiEditor; import com.intellij.uiDesigner.editor.UIFormEditor; -import com.intellij.uiDesigner.make.SourceInstrumentationTask; import com.intellij.util.ui.update.MergingUpdateQueue; import com.intellij.util.ui.update.Update; import icons.UIDesignerIcons; @@ -82,7 +80,6 @@ public class UIDesignerToolWindowManager implements ProjectComponent { StartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable() { public void run() { myToolWindowReady = true; - CompilerManager.getInstance(myProject).addBeforeTask(new SourceInstrumentationTask()); } }); }