From a940d3d1b1b41a3ba7dc5f65347e6240369d8e55 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 29 Dec 2011 17:23:05 +0400 Subject: [PATCH 01/32] @Nullable icon --- platform/platform-api/src/com/intellij/openapi/ui/Messages.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-api/src/com/intellij/openapi/ui/Messages.java b/platform/platform-api/src/com/intellij/openapi/ui/Messages.java index a6861357baf9..a6c0cec69314 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/Messages.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/Messages.java @@ -546,7 +546,7 @@ public class Messages { public static String showInputDialog(Project project, @Nls String message, @Nls String title, - Icon icon, + @Nullable Icon icon, @NonNls String initialValue, @Nullable InputValidator validator) { if (isApplicationInUnitTestOrHeadless()) { From 210e7bcbc47eee6a172337816722b6e3e6586c87 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 29 Dec 2011 18:46:58 +0400 Subject: [PATCH 02/32] tasks: saving context on commit --- .../tasks/tasks-core/src/META-INF/plugin.xml | 3 +- .../tasks/config/TaskConfigurable.form | 20 +++++-- .../tasks/config/TaskConfigurable.java | 3 + .../tasks/context/WorkingContextManager.java | 2 +- .../tasks/impl/TaskCheckinHandlerFactory.java | 57 +++++++++++++++++++ .../intellij/tasks/impl/TaskManagerImpl.java | 1 + 6 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java diff --git a/plugins/tasks/tasks-core/src/META-INF/plugin.xml b/plugins/tasks/tasks-core/src/META-INF/plugin.xml index f038f640e5eb..6ad70bca3fb8 100644 --- a/plugins/tasks/tasks-core/src/META-INF/plugin.xml +++ b/plugins/tasks/tasks-core/src/META-INF/plugin.xml @@ -15,9 +15,7 @@ com.intellij.tasks.TaskManager com.intellij.tasks.impl.TaskManagerImpl - - @@ -111,6 +109,7 @@ + diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskConfigurable.form b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskConfigurable.form index 001f2d52ad5d..ad72e0947e23 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskConfigurable.form +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskConfigurable.form @@ -1,6 +1,6 @@
- + @@ -10,10 +10,10 @@ - + - + @@ -33,18 +33,18 @@ - + - + - + @@ -111,6 +111,14 @@ + + + + + + + + diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskConfigurable.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskConfigurable.java index 342c13c23433..389a9e515f16 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskConfigurable.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskConfigurable.java @@ -41,6 +41,9 @@ public class TaskConfigurable extends BindableConfigurable implements Searchable private JTextField myHistoryLength; private JPanel myCacheSettings; + @BindControl("saveContextOnCommit") + private JCheckBox mySaveContextOnCommit; + private final Project myProject; private Configurable[] myConfigurables; private final NotNullLazyValue myControlBinder = new NotNullLazyValue() { diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/context/WorkingContextManager.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/WorkingContextManager.java index 26f35e80abec..a3e4cfb3f47b 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/context/WorkingContextManager.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/WorkingContextManager.java @@ -107,7 +107,7 @@ public class WorkingContextManager { saveContext(entryName, TASKS_ZIP_POSTFIX, task.getSummary()); } - public void saveContext(String entryName, @Nullable String comment) { + public void saveContext(@Nullable String entryName, @Nullable String comment) { saveContext(entryName, CONTEXT_ZIP_POSTFIX, comment); } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java new file mode 100644 index 000000000000..db91fce8a788 --- /dev/null +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java @@ -0,0 +1,57 @@ +/* + * Copyright 2000-2011 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.tasks.impl; + +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vcs.CheckinProjectPanel; +import com.intellij.openapi.vcs.changes.CommitContext; +import com.intellij.openapi.vcs.checkin.CheckinHandler; +import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory; +import com.intellij.tasks.TaskManager; +import com.intellij.tasks.context.WorkingContextManager; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; + +/** + * @author Dmitry Avdeev + * Date: 12/29/11 + */ +public class TaskCheckinHandlerFactory extends CheckinHandlerFactory { + + @NotNull + @Override + public CheckinHandler createHandler(final CheckinProjectPanel panel, final CommitContext commitContext) { + return new CheckinHandler() { + @Override + public void checkinSuccessful() { + final String message = panel.getCommitMessage(); + if (message != null) { + final Project project = panel.getProject(); + TaskManagerImpl manager = (TaskManagerImpl)TaskManager.getManager(project); + if (manager.getState().saveContextOnCommit) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + WorkingContextManager.getInstance(project).saveContext(null, message); + } + }); + } + } + } + }; + } +} diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java index aa4ddaba161e..f881ce53ca45 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java @@ -782,6 +782,7 @@ public class TaskManagerImpl extends TaskManager implements ProjectComponent, Pe public boolean clearContext = true; public boolean createChangelist = true; + public boolean saveContextOnCommit = true; public boolean trackContextForNewChangelist = true; public boolean markAsInProgress = false; From eb65ee3745bd15d4df78bb6043a51fcfcd65fac6 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 29 Dec 2011 19:19:49 +0400 Subject: [PATCH 03/32] intentions ui cleanup --- .../config/IntentionDescriptionPanel.form | 55 ++++++++++--------- .../config/IntentionDescriptionPanel.java | 5 +- .../impl/config/IntentionSettingsPanel.form | 14 +---- 3 files changed, 36 insertions(+), 38 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.form b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.form index cb666308bea7..f778120a1297 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.form +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.form @@ -1,34 +1,13 @@
- + - - - - - - - - - - - - - - - - - - - - - @@ -51,7 +30,7 @@ - + @@ -65,13 +44,13 @@ - + - + @@ -95,7 +74,9 @@ - + + + @@ -103,10 +84,32 @@ + + + + + + + + + + + + + + + + + + + + + +
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java index def771dcf3a9..8ff483061ab6 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java @@ -139,6 +139,10 @@ public class IntentionDescriptionPanel { } } + private void createUIComponents() { + // TODO: place custom component creation code here + } + private static void showUsages(final JPanel panel, final TitledSeparator separator, final List usagePanels, @@ -181,7 +185,6 @@ public class IntentionDescriptionPanel { } usagePanel.reset(exampleUsage.getText(), fileType); - separator.setText(name); if (!reuse) { if (i == exampleUsages.length) { gb.gridwidth = GridBagConstraints.REMAINDER; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsPanel.form b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsPanel.form index bf0ce974d35e..d90f966ee483 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsPanel.form +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsPanel.form @@ -30,8 +30,8 @@
- - + + @@ -41,20 +41,12 @@ - + - - - - - - - - From 904d5a2466d6d72b9573394e3c076aa6d25d4174 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Fri, 30 Dec 2011 14:29:41 +0400 Subject: [PATCH 04/32] intentions ui cleanup --- .../config/IntentionDescriptionPanel.form | 30 +++++++------------ .../config/IntentionDescriptionPanel.java | 4 --- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.form b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.form index f778120a1297..928e7dea908a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.form +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.form @@ -1,7 +1,7 @@
- + @@ -30,7 +30,7 @@ - + @@ -75,7 +75,7 @@ - + @@ -84,31 +84,21 @@ - + - - + - - - - - - - - - - - - - - + + + + + diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java index 8ff483061ab6..65845e38e71a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java @@ -139,10 +139,6 @@ public class IntentionDescriptionPanel { } } - private void createUIComponents() { - // TODO: place custom component creation code here - } - private static void showUsages(final JPanel panel, final TitledSeparator separator, final List usagePanels, From 3d20792767be4657a5243513371dc71cebf1cf3e Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Fri, 30 Dec 2011 14:43:30 +0400 Subject: [PATCH 05/32] extra borders removed --- .../src/com/intellij/ide/palette/impl/PaletteWindow.java | 1 + .../uiDesigner/propertyInspector/PropertyInspector.java | 3 +++ .../propertyInspector/UIDesignerToolWindowManager.java | 3 +++ 3 files changed, 7 insertions(+) diff --git a/java/idea-ui/src/com/intellij/ide/palette/impl/PaletteWindow.java b/java/idea-ui/src/com/intellij/ide/palette/impl/PaletteWindow.java index 1f01d4d51f0b..f14a38242e12 100644 --- a/java/idea-ui/src/com/intellij/ide/palette/impl/PaletteWindow.java +++ b/java/idea-ui/src/com/intellij/ide/palette/impl/PaletteWindow.java @@ -65,6 +65,7 @@ public class PaletteWindow extends JPanel implements DataProvider { setLayout(new GridLayout(1, 1)); myScrollPane.addMouseListener(new MyScrollPanePopupHandler()); + myScrollPane.setBorder(null); KeyStroke escStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); new ClearActiveItemAction().registerCustomShortcutSet(new CustomShortcutSet(escStroke), myScrollPane); refreshPalette(); diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/PropertyInspector.java b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/PropertyInspector.java index b9077c5cc048..477ed50c11a6 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/PropertyInspector.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/PropertyInspector.java @@ -18,7 +18,9 @@ package com.intellij.uiDesigner.propertyInspector; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.ex.MultiLineLabel; import com.intellij.openapi.util.Comparing; +import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.ScrollPaneFactory; +import com.intellij.ui.SideBorder; import com.intellij.uiDesigner.UIDesignerBundle; import com.intellij.uiDesigner.componentTree.ComponentSelectionListener; import com.intellij.uiDesigner.componentTree.ComponentTree; @@ -65,6 +67,7 @@ public final class PropertyInspector extends JPanel{ // Card with property inspector final JPanel inspectorCard = new JPanel(new GridBagLayout()); final JScrollPane inspectorScrollPane = ScrollPaneFactory.createScrollPane(myInspectorTable); + inspectorScrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM)); inspectorCard.add(inspectorScrollPane, new GridBagConstraints(0, 0, 0, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0) ); 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 c628acde799b..4f2866fa3ab7 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/UIDesignerToolWindowManager.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/UIDesignerToolWindowManager.java @@ -31,7 +31,9 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.ToolWindow; import com.intellij.openapi.wm.ToolWindowAnchor; import com.intellij.openapi.wm.ToolWindowManager; +import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.ScrollPaneFactory; +import com.intellij.ui.SideBorder; import com.intellij.uiDesigner.UIDesignerBundle; import com.intellij.uiDesigner.componentTree.ComponentTree; import com.intellij.uiDesigner.componentTree.ComponentTreeBuilder; @@ -95,6 +97,7 @@ public class UIDesignerToolWindowManager implements ProjectComponent { } myPendingListeners.clear(); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myComponentTree); + scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM)); scrollPane.setPreferredSize(new Dimension(250, -1)); myComponentTree.initQuickFixManager(scrollPane.getViewport()); myPropertyInspector= new PropertyInspector(myProject, myComponentTree); From 1c4a3995dea63bda9ca8f0f94376a19889d6ad61 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Fri, 30 Dec 2011 14:57:38 +0400 Subject: [PATCH 06/32] extra border removed --- .../intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java index 3769f684845e..b58bb53c634b 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java @@ -23,6 +23,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.EditorSettings; +import com.intellij.openapi.editor.impl.EditorImpl; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.DumbAwareRunnable; @@ -396,6 +397,7 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes editorSettings.setLineNumbersShown(false); editorSettings.setFoldingOutlineShown(false); + ((EditorImpl)editor).getScrollPane().setBorder(null); myEditorAdapter = new EditorAdapter(editor, myProject); final JPanel panel = new JPanel(new BorderLayout()); panel.add(editor.getComponent(), BorderLayout.CENTER); From 7811fa4a4367cde3b4133fd5168f142b3a18eab2 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Fri, 30 Dec 2011 14:50:51 +0400 Subject: [PATCH 07/32] collapseAll for toolbar --- .../intellij/ide/projectView/impl/ProjectViewImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java index 01a17f201cdb..78a9ec8e3464 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java @@ -520,10 +520,11 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo scrollAction = (ScrollFromSourceAction)action; myActionGroup.remove(scrollAction); } - //if (action instanceof CollapseAllToolbarAction) { - // collapseAction = (CollapseAllToolbarAction)action; - // myActionGroup.remove(collapseAction); - //} + if (action instanceof CollapseAllToolbarAction) { + collapseAction = (CollapseAllToolbarAction)action; + collapseAction.getTemplatePresentation().setIcon(IconLoader.getIcon("/general/collapseAll.png")); + myActionGroup.remove(collapseAction); + } } decorator.setTitleActions(new AnAction[] {scrollAction, collapseAction}); } From 9e368febb4c70f15d650e735ebac4f18695a1d54 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Fri, 30 Dec 2011 15:03:00 +0400 Subject: [PATCH 08/32] fix collapse all when selection on first level present --- .../src/com/intellij/ide/projectView/impl/ProjectViewImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java index 78a9ec8e3464..ff6a258b719e 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java @@ -685,7 +685,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo AbstractProjectViewPane pane = getCurrentProjectViewPane(); JTree tree = pane.myTree; if (tree != null) { - TreeUtil.collapseAll(tree, -1); + TreeUtil.collapseAll(tree, 0); } } From db6338fade5538afc067dd2e6ebd8a4098363730 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 12:06:01 +0100 Subject: [PATCH 09/32] provide information about a place where we are --- .../impl/java/JavaFileTreeModel.java | 21 +++++++++++++++-- .../structureView/impl/java/KindSorter.java | 8 +++++-- .../ide/actions/ViewStructureAction.java | 14 ++++++++++- .../openapi/actionSystem/AnActionEvent.java | 3 ++- .../src/com/intellij/ui/PlaceHolder.java | 23 +++++++++++++++++++ .../src/com/intellij/ui/PlaceProvider.java | 23 +++++++++++++++++++ .../src/com/intellij/ui/tabs/TabInfo.java | 3 ++- .../openapi/vcs/actions/VcsContext.java | 5 ++-- 8 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 platform/platform-api/src/com/intellij/ui/PlaceHolder.java create mode 100644 platform/platform-api/src/com/intellij/ui/PlaceProvider.java diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaFileTreeModel.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaFileTreeModel.java index d45c90798879..325c2867a4c8 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaFileTreeModel.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaFileTreeModel.java @@ -15,6 +15,7 @@ */ package com.intellij.ide.structureView.impl.java; +import com.intellij.ide.actions.ViewStructureAction; import com.intellij.ide.structureView.StructureViewModel; import com.intellij.ide.structureView.StructureViewTreeElement; import com.intellij.ide.structureView.TextEditorBasedStructureViewModel; @@ -23,15 +24,17 @@ import com.intellij.ide.util.treeView.smartTree.Grouper; import com.intellij.ide.util.treeView.smartTree.NodeProvider; import com.intellij.ide.util.treeView.smartTree.Sorter; import com.intellij.psi.*; +import com.intellij.ui.PlaceHolder; import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.Collection; -public class JavaFileTreeModel extends TextEditorBasedStructureViewModel implements StructureViewModel.ElementInfoProvider { +public class JavaFileTreeModel extends TextEditorBasedStructureViewModel implements StructureViewModel.ElementInfoProvider, PlaceHolder { private static final Collection NODE_PROVIDERS = Arrays.asList(new JavaInheritedMembersNodeProvider(), new JavaAnonymousClassesNodeProvider()); private final PsiJavaFile myFile; + private String myPlace; public JavaFileTreeModel(@NotNull PsiJavaFile file) { super(file); @@ -65,7 +68,11 @@ public class JavaFileTreeModel extends TextEditorBasedStructureViewModel impleme @NotNull public Sorter[] getSorters() { - return new Sorter[]{KindSorter.INSTANCE, VisibilitySorter.INSTANCE, AnonymousClassesSorter.INSTANCE, Sorter.ALPHA_SORTER}; + return new Sorter[] { + ViewStructureAction.isInStructureViewPopup(this) ? KindSorter.POPUP_INSTANCE : KindSorter.INSTANCE, + VisibilitySorter.INSTANCE, + AnonymousClassesSorter.INSTANCE, + Sorter.ALPHA_SORTER}; } protected PsiFile getPsiFile() { @@ -110,4 +117,14 @@ public class JavaFileTreeModel extends TextEditorBasedStructureViewModel impleme protected Class[] getSuitableClasses() { return new Class[]{PsiClass.class, PsiMethod.class, PsiField.class, PsiJavaFile.class}; } + + @Override + public void setPlace(String place) { + myPlace = place; + } + + @Override + public String getPlace() { + return myPlace; + } } diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/KindSorter.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/KindSorter.java index 584f0a3e5f5c..18cc5972d29a 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/KindSorter.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/KindSorter.java @@ -25,9 +25,13 @@ import java.util.Comparator; public class KindSorter implements Sorter { public static final Sorter INSTANCE = new KindSorter(); + public static final Sorter POPUP_INSTANCE = new KindSorter(){{isPopup = true;}}; + @NonNls public static final String ID = "KIND"; - private static final Comparator COMPARATOR = new Comparator() { + boolean isPopup = false; + + private final Comparator COMPARATOR = new Comparator() { public int compare(final Object o1, final Object o2) { return getWeight(o1) - getWeight(o2); } @@ -37,7 +41,7 @@ public class KindSorter implements Sorter { return 55; } if (value instanceof JavaClassTreeElement) { - return 10; + return isPopup ? 53 : 10; } if (value instanceof ClassInitializerTreeElement) { return 15; diff --git a/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java b/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java index 9b4de3c2ee48..a1e115a7f014 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java @@ -33,10 +33,13 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.pom.Navigatable; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; +import com.intellij.ui.PlaceHolder; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ViewStructureAction extends AnAction { + private static final String PLACE = "StructureViewPopup"; + public ViewStructureAction() { setEnabledInModalContext(true); } @@ -91,7 +94,16 @@ public class ViewStructureAction extends AnAction { final StructureViewBuilder structureViewBuilder = fileEditor.getStructureViewBuilder(); if (structureViewBuilder == null) return null; StructureView structureView = structureViewBuilder.createStructureView(fileEditor, project); - return createStructureViewPopup(structureView.getTreeModel(), editor, project, navigatable, structureView); + final StructureViewModel model = structureView.getTreeModel(); + if (model instanceof PlaceHolder) { + //noinspection unchecked + ((PlaceHolder)model).setPlace(PLACE); + } + return createStructureViewPopup(model, editor, project, navigatable, structureView); + } + + public static boolean isInStructureViewPopup(@NotNull PlaceHolder model) { + return PLACE.equals(model.getPlace()); } public static FileStructureDialog createStructureViewBasedDialog(final StructureViewModel structureViewModel, diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java index 05e9217dc5c0..6e0547b827e3 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java @@ -17,6 +17,7 @@ package com.intellij.openapi.actionSystem; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.ui.PlaceProvider; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; @@ -32,7 +33,7 @@ import java.util.Map; * @see AnAction#update(AnActionEvent) */ -public class AnActionEvent { +public class AnActionEvent implements PlaceProvider { private final InputEvent myInputEvent; private final ActionManager myActionManager; @NotNull private final DataContext myDataContext; diff --git a/platform/platform-api/src/com/intellij/ui/PlaceHolder.java b/platform/platform-api/src/com/intellij/ui/PlaceHolder.java new file mode 100644 index 000000000000..88f4d0a140fc --- /dev/null +++ b/platform/platform-api/src/com/intellij/ui/PlaceHolder.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui; + +/** + * @author Konstantin Bulenkov + */ +public interface PlaceHolder extends PlaceProvider { + void setPlace(Place place); +} diff --git a/platform/platform-api/src/com/intellij/ui/PlaceProvider.java b/platform/platform-api/src/com/intellij/ui/PlaceProvider.java new file mode 100644 index 000000000000..c74cbc5e79b4 --- /dev/null +++ b/platform/platform-api/src/com/intellij/ui/PlaceProvider.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui; + +/** + * @author Konstantin Bulenkov + */ +public interface PlaceProvider { + Place getPlace(); +} diff --git a/platform/platform-api/src/com/intellij/ui/tabs/TabInfo.java b/platform/platform-api/src/com/intellij/ui/tabs/TabInfo.java index 3ffe498ed2e8..0a17ff9e0258 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/TabInfo.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/TabInfo.java @@ -18,6 +18,7 @@ package com.intellij.ui.tabs; import com.intellij.openapi.actionSystem.ActionGroup; import com.intellij.openapi.ui.Queryable; import com.intellij.openapi.util.IconLoader; +import com.intellij.ui.PlaceProvider; import com.intellij.ui.SimpleColoredText; import com.intellij.ui.SimpleTextAttributes; import com.intellij.ui.content.AlertIcon; @@ -31,7 +32,7 @@ import java.beans.PropertyChangeSupport; import java.lang.ref.WeakReference; import java.util.Map; -public final class TabInfo implements Queryable { +public final class TabInfo implements Queryable, PlaceProvider { public static final String ACTION_GROUP = "actionGroup"; public static final String ICON = "icon"; diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/actions/VcsContext.java b/platform/vcs-api/src/com/intellij/openapi/vcs/actions/VcsContext.java index 63e3e48d0430..5e55583a2dc7 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/actions/VcsContext.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/actions/VcsContext.java @@ -22,12 +22,13 @@ import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangeList; import com.intellij.openapi.vcs.ui.Refreshable; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.ui.PlaceProvider; import org.jetbrains.annotations.Nullable; import java.io.File; import java.util.Collection; -public interface VcsContext { +public interface VcsContext extends PlaceProvider { Project getProject(); @Nullable @@ -45,8 +46,6 @@ public interface VcsContext { Refreshable getRefreshableDialog(); - String getPlace(); - File getSelectedIOFile(); FilePath[] getSelectedFilePaths(); From 63cb9ab4ec6b5cff90cd0dc3ce97f7ac3ccaf131 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Fri, 30 Dec 2011 15:14:30 +0400 Subject: [PATCH 10/32] Need VirtualFileManager in core for findFileByUrl() --- .../com/intellij/core/CoreEnvironment.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/platform/core-impl/src/com/intellij/core/CoreEnvironment.java b/platform/core-impl/src/com/intellij/core/CoreEnvironment.java index 32e667e3c046..76c4211304f6 100644 --- a/platform/core-impl/src/com/intellij/core/CoreEnvironment.java +++ b/platform/core-impl/src/com/intellij/core/CoreEnvironment.java @@ -20,6 +20,7 @@ import com.intellij.lang.impl.PsiBuilderFactoryImpl; import com.intellij.mock.*; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.openapi.extensions.ExtensionPoint; @@ -34,9 +35,13 @@ import com.intellij.openapi.roots.FileIndexFacade; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.StaticGetter; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.VirtualFileManager; +import com.intellij.openapi.vfs.VirtualFileSystem; import com.intellij.openapi.vfs.encoding.EncodingRegistry; +import com.intellij.openapi.vfs.impl.VirtualFileManagerImpl; import com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem; import com.intellij.openapi.vfs.local.CoreLocalFileSystem; +import com.intellij.openapi.vfs.newvfs.FileSystemPersistence; import com.intellij.psi.PsiFileFactory; import com.intellij.psi.PsiManager; import com.intellij.psi.impl.*; @@ -53,6 +58,7 @@ import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.util.PsiModificationTracker; import com.intellij.util.CachedValuesManagerImpl; import com.intellij.util.Function; +import com.intellij.util.messages.impl.MessageBusImpl; import org.picocontainer.MutablePicoContainer; import java.lang.reflect.Modifier; @@ -95,6 +101,22 @@ public class CoreEnvironment { } }, null)); + registerComponentInstance(appContainer, VirtualFileManager.class, + new VirtualFileManagerImpl(new VirtualFileSystem[] {myLocalFileSystem, myJarFileSystem}, + new MessageBusImpl(myApplication, null), + new FileSystemPersistence() { + @Override + public void refresh(boolean asynchronous, Runnable postAction, ModalityState modalityState) { + } + + @Override + public int getCheapFileSystemModificationCount() { + return 0; + } + } + ) + ); + myApplication.registerService(DefaultASTFactory.class, new CoreASTFactory()); myApplication.registerService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl()); myApplication.registerService(ReferenceProvidersRegistry.class, new MockReferenceProvidersRegistry()); From 106dffde93d9e014f752406344624ecc734c7f3d Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Fri, 30 Dec 2011 15:45:17 +0400 Subject: [PATCH 11/32] missing icon --- platform/icons/src/general/collapseAll.png | Bin 0 -> 1069 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 platform/icons/src/general/collapseAll.png diff --git a/platform/icons/src/general/collapseAll.png b/platform/icons/src/general/collapseAll.png new file mode 100644 index 0000000000000000000000000000000000000000..e04f4a0e6cd542c19e98ac315c7926f6eca62090 GIT binary patch literal 1069 zcmaJ=Pe>F|9G)o5EXg3qGHV<=1hwld(U>6`GhLQv^plJP9Ux9jp z*n37#bf6CTqNqZHR$L!CV^|nX5cQ22OHoq*kzF9En*r+k^OqEMhzSgU6f$GwsCFU@&b!7H36d6r`tj%QfEhhs&bUt~FQ`=f9)Tk95MQuB5!d<#%L2w5V- zq|<3ST|+}V$#8-oFf7mTya#)DoPHB28IS2y=NTm6sJ3n)9h#)esC2?Havz{G$9`)m~tuDjX|Wr-mh zCtQbF3dIg!v5wE$4X5?ZP4%K^H>S0eFiX59;@wQg9Wj!7z_(XmVm8a16s2U4RW(+ zQ7@c}zaZZ>Rx6xKT|q2^lVRM^{x#~n3G2r_?g$rOcBBtXtalp=oB0vf@uPSYk%EcL z`;pn392#2Pzy5JiKeEDSHIXUB45E$G|3U}|a9i62{Cn-jh+rzYc<=0}U~e_6}!`CYWaZJf&yE2H;H T9&}PO?gNg5qtcV6&f9+glV4`J literal 0 HcmV?d00001 From a67234d3148e7ec0cb9177d64b758226ccc74a6e Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Fri, 30 Dec 2011 15:51:20 +0400 Subject: [PATCH 12/32] Need messages in core --- .../java-psi-impl}/src/messages/JavaErrorMessages.properties | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {resources-en => java/java-psi-impl}/src/messages/JavaErrorMessages.properties (100%) diff --git a/resources-en/src/messages/JavaErrorMessages.properties b/java/java-psi-impl/src/messages/JavaErrorMessages.properties similarity index 100% rename from resources-en/src/messages/JavaErrorMessages.properties rename to java/java-psi-impl/src/messages/JavaErrorMessages.properties From a25b1e533b1753d1babcec42112a95ca75880ab5 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 12:46:52 +0100 Subject: [PATCH 13/32] proper size on first show --- .../intellij/ide/util/FileStructurePopup.java | 56 +++++++++++-------- .../filtered/FilteringTreeBuilder.java | 2 +- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index 6f856340fc48..a235f52c19a5 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -33,6 +33,7 @@ import com.intellij.openapi.keymap.KeymapUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.JBPopup; import com.intellij.openapi.ui.popup.JBPopupFactory; +import com.intellij.openapi.util.DimensionService; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.TextRange; @@ -44,7 +45,6 @@ import com.intellij.psi.PsiFile; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.SpeedSearchBase; import com.intellij.ui.TreeSpeedSearch; -import com.intellij.ui.docking.DockManager; import com.intellij.ui.speedSearch.ElementFilter; import com.intellij.ui.speedSearch.SpeedSearchSupply; import com.intellij.ui.treeStructure.Tree; @@ -87,7 +87,7 @@ public class FileStructurePopup implements Disposable { private String myTitle; private TreeSpeedSearch mySpeedSearch; private SmartTreeStructure myTreeStructure; - private JComponent myPanel; + private int myPrefferedWidth; public FileStructurePopup(StructureViewModel structureViewModel, @Nullable Editor editor, @@ -158,9 +158,10 @@ public class FileStructurePopup implements Disposable { } public void show() { - myPanel = createCenterPanel(); - new MnemonicHelper().register(myPanel); - myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myPanel, null) + JComponent panel = createCenterPanel(); + new MnemonicHelper().register(panel); + boolean shouldSetWidth = DimensionService.getInstance().getSize(getDimensionServiceKey(), myProject) == null; + myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, null) .setTitle(myTitle) .setResizable(true) .setFocusable(true) @@ -171,20 +172,29 @@ public class FileStructurePopup implements Disposable { Disposer.register(myPopup, myDisposable); Disposer.register(myPopup, this); Disposer.register(myPopup, myAbstractTreeBuilder); - myPopup.showInCenterOf(myEditor.getComponent()); - myAbstractTreeBuilder.expandAll(new Runnable() { + myPopup.showInBestPositionFor(myEditor); + + if (shouldSetWidth) { + myPopup.setSize(new Dimension(myPrefferedWidth + 10, myPopup.getSize().height)); + } + new Alarm().addRequest(new Runnable() { @Override public void run() { - IdeFocusManager.getInstance(myProject).requestFocus(myTree, true); - myAbstractTreeBuilder.queueUpdate().doWhenDone(new Runnable() { + myAbstractTreeBuilder.expandAll(new Runnable() { @Override public void run() { - myAbstractTreeBuilder.expandAll(null); - selectPsiElement(getCurrentElement(getPsiFile(myProject))); + IdeFocusManager.getInstance(myProject).requestFocus(myTree, true); + myAbstractTreeBuilder.queueUpdate().doWhenDone(new Runnable() { + @Override + public void run() { + myAbstractTreeBuilder.expandAll(null); + selectPsiElement(getCurrentElement(getPsiFile(myProject))); + } + }); } }); } - }); + }, 100); final Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, myPopup); alarm.addRequest(new Runnable() { String filter = ""; @@ -192,7 +202,7 @@ public class FileStructurePopup implements Disposable { public void run() { alarm.cancelAllRequests(); String prefix = mySpeedSearch.getEnteredPrefix(); - myTree.getEmptyText().setText("Can't find '" + prefix + "'"); + myTree.getEmptyText().setText(StringUtil.isEmpty(prefix) ? "Nothing to show" : "Can't find '" + prefix + "'"); if (prefix == null) prefix = ""; if (!filter.equals(prefix)) { @@ -254,8 +264,8 @@ public class FileStructurePopup implements Disposable { public void dispose() { } - protected String getDimensionServiceKey() { - return DockManager.getInstance(myProject).getDimensionKeyForFocus("#com.intellij.ide.util.FileStructureDialog"); + protected static String getDimensionServiceKey() { + return "StructurePopup"; } @Nullable @@ -324,7 +334,7 @@ public class FileStructurePopup implements Disposable { for (FileStructureNodeProvider provider : fileStructureNodeProviders) { addCheckbox(comboPanel, provider); } - + myPrefferedWidth = Math.max(comboPanel.getPreferredSize().width, 350); panel.add(comboPanel, BorderLayout.NORTH); panel.add(ScrollPaneFactory.createScrollPane(myAbstractTreeBuilder.getTree()), BorderLayout.CENTER); panel.add(createSouthPanel(), BorderLayout.SOUTH); @@ -463,13 +473,13 @@ public class FileStructurePopup implements Disposable { } } - private class MyFilter extends ElementFilter.Active.Impl { - - @Override - public boolean shouldBeShowing(StructureViewComponent.StructureViewTreeElementWrapper value) { - return true; - } - } + //private class MyFilter extends ElementFilter.Active.Impl { + // + // @Override + // public boolean shouldBeShowing(StructureViewComponent.StructureViewTreeElementWrapper value) { + // return true; + // } + //} private class FileStructurePopupFilter implements ElementFilter { diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeBuilder.java b/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeBuilder.java index 3872d54b0ff7..dc11c7821da9 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeBuilder.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeBuilder.java @@ -112,7 +112,7 @@ public class FilteringTreeBuilder extends AbstractTreeBuilder { refilter(null, true, false); } - public ActionCallback refilter(final Object preferredSelection, final boolean adjustSelection, final boolean now) { + public ActionCallback refilter(@Nullable final Object preferredSelection, final boolean adjustSelection, final boolean now) { if (myRefilterQueue != null) { myRefilterQueue.cancelAllUpdates(); } From 2e26e5f70ace21ed4b718e19933b3d7f383356db Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 12:55:58 +0100 Subject: [PATCH 14/32] remove unused from platform-impl --- .../com/intellij/ui/TreeToolTipHandler.java | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 platform/platform-impl/src/com/intellij/ui/TreeToolTipHandler.java diff --git a/platform/platform-impl/src/com/intellij/ui/TreeToolTipHandler.java b/platform/platform-impl/src/com/intellij/ui/TreeToolTipHandler.java deleted file mode 100644 index e7fc2fe14f3d..000000000000 --- a/platform/platform-impl/src/com/intellij/ui/TreeToolTipHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.ui; - -import javax.swing.*; - -/** - * @deprecated use {@link com.intellij.ui.treeStructure.Tree} instead - */ -public class TreeToolTipHandler { - public static void install(JTree tree) { - } -} From 5b99f7efe2fe970806558db8b6cb27aa773c49fd Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Fri, 30 Dec 2011 16:30:04 +0400 Subject: [PATCH 15/32] extra border removed --- .../src/com/intellij/openapi/vcs/update/UpdateInfoTree.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java index 5ad2fbe0a1e5..ce6c95ee1838 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java @@ -148,7 +148,9 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton implements Di } protected JComponent createCenterPanel() { - myCenterPanel.add(CARD_STATUS, ScrollPaneFactory.createScrollPane(myTree)); + JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree); + scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT)); + myCenterPanel.add(CARD_STATUS, scrollPane); myTreeBrowser = new CommittedChangesTreeBrowser(myProject, Collections.emptyList()); Disposer.register(this, myTreeBrowser); myTreeBrowser.setHelpId(getHelpId()); From ca458bfbf186d390b334db26ab7301cae998c6ee Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 14:29:13 +0100 Subject: [PATCH 16/32] allow expandable items for popups --- .../ui/AbstractExpandableItemsHandler.java | 15 ++++++++++++++- .../src/com/intellij/ui/popup/AbstractPopup.java | 11 +++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java b/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java index 886671eeceec..31bb933bfea0 100644 --- a/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java +++ b/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java @@ -18,6 +18,7 @@ package com.intellij.ui; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Pair; +import com.intellij.ui.popup.AbstractPopup; import com.intellij.util.Alarm; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -213,7 +214,19 @@ abstract public class AbstractExpandableItemsHandler Date: Fri, 30 Dec 2011 14:30:05 +0100 Subject: [PATCH 17/32] enable expandable items --- .../src/com/intellij/ide/util/FileStructurePopup.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index a235f52c19a5..567befcf339a 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -45,6 +45,7 @@ import com.intellij.psi.PsiFile; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.SpeedSearchBase; import com.intellij.ui.TreeSpeedSearch; +import com.intellij.ui.popup.AbstractPopup; import com.intellij.ui.speedSearch.ElementFilter; import com.intellij.ui.speedSearch.SpeedSearchSupply; import com.intellij.ui.treeStructure.Tree; @@ -167,6 +168,7 @@ public class FileStructurePopup implements Disposable { .setFocusable(true) .setMovable(true) .setCancelKeyEnabled(false) + .addUserData("ShowHints") .setDimensionServiceKey(null, getDimensionServiceKey(), false) .createPopup(); Disposer.register(myPopup, myDisposable); @@ -174,6 +176,7 @@ public class FileStructurePopup implements Disposable { Disposer.register(myPopup, myAbstractTreeBuilder); myPopup.showInBestPositionFor(myEditor); + ((AbstractPopup)myPopup).setShowHints(true); if (shouldSetWidth) { myPopup.setSize(new Dimension(myPrefferedWidth + 10, myPopup.getSize().height)); } From 655d7278accb71bb917e8301276362348a8d8b74 Mon Sep 17 00:00:00 2001 From: "kirill.safonov" Date: Fri, 30 Dec 2011 17:30:41 +0400 Subject: [PATCH 18/32] do fix Finish button in Data Binding Wizard on Mac (IDEA-79279) --- .../com/intellij/uiDesigner/wizard/DataBindingWizard.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/wizard/DataBindingWizard.java b/plugins/ui-designer/src/com/intellij/uiDesigner/wizard/DataBindingWizard.java index 08b9afeac463..3f2b6cf2bef1 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/wizard/DataBindingWizard.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/wizard/DataBindingWizard.java @@ -59,9 +59,10 @@ public final class DataBindingWizard extends AbstractWizard{ } protected void updateStep() { - super.updateStep(); // "Finish" button is enabled only at the last step - getFinishButton().setEnabled(getCurrentStep() == mySteps.size() - 1); + getFinishButton().setEnabled(isLastStep()); + super.updateStep(); + } protected void doOKAction() { From 245115807ec9cd69a67a762ba7c6f25262240d0e Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Fri, 30 Dec 2011 18:11:37 +0300 Subject: [PATCH 19/32] [nik] stack pop exception in <<<.. case --- .../options/colors/highlighting/HighlightsExtractor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/highlighting/HighlightsExtractor.java b/platform/lang-impl/src/com/intellij/application/options/colors/highlighting/HighlightsExtractor.java index 98333f988d42..db4b3b45b952 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/highlighting/HighlightsExtractor.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/highlighting/HighlightsExtractor.java @@ -72,7 +72,7 @@ public class HighlightsExtractor { if (openTag == -1) { return null; } - if (text.charAt(openTag + 1) == '<') { + while (text.charAt(openTag + 1) == '<') { openTag++; } if (text.charAt(openTag + 1) == '/') { @@ -104,7 +104,7 @@ public class HighlightsExtractor { sb.append(text.substring(index, text.length())); break; } - if (text.charAt(from+1) == '<') { + while (text.charAt(from+1) == '<') { from++; } int to = text.indexOf('>', from+1); From f885dd7591df10b36cf7c62e27129e065dfc91df Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 30 Dec 2011 16:00:42 +0100 Subject: [PATCH 20/32] editing default run configuration: quickly navigate to default of selected configuration --- .../src/com/intellij/execution/impl/RunConfigurable.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java index 1fcdb43be9e1..11ac314c5f73 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java @@ -452,7 +452,13 @@ class RunConfigurable extends BaseConfigurable { group.add(new AnAction(ExecutionBundle.message("run.configuration.edit.default.configuration.settings.button"), ExecutionBundle.message("run.configuration.edit.default.configuration.settings.button"), EDIT_DEFAULTS_ICON) { public void actionPerformed(final AnActionEvent e) { - final TreeNode defaults = TreeUtil.findNodeWithObject("Defaults", myTree.getModel(), myRoot); + TreeNode defaults = TreeUtil.findNodeWithObject("Defaults", myTree.getModel(), myRoot); + if (defaults != null) { + final ConfigurationType configurationType = getSelectedConfigurationType(); + if (configurationType != null) { + defaults = TreeUtil.findNodeWithObject(configurationType, myTree.getModel(), defaults); + } + } final DefaultMutableTreeNode defaultsNode = (DefaultMutableTreeNode)defaults; final TreePath path = TreeUtil.getPath(myRoot, defaultsNode); myTree.expandPath(path); From 7c732a919f969183fb384c44f840bd64f8604b6a Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 16:08:20 +0100 Subject: [PATCH 21/32] speed search comparator for structure tree --- .../lang-impl/src/com/intellij/ide/util/FileStructurePopup.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index 567befcf339a..0088d95a9688 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -143,6 +143,8 @@ public class FileStructurePopup implements Disposable { return myPopup.getContent().getVisibleRect(); } }; + mySpeedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false)); + myAbstractTreeBuilder = new FilteringTreeBuilder(project, myTree, new FileStructurePopupFilter(), myTreeStructure, null) { @Override protected boolean validateNode(Object child) { From 52e6e8e2d7a54acdde900cf6d7c973e2d38e01b3 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 30 Dec 2011 16:10:42 +0100 Subject: [PATCH 22/32] light fixture-based SuspiciousCollectionMethodCallsTest --- .../src/Test.java => IgnoreConvertible.java} | 3 ++- .../suspiciousCalls/IgnoreConvertible/expected.xml | 9 --------- .../inspection/suspiciousCalls/Wildcard.java | 12 ++++++++++++ .../suspiciousCalls/Wildcard/expected.xml | 9 --------- .../suspiciousCalls/Wildcard/src/Test.java | 8 -------- .../suspiciousCalls/WildcardCapture/expected.xml | 4 ---- .../suspiciousCalls/WildcardCapture/src/Test.java | 8 -------- .../SuspiciousCollectionMethodCallsTest.java | 14 ++++++-------- 8 files changed, 20 insertions(+), 47 deletions(-) rename java/java-tests/testData/inspection/suspiciousCalls/{IgnoreConvertible/src/Test.java => IgnoreConvertible.java} (63%) delete mode 100644 java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible/expected.xml create mode 100644 java/java-tests/testData/inspection/suspiciousCalls/Wildcard.java delete mode 100644 java/java-tests/testData/inspection/suspiciousCalls/Wildcard/expected.xml delete mode 100644 java/java-tests/testData/inspection/suspiciousCalls/Wildcard/src/Test.java delete mode 100644 java/java-tests/testData/inspection/suspiciousCalls/WildcardCapture/expected.xml delete mode 100644 java/java-tests/testData/inspection/suspiciousCalls/WildcardCapture/src/Test.java diff --git a/java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible/src/Test.java b/java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible.java similarity index 63% rename from java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible/src/Test.java rename to java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible.java index 8f627f6ff22b..1433b2ba1a69 100644 --- a/java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible/src/Test.java +++ b/java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible.java @@ -1,3 +1,4 @@ +import java.util.Map; import java.util.List; import java.util.ArrayList; @@ -10,6 +11,6 @@ class Clazz { } void foo(List c) { - c.contains(""); + c.contains(""); } } \ No newline at end of file diff --git a/java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible/expected.xml b/java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible/expected.xml deleted file mode 100644 index 77314fecede1..000000000000 --- a/java/java-tests/testData/inspection/suspiciousCalls/IgnoreConvertible/expected.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - Test.java - 13 - 'List<? extends Number>' may not contain objects of type 'String' - - - diff --git a/java/java-tests/testData/inspection/suspiciousCalls/Wildcard.java b/java/java-tests/testData/inspection/suspiciousCalls/Wildcard.java new file mode 100644 index 000000000000..179810f4929d --- /dev/null +++ b/java/java-tests/testData/inspection/suspiciousCalls/Wildcard.java @@ -0,0 +1,12 @@ +import java.util.List; +import java.util.ArrayList; + +class Clazz { + void foo(List l) { + boolean b = l.contains(""); } + void bar() { + List> l = new ArrayList>(); + Class o = String.class; + int i = l.indexOf(o); + } +} \ No newline at end of file diff --git a/java/java-tests/testData/inspection/suspiciousCalls/Wildcard/expected.xml b/java/java-tests/testData/inspection/suspiciousCalls/Wildcard/expected.xml deleted file mode 100644 index 39cdee891698..000000000000 --- a/java/java-tests/testData/inspection/suspiciousCalls/Wildcard/expected.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - Test.java - 6 - 'List<? extends Number>' may not contain objects of type 'String' - - - diff --git a/java/java-tests/testData/inspection/suspiciousCalls/Wildcard/src/Test.java b/java/java-tests/testData/inspection/suspiciousCalls/Wildcard/src/Test.java deleted file mode 100644 index 192549b3e79e..000000000000 --- a/java/java-tests/testData/inspection/suspiciousCalls/Wildcard/src/Test.java +++ /dev/null @@ -1,8 +0,0 @@ -import java.util.List; -import java.util.ArrayList; - -class Clazz { - void foo(List l) { - boolean b = l.contains(""); - } -} \ No newline at end of file diff --git a/java/java-tests/testData/inspection/suspiciousCalls/WildcardCapture/expected.xml b/java/java-tests/testData/inspection/suspiciousCalls/WildcardCapture/expected.xml deleted file mode 100644 index d704d58ed391..000000000000 --- a/java/java-tests/testData/inspection/suspiciousCalls/WildcardCapture/expected.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/java/java-tests/testData/inspection/suspiciousCalls/WildcardCapture/src/Test.java b/java/java-tests/testData/inspection/suspiciousCalls/WildcardCapture/src/Test.java deleted file mode 100644 index 7ab2ffafa430..000000000000 --- a/java/java-tests/testData/inspection/suspiciousCalls/WildcardCapture/src/Test.java +++ /dev/null @@ -1,8 +0,0 @@ -import java.util.List; -import java.util.ArrayList; - -class Clazz { - List> l = new ArrayList>(); - Class o = String.class; - int i = l.indexOf(o); -} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java index 2d6268dfc699..9885c8d7ea05 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java @@ -1,24 +1,22 @@ package com.intellij.codeInspection; import com.intellij.JavaTestUtil; -import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; import com.intellij.codeInspection.miscGenerics.SuspiciousCollectionsMethodCallsInspection; -import com.intellij.testFramework.InspectionTestCase; +import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; -public class SuspiciousCollectionMethodCallsTest extends InspectionTestCase { +public class SuspiciousCollectionMethodCallsTest extends LightCodeInsightFixtureTestCase { private final SuspiciousCollectionsMethodCallsInspection myTool = new SuspiciousCollectionsMethodCallsInspection(); @Override - protected String getTestDataPath() { - return JavaTestUtil.getJavaTestDataPath() + "/inspection"; + protected String getBasePath() { + return JavaTestUtil.getRelativeJavaTestDataPath() + "/inspection/suspiciousCalls"; } private void doTest() throws Exception { - final LocalInspectionToolWrapper tool = new LocalInspectionToolWrapper(myTool); - doTest("suspiciousCalls/" + getTestName(false), tool, "java 1.5"); + myFixture.enableInspections(myTool); + myFixture.testHighlighting(getTestName(false) + ".java"); } - public void testWildcardCapture() throws Exception { doTest(); } public void testWildcard() throws Exception { doTest(); } public void testIgnoreConvertible() throws Exception { myTool.REPORT_CONVERTIBLE_METHOD_CALLS = false; From 75c5872a0a264d1246dec8e31b347c28382bba49 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 30 Dec 2011 16:17:32 +0100 Subject: [PATCH 23/32] IDEA-51920 'Suspicious call to Map.get' inspection should be aware of dataflow type information --- .../SuspiciousCollectionsMethodCallsInspection.java | 12 +++++++++++- .../testData/inspection/suspiciousCalls/UseDfa.java | 11 +++++++++++ .../SuspiciousCollectionMethodCallsTest.java | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 java/java-tests/testData/inspection/suspiciousCalls/UseDfa.java diff --git a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java index 507b5f5bcd63..199a48507a9f 100644 --- a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java @@ -16,6 +16,7 @@ package com.intellij.codeInspection.miscGenerics; import com.intellij.codeInsight.daemon.GroupNames; +import com.intellij.codeInsight.guess.GuessManager; import com.intellij.codeInspection.InspectionsBundle; import com.intellij.codeInspection.ProblemsHolder; import com.intellij.codeInspection.ex.BaseLocalInspectionTool; @@ -133,8 +134,17 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect final IntArrayList indices) { final PsiExpression[] args = methodCall.getArgumentList().getExpressions(); if (args.length != 1) return null; + PsiType argType = args[0].getType(); - return getSuspiciousMethodCallMessage(methodCall, argType, reportConvertibleMethodCalls, patternMethods, indices); + final String plainMessage = getSuspiciousMethodCallMessage(methodCall, argType, reportConvertibleMethodCalls, patternMethods, indices); + if (plainMessage != null) { + final PsiType dfaType = GuessManager.getInstance(methodCall.getProject()).getControlFlowExpressionType(args[0]); + if (dfaType != null && getSuspiciousMethodCallMessage(methodCall, dfaType, reportConvertibleMethodCalls, patternMethods, indices) == null) { + return null; + } + } + + return plainMessage; } @Nullable diff --git a/java/java-tests/testData/inspection/suspiciousCalls/UseDfa.java b/java/java-tests/testData/inspection/suspiciousCalls/UseDfa.java new file mode 100644 index 000000000000..7ba8c3d9bd22 --- /dev/null +++ b/java/java-tests/testData/inspection/suspiciousCalls/UseDfa.java @@ -0,0 +1,11 @@ +import java.lang.Integer; +import java.util.Map; + +class Clazz { + void f(Map map, Object o) { + if (o instanceof Integer && map.containsKey(o)) { + System.out.println(); + } + } + +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java index 9885c8d7ea05..22e972f55d1b 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java @@ -17,6 +17,7 @@ public class SuspiciousCollectionMethodCallsTest extends LightCodeInsightFixture myFixture.testHighlighting(getTestName(false) + ".java"); } + public void testUseDfa() throws Exception { doTest(); } public void testWildcard() throws Exception { doTest(); } public void testIgnoreConvertible() throws Exception { myTool.REPORT_CONVERTIBLE_METHOD_CALLS = false; From 7abe089a7c3839873505e023355d79730349a634 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 16:32:46 +0100 Subject: [PATCH 24/32] support camel case in speed search --- .../options/ProcessedModulesTable.java | 3 +- .../debugger/ui/impl/watch/DebuggerTree.java | 4 +- .../find/actions/ShowUsagesAction.java | 7 +- .../ide/util/FileStructureDialog.java | 11 ++-- .../intellij/ide/util/FileStructurePopup.java | 3 +- .../com/intellij/ide/util/MemberChooser.java | 2 +- .../openapi/util/registry/RegistryUi.java | 2 +- .../intellij/ide/util/ElementsChooser.java | 2 +- .../src/com/intellij/ui/SpeedSearchBase.java | 29 --------- .../intellij/ui/SpeedSearchComparator.java | 64 +++++++++++++++++++ .../maven/wizards/MavenModuleWizardStep.java | 2 +- 11 files changed, 80 insertions(+), 49 deletions(-) create mode 100644 platform/platform-impl/src/com/intellij/ui/SpeedSearchComparator.java diff --git a/java/compiler/impl/src/com/intellij/compiler/options/ProcessedModulesTable.java b/java/compiler/impl/src/com/intellij/compiler/options/ProcessedModulesTable.java index 2f9b75f8fa41..718901122c57 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/ProcessedModulesTable.java +++ b/java/compiler/impl/src/com/intellij/compiler/options/ProcessedModulesTable.java @@ -23,6 +23,7 @@ import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; import com.intellij.ui.SpeedSearchBase; +import com.intellij.ui.SpeedSearchComparator; import com.intellij.ui.TableUtil; import com.intellij.ui.ToolbarDecorator; import com.intellij.ui.table.JBTable; @@ -109,7 +110,7 @@ public class ProcessedModulesTable extends JPanel { } } }; - speedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false)); + speedSearch.setComparator(new SpeedSearchComparator(false)); } public void refresh() { diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java index 4f41c04d6b9a..9f26238aefda 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java @@ -52,7 +52,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.ui.SpeedSearchBase; +import com.intellij.ui.SpeedSearchComparator; import com.intellij.ui.TreeSpeedSearch; import com.sun.jdi.*; @@ -119,7 +119,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi myProject = project; final TreeSpeedSearch search = new TreeSpeedSearch(this); - search.setComparator(new SpeedSearchBase.SpeedSearchComparator(false)); + search.setComparator(new SpeedSearchComparator(false)); } protected NodeManagerImpl createNodeManager(Project project) { diff --git a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java index 50f2ec168c7a..fa52ac698e9b 100644 --- a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java +++ b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java @@ -49,10 +49,7 @@ import com.intellij.psi.SmartPsiElementPointer; import com.intellij.psi.search.ProjectScope; import com.intellij.psi.search.PsiElementProcessor; import com.intellij.psi.search.SearchScope; -import com.intellij.ui.InplaceButton; -import com.intellij.ui.JBTableWithHintProvider; -import com.intellij.ui.SpeedSearchBase; -import com.intellij.ui.TableScrollingUtil; +import com.intellij.ui.*; import com.intellij.ui.awt.RelativePoint; import com.intellij.usageView.UsageViewBundle; import com.intellij.usages.*; @@ -414,7 +411,7 @@ public class ShowUsagesAction extends AnAction implements PopupAction { table.getSelectionModel().setSelectionInterval(viewRow, viewRow); } }; - speedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false)); + speedSearch.setComparator(new SpeedSearchComparator(false)); PopupChooserBuilder builder = new PopupChooserBuilder(table); if (title != null) { diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java index 011b27c7dd04..cda16464def2 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java @@ -48,10 +48,7 @@ import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiUtilBase; -import com.intellij.ui.IdeBorderFactory; -import com.intellij.ui.ListScrollingUtil; -import com.intellij.ui.SideBorder; -import com.intellij.ui.SpeedSearchBase; +import com.intellij.ui.*; import com.intellij.ui.docking.DockManager; import com.intellij.ui.speedSearch.SpeedSearchSupply; import com.intellij.util.ArrayUtil; @@ -448,7 +445,7 @@ public class FileStructureDialog extends DialogWrapper { } ArrayList filteredElements = new ArrayList(childElements.length); - SpeedSearchBase.SpeedSearchComparator speedSearchComparator = createSpeedSearchComparator(); + SpeedSearchComparator speedSearchComparator = createSpeedSearchComparator(); for (Object child : childElements) { if (child instanceof AbstractTreeNode) { @@ -474,8 +471,8 @@ public class FileStructureDialog extends DialogWrapper { } } - private static SpeedSearchBase.SpeedSearchComparator createSpeedSearchComparator() { - return new SpeedSearchBase.SpeedSearchComparator(false); + private static SpeedSearchComparator createSpeedSearchComparator() { + return new SpeedSearchComparator(false); } private class MyTreeActionsOwner implements TreeActionsOwner { diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index 0088d95a9688..aedb07ef1903 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -44,6 +44,7 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.SpeedSearchBase; +import com.intellij.ui.SpeedSearchComparator; import com.intellij.ui.TreeSpeedSearch; import com.intellij.ui.popup.AbstractPopup; import com.intellij.ui.speedSearch.ElementFilter; @@ -143,7 +144,7 @@ public class FileStructurePopup implements Disposable { return myPopup.getContent().getVisibleRect(); } }; - mySpeedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false)); + mySpeedSearch.setComparator(new SpeedSearchComparator(false, true)); myAbstractTreeBuilder = new FilteringTreeBuilder(project, myTree, new FileStructurePopupFilter(), myTreeStructure, null) { @Override diff --git a/platform/lang-impl/src/com/intellij/ide/util/MemberChooser.java b/platform/lang-impl/src/com/intellij/ide/util/MemberChooser.java index f80c1e82d03a..6c2cf697d2a3 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/MemberChooser.java +++ b/platform/lang-impl/src/com/intellij/ide/util/MemberChooser.java @@ -328,7 +328,7 @@ public class MemberChooser extends DialogWrapper implemen return delegate.getText(); } }); - treeSpeedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false)); + treeSpeedSearch.setComparator(new SpeedSearchComparator(false)); treeSpeedSearch.addChangeListener(new PropertyChangeListener() { @Override diff --git a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java index 6cd0a255b729..820a2aa14de1 100644 --- a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java +++ b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java @@ -128,7 +128,7 @@ public class RegistryUi implements Disposable { tb.setTargetComponent(myTable); myContent.add(tb.getComponent(), BorderLayout.NORTH); - new TableSpeedSearch(myTable).setComparator(new SpeedSearchBase.SpeedSearchComparator(false)); + new TableSpeedSearch(myTable).setComparator(new SpeedSearchComparator(false)); } diff --git a/platform/platform-impl/src/com/intellij/ide/util/ElementsChooser.java b/platform/platform-impl/src/com/intellij/ide/util/ElementsChooser.java index f09178bc2fe9..99bde93d4ba9 100644 --- a/platform/platform-impl/src/com/intellij/ide/util/ElementsChooser.java +++ b/platform/platform-impl/src/com/intellij/ide/util/ElementsChooser.java @@ -134,7 +134,7 @@ public class ElementsChooser extends JPanel implements ComponentWithEmptyText } } }; - speedSearch.setComparator(new SpeedSearchBase.SpeedSearchComparator(false)); + speedSearch.setComparator(new SpeedSearchComparator(false)); setElements(elements, marked); installActions(myTable); } diff --git a/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java b/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java index a6087b77996e..2d58ce840c68 100644 --- a/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java +++ b/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java @@ -27,7 +27,6 @@ import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.ex.ToolWindowManagerAdapter; import com.intellij.openapi.wm.ex.ToolWindowManagerEx; import com.intellij.openapi.wm.ex.ToolWindowManagerListener; -import com.intellij.psi.codeStyle.NameUtil; import com.intellij.ui.speedSearch.SpeedSearchSupply; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; @@ -163,34 +162,6 @@ public abstract class SpeedSearchBase extends SpeedSear myComparator = comparator; } - public static class SpeedSearchComparator { - private NameUtil.MinusculeMatcher myMinusculeMatcher; - private String myRecentSearchText; - private boolean myShouldMatchFromTheBeginning; - - public SpeedSearchComparator() { - this(true); - } - - public SpeedSearchComparator(boolean shouldMatchFromTheBeginning) { - myShouldMatchFromTheBeginning = shouldMatchFromTheBeginning; - } - - @Nullable - public Iterable matchingFragments(String pattern, String text) { - if (myRecentSearchText == null || !myRecentSearchText.equals(pattern)) { - myRecentSearchText = pattern; - myMinusculeMatcher = new NameUtil.MinusculeMatcher(myShouldMatchFromTheBeginning ? pattern : "*" + pattern, NameUtil.MatchingCaseSensitivity.NONE); - } - return myMinusculeMatcher.matchingFragments(text); - } - - - public String getRecentSearchText() { - return myRecentSearchText; - } - } - @Nullable private Object findNextElement(String s) { final String _s = s.trim(); diff --git a/platform/platform-impl/src/com/intellij/ui/SpeedSearchComparator.java b/platform/platform-impl/src/com/intellij/ui/SpeedSearchComparator.java new file mode 100644 index 000000000000..0ce4b25bc2b4 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/ui/SpeedSearchComparator.java @@ -0,0 +1,64 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui; + +import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.codeStyle.NameUtil; +import org.jetbrains.annotations.Nullable; + +/** +* @author Konstantin Bulenkov +*/ +public class SpeedSearchComparator { + private NameUtil.MinusculeMatcher myMinusculeMatcher; + private String myRecentSearchText; + private boolean myShouldMatchFromTheBeginning; + private boolean myShouldMatchCamelCase; + + public SpeedSearchComparator() { + this(true); + } + + public SpeedSearchComparator(boolean shouldMatchFromTheBeginning) { + this(shouldMatchFromTheBeginning, false); + } + + public SpeedSearchComparator(boolean shouldMatchFromTheBeginning, boolean shouldMatchCamelCase) { + myShouldMatchFromTheBeginning = shouldMatchFromTheBeginning; + myShouldMatchCamelCase = shouldMatchCamelCase; + } + + @Nullable + public Iterable matchingFragments(String pattern, String text) { + if (myRecentSearchText == null || !myRecentSearchText.equals(pattern)) { + myRecentSearchText = pattern; + if (myShouldMatchCamelCase) { + pattern = StringUtil.join(NameUtil.nameToWords(pattern), "*"); + } + if (!myShouldMatchFromTheBeginning && !pattern.startsWith("*")) { + pattern = "*" + pattern; + } + myMinusculeMatcher = new NameUtil.MinusculeMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE); + } + return myMinusculeMatcher.matchingFragments(text); + } + + + public String getRecentSearchText() { + return myRecentSearchText; + } +} diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleWizardStep.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleWizardStep.java index 2cc11707e3bc..f9eb6e511e53 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleWizardStep.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleWizardStep.java @@ -157,7 +157,7 @@ public class MavenModuleWizardStep extends ModuleWizardStep { MavenArchetype info = getArchetypeInfoFromPathComponent(path.getLastPathComponent()); return info.groupId + ":" + info.artifactId + ":" + info.version; } - }).setComparator(new SpeedSearchBase.SpeedSearchComparator(false)); + }).setComparator(new SpeedSearchComparator(false)); myArchetypeDescriptionField.setEditable(false); myArchetypeDescriptionField.setBackground(UIUtil.getPanelBackground()); From 8c6bb0cadc7bd31123e9c2701f67b57fcada6cf0 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 16:40:51 +0100 Subject: [PATCH 25/32] cleanup --- .../lang-impl/src/com/intellij/ide/util/FileStructurePopup.java | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index aedb07ef1903..dab36ac311a9 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -171,7 +171,6 @@ public class FileStructurePopup implements Disposable { .setFocusable(true) .setMovable(true) .setCancelKeyEnabled(false) - .addUserData("ShowHints") .setDimensionServiceKey(null, getDimensionServiceKey(), false) .createPopup(); Disposer.register(myPopup, myDisposable); From 9296fa82860e5b387dccc8b209c86eeaeecfa976 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 16:45:23 +0100 Subject: [PATCH 26/32] enable tree file structure --- platform/platform-resources-en/src/misc/registry.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index 2c62ad308870..d9f39bd2f2db 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -170,6 +170,6 @@ show.anonymous.in.structure.view.description=Enables Java anonymous classes in S enable.groovy.hotswap=true enable.groovy.hotswap.description=Whether IDEA should add a special java agent to the debugged process which allows to hot-swap Groovy changes in some cases -file.structure.tree.mode=false +file.structure.tree.mode=true rename.preselect=true \ No newline at end of file From 1fdf8f0f421b7681f4a6e1c5de3dd09615b7d771 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 16:46:55 +0100 Subject: [PATCH 27/32] cleanup --- platform/platform-resources-en/src/misc/registry.properties | 6 ------ 1 file changed, 6 deletions(-) diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index d9f39bd2f2db..b501a5c6579e 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -149,8 +149,6 @@ jvmbugfix.mac.caccessibleLeak=true projectView.showHierarchyErrors=true projectView.hide.dot.idea=true -dir.diff.default.src.folder= -dir.diff.default.trg.folder= show.live.templates.in.completion=false documentation.component.editor.font=false @@ -163,10 +161,6 @@ ide.enable.toolwindow.stack=false change.signature.awesome.mode=true change.signature.awesome.mode.description=Enables list view for change signature -navbar.is.decorated=true -navbar.is.decorated.description=NavBar with decorations -show.anonymous.in.structure.view=false -show.anonymous.in.structure.view.description=Enables Java anonymous classes in Structure View enable.groovy.hotswap=true enable.groovy.hotswap.description=Whether IDEA should add a special java agent to the debugged process which allows to hot-swap Groovy changes in some cases From cb76ea3053577dc8ff037f105d211b439595c5e5 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 30 Dec 2011 16:57:38 +0100 Subject: [PATCH 28/32] narrow down fixes --- .../src/com/intellij/ide/util/FileStructurePopup.java | 8 ++++---- .../src/messages/IdeBundle.properties | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index dab36ac311a9..1828aa7dd08f 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -82,7 +82,7 @@ public class FileStructurePopup implements Disposable { private final MyTreeActionsOwner myTreeActionsOwner; private JBPopup myPopup; - @NonNls private static final String ourPropertyKey = "FileStructure.narrowDown"; + @NonNls private static final String narrowDownPropertyKey = "FileStructurePopup.narrowDown"; private boolean myShouldNarrowDown = false; private Tree myTree; private FilteringTreeBuilder myAbstractTreeBuilder; @@ -390,12 +390,12 @@ public class FileStructurePopup implements Disposable { } private JComponent createSouthPanel() { - final JCheckBox checkBox = new JCheckBox(IdeBundle.message("checkbox.narrow.down.the.list.on.typing")); - checkBox.setSelected(PropertiesComponent.getInstance().isTrueValue(ourPropertyKey)); + final JCheckBox checkBox = new JCheckBox(IdeBundle.message("checkbox.narrow.down.on.typing")); + checkBox.setSelected(PropertiesComponent.getInstance().getBoolean(narrowDownPropertyKey, true)); checkBox.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { myShouldNarrowDown = checkBox.isSelected(); - PropertiesComponent.getInstance().setValue(ourPropertyKey, Boolean.toString(myShouldNarrowDown)); + PropertiesComponent.getInstance().setValue(narrowDownPropertyKey, Boolean.toString(myShouldNarrowDown)); myAbstractTreeBuilder.queueUpdate(); } diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index 23d64f345571..c8b3930184e7 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -800,6 +800,7 @@ action.show.classes=Show Classes action.expand.all=Expand All action.collapse.all=Collapse All checkbox.narrow.down.the.list.on.typing=&Narrow &&down the list on typing +checkbox.narrow.down.on.typing=&Narrow &&down on typing node.default= node.default.package= prompt.enter.a.new.package.name=Enter a new package name: From ff8964d0ca739afc59d57ebde755c1c77819baea Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 30 Dec 2011 17:07:35 +0100 Subject: [PATCH 29/32] cleanup --- .../SuspiciousCollectionsMethodCallsInspection.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java index 199a48507a9f..d16b8e0b0bdf 100644 --- a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java @@ -21,7 +21,6 @@ import com.intellij.codeInspection.InspectionsBundle; import com.intellij.codeInspection.ProblemsHolder; import com.intellij.codeInspection.ex.BaseLocalInspectionTool; import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.util.*; @@ -37,7 +36,6 @@ import java.util.List; * @author ven */ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspectionTool { - private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.miscGenerics.SuspiciousCollectionsMethodCallsInspection"); public boolean REPORT_CONVERTIBLE_METHOD_CALLS = true; @Nullable @@ -165,6 +163,7 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect if (calleeMethod == null) return null; PsiMethod contextMethod = PsiTreeUtil.getParentOfType(methodCall, PsiMethod.class); + //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (patternMethods) { if (patternMethods.isEmpty()) { setupPatternMethods(methodCall.getManager(), methodCall.getResolveScope(), patternMethods, indices); @@ -182,6 +181,8 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect final PsiClass calleeClass = calleeMethod.getContainingClass(); PsiSubstitutor substitutor = resolveResult.getSubstitutor(); final PsiClass patternClass = patternMethod.getContainingClass(); + assert patternClass != null; + assert calleeClass != null; substitutor = TypeConversionUtil.getClassSubstitutor(patternClass, calleeClass, substitutor); if (substitutor == null) continue; From c7c639e0fe221acb7f18405f3d71cdd8774f9546 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 30 Dec 2011 17:22:19 +0100 Subject: [PATCH 30/32] IDEA-49737 Gant: perform refresh (synchronize) after Gant script running completion --- .../gradle/config/GradleScriptType.java | 5 ++++ .../plugins/groovy/gant/GantRunner.java | 4 ++++ .../runner/GroovyScriptRunConfiguration.java | 23 +++++++++++++++++++ .../groovy/runner/GroovyScriptRunner.java | 4 ++++ 4 files changed, 36 insertions(+) diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleScriptType.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleScriptType.java index 444316873d24..459bfc00d258 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleScriptType.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleScriptType.java @@ -142,6 +142,11 @@ public class GradleScriptType extends GroovyScriptType { @Override public GroovyScriptRunner getRunner() { return new GroovyScriptRunner() { + @Override + public boolean shouldRefreshAfterFinish() { + return true; + } + @Override public boolean isValidModule(@NotNull Module module) { GradleLibraryManager libraryManager = ServiceManager.getService(GradleLibraryManager.class); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/gant/GantRunner.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/gant/GantRunner.java index aff6a430778a..d6845c3c2d53 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/gant/GantRunner.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/gant/GantRunner.java @@ -40,6 +40,10 @@ import java.io.File; * @author ilyas */ public class GantRunner extends GroovyScriptRunner { + @Override + public boolean shouldRefreshAfterFinish() { + return true; + } @Override public boolean isValidModule(@NotNull Module module) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/runner/GroovyScriptRunConfiguration.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/runner/GroovyScriptRunConfiguration.java index b7aea262ef1e..a2eaa62f81b6 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/runner/GroovyScriptRunConfiguration.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/runner/GroovyScriptRunConfiguration.java @@ -21,8 +21,12 @@ import com.intellij.execution.ExecutionException; import com.intellij.execution.Executor; import com.intellij.execution.configurations.*; import com.intellij.execution.filters.TextConsoleBuilderFactory; +import com.intellij.execution.process.OSProcessHandler; +import com.intellij.execution.process.ProcessAdapter; +import com.intellij.execution.process.ProcessEvent; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.execution.util.ProgramParametersUtil; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.PathMacroManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; @@ -40,6 +44,7 @@ import com.intellij.openapi.util.WriteExternalException; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; @@ -180,6 +185,24 @@ public class GroovyScriptRunConfiguration extends ModuleBasedConfiguration Date: Fri, 30 Dec 2011 17:46:19 +0100 Subject: [PATCH 31/32] breakpointability --- .../com/intellij/codeInsight/editorActions/TypedHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java index c37dbe62c870..5976e1aedf50 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java @@ -167,7 +167,9 @@ public class TypedHandler extends TypedActionHandlerBase { for(TypedHandlerDelegate delegate: delegates) { final TypedHandlerDelegate.Result result = delegate.checkAutoPopup(charTyped, project, editor, file); handled = result == TypedHandlerDelegate.Result.STOP; - if (result != TypedHandlerDelegate.Result.CONTINUE) break; + if (result != TypedHandlerDelegate.Result.CONTINUE) { + break; + } } if (!handled) { From 3bc866a991249bb3bebe60223ebb9cb19214e3db Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 30 Dec 2011 18:06:50 +0100 Subject: [PATCH 32/32] IDEA-59783 Properties files: code completion list does not open after dot character --- ...vaClassReferenceCompletionContributor.java | 36 ++++++++++--------- .../editorActions/JavaTypedHandler.java | 27 +++++++------- .../completion/JavaAutoPopupTest.groovy | 11 ++++++ 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassReferenceCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassReferenceCompletionContributor.java index dc6c7dcf7b2a..b51d363fec78 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassReferenceCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassReferenceCompletionContributor.java @@ -15,10 +15,12 @@ */ package com.intellij.codeInsight.completion; +import com.intellij.psi.PsiFile; import com.intellij.psi.PsiReference; import com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference; import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReference; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @author peter @@ -26,25 +28,25 @@ import org.jetbrains.annotations.NotNull; public class JavaClassReferenceCompletionContributor extends CompletionContributor { @Override public void duringCompletion(@NotNull CompletionInitializationContext context) { - PsiReference reference = context.getFile().findReferenceAt(context.getStartOffset()); - if (reference instanceof PsiMultiReference) { - for (final PsiReference psiReference : ((PsiMultiReference)reference).getReferences()) { - if (psiReference instanceof JavaClassReference) { - reference = psiReference; - break; - } - } - } - if (reference instanceof JavaClassReference) { - final JavaClassReference classReference = (JavaClassReference)reference; - if (classReference.getExtendClassNames() != null) { - final PsiReference[] references = classReference.getJavaClassReferenceSet().getReferences(); - final PsiReference last = references[references.length - 1]; - context.setReplacementOffset(last.getRangeInElement().getEndOffset() + last.getElement().getTextRange().getStartOffset()); - } + JavaClassReference reference = findJavaClassReference(context.getFile(), context.getStartOffset()); + if (reference != null && reference.getExtendClassNames() != null) { + final PsiReference[] references = reference.getJavaClassReferenceSet().getReferences(); + final PsiReference last = references[references.length - 1]; + context.setReplacementOffset(last.getRangeInElement().getEndOffset() + last.getElement().getTextRange().getStartOffset()); } } - + @Nullable + public static JavaClassReference findJavaClassReference(final PsiFile file, final int offset) { + PsiReference reference = file.findReferenceAt(offset); + if (reference instanceof PsiMultiReference) { + for (final PsiReference psiReference : ((PsiMultiReference)reference).getReferences()) { + if (psiReference instanceof JavaClassReference) { + return (JavaClassReference)psiReference; + } + } + } + return reference instanceof JavaClassReference ? (JavaClassReference)reference : null; + } } diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java index 38b70edada51..21c23437de84 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java @@ -17,6 +17,7 @@ package com.intellij.codeInsight.editorActions; import com.intellij.codeInsight.AutoPopupController; import com.intellij.codeInsight.CodeInsightSettings; +import com.intellij.codeInsight.completion.JavaClassReferenceCompletionContributor; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorModificationUtil; import com.intellij.openapi.editor.ScrollType; @@ -37,6 +38,7 @@ import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.TokenSet; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -46,19 +48,6 @@ public class JavaTypedHandler extends TypedHandlerDelegate { static final TokenSet INVALID_INSIDE_REFERENCE = TokenSet.create(JavaTokenType.SEMICOLON, JavaTokenType.LBRACE, JavaTokenType.RBRACE); private boolean myJavaLTTyped; - public Result checkAutoPopup(final char charTyped, final Project project, final Editor editor, final PsiFile file) { - if (charTyped == '@' && file instanceof PsiJavaFile) { - autoPopupJavadocLookup(project, editor); - return Result.STOP; - } - if (charTyped == '#' || charTyped == '.') { - autoPopupMemberLookup(project, editor); - return Result.STOP; - } - - return Result.CONTINUE; - } - private static void autoPopupMemberLookup(Project project, final Editor editor) { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, new Condition() { public boolean value(final PsiFile file) { @@ -79,7 +68,7 @@ public class JavaTypedHandler extends TypedHandlerDelegate { if (parent instanceof PsiParameterList || parent instanceof PsiParameter) return false; if (!".".equals(lastElement.getText()) && !"#".equals(lastElement.getText())) { - return false; + return JavaClassReferenceCompletionContributor.findJavaClassReference(file, offset - 1) != null; } else{ final PsiElement element = file.findElementAt(offset); @@ -92,6 +81,14 @@ public class JavaTypedHandler extends TypedHandlerDelegate { } public Result beforeCharTyped(final char c, final Project project, final Editor editor, final PsiFile file, final FileType fileType) { + if (c == '@' && file instanceof PsiJavaFile) { + autoPopupJavadocLookup(project, editor); + } + else if (c == '#' || c == '.') { + autoPopupMemberLookup(project, editor); + } + + final FileType originalFileType = getOriginalFileType(file); int offsetBefore = editor.getCaretModel().getOffset(); @@ -143,7 +140,7 @@ public class JavaTypedHandler extends TypedHandlerDelegate { return Result.CONTINUE; } - public Result charTyped(final char c, final Project project, final Editor editor, final PsiFile file) { + public Result charTyped(final char c, final Project project, final Editor editor, @NotNull final PsiFile file) { if (myJavaLTTyped) { myJavaLTTyped = false; handleAfterJavaLT(editor, JavaTokenType.LT, JavaTokenType.GT, INVALID_INSIDE_REFERENCE); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy index 4e1bfe1fcacb..82afed75f69b 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy @@ -1150,5 +1150,16 @@ class Foo {{ myFixture.checkResult 'class Foo extends Abcdefg ' } + public void testClassNameInProperties() { + myFixture.addClass("package java.langa; public class Abcdefg {}") + myFixture.configureByText 'a.properties', 'key.11=java' + type '.' + assert lookup + type 'lang' + assert myFixture.lookupElementStrings.size() >= 2 + type '.' + assert lookup + } + }