diff --git a/java/java-impl/src/com/intellij/util/xml/PsiClassConverter.java b/java/java-impl/src/com/intellij/util/xml/PsiClassConverter.java index c200d37825dd..31f051c1e207 100644 --- a/java/java-impl/src/com/intellij/util/xml/PsiClassConverter.java +++ b/java/java-impl/src/com/intellij/util/xml/PsiClassConverter.java @@ -112,7 +112,7 @@ public class PsiClassConverter extends Converter implements CustomRefe if (virtualFile == null) return null; ProjectFileIndex fileIndex = ProjectRootManager.getInstance(file.getProject()).getFileIndex(); boolean tests = fileIndex.isInTestSourceContent(virtualFile); - return module.getModuleRuntimeScope(tests).union(module.getModuleWithDependenciesAndLibrariesScope(tests)); + return module.getModuleRuntimeScope(tests); } public static class AnnotationType extends PsiClassConverter { diff --git a/java/openapi/src/com/intellij/util/xml/DomJavaUtil.java b/java/openapi/src/com/intellij/util/xml/DomJavaUtil.java index 0c2b022ac941..200d963a5f6a 100644 --- a/java/openapi/src/com/intellij/util/xml/DomJavaUtil.java +++ b/java/openapi/src/com/intellij/util/xml/DomJavaUtil.java @@ -51,7 +51,7 @@ public class DomJavaUtil { else { ProjectFileIndex fileIndex = ProjectRootManager.getInstance(file.getProject()).getFileIndex(); boolean tests = fileIndex.isInTestSourceContent(virtualFile); - scope = module.getModuleRuntimeScope(tests).union(module.getModuleWithDependenciesAndLibrariesScope(tests)); + scope = module.getModuleRuntimeScope(tests); } } else { diff --git a/java/openapi/src/com/intellij/util/xml/converters/values/ClassValueConverter.java b/java/openapi/src/com/intellij/util/xml/converters/values/ClassValueConverter.java index af9bee8c8a83..cb2820c28a00 100644 --- a/java/openapi/src/com/intellij/util/xml/converters/values/ClassValueConverter.java +++ b/java/openapi/src/com/intellij/util/xml/converters/values/ClassValueConverter.java @@ -63,6 +63,6 @@ public abstract class ClassValueConverter extends Converter implements } final boolean inTests = ProjectRootManager.getInstance(project).getFileIndex().isInTestSourceContent(file); - return module.getModuleRuntimeScope(inTests).union(module.getModuleWithDependenciesAndLibrariesScope(inTests)); + return module.getModuleRuntimeScope(inTests); } } diff --git a/platform/lang-api/src/com/intellij/ide/StandardTargetWeights.java b/platform/lang-api/src/com/intellij/ide/StandardTargetWeights.java index e9e554bb80e7..ca41ff18a1ef 100644 --- a/platform/lang-api/src/com/intellij/ide/StandardTargetWeights.java +++ b/platform/lang-api/src/com/intellij/ide/StandardTargetWeights.java @@ -26,7 +26,7 @@ public interface StandardTargetWeights { float COMMANDER_WEIGHT = 5; float FAVORITES_WEIGHT = 6; float SCOPE_WEIGHT = 6.5f; - float NAV_BAR = 8; + float NAV_BAR_WEIGHT = 8; float CHANGES_VIEW = 9; float OS_FILE_MANAGER = 9.5f; float PROJECT_SETTINGS_WEIGHT = 10; diff --git a/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java b/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java index 31e12e7ed942..d5a9598d4efc 100644 --- a/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java +++ b/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java @@ -39,7 +39,6 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.LightColors; -import com.intellij.ui.NonFocusableCheckBox; import com.intellij.ui.components.JBList; import com.intellij.ui.components.labels.LinkLabel; import com.intellij.ui.components.labels.LinkListener; @@ -58,11 +57,11 @@ import java.util.regex.Pattern; public class EditorSearchComponent extends JPanel implements DataProvider, SelectionListener, SearchResults.SearchResultsListener, LivePreviewControllerBase.ReplaceListener { private static final int MATCHES_LIMIT = 10000; - private static final String CASE_SENSITIVE = "Case Sensitive"; - private static final String REGEX = "Regex"; private final JLabel myMatchInfoLabel; private final LinkLabel myClickToHighlightLabel; private final Project myProject; + private DefaultActionGroup myActionsGroup; + private ActionToolbar myActionsToolbar; public Editor getEditor() { return myEditor; @@ -90,7 +89,6 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec private static final Color FOCUS_CATCHER_COLOR = new Color(0x9999ff); private final JComponent myToolbarComponent; private DocumentAdapter myDocumentListener; - private final JCheckBox myCbRegexp; private MyLivePreviewController myLivePreviewController; private LivePreview myLivePreview; @@ -100,7 +98,6 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec private SearchResults mySearchResults; private final FindModel myFindModel; - private JCheckBox myCbMatchCase; private JPanel myReplacementPane; public JComponent getToolbarComponent() { @@ -217,33 +214,30 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec myDefaultBackground = new JTextField().getBackground(); - DefaultActionGroup actionsGroup = new DefaultActionGroup("search bar", false); - actionsGroup.add(new ShowHistoryAction(mySearchField, this)); - actionsGroup.add(new PrevOccurrenceAction(this, mySearchField)); - actionsGroup.add(new NextOccurrenceAction(this, mySearchField)); - actionsGroup.add(new FindAllAction(this)); + myActionsGroup = new DefaultActionGroup("search bar", false); + myActionsGroup.add(new ShowHistoryAction(mySearchField, this)); + myActionsGroup.add(new PrevOccurrenceAction(this, mySearchField)); + myActionsGroup.add(new NextOccurrenceAction(this, mySearchField)); + myActionsGroup.add(new FindAllAction(this)); + myActionsGroup.add(new ToggleMatchCase(this)); + myActionsGroup.add(new ToggleRegex(this)); - actionsGroup.addAction(new ToggleWholeWordsOnlyAction(this)).setAsSecondary(true); + myActionsGroup.addAction(new ToggleWholeWordsOnlyAction(this)); if (FindManagerImpl.ourHasSearchInCommentsAndLiterals) { - actionsGroup.addAction(new ToggleInCommentsAction(this)).setAsSecondary(true); - actionsGroup.addAction(new ToggleInLiteralsOnlyAction(this)).setAsSecondary(true); + myActionsGroup.addAction(new ToggleInCommentsAction(this)).setAsSecondary(true); + myActionsGroup.addAction(new ToggleInLiteralsOnlyAction(this)).setAsSecondary(true); } - actionsGroup.addAction(new TogglePreserveCaseAction(this)).setAsSecondary(true); - actionsGroup.addAction(new ToggleSelectionOnlyAction(this)).setAsSecondary(true); + myActionsGroup.addAction(new TogglePreserveCaseAction(this)).setAsSecondary(true); + myActionsGroup.addAction(new ToggleSelectionOnlyAction(this)); - final ActionToolbar tb = ActionManager.getInstance().createActionToolbar("SearchBar", actionsGroup, true); - tb.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY); - myToolbarComponent = tb.getComponent(); + myActionsToolbar = ActionManager.getInstance().createActionToolbar("SearchBar", myActionsGroup, true); + + myActionsToolbar.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY); + myToolbarComponent = myActionsToolbar.getComponent(); myToolbarComponent.setBorder(null); myToolbarComponent.setOpaque(false); leadPanel.add(myToolbarComponent); - myCbMatchCase = new NonFocusableCheckBox(CASE_SENSITIVE); - myCbRegexp = new NonFocusableCheckBox(REGEX); - - leadPanel.add(myCbMatchCase); - leadPanel.add(myCbRegexp); - myFindModel.addObserver(new FindModel.FindModelObserver() { @Override public void findModelChanged(FindModel findModel) { @@ -259,28 +253,6 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec updateUIWithFindModel(); - myCbMatchCase.setMnemonic('C'); - myCbRegexp.setMnemonic('e'); - - setSmallerFontAndOpaque(myCbMatchCase); - setSmallerFontAndOpaque(myCbRegexp); - - - myCbMatchCase.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - final boolean b = myCbMatchCase.isSelected(); - FindSettings.getInstance().setLocalCaseSensitive(b); - myFindModel.setCaseSensitive(b); - } - }); - - myCbRegexp.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - final boolean b = myCbRegexp.isSelected(); - myFindModel.setRegularExpressions(b); - } - }); - JPanel tailPanel = new NonOpaquePanel(new BorderLayout(5, 0)); JPanel tailContainer = new NonOpaquePanel(new BorderLayout(5, 0)); tailContainer.add(tailPanel, BorderLayout.EAST); @@ -315,7 +287,7 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec tailPanel.add(labelsPanel, BorderLayout.CENTER); tailPanel.add(closeLabel, BorderLayout.EAST); - setSmallerFont(mySearchField); + Utils.setSmallerFont(mySearchField); mySearchField.registerKeyboardAction(new ActionListener() { public void actionPerformed(final ActionEvent e) { if ("".equals(mySearchField.getText())) { @@ -400,8 +372,8 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec } private void updateUIWithFindModel() { - myCbMatchCase.setSelected(myFindModel.isCaseSensitive()); - myCbRegexp.setSelected(myFindModel.isRegularExpressions()); + + myActionsToolbar.updateActionsImmediately(); String stringToFind = myFindModel.getStringToFind(); @@ -424,6 +396,7 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec } updateExcludeStatus(); } + Utils.setSmallerFontForChildren(myToolbarComponent); } private static boolean wholeWordsApplicable(String stringToFind) { @@ -515,11 +488,12 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec setSmallerFontAndOpaque(myReplaceAllButton); setSmallerFontAndOpaque(myExcludeButton); - setSmallerFont(myReplaceField); + Utils.setSmallerFont(myReplaceField); myReplaceField.putClientProperty("AuxEditorComponent", Boolean.TRUE); new VariantsCompletionAction(this, myReplaceField); new NextOccurrenceAction(this, myReplaceField); new PrevOccurrenceAction(this, myReplaceField); + Utils.setSmallerFontForChildren(myToolbarComponent); } private void replaceFieldDocumentChanged() { @@ -646,17 +620,10 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec } private static void setSmallerFontAndOpaque(final JComponent component) { - setSmallerFont(component); + Utils.setSmallerFont(component); component.setOpaque(false); } - private static void setSmallerFont(final JComponent component) { - if (SystemInfo.isMac) { - Font f = component.getFont(); - component.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2)); - } - } - public void requestFocus() { requestFocus(mySearchField); } diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/EditorHeaderToggleAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/EditorHeaderToggleAction.java index 66fbedacb63f..0c64a9d9d39d 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/EditorHeaderToggleAction.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/EditorHeaderToggleAction.java @@ -1,18 +1,48 @@ package com.intellij.find.editorHeaderActions; import com.intellij.find.EditorSearchComponent; -import com.intellij.openapi.actionSystem.ToggleAction; +import com.intellij.openapi.actionSystem.*; +import com.intellij.util.ui.EmptyIcon; + +import javax.swing.*; +import java.awt.event.InputEvent; public abstract class EditorHeaderToggleAction extends ToggleAction { + @Override + public boolean displayTextInToolbar() { + return true; + } + public EditorSearchComponent getEditorSearchComponent() { return myEditorSearchComponent; } + @Override + public void update(AnActionEvent e) { + super.update(e); + if (e == null) return; + if (e.getPresentation().getIcon() == null && !isSecondary()) { + e.getPresentation().setIcon(new EmptyIcon(1, 1)); + } + } + + private boolean isSecondary() { + return this instanceof SecondaryHeaderAction; + } + private EditorSearchComponent myEditorSearchComponent; protected EditorHeaderToggleAction(EditorSearchComponent editorSearchComponent, String text) { super(text); myEditorSearchComponent = editorSearchComponent; + if (!isSecondary()) { + final int m = text.indexOf('&'); + if (m != -1 && m < text.length()-1) { + char c = text.charAt(m+1); + Shortcut shortcut = new KeyboardShortcut(KeyStroke.getKeyStroke(Character.toUpperCase(c), InputEvent.ALT_DOWN_MASK), null); + registerCustomShortcutSet(new CustomShortcutSet(shortcut), myEditorSearchComponent); + } + } } } diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SecondaryHeaderAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SecondaryHeaderAction.java new file mode 100644 index 000000000000..1d62c790f92f --- /dev/null +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SecondaryHeaderAction.java @@ -0,0 +1,11 @@ +package com.intellij.find.editorHeaderActions; + +/** + * Created by IntelliJ IDEA. + * User: zajac + * Date: 02.04.11 + * Time: 14:43 + * To change this template use File | Settings | File Templates. + */ +public interface SecondaryHeaderAction { +} diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ShowHistoryAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ShowHistoryAction.java index 0c805e107874..690fc2b5fdd7 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ShowHistoryAction.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ShowHistoryAction.java @@ -4,7 +4,6 @@ import com.intellij.find.EditorSearchComponent; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.util.IconLoader; -import com.intellij.ui.EditorTextField; import com.intellij.util.containers.ContainerUtil; import javax.swing.*; @@ -35,6 +34,7 @@ public class ShowHistoryAction extends EditorHeaderAction implements DumbAware { //ContainerUtil.addAll(shortcuts, ActionManager.getInstance().getAction(IdeActions.ACTION_FIND).getShortcutSet().getShortcuts()); ContainerUtil.addAll(shortcuts, ActionManager.getInstance().getAction("IncrementalSearch").getShortcutSet().getShortcuts()); } + shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), null)); shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK), null)); registerCustomShortcutSet( diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInCommentsAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInCommentsAction.java index baa6baeb77cd..2c796b0077e7 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInCommentsAction.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInCommentsAction.java @@ -3,8 +3,8 @@ package com.intellij.find.editorHeaderActions; import com.intellij.find.EditorSearchComponent; import com.intellij.openapi.actionSystem.AnActionEvent; -public class ToggleInCommentsAction extends EditorHeaderToggleAction { - private static final String TEXT = "In Comments Only"; +public class ToggleInCommentsAction extends EditorHeaderToggleAction implements SecondaryHeaderAction { + private static final String TEXT = "In Co&mments Only"; public ToggleInCommentsAction(EditorSearchComponent editorSearchComponent) { super(editorSearchComponent, TEXT); diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInLiteralsOnlyAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInLiteralsOnlyAction.java index 869103feb4b8..80478def9873 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInLiteralsOnlyAction.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInLiteralsOnlyAction.java @@ -3,8 +3,8 @@ package com.intellij.find.editorHeaderActions; import com.intellij.find.EditorSearchComponent; import com.intellij.openapi.actionSystem.AnActionEvent; -public class ToggleInLiteralsOnlyAction extends EditorHeaderToggleAction { - private static final String TEXT = "In Literals Only"; +public class ToggleInLiteralsOnlyAction extends EditorHeaderToggleAction implements SecondaryHeaderAction { + private static final String TEXT = "In &Literals Only"; public ToggleInLiteralsOnlyAction(EditorSearchComponent editorSearchComponent) { super(editorSearchComponent, TEXT); diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleMatchCase.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleMatchCase.java new file mode 100644 index 000000000000..2c046f81a319 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleMatchCase.java @@ -0,0 +1,39 @@ +/* + * 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.find.editorHeaderActions; + +import com.intellij.find.EditorSearchComponent; +import com.intellij.find.FindSettings; +import com.intellij.openapi.actionSystem.AnActionEvent; + +public class ToggleMatchCase extends EditorHeaderToggleAction { + private static final String CASE_SENSITIVE = "&Case Sensitive"; + + public ToggleMatchCase(EditorSearchComponent editorSearchComponent) { + super(editorSearchComponent, CASE_SENSITIVE); + } + + @Override + public boolean isSelected(AnActionEvent e) { + return getEditorSearchComponent().getFindModel().isCaseSensitive(); + } + + @Override + public void setSelected(AnActionEvent e, boolean state) { + getEditorSearchComponent().getFindModel().setCaseSensitive(state); + FindSettings.getInstance().setLocalCaseSensitive(state); + } +} diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/TogglePreserveCaseAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/TogglePreserveCaseAction.java index 59e095823003..62630b822be4 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/TogglePreserveCaseAction.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/TogglePreserveCaseAction.java @@ -4,7 +4,7 @@ import com.intellij.find.EditorSearchComponent; import com.intellij.find.FindModel; import com.intellij.openapi.actionSystem.AnActionEvent; -public class TogglePreserveCaseAction extends EditorHeaderToggleAction { +public class TogglePreserveCaseAction extends EditorHeaderToggleAction implements SecondaryHeaderAction { private static final String TEXT = "Preserve Case"; public TogglePreserveCaseAction(EditorSearchComponent editorSearchComponent) { diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleRegex.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleRegex.java new file mode 100644 index 000000000000..0e432bc2d5f3 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleRegex.java @@ -0,0 +1,43 @@ +/* + * 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.find.editorHeaderActions; + +import com.intellij.find.EditorSearchComponent; +import com.intellij.find.FindModel; +import com.intellij.openapi.actionSystem.AnActionEvent; + +public class ToggleRegex extends EditorHeaderToggleAction { + + private static final String REGEX = "R&egex"; + + @Override + public boolean isSelected(AnActionEvent e) { + return getEditorSearchComponent().getFindModel().isRegularExpressions(); + } + + @Override + public void setSelected(AnActionEvent e, boolean state) { + final FindModel findModel = getEditorSearchComponent().getFindModel(); + findModel.setRegularExpressions(state); + if (state) { + findModel.setWholeWordsOnly(false); + } + } + + public ToggleRegex(EditorSearchComponent editorSearchComponent) { + super(editorSearchComponent, REGEX); + } +} diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleSelectionOnlyAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleSelectionOnlyAction.java index 7913a1d8af1d..63111e0e2693 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleSelectionOnlyAction.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleSelectionOnlyAction.java @@ -4,7 +4,7 @@ import com.intellij.find.EditorSearchComponent; import com.intellij.openapi.actionSystem.AnActionEvent; public class ToggleSelectionOnlyAction extends EditorHeaderToggleAction { - private static final String SELECTION_ONLY = "Selection Only"; + private static final String SELECTION_ONLY = "&Selection Only"; public ToggleSelectionOnlyAction(EditorSearchComponent editorSearchComponent) { super(editorSearchComponent, SELECTION_ONLY); @@ -18,7 +18,9 @@ public class ToggleSelectionOnlyAction extends EditorHeaderToggleAction { @Override public void update(AnActionEvent e) { super.update(e); - e.getPresentation().setVisible(getEditorSearchComponent().getFindModel().isReplaceState()); + final boolean replaceState = getEditorSearchComponent().getFindModel().isReplaceState(); + e.getPresentation().setVisible(replaceState); + e.getPresentation().setEnabled(replaceState); } @Override diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleWholeWordsOnlyAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleWholeWordsOnlyAction.java index f0a2b8af06b3..fd45b95a0581 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleWholeWordsOnlyAction.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleWholeWordsOnlyAction.java @@ -5,7 +5,7 @@ import com.intellij.find.FindSettings; import com.intellij.openapi.actionSystem.AnActionEvent; public class ToggleWholeWordsOnlyAction extends EditorHeaderToggleAction { - private static final String WHOLE_WORDS_ONLY = "Whole Words Only"; + private static final String WHOLE_WORDS_ONLY = "&Whole Words"; public ToggleWholeWordsOnlyAction(EditorSearchComponent editorSearchComponent) { super(editorSearchComponent, WHOLE_WORDS_ONLY); diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/Utils.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/Utils.java index c6c0d778d662..f3012fb7222d 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/Utils.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/Utils.java @@ -3,8 +3,10 @@ package com.intellij.find.editorHeaderActions; import com.intellij.openapi.ui.popup.JBPopup; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.PopupChooserBuilder; +import com.intellij.openapi.util.SystemInfo; import javax.swing.*; +import java.awt.*; public class Utils { private Utils() { @@ -39,4 +41,24 @@ public class Utils { popup.showUnderneathOf(textField); } } + + public static void setSmallerFont(final JComponent component) { + if (SystemInfo.isMac) { + Font f = new JLabel(" ").getFont(); + Font font = smaller(f); + component.setFont(font); + } + } + + static Font smaller(Font f) { + return f.deriveFont(f.getStyle(), f.getSize() - 2); + } + + public static void setSmallerFontForChildren(JComponent component) { + for (Component c : component.getComponents()) { + if (c instanceof JComponent) { + setSmallerFont((JComponent)c); + } + } + } } diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/ActivateNavigationBarAction.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/ActivateNavigationBarAction.java index 3e217e307f74..621e69120d07 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/ActivateNavigationBarAction.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/ActivateNavigationBarAction.java @@ -19,36 +19,30 @@ import com.intellij.ide.ui.UISettings; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; -import com.intellij.openapi.project.Project; import com.intellij.openapi.project.DumbAware; +import com.intellij.openapi.project.Project; import com.intellij.openapi.wm.ex.WindowManagerEx; import com.intellij.openapi.wm.impl.IdeFrameImpl; import com.intellij.openapi.wm.impl.IdeRootPane; /** - * User: anna - * Date: 10-Nov-2005 + * @author Anna Kozlova + * @author Konstantin Bulenkov */ public class ActivateNavigationBarAction extends AnAction implements DumbAware { public void actionPerformed(AnActionEvent e) { - Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext()); - if (project != null){ - if (UISettings.getInstance().SHOW_NAVIGATION_BAR){ - final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(project); - final IdeRootPane ideRootPane = ((IdeRootPane)frame.getRootPane()); - ((NavBarPanel)ideRootPane.findByName(NavBarRootPaneExtension.NAV_BAR).getComponent()).selectTail(); - } + final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext()); + if (project != null && UISettings.getInstance().SHOW_NAVIGATION_BAR){ + final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(project); + final IdeRootPane ideRootPane = ((IdeRootPane)frame.getRootPane()); + final NavBarPanel navBarPanel = (NavBarPanel)ideRootPane.findByName(NavBarRootPaneExtension.NAV_BAR).getComponent(); + navBarPanel.activatePopupOnLastElement(e.getDataContext()); } } public void update(AnActionEvent e) { - Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext()); - if (project == null){ - e.getPresentation().setEnabled(false); - return; - } - if (!UISettings.getInstance().SHOW_NAVIGATION_BAR){ - e.getPresentation().setEnabled(false); - } + final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext()); + final boolean enabled = project != null && UISettings.getInstance().SHOW_NAVIGATION_BAR; + e.getPresentation().setEnabled(enabled); } } diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java index ae375bb0a9b2..4632e9ffe9be 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java @@ -15,6 +15,7 @@ */ package com.intellij.ide.navigationToolbar; +import com.intellij.codeInsight.hint.HintManager; import com.intellij.codeInsight.hint.HintManagerImpl; import com.intellij.ide.CopyPasteDelegator; import com.intellij.ide.DataManager; @@ -714,13 +715,37 @@ public class NavBarPanel extends OpaquePanel.List implements DataProvider, Popup public void run(RelativePoint rp) { Point p = rp.getPointOn(myHintContainer).getPoint(); final HintHint hintInfo = new HintHint(editor, p); - HintManagerImpl.getInstanceImpl().showEditorHint(myHint, editor, p, HintManagerImpl.HIDE_BY_ESCAPE, 0, true, hintInfo); + HintManagerImpl.getInstanceImpl().showEditorHint(myHint, editor, p, HintManager.HIDE_BY_ESCAPE, 0, true, hintInfo); } }); } - selectTail(); + activatePopupOnLastElement(); } }, NavBarUpdateQueue.ID.SHOW_HINT); + + } + + public void activatePopupOnLastElement() { + activatePopupOnLastElement(null); + } + + public void activatePopupOnLastElement(@Nullable DataContext context) { + if (context != null) { + myUpdateQueue.queueModelUpdate(context); + } + myUpdateQueue.queueRebuildUi(); + myUpdateQueue.queueSelect(new Runnable() { + @Override + public void run() { + if (!myList.isEmpty()) { + myModel.setSelectedIndex(Math.max(myList.size() - 2, 0)); + IdeFocusManager.getInstance(myProject).requestFocus(NavBarPanel.this, true); + restorePopup(); + } + } + }); + + myUpdateQueue.flush(); } AsyncResult getHintContainerShowPoint() { diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/SelectInNavBarTarget.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/SelectInNavBarTarget.java index 3f017d143ac7..28a7bcceac92 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/SelectInNavBarTarget.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/SelectInNavBarTarget.java @@ -27,9 +27,6 @@ import com.intellij.openapi.util.AsyncResult; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.IdeFrame; import com.intellij.openapi.wm.IdeRootPaneNorthExtension; -import com.intellij.openapi.wm.ex.WindowManagerEx; -import com.intellij.openapi.wm.impl.IdeFrameImpl; -import com.intellij.openapi.wm.impl.IdeRootPane; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFileSystemItem; import org.jetbrains.annotations.NonNls; @@ -37,62 +34,64 @@ import org.jetbrains.annotations.NonNls; import javax.swing.*; /** - * User: anna - * Date: 09-Nov-2005 + * @author Anna Kozlova + * @author Konstantin Bulenkov */ public class SelectInNavBarTarget extends SelectInTargetPsiWrapper implements DumbAware { + public static final String NAV_BAR_ID = "NavBar"; + public SelectInNavBarTarget(final Project project) { super(project); } - public String toString() { - return SelectInManager.NAV_BAR; - } - @NonNls public String getToolWindowId() { - return "NavBar"; + return NAV_BAR_ID; + } + + protected boolean canSelect(final PsiFileSystemItem file) { + return UISettings.getInstance().SHOW_NAVIGATION_BAR; + } + + protected void select(final Object selector, final VirtualFile virtualFile, final boolean requestFocus) { + selectInNavBar(); + } + + protected void select(final PsiElement element, boolean requestFocus) { + selectInNavBar(); + } + + private static void selectInNavBar() { + DataManager.getInstance().getDataContextFromFocus() + .doWhenDone(new AsyncResult.Handler() { + @Override + public void run(DataContext context) { + final IdeFrame frame = IdeFrame.KEY.getData(context); + if (frame != null) { + final IdeRootPaneNorthExtension navBarExt = frame.getNorthExtension(NavBarRootPaneExtension.NAV_BAR); + if (navBarExt != null) { + final JComponent c = navBarExt.getComponent(); + final NavBarPanel panel = (NavBarPanel)c.getClientProperty("NavBarPanel"); + panel.activatePopupOnLastElement(); + } + } + } + }); + } + + public float getWeight() { + return StandardTargetWeights.NAV_BAR_WEIGHT; } public String getMinorViewId() { return null; } - public float getWeight() { - return StandardTargetWeights.NAV_BAR; - } - - protected boolean canSelect(PsiFileSystemItem file) { - return UISettings.getInstance().SHOW_NAVIGATION_BAR; - } - - protected void select(final Object selector, VirtualFile virtualFile, final boolean requestFocus) { - selectTail(); - } - - private static void selectTail() { - DataManager.getInstance().getDataContextFromFocus().doWhenDone(new AsyncResult.Handler() { - @Override - public void run(DataContext context) { - IdeFrame frame = IdeFrame.KEY.getData(context); - if (frame != null) { - IdeRootPaneNorthExtension navBarExt = frame.getNorthExtension(NavBarRootPaneExtension.NAV_BAR); - if (navBarExt != null) { - JComponent c = navBarExt.getComponent(); - NavBarPanel panel = (NavBarPanel)c.getClientProperty("NavBarPanel"); - panel.selectTail(); - } - } - } - }); - } - protected boolean canWorkWithCustomObjects() { return false; } - protected void select(PsiElement element, boolean requestFocus) { - selectTail(); + public String toString() { + return SelectInManager.NAV_BAR; } - } diff --git a/platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java b/platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java index 48e23bdb81a7..bb61408d0bd3 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java +++ b/platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java @@ -154,7 +154,7 @@ public class NavigationItemListCellRenderer extends OpaquePanel implements ListC } textAttributes.setForegroundColor(color); SimpleTextAttributes nameAttributes = SimpleTextAttributes.fromTextAttributes(textAttributes); - SpeedSearchUtil.appendColoredFragmentForMatcher(name, this, nameAttributes, myMatcher, bgColor); + SpeedSearchUtil.appendColoredFragmentForMatcher(name, this, nameAttributes, myMatcher, bgColor, selected); setIcon(presentation.getIcon(false)); if (myRenderLocation) { diff --git a/platform/lang-impl/src/com/intellij/ide/util/PsiElementListCellRenderer.java b/platform/lang-impl/src/com/intellij/ide/util/PsiElementListCellRenderer.java index a01d803c09c5..b2dd89d95831 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/PsiElementListCellRenderer.java +++ b/platform/lang-impl/src/com/intellij/ide/util/PsiElementListCellRenderer.java @@ -104,7 +104,7 @@ public abstract class PsiElementListCellRenderer extends J if (nameAttributes == null) nameAttributes = new SimpleTextAttributes(Font.PLAIN, color); assert name != null : "Null name for PSI element " + element; - SpeedSearchUtil.appendColoredFragmentForMatcher(name, this, nameAttributes, myMatcher, bgColor); + SpeedSearchUtil.appendColoredFragmentForMatcher(name, this, nameAttributes, myMatcher, bgColor, selected); setIcon(PsiElementListCellRenderer.this.getIcon(element)); String containerText = getContainerText(element, name + (myModuleName != null ? myModuleName + " " : "")); diff --git a/platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java b/platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java index 282e7fabf377..fdd024eab86d 100644 --- a/platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java +++ b/platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java @@ -261,6 +261,12 @@ public class PresentationData implements ItemPresentation, ComparableObject { myTooltip = from.myTooltip; } + public PresentationData clone() { + PresentationData clone = new PresentationData(); + clone.copyFrom(this); + return clone; + } + public void applyFrom(PresentationData from) { myAttributesKey = getValue(myAttributesKey, from.myAttributesKey); myClosedIcon = getValue(myClosedIcon, from.myClosedIcon); diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java index e061db355778..ed3cd5262dea 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java @@ -317,7 +317,7 @@ public class AbstractTreeUi { runnable.run(); } else { - UIUtil.invokeLaterIfNeeded(runnable); + invokeLaterIfNeeded(runnable); } } } @@ -336,7 +336,7 @@ public class AbstractTreeUi { cleanup.run(); } else { - UIUtil.invokeLaterIfNeeded(cleanup); + invokeLaterIfNeeded(cleanup); } } @@ -817,7 +817,7 @@ public class AbstractTreeUi { result.setDone(_update(nodeDescriptor)); } else { - UIUtil.invokeLaterIfNeeded(new Runnable() { + invokeLaterIfNeeded(new Runnable() { public void run() { execute(new Runnable() { public void run() { @@ -834,7 +834,7 @@ public class AbstractTreeUi { public void run(final Boolean changes) { if (changes) { final long updateStamp = nodeDescriptor.getUpdateCount(); - UIUtil.invokeLaterIfNeeded(new Runnable() { + invokeLaterIfNeeded(new Runnable() { public void run() { Object element = nodeDescriptor.getElement(); DefaultMutableTreeNode node = getNodeForElement(element, false); @@ -2566,7 +2566,8 @@ public class AbstractTreeUi { final LoadedChildren loaded = new LoadedChildren(loadedElements); for (final Object each : loadedElements) { - final NodeDescriptor eachChildDescriptor = getTreeStructure().createDescriptor(each, updateInfo.getDescriptor()); + NodeDescriptor existingDesc = getDescriptorFrom(getNodeForElement(each, true)); + final NodeDescriptor eachChildDescriptor = existingDesc != null ? existingDesc : getTreeStructure().createDescriptor(each, updateInfo.getDescriptor()); execute(new Runnable() { public void run() { loaded.putDescriptor(each, eachChildDescriptor, update(eachChildDescriptor, true).getResult()); diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/PresentableNodeDescriptor.java b/platform/platform-api/src/com/intellij/ide/util/treeView/PresentableNodeDescriptor.java index 2872bf2c387c..bafb35c0da4c 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/PresentableNodeDescriptor.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/PresentableNodeDescriptor.java @@ -19,6 +19,7 @@ import com.intellij.ide.projectView.PresentationData; import com.intellij.openapi.project.Project; import com.intellij.ui.SimpleTextAttributes; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.awt.*; @@ -33,19 +34,24 @@ public abstract class PresentableNodeDescriptor extends NodeDescriptor { public final boolean update() { if (shouldUpdateData()) { + PresentationData before = getPresentation().clone(); PresentationData updated = getUpdatedPresentation(); - return shouldApply() ? apply(updated) : false; + return shouldApply() ? apply(updated, before) : false; } else { return false; } } protected final boolean apply(PresentationData presentation) { + return apply(presentation, null); + } + + protected final boolean apply(PresentationData presentation, @Nullable PresentationData before) { myOpenIcon = presentation.getIcon(true); myClosedIcon = presentation.getIcon(false); myName = presentation.getPresentableText(); myColor = presentation.getForcedTextForeground(); - boolean updated = !presentation.equals(myUpdatedPresentation); + boolean updated = before != null ? !presentation.equals(before) : true; if (myUpdatedPresentation == null) { myUpdatedPresentation = createPresentation(); diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchUtil.java b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchUtil.java index 4cbaaf209b8a..e31af62abec8 100644 --- a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchUtil.java +++ b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchUtil.java @@ -17,6 +17,7 @@ package com.intellij.ui.speedSearch; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.registry.Registry; import com.intellij.psi.codeStyle.NameUtil; import com.intellij.ui.SimpleColoredComponent; import com.intellij.ui.SimpleTextAttributes; @@ -61,8 +62,9 @@ public final class SpeedSearchUtil { final SimpleColoredComponent component, final SimpleTextAttributes attributes, final NameUtil.Matcher matcher, - final Color selectedBg) { - if (!(matcher instanceof NameUtil.MinusculeMatcher)) { + final Color selectedBg, + final boolean selected) { + if (!(matcher instanceof NameUtil.MinusculeMatcher) || (Registry.is("ide.highlight.match.in.selected.only") && !selected)) { component.append(text, attributes); return; } diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionButtonWithText.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionButtonWithText.java index ffa6f65acb06..d5a23ecdf0e9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionButtonWithText.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionButtonWithText.java @@ -17,6 +17,7 @@ package com.intellij.openapi.actionSystem.impl; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.ex.ActionButtonLook; +import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.UIUtil; import javax.swing.*; @@ -38,7 +39,7 @@ public class ActionButtonWithText extends ActionButton { final Dimension preferredSize = new Dimension(super.getPreferredSize()); final String text = getText(); final FontMetrics fontMetrics = getFontMetrics(getFont()); - preferredSize.width += ICON_TEXT_SPACE; + preferredSize.width += iconTextSpace(); preferredSize.width += fontMetrics.stringWidth(text); return preferredSize; } @@ -58,7 +59,7 @@ public class ActionButtonWithText extends ActionButton { UIUtil.applyRenderingHints(g); g.setColor(isButtonEnabled() ? UIUtil.getLabelForeground() : UIUtil.getInactiveTextColor()); final int iconTextDifference = (int)Math.ceil((icon.getIconHeight() - textHeight) / 2); - final int textStartX = x + icon.getIconWidth() + ICON_TEXT_SPACE; + final int textStartX = x + icon.getIconWidth() + iconTextSpace(); g.drawString(text, textStartX, y + iconTextDifference + fontMetrics.getMaxAscent()); final int mnemonicIndex = getMnemonicCharIndex(text); if (mnemonicIndex >= 0) { @@ -70,7 +71,15 @@ public class ActionButtonWithText extends ActionButton { } } + private int iconTextSpace() { + return (getIcon() instanceof EmptyIcon || getIcon() == null ) ? 0 : ICON_TEXT_SPACE; + } + private int getMnemonicCharIndex(String text) { + final int mnemonicIndex = myPresentation.getDisplayedMnemonicIndex(); + if (mnemonicIndex != -1) { + return mnemonicIndex; + } final ShortcutSet shortcutSet = myAction.getShortcutSet(); final Shortcut[] shortcuts = shortcutSet.getShortcuts(); for (int i = 0; i < shortcuts.length; i++) { diff --git a/platform/platform-impl/src/com/intellij/ui/LabeledIcon.java b/platform/platform-impl/src/com/intellij/ui/LabeledIcon.java index 8c728c5ba13b..994059c7c15f 100644 --- a/platform/platform-impl/src/com/intellij/ui/LabeledIcon.java +++ b/platform/platform-impl/src/com/intellij/ui/LabeledIcon.java @@ -30,6 +30,8 @@ public class LabeledIcon implements Icon { private final String[] myStrings; private int myIconTextGap = 0; + private Font myFont = UIUtil.getLabelFont(); + /** * @param icon not null icon. * @param text to be painted under the icon. This parameter can @@ -51,6 +53,14 @@ public class LabeledIcon implements Icon { } } + public Font getFont() { + return myFont; + } + + public void setFont(Font font) { + myFont = font; + } + public void setIconTextGap(int iconTextGap) { myIconTextGap = iconTextGap; } @@ -69,15 +79,18 @@ public class LabeledIcon implements Icon { private int getTextHeight() { if (myStrings != null) { - Font font = UIUtil.getLabelFont(); - FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(font); - return fontMetrics.getHeight() * myStrings.length; + return getFontHeight(myStrings, myFont); } else { return 0; } } + private static int getFontHeight(String[] strings, Font font) { + FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(font); + return fontMetrics.getHeight() * strings.length; + } + private int getTextWidth() { if (myStrings != null) { int width = 0; @@ -109,7 +122,7 @@ public class LabeledIcon implements Icon { } // Draw text if (myStrings != null) { - Font font = UIUtil.getLabelFont(); + Font font = getFont(); FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(font); g.setFont(fontMetrics.getFont()); if (myMnemonic != null) { diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java index cd1c17c4dfff..6063d5d648c8 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -728,10 +728,6 @@ public class AbstractPopup implements JBPopup { if (myRequestFocus) { _requestFocus(); - - if (myFocusable && myFocusTrackback != null) { - myFocusTrackback.cleanParentWindow(); - } } if (myPreferredFocusedComponent != null && myInStack) { @@ -745,6 +741,10 @@ public class AbstractPopup implements JBPopup { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { + if (myFocusable && myRequestFocus && myFocusTrackback != null) { + myFocusTrackback.cleanParentWindow(); + } + result.setDone(); } }); diff --git a/platform/platform-impl/testSrc/com/intellij/ide/util/treeView/TreeUiTest.java b/platform/platform-impl/testSrc/com/intellij/ide/util/treeView/TreeUiTest.java index 9bdfa0c2e2f6..7ded4a44c823 100644 --- a/platform/platform-impl/testSrc/com/intellij/ide/util/treeView/TreeUiTest.java +++ b/platform/platform-impl/testSrc/com/intellij/ide/util/treeView/TreeUiTest.java @@ -2204,16 +2204,6 @@ public class TreeUiTest extends AbstractTreeBuilderTest { public SyncUpdate() { super(false, false); } - - @Override - public void testQueryWhenUpdatingPresentation() throws Exception { - super.testQueryWhenUpdatingPresentation(); //To change body of overridden methods use File | Settings | File Templates. - } - - @Override - public void testElementMove1() throws Exception { - super.testElementMove1(); //To change body of overridden methods use File | Settings | File Templates. - } } public static class Passthrough extends TreeUiTest { diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index 606e027f2738..2552ad9c8f01 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -38,6 +38,7 @@ ide.forcedShowTooltip=alt ide.forcedShowTooltip.description=Shortcut for forced show tooltip ide.popup.dropShadow=false ide.consumeKnownToolkitBugs=true +ide.highlight.match.in.selected.only=true ide.appIcon.progress=true ide.appIcon.badge=true @@ -118,7 +119,7 @@ frameworks.download.libraries.server.url=http://pluginsrepo-test:8080 caches.indexerThreadsCount=-1 vcs.show.history.numbers=true navbar.updateMergeTime=250 -navbar.userActivityMergeTime=500 +navbar.userActivityMergeTime=100 navbar.newpopup=true inspectionGadgets.telemetry.enabled=false @@ -128,3 +129,5 @@ minuscule.humps.matching.description=Camel Case without holding Shift in Ctrl+N/ jvmbugfix.mac.caccessibleLeak=true projectView.showHierarchyErrors=false +dir.diff.default.src.folder= +dir.diff.default.trg.folder= diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/dir/TestDirDiffAction.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/dir/TestDirDiffAction.java index 0011dee9ce56..812cff21d0a5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/dir/TestDirDiffAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/dir/TestDirDiffAction.java @@ -22,7 +22,9 @@ import com.intellij.openapi.diff.DirDiffManager; import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserFactory; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.VirtualFileManager; /** * @author Konstantin Bulenkov @@ -32,9 +34,11 @@ public class TestDirDiffAction extends AnAction { public void actionPerformed(AnActionEvent e) { final Project project = e.getData(PlatformDataKeys.PROJECT); if (project != null) { + final VirtualFile src = VirtualFileManager.getInstance().findFileByUrl(Registry.stringValue("dir.diff.default.src.folder")); + final VirtualFile trg = VirtualFileManager.getInstance().findFileByUrl(Registry.stringValue("dir.diff.default.trg.folder")); final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false); - final VirtualFile[] files1 = FileChooserFactory.getInstance().createFileChooser(descriptor, project).choose(null, project); - final VirtualFile[] files2 = FileChooserFactory.getInstance().createFileChooser(descriptor, project).choose(null, project); + final VirtualFile[] files1 = src != null ? new VirtualFile[]{src} : FileChooserFactory.getInstance().createFileChooser(descriptor, project).choose(null, project); + final VirtualFile[] files2 = trg != null ? new VirtualFile[]{trg} : FileChooserFactory.getInstance().createFileChooser(descriptor, project).choose(null, project); if (files1.length == 1 && files2.length == 1) { final DirDiffManager diffManager = DirDiffManager.getInstance(project); if (diffManager.canShow(files1[0], files2[0])) { diff --git a/plugins/IntentionPowerPak/src/META-INF/plugin.xml b/plugins/IntentionPowerPak/src/META-INF/plugin.xml index 72a481e9b792..eadf9c617e86 100644 --- a/plugins/IntentionPowerPak/src/META-INF/plugin.xml +++ b/plugins/IntentionPowerPak/src/META-INF/plugin.xml @@ -21,7 +21,7 @@ - com.siyeh.ipp.integer.ConvertToEngineeringNotationIntention + com.siyeh.ipp.integer.ConvertToScientificNotationIntention intention.category.numbers diff --git a/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties b/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties index 3763cddaa34f..e907ff127049 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties +++ b/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties @@ -57,8 +57,8 @@ convert.integer.to.hex.intention.name=Convert to hex convert.integer.to.hex.intention.family.name=Convert to Hexadecimal convert.integer.to.binary.intention.name=Convert to binary convert.integer.to.binary.intention.family.name=Convert to Binary -convert.to.engineering.notation.intention.name=Convert to engineering notation -convert.to.engineering.notation.intention.family.name=Convert to Engineering Notation +convert.to.scientific.notation.intention.name=Convert to scientific notation +convert.to.scientific.notation.intention.family.name=Convert to Scientific Notation convert.to.plain.intention.name=Convert to plain convert.to.plain.intention.family.name=Convert to Plain string.to.char.intention.name=Replace string literal with character diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToEngineeringNotationIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToScientificNotationIntention.java similarity index 87% rename from plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToEngineeringNotationIntention.java rename to plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToScientificNotationIntention.java index 746800de5cdc..4970530026d0 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToEngineeringNotationIntention.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToScientificNotationIntention.java @@ -25,9 +25,8 @@ import java.util.Locale; /** * @author Konstantin Bulenkov - * todo: actually it's a scientific notation, not an engineering one. */ -public class ConvertToEngineeringNotationIntention extends ConvertNumberIntentionBase { +public class ConvertToScientificNotationIntention extends ConvertNumberIntentionBase { private static final DecimalFormat FORMAT = new DecimalFormat("0.0#############E00", new DecimalFormatSymbols(Locale.US)); @Override @@ -40,6 +39,6 @@ public class ConvertToEngineeringNotationIntention extends ConvertNumberIntentio @NotNull @Override protected PsiElementPredicate getElementPredicate() { - return new ConvertToEngineeringNotationPredicate(); + return new ConvertToScientificNotationPredicate(); } } diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToEngineeringNotationPredicate.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToScientificNotationPredicate.java similarity index 95% rename from plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToEngineeringNotationPredicate.java rename to plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToScientificNotationPredicate.java index ce093bd4ba4d..19771c8062f4 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToEngineeringNotationPredicate.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToScientificNotationPredicate.java @@ -23,7 +23,7 @@ import com.siyeh.ipp.base.PsiElementPredicate; /** * @author Konstantin Bulenkov */ -class ConvertToEngineeringNotationPredicate implements PsiElementPredicate { +class ConvertToScientificNotationPredicate implements PsiElementPredicate { public boolean satisfiedBy(PsiElement element) { if (!(element instanceof PsiLiteralExpression)) { diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToEngineeringNotationIntention/after.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/after.java.template similarity index 100% rename from plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToEngineeringNotationIntention/after.java.template rename to plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/after.java.template diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToEngineeringNotationIntention/before.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/before.java.template similarity index 100% rename from plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToEngineeringNotationIntention/before.java.template rename to plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/before.java.template diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToEngineeringNotationIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/description.html similarity index 82% rename from plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToEngineeringNotationIntention/description.html rename to plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/description.html index 65facc7cf205..2c51fade5f6f 100644 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToEngineeringNotationIntention/description.html +++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/description.html @@ -1,7 +1,7 @@ This intention converts selected double or float literal written in decimal notation -into engineering notation. +into scientific notation. diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/NegatedFloatToEng.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/NegatedFloatToSci.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/NegatedFloatToEng.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/NegatedFloatToSci.java diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/NegatedFloatToEng_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/NegatedFloatToSci_after.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/NegatedFloatToEng_after.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/NegatedFloatToSci_after.java diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/EngToPlain.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToPlain.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/EngToPlain.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToPlain.java diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/EngToPlain_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToPlain_after.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/EngToPlain_after.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToPlain_after.java diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/PlainToEng.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToSci.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/PlainToEng.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToSci.java diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/PlainToEng_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToSci_after.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/PlainToEng_after.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToSci_after.java diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToPlainWithUnderscores.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/WithUnderscoresToPlain.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToPlainWithUnderscores.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/WithUnderscoresToPlain.java diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToPlainWithUnderscores_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/WithUnderscoresToPlain_after.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToPlainWithUnderscores_after.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/WithUnderscoresToPlain_after.java diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToEngWithUnderscores.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/WithUnderscoresToSci.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToEngWithUnderscores.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/WithUnderscoresToSci.java diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToEngWithUnderscores_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/float/WithUnderscoresToSci_after.java similarity index 100% rename from plugins/IntentionPowerPak/test/com/siyeh/ipp/float/ToEngWithUnderscores_after.java rename to plugins/IntentionPowerPak/test/com/siyeh/ipp/float/WithUnderscoresToSci_after.java diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToPlainTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToPlainTest.java index fa2a26182735..5ae518088806 100644 --- a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToPlainTest.java +++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToPlainTest.java @@ -19,9 +19,9 @@ import com.siyeh.IntentionPowerPackBundle; import com.siyeh.ipp.IPPTestCase; public class ConvertToPlainTest extends IPPTestCase { - public void testEngToPlain() { doTest(); } + public void testToPlain() { doTest(); } public void testNegatedFloatToPlain() { doTest(); } - public void testToPlainWithUnderscores() { doTest(); } + public void testWithUnderscoresToPlain() { doTest(); } @Override protected String getIntentionName() { diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToEngineeringNotationTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToScientificNotationTest.java similarity index 72% rename from plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToEngineeringNotationTest.java rename to plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToScientificNotationTest.java index f7b404ceb239..4643e1743c89 100644 --- a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToEngineeringNotationTest.java +++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertToScientificNotationTest.java @@ -18,14 +18,14 @@ package com.siyeh.ipp.integer; import com.siyeh.IntentionPowerPackBundle; import com.siyeh.ipp.IPPTestCase; -public class ConvertToEngineeringNotationTest extends IPPTestCase { - public void testPlainToEng() { doTest(); } - public void testNegatedFloatToEng() { doTest(); } - public void testToEngWithUnderscores() { doTest(); } +public class ConvertToScientificNotationTest extends IPPTestCase { + public void testToSci() { doTest(); } + public void testNegatedFloatToSci() { doTest(); } + public void testWithUnderscoresToSci() { doTest(); } @Override protected String getIntentionName() { - return IntentionPowerPackBundle.message("convert.to.engineering.notation.intention.name"); + return IntentionPowerPackBundle.message("convert.to.scientific.notation.intention.name"); } @Override diff --git a/xml/impl/src/com/intellij/xml/index/ResourceRelevance.java b/xml/impl/src/com/intellij/xml/index/ResourceRelevance.java index 49d2db39f1d1..411ebc65af19 100644 --- a/xml/impl/src/com/intellij/xml/index/ResourceRelevance.java +++ b/xml/impl/src/com/intellij/xml/index/ResourceRelevance.java @@ -37,7 +37,7 @@ public enum ResourceRelevance { public static ResourceRelevance getRelevance(VirtualFile resource, @Nullable Module module, ProjectFileIndex fileIndex) { boolean inTest = fileIndex.isInTestSourceContent(resource); if (module != null) { - GlobalSearchScope scope = module.getModuleWithDependenciesAndLibrariesScope(inTest); + GlobalSearchScope scope = module.getModuleRuntimeScope(inTest); Module resourceModule = fileIndex.getModuleForFile(resource); if (resourceModule != null && (resourceModule == module || scope.isSearchInModuleContent(resourceModule)) ||