mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge commit 'origin/master'
This commit is contained in:
@@ -112,7 +112,7 @@ public class PsiClassConverter extends Converter<PsiClass> 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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -63,6 +63,6 @@ public abstract class ClassValueConverter extends Converter<PsiClass> implements
|
||||
}
|
||||
final boolean inTests = ProjectRootManager.getInstance(project).getFileIndex().isInTestSourceContent(file);
|
||||
|
||||
return module.getModuleRuntimeScope(inTests).union(module.getModuleWithDependenciesAndLibrariesScope(inTests));
|
||||
return module.getModuleRuntimeScope(inTests);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+31
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -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 {
|
||||
}
|
||||
@@ -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(
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-18
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<RelativePoint> getHintContainerShowPoint() {
|
||||
|
||||
+41
-42
@@ -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<DataContext>() {
|
||||
@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<DataContext>() {
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -104,7 +104,7 @@ public abstract class PsiElementListCellRenderer<T extends PsiElement> 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 + " " : ""));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
+8
-2
@@ -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<E> extends NodeDescriptor<E> {
|
||||
|
||||
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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+11
-2
@@ -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++) {
|
||||
|
||||
@@ -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 <code>null</code> icon.
|
||||
* @param text to be painted under the <code>icon<code>. 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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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=
|
||||
|
||||
@@ -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])) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<className>com.siyeh.ipp.integer.ConvertToEngineeringNotationIntention</className>
|
||||
<className>com.siyeh.ipp.integer.ConvertToScientificNotationIntention</className>
|
||||
<categoryKey>intention.category.numbers</categoryKey>
|
||||
</intentionAction>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-3
@@ -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();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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)) {
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
<font face="verdana" size="-1">This intention converts selected double or float literal written in <b>decimal</b> notation
|
||||
into <b>engineering</b> notation.
|
||||
into <b>scientific</b> notation.
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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() {
|
||||
|
||||
+5
-5
@@ -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
|
||||
@@ -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)) ||
|
||||
|
||||
Reference in New Issue
Block a user