mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -18,3 +18,10 @@ To develop IntelliJ IDEA, you can use either IntelliJ IDEA Community Edition or
|
||||
|
||||
Pull requests are welcome. Please make sure that you follow the [IntelliJ Coding Guidelines](http://www.jetbrains.org/display/IJOS/IntelliJ+Coding+Guidelines).
|
||||
Note that you'll need to submit a [Contributor Agreement](http://www.jetbrains.org/display/IJOS/Contributor+Agreement) before we can accept your pull request.
|
||||
|
||||
See http://www.jetbrains.org/ for more information.
|
||||
|
||||
## Developer Documentation
|
||||
|
||||
You can find information on the internal architecture of IntelliJ IDEA and plugin development at the
|
||||
[PluginDevelopment](http://confluence.jetbrains.com/display/IDEADEV/PluginDevelopment) site.
|
||||
|
||||
+18
-5
@@ -367,13 +367,26 @@ public abstract class BreakpointPropertiesPanel {
|
||||
}
|
||||
};
|
||||
|
||||
ButtonGroup checkboxesGroup = new ButtonGroup();
|
||||
checkboxesGroup.add(myPassCountCheckbox);
|
||||
checkboxesGroup.add(myConditionCheckbox);
|
||||
myPassCountCheckbox.addActionListener(updateListener);
|
||||
myPassCountCheckbox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (myPassCountCheckbox.isSelected()) {
|
||||
myConditionCheckbox.setSelected(false);
|
||||
}
|
||||
updateCheckboxes();
|
||||
}
|
||||
});
|
||||
myInstanceFiltersCheckBox.addActionListener(updateListener);
|
||||
myClassFiltersCheckBox.addActionListener(updateListener);
|
||||
myConditionCheckbox.addActionListener(updateListener);
|
||||
myConditionCheckbox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (myConditionCheckbox.isSelected()) {
|
||||
myPassCountCheckbox.setSelected(false);
|
||||
}
|
||||
updateCheckboxes();
|
||||
}
|
||||
});
|
||||
DebuggerUIUtil.focusEditorOnCheck(myPassCountCheckbox, myPassCountField);
|
||||
DebuggerUIUtil.focusEditorOnCheck(myLogExpressionCheckBox, myLogExpressionCombo);
|
||||
DebuggerUIUtil.focusEditorOnCheck(myInstanceFiltersCheckBox, myInstanceFiltersField.getTextField());
|
||||
|
||||
+10
-12
@@ -226,15 +226,15 @@ public abstract class BreakpointWithHighlighter extends Breakpoint {
|
||||
}
|
||||
buf.append(" <br> ");
|
||||
buf.append(DebuggerBundle.message("breakpoint.property.name.suspend.policy")).append(" : ");
|
||||
if (DebuggerSettings.SUSPEND_ALL.equals(SUSPEND_POLICY)) {
|
||||
if (DebuggerSettings.SUSPEND_NONE.equals(SUSPEND_POLICY) || !SUSPEND) {
|
||||
buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.none"));
|
||||
}
|
||||
else if (DebuggerSettings.SUSPEND_ALL.equals(SUSPEND_POLICY)) {
|
||||
buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.all"));
|
||||
}
|
||||
else if (DebuggerSettings.SUSPEND_THREAD.equals(SUSPEND_POLICY)) {
|
||||
buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.thread"));
|
||||
}
|
||||
else if (DebuggerSettings.SUSPEND_NONE.equals(SUSPEND_POLICY)) {
|
||||
buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.none"));
|
||||
}
|
||||
buf.append(" <br> ");
|
||||
buf.append(DebuggerBundle.message("breakpoint.property.name.log.message")).append(": ");
|
||||
buf.append(LOG_ENABLED ? CommonBundle.getYesButtonText() : CommonBundle.getNoButtonText());
|
||||
@@ -433,7 +433,7 @@ public abstract class BreakpointWithHighlighter extends Breakpoint {
|
||||
}
|
||||
|
||||
private void setupGutterRenderer(@NotNull RangeHighlighter highlighter) {
|
||||
MyGutterIconRenderer renderer = new MyGutterIconRenderer(getIcon(), getDescription());
|
||||
MyGutterIconRenderer renderer = new MyGutterIconRenderer(this);
|
||||
highlighter.setGutterIconRenderer(renderer);
|
||||
}
|
||||
|
||||
@@ -597,23 +597,21 @@ public abstract class BreakpointWithHighlighter extends Breakpoint {
|
||||
}
|
||||
|
||||
private class MyGutterIconRenderer extends GutterIconRenderer {
|
||||
private final Icon myIcon;
|
||||
private final String myDescription;
|
||||
private BreakpointWithHighlighter myBreakpoint;
|
||||
|
||||
public MyGutterIconRenderer(@NotNull Icon icon, @NotNull String description) {
|
||||
myIcon = icon;
|
||||
myDescription = description;
|
||||
public MyGutterIconRenderer(BreakpointWithHighlighter breakpoint) {
|
||||
myBreakpoint = breakpoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Icon getIcon() {
|
||||
return myIcon;
|
||||
return myBreakpoint.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltipText() {
|
||||
return myDescription;
|
||||
return myBreakpoint.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,6 @@ import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.ProjectViewTestUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.IOException;
|
||||
@@ -63,7 +62,7 @@ public class NavigateFromSourceTest extends BaseProjectViewTestCase {
|
||||
final PsiFile containingFile = psiClass.getContainingFile();
|
||||
final VirtualFile virtualFile = containingFile.getVirtualFile();
|
||||
|
||||
ProjectViewTestUtil.checkNavigateFromSourceBehaviour(psiClass, virtualFile, pane);
|
||||
myStructure.checkNavigateFromSourceBehaviour(psiClass, virtualFile, pane);
|
||||
|
||||
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" +
|
||||
" -PsiDirectory: showClassMembers\n" +
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ProjectTreeBuilderTest extends BaseProjectViewTestCase {
|
||||
|
||||
PsiFile element = aClass.getContainingFile();
|
||||
|
||||
ProjectViewTestUtil.checkNavigateFromSourceBehaviour(element, element.getVirtualFile(), myStructure.createPane());
|
||||
myStructure.checkNavigateFromSourceBehaviour(element, element.getVirtualFile(), myStructure.createPane());
|
||||
}
|
||||
|
||||
public void testShowClassMembers() throws IncorrectOperationException, IOException {
|
||||
@@ -51,7 +51,7 @@ public class ProjectTreeBuilderTest extends BaseProjectViewTestCase {
|
||||
|
||||
final AbstractProjectViewPSIPane pane = myStructure.createPane();
|
||||
|
||||
ProjectViewTestUtil.checkNavigateFromSourceBehaviour(innerClass2Field, innerClass2Field.getContainingFile().getVirtualFile(), pane);
|
||||
myStructure.checkNavigateFromSourceBehaviour(innerClass2Field, innerClass2Field.getContainingFile().getVirtualFile(), pane);
|
||||
|
||||
IdeaTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" +
|
||||
" -PsiDirectory: showClassMembers\n" +
|
||||
|
||||
@@ -47,6 +47,12 @@ class OptimizedFileManager17 extends com.sun.tools.javac.file.JavacFileManager {
|
||||
private final Map<File, File[]> myDirectoryCache = new HashMap<File, File[]>();
|
||||
public static final File[] NULL_FILE_ARRAY = new File[0];
|
||||
|
||||
private static final String _OS_NAME = System.getProperty("os.name").toLowerCase(Locale.US);
|
||||
private static final boolean isWindows = _OS_NAME.startsWith("windows");
|
||||
private static final boolean isOS2 = _OS_NAME.startsWith("os/2") || _OS_NAME.startsWith("os2");
|
||||
private static final boolean isMac = _OS_NAME.startsWith("mac");
|
||||
private static final boolean isFileSystemCaseSensitive = !isWindows && !isOS2 && !isMac;
|
||||
|
||||
public OptimizedFileManager17() throws Throwable {
|
||||
super(new Context(), true, null);
|
||||
final Field archivesField = com.sun.tools.javac.file.JavacFileManager.class.getDeclaredField("archives");
|
||||
@@ -214,7 +220,7 @@ class OptimizedFileManager17 extends com.sun.tools.javac.file.JavacFileManager {
|
||||
|
||||
private class InputFileObject extends BaseFileObject {
|
||||
private String name;
|
||||
final File file;
|
||||
private final File file;
|
||||
private Reference<File> absFileRef;
|
||||
|
||||
public InputFileObject(JavacFileManager fileManager, File f) {
|
||||
@@ -285,20 +291,38 @@ class OptimizedFileManager17 extends com.sun.tools.javac.file.JavacFileManager {
|
||||
|
||||
@Override
|
||||
protected String inferBinaryName(Iterable<? extends File> path) {
|
||||
String fPath = file.getPath();
|
||||
//System.err.println("RegularFileObject " + file + " " +r.getPath());
|
||||
final String fPath = file.getPath();
|
||||
for (File dir: path) {
|
||||
//System.err.println("dir: " + dir);
|
||||
String dPath = dir.getPath();
|
||||
if (dPath.length() == 0)
|
||||
dPath = System.getProperty("user.dir");
|
||||
if (!dPath.endsWith(File.separator))
|
||||
dPath += File.separator;
|
||||
if (fPath.regionMatches(true, 0, dPath, 0, dPath.length())
|
||||
&& new File(fPath.substring(0, dPath.length())).equals(new File(dPath))) {
|
||||
String relativeName = fPath.substring(dPath.length());
|
||||
return removeExtension(relativeName).replace(File.separatorChar, '.');
|
||||
String dirPath = dir.getPath();
|
||||
if (dirPath.length() == 0) {
|
||||
dirPath = System.getProperty("user.dir");
|
||||
}
|
||||
if (!fPath.regionMatches(!isFileSystemCaseSensitive, 0, dirPath, 0, dirPath.length())) {
|
||||
continue;
|
||||
}
|
||||
final int pathLength = fPath.length();
|
||||
final boolean endsWithSeparator = dirPath.endsWith(File.separator);
|
||||
if (!endsWithSeparator) {
|
||||
// need to check if the next char in fPath is file separator
|
||||
final int separatorIdx = dirPath.length();
|
||||
if (pathLength <= separatorIdx || fPath.charAt(separatorIdx) != File.separatorChar) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// fPath starts with dirPath
|
||||
final int startIndex = endsWithSeparator ? dirPath.length() : dirPath.length() + 1;
|
||||
int endIndex = fPath.lastIndexOf('.');
|
||||
if (endIndex <= startIndex) {
|
||||
endIndex = fPath.length();
|
||||
}
|
||||
final int length = endIndex - startIndex;
|
||||
final StringBuilder buf = new StringBuilder(length).append(fPath, startIndex, endIndex);
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
if (buf.charAt(idx) == File.separatorChar) {
|
||||
buf.setCharAt(idx, '.');
|
||||
}
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -211,7 +211,6 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
|
||||
if (directoryName != null ? !directoryName.equals(findModel.directoryName) : findModel.directoryName != null) return false;
|
||||
if (fileFilter != null ? !fileFilter.equals(findModel.fileFilter) : findModel.fileFilter != null) return false;
|
||||
if (moduleName != null ? !moduleName.equals(findModel.moduleName) : findModel.moduleName != null) return false;
|
||||
if (myPattern != null ? !myPattern.equals(findModel.myPattern) : findModel.myPattern != null) return false;
|
||||
if (myStringToFind != null ? !myStringToFind.equals(findModel.myStringToFind) : findModel.myStringToFind != null) return false;
|
||||
if (myStringToReplace != null ? !myStringToReplace.equals(findModel.myStringToReplace) : findModel.myStringToReplace != null) {
|
||||
return false;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.find.impl.livePreview.LivePreviewControllerBase;
|
||||
import com.intellij.find.impl.livePreview.SearchResults;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.CustomComponentAction;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -35,11 +36,14 @@ import com.intellij.openapi.editor.event.SelectionListener;
|
||||
import com.intellij.openapi.editor.impl.EditorHeaderComponent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Getter;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.LightColors;
|
||||
import com.intellij.ui.SearchTextField;
|
||||
import com.intellij.ui.TextComponentUndoProvider;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
@@ -48,6 +52,7 @@ import com.intellij.ui.components.labels.LinkListener;
|
||||
import com.intellij.ui.components.panels.NonOpaquePanel;
|
||||
import com.intellij.ui.speedSearch.SpeedSearchSupply;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -57,6 +62,7 @@ import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
@@ -84,10 +90,30 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
return mySearchField;
|
||||
}
|
||||
|
||||
private JSplitPane mySplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||||
private JPanel myLeftComponent = new JPanel(new BorderLayout());
|
||||
private JPanel myRightComponent = new JPanel(new BorderLayout());
|
||||
|
||||
{
|
||||
mySplitPane.setOpaque(false);
|
||||
mySplitPane.setBorder(IdeBorderFactory.createEmptyBorder(1, 0, 2, 0));
|
||||
mySplitPane.setContinuousLayout(true);
|
||||
myLeftComponent.setOpaque(false);
|
||||
myRightComponent.setOpaque(false);
|
||||
|
||||
mySplitPane.setLeftComponent(myLeftComponent);
|
||||
mySplitPane.setRightComponent(myRightComponent);
|
||||
add(mySplitPane, BorderLayout.NORTH);
|
||||
}
|
||||
|
||||
private JTextComponent mySearchField;
|
||||
private SearchTextField mySearchSearchTextField;
|
||||
|
||||
private JTextComponent myReplaceField;
|
||||
private TextComponentUndoProvider mySearchUndo;
|
||||
private TextComponentUndoProvider myReplaceUndo;
|
||||
private SearchTextField myReplaceSearchTextField;
|
||||
|
||||
private MyUndoProvider mySearchUndo;
|
||||
private MyUndoProvider myReplaceUndo;
|
||||
|
||||
private Getter<JTextComponent> mySearchFieldGetter = new Getter<JTextComponent>() {
|
||||
@Override
|
||||
@@ -273,13 +299,20 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
|
||||
private void configureLeadPanel() {
|
||||
JPanel myLeadPanel = createLeadPane();
|
||||
add(myLeadPanel, BorderLayout.WEST);
|
||||
myRightComponent.add(myLeadPanel, BorderLayout.WEST);
|
||||
|
||||
if (mySearchUndo != null) {
|
||||
mySearchUndo.dispose();
|
||||
}
|
||||
mySearchField = createTextField(myLeadPanel);
|
||||
mySearchUndo = new TextComponentUndoProvider(mySearchField);
|
||||
|
||||
Ref<SearchTextField> ref = Ref.create();
|
||||
mySearchField = createTextField(BorderLayout.NORTH, ref);
|
||||
mySearchSearchTextField = ref.get();
|
||||
if (mySearchSearchTextField != null) {
|
||||
setupHistoryToSearchField(mySearchSearchTextField, FindSettings.getInstance().getRecentFindStrings());
|
||||
}
|
||||
|
||||
mySearchUndo = new MyUndoProvider(mySearchField);
|
||||
|
||||
setupSearchFieldListener();
|
||||
|
||||
@@ -287,7 +320,11 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
initToolbar();
|
||||
}
|
||||
|
||||
myLeadPanel.add(myToolbarComponent);
|
||||
JPanel centerPanel = new JPanel(new BorderLayout());
|
||||
centerPanel.setOpaque(false);
|
||||
centerPanel.add(myToolbarComponent, BorderLayout.CENTER);
|
||||
|
||||
myRightComponent.add(centerPanel, BorderLayout.CENTER);
|
||||
|
||||
if (secondaryActionsAvailable()) {
|
||||
if (myToolbarComponent instanceof ActionToolbarImpl) {
|
||||
@@ -299,21 +336,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
JPanel tailPanel = new NonOpaquePanel(new BorderLayout(5, 0));
|
||||
JPanel tailContainer = new NonOpaquePanel(new BorderLayout(5, 0));
|
||||
tailContainer.add(tailPanel, BorderLayout.EAST);
|
||||
add(tailContainer, BorderLayout.CENTER);
|
||||
|
||||
myMatchInfoLabel = new JLabel();
|
||||
setSmallerFontAndOpaque(myMatchInfoLabel);
|
||||
|
||||
|
||||
myClickToHighlightLabel = new LinkLabel("Click to highlight", null, new LinkListener() {
|
||||
@Override
|
||||
public void linkSelected(LinkLabel aSource, Object aLinkData) {
|
||||
setMatchesLimit(Integer.MAX_VALUE);
|
||||
updateResults(true);
|
||||
}
|
||||
});
|
||||
setSmallerFontAndOpaque(myClickToHighlightLabel);
|
||||
myClickToHighlightLabel.setVisible(false);
|
||||
centerPanel.add(tailContainer, BorderLayout.EAST);
|
||||
|
||||
JLabel closeLabel = new JLabel(" ", AllIcons.Actions.Cross, SwingConstants.RIGHT);
|
||||
closeLabel.addMouseListener(new MouseAdapter() {
|
||||
@@ -325,11 +348,6 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
|
||||
closeLabel.setToolTipText("Close search bar (Escape)");
|
||||
|
||||
JPanel labelsPanel = new NonOpaquePanel(new FlowLayout());
|
||||
|
||||
labelsPanel.add(myMatchInfoLabel);
|
||||
labelsPanel.add(myClickToHighlightLabel);
|
||||
tailPanel.add(labelsPanel, BorderLayout.CENTER);
|
||||
tailPanel.add(closeLabel, BorderLayout.EAST);
|
||||
|
||||
Utils.setSmallerFont(mySearchField);
|
||||
@@ -362,6 +380,11 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
Utils.setSmallerFontForChildren(myToolbarComponent);
|
||||
}
|
||||
|
||||
private void setupHistoryToSearchField(SearchTextField field, String[] strings) {
|
||||
field.setHistorySize(strings.length);
|
||||
field.setHistory(ContainerUtil.reverse(Arrays.asList(strings)));
|
||||
}
|
||||
|
||||
private void initToolbar() {
|
||||
DefaultActionGroup actionGroup = new DefaultActionGroup("search bar", false);
|
||||
actionGroup.add(new ShowHistoryAction(mySearchFieldGetter, this));
|
||||
@@ -372,6 +395,17 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
actionGroup.add(new ToggleMatchCase(this));
|
||||
actionGroup.add(new ToggleRegex(this));
|
||||
|
||||
myMatchInfoLabel = new JLabel();
|
||||
|
||||
myClickToHighlightLabel = new LinkLabel("Click to highlight", null, new LinkListener() {
|
||||
@Override
|
||||
public void linkSelected(LinkLabel aSource, Object aLinkData) {
|
||||
setMatchesLimit(Integer.MAX_VALUE);
|
||||
updateResults(true);
|
||||
}
|
||||
});
|
||||
myClickToHighlightLabel.setVisible(false);
|
||||
|
||||
myActionsToolbar = ActionManager.getInstance().createActionToolbar("SearchBar", actionGroup, true);
|
||||
myActionsToolbar.setSecondaryActionsTooltip("More Options(" + ShowMoreOptions.SHORT_CUT + ")");
|
||||
|
||||
@@ -383,6 +417,25 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
actionGroup.addAction(new TogglePreserveCaseAction(this));
|
||||
actionGroup.addAction(new ToggleSelectionOnlyAction(this));
|
||||
|
||||
class MyCustomComponentDoNothingAction extends AnAction implements CustomComponentAction {
|
||||
private JComponent c;
|
||||
|
||||
MyCustomComponentDoNothingAction(JComponent c) {
|
||||
this.c = c;
|
||||
c.setBorder(IdeBorderFactory.createEmptyBorder(new Insets(0, 10, 0, 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createCustomComponent(Presentation presentation) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
actionGroup.add(new MyCustomComponentDoNothingAction(myMatchInfoLabel));
|
||||
actionGroup.add(new MyCustomComponentDoNothingAction(myClickToHighlightLabel));
|
||||
|
||||
myActionsToolbar.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY);
|
||||
myToolbarComponent = myActionsToolbar.getComponent();
|
||||
@@ -453,7 +506,8 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
myActionsToolbar.updateActionsImmediately();
|
||||
|
||||
if ((myFindModel.isMultiline() && mySearchField instanceof JTextField) || (!myFindModel.isMultiline() && mySearchField instanceof JTextArea)) {
|
||||
removeAll();
|
||||
myLeftComponent.removeAll();
|
||||
myRightComponent.removeAll();
|
||||
configureLeadPanel();
|
||||
if (myReplacementPane != null) {
|
||||
myReplacementPane = null;
|
||||
@@ -471,7 +525,8 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
if (myFindModel.isReplaceState() && myReplacementPane == null) {
|
||||
configureReplacementPane();
|
||||
} else if (!myFindModel.isReplaceState() && myReplacementPane != null) {
|
||||
remove(myReplacementPane);
|
||||
myLeftComponent.remove(myReplaceField);
|
||||
myRightComponent.remove(myReplacementPane);
|
||||
myReplacementPane = null;
|
||||
}
|
||||
if (myFindModel.isReplaceState()) {
|
||||
@@ -483,8 +538,8 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
}
|
||||
|
||||
updateReplaceButton();
|
||||
|
||||
Utils.setSmallerFontForChildren(myToolbarComponent);
|
||||
revalidate();
|
||||
}
|
||||
|
||||
private static boolean wholeWordsApplicable(String stringToFind) {
|
||||
@@ -501,17 +556,21 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
}
|
||||
|
||||
private void configureReplacementPane() {
|
||||
myReplacementPane = createLeadPane();
|
||||
myReplacementPane = new NonOpaquePanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
|
||||
if (myReplaceUndo != null) {
|
||||
myReplaceUndo.dispose();
|
||||
}
|
||||
myReplaceField = createTextField(myReplacementPane);
|
||||
myReplaceUndo = new TextComponentUndoProvider(myReplaceField);
|
||||
|
||||
//if (myToolbarComponent instanceof ActionToolbarImpl) {
|
||||
// new ShowMoreOptions(myToolbarComponent, myReplaceField);
|
||||
//}
|
||||
Ref<SearchTextField> ref = Ref.create();
|
||||
myReplaceField = createTextField(BorderLayout.SOUTH, ref);
|
||||
myReplaceSearchTextField = ref.get();
|
||||
if (myReplaceSearchTextField != null) {
|
||||
setupHistoryToSearchField(myReplaceSearchTextField, FindSettings.getInstance().getRecentReplaceStrings());
|
||||
}
|
||||
myReplaceUndo = new MyUndoProvider(myReplaceField);
|
||||
|
||||
revalidate();
|
||||
|
||||
DocumentListener replaceFieldListener = new DocumentListener() {
|
||||
@Override
|
||||
@@ -536,7 +595,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
}
|
||||
|
||||
myReplaceField.setText(myFindModel.getStringToReplace());
|
||||
add(myReplacementPane, BorderLayout.SOUTH);
|
||||
myRightComponent.add(myReplacementPane, BorderLayout.SOUTH);
|
||||
|
||||
myReplaceButton = new JButton("Replace");
|
||||
myReplaceButton.setFocusable(false);
|
||||
@@ -591,7 +650,6 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
new VariantsCompletionAction(this, myReplaceFieldGetter);
|
||||
new NextOccurrenceAction(this, myReplaceFieldGetter);
|
||||
new PrevOccurrenceAction(this, myReplaceFieldGetter);
|
||||
|
||||
}
|
||||
|
||||
private void replaceFieldDocumentChanged() {
|
||||
@@ -633,7 +691,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
}
|
||||
|
||||
private static JPanel createLeadPane() {
|
||||
return new NonOpaquePanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
return new NonOpaquePanel(new BorderLayout());
|
||||
}
|
||||
|
||||
public void showHistory(final boolean byClickingToolbarButton, JTextComponent textField) {
|
||||
@@ -661,7 +719,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
}
|
||||
}
|
||||
|
||||
private JTextComponent createTextField(JPanel leadPanel) {
|
||||
private JTextComponent createTextField(Object constraint, Ref<SearchTextField> searchTextField) {
|
||||
final JTextComponent editorTextField;
|
||||
if (myFindModel.isMultiline()) {
|
||||
editorTextField = new JTextArea("") {
|
||||
@@ -676,22 +734,19 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
final JScrollPane scrollPane = new JBScrollPane(editorTextField,
|
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
|
||||
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
leadPanel.add(scrollPane);
|
||||
myLeftComponent.add(scrollPane, constraint);
|
||||
}
|
||||
else {
|
||||
editorTextField = new JTextField("") {
|
||||
@Override
|
||||
protected void paintBorder(final Graphics g) {
|
||||
super.paintBorder(g);
|
||||
paintBorderOfTextField(g);
|
||||
}
|
||||
};
|
||||
((JTextField)editorTextField).setColumns(25);
|
||||
SearchTextField stf = new SearchTextField(true);
|
||||
stf.setOpaque(false);
|
||||
editorTextField = stf.getTextEditor();
|
||||
if (UIUtil.isUnderGTKLookAndFeel()) {
|
||||
editorTextField.setOpaque(false);
|
||||
}
|
||||
leadPanel.add(editorTextField);
|
||||
myLeftComponent.add(stf, constraint);
|
||||
searchTextField.set(stf);
|
||||
}
|
||||
editorTextField.setMinimumSize(new Dimension(200, -1));
|
||||
editorTextField.putClientProperty("AuxEditorComponent", Boolean.TRUE);
|
||||
|
||||
editorTextField.addFocusListener(new FocusListener() {
|
||||
@@ -738,8 +793,14 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
if (text.length() > 0) {
|
||||
if (textField == mySearchField) {
|
||||
FindSettings.getInstance().addStringToFind(text);
|
||||
if (mySearchSearchTextField != null) {
|
||||
mySearchSearchTextField.addCurrentTextToHistory();
|
||||
}
|
||||
} else {
|
||||
FindSettings.getInstance().addStringToReplace(text);
|
||||
if (myReplaceSearchTextField != null) {
|
||||
myReplaceSearchTextField.addCurrentTextToHistory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -904,6 +965,34 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
return insets;
|
||||
}
|
||||
|
||||
private static class MyUndoProvider extends TextComponentUndoProvider {
|
||||
private boolean myEnabled = true;
|
||||
public MyUndoProvider(JTextComponent textComponent) {
|
||||
super(textComponent);
|
||||
textComponent.getDocument().addDocumentListener(new com.intellij.ui.DocumentAdapter() {
|
||||
@Override
|
||||
protected void textChanged(javax.swing.event.DocumentEvent e) {
|
||||
myEnabled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canUndo() {
|
||||
return super.canUndo() && myEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canRedo() {
|
||||
return super.canRedo() && myEnabled;
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
myEnabled = false;
|
||||
myUndoManager.discardAllEdits();
|
||||
}
|
||||
}
|
||||
|
||||
private class MyLivePreviewController extends LivePreviewControllerBase {
|
||||
public MyLivePreviewController() {
|
||||
super(EditorSearchComponent.this.mySearchResults, EditorSearchComponent.this.myLivePreview);
|
||||
@@ -941,7 +1030,8 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
mySuppressUpdate = false;
|
||||
}
|
||||
//getFocusBack();
|
||||
addTextToRecent(myReplaceField) ;
|
||||
addTextToRecent(myReplaceField);
|
||||
clearUndoInTextFields();
|
||||
}
|
||||
|
||||
public void exclude() {
|
||||
@@ -952,4 +1042,9 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
performReplaceAll(myEditor);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearUndoInTextFields() {
|
||||
myReplaceUndo.disable();
|
||||
mySearchUndo.disable();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-10
@@ -42,16 +42,11 @@ public class ShowHistoryAction extends EditorHeaderAction implements DumbAware {
|
||||
shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK), null));
|
||||
|
||||
registerCustomShortcutSet(new CustomShortcutSet(shortcuts.toArray(new Shortcut[shortcuts.size()])), getTextField());
|
||||
if (!editorSearchComponent.getFindModel().isMultiline()) {
|
||||
getTextField().registerKeyboardAction(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (getTextField().getText().isEmpty()) {
|
||||
getEditorSearchComponent().showHistory(false, getTextField());
|
||||
}
|
||||
}
|
||||
}, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), JComponent.WHEN_FOCUSED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setVisible(getEditorSearchComponent().getFindModel().isMultiline());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -245,16 +245,19 @@ public class FavoritesTreeViewPanel extends JPanel implements DataProvider, Dock
|
||||
@Override
|
||||
public void rootsChanged() {
|
||||
myBuilder.updateFromRoot();
|
||||
myTree.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listAdded(String listName) {
|
||||
myBuilder.updateFromRoot();
|
||||
myTree.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listRemoved(String listName) {
|
||||
myBuilder.updateFromRoot();
|
||||
myTree.repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -413,8 +413,8 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
|
||||
|
||||
public AnAction[] getTitleActions() {
|
||||
return new AnAction[]{
|
||||
CommonActionsManager.getInstance().createCollapseAllHeaderAction(getTree()),
|
||||
CommonActionsManager.getInstance().createExpandAllHeaderAction(getTree()),
|
||||
CommonActionsManager.getInstance().createCollapseAllHeaderAction(getTree()),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ public abstract class AbstractFileTreeTable<T> extends TreeTable {
|
||||
}
|
||||
});
|
||||
final DefaultTreeExpander treeExpander = new DefaultTreeExpander(getTree());
|
||||
CommonActionsManager.getInstance().createCollapseAllAction(treeExpander, this);
|
||||
CommonActionsManager.getInstance().createExpandAllAction(treeExpander, this);
|
||||
CommonActionsManager.getInstance().createCollapseAllAction(treeExpander, this);
|
||||
|
||||
getTree().setShowsRootHandles(true);
|
||||
getTree().setLineStyleAngled();
|
||||
|
||||
@@ -100,7 +100,9 @@ public class SearchTextField extends JPanel {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||
if (myPopup == null || !myPopup.isVisible()) {
|
||||
if (hasNativeLeopardSearchControl()) {
|
||||
myNativeSearchPopup.show(myTextField, 5, myTextField.getHeight());
|
||||
} else if (myPopup == null || !myPopup.isVisible()) {
|
||||
showPopup();
|
||||
}
|
||||
}
|
||||
@@ -372,7 +374,7 @@ public class SearchTextField extends JPanel {
|
||||
}
|
||||
|
||||
protected void showPopup() {
|
||||
if (myPopup == null) {
|
||||
if (myPopup == null || !myPopup.isVisible()) {
|
||||
final JList list = new JBList(myModel);
|
||||
final Runnable chooseRunnable = createItemChosenCallback(list);
|
||||
myPopup = JBPopupFactory.getInstance().createListPopupBuilder(list)
|
||||
|
||||
@@ -29,8 +29,8 @@ import javax.swing.undo.UndoManager;
|
||||
* @author yole
|
||||
*/
|
||||
public class TextComponentUndoProvider implements Disposable {
|
||||
private final JTextComponent myTextComponent;
|
||||
private final UndoManager myUndoManager = new UndoManager();
|
||||
protected final JTextComponent myTextComponent;
|
||||
protected final UndoManager myUndoManager = new UndoManager();
|
||||
private UndoableEditListener myUndoableEditListener;
|
||||
|
||||
public TextComponentUndoProvider(final JTextComponent textComponent) {
|
||||
@@ -47,27 +47,53 @@ public class TextComponentUndoProvider implements Disposable {
|
||||
Shortcut[] redoShortcuts = activeKeymap.getShortcuts(IdeActions.ACTION_REDO);
|
||||
|
||||
AnAction undoAction = new AnAction() {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
super.update(e);
|
||||
e.getPresentation().setEnabled(canUndo());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
if (myUndoManager.canUndo()) {
|
||||
myUndoManager.undo();
|
||||
}
|
||||
undo();
|
||||
}
|
||||
};
|
||||
|
||||
AnAction redoAction = new AnAction() {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
super.update(e);
|
||||
e.getPresentation().setEnabled(canRedo());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
if (myUndoManager.canRedo()) {
|
||||
myUndoManager.redo();
|
||||
}
|
||||
redo();
|
||||
}
|
||||
};
|
||||
|
||||
undoAction.registerCustomShortcutSet(new CustomShortcutSet(undoShortcuts), myTextComponent);
|
||||
redoAction.registerCustomShortcutSet(new CustomShortcutSet(redoShortcuts), myTextComponent);
|
||||
}
|
||||
|
||||
protected boolean canUndo() {
|
||||
return myUndoManager.canUndo();
|
||||
}
|
||||
|
||||
protected boolean canRedo() {
|
||||
return myUndoManager.canRedo();
|
||||
}
|
||||
|
||||
protected void redo() {
|
||||
if (myUndoManager.canRedo()) {
|
||||
myUndoManager.redo();
|
||||
}
|
||||
}
|
||||
|
||||
protected void undo() {
|
||||
if (myUndoManager.canUndo()) {
|
||||
myUndoManager.undo();
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
||||
@@ -827,6 +827,9 @@
|
||||
<usageContextPanelProvider implementation="com.intellij.usageView.impl.UsageContextCallHierarchyPanel$Provider"/>
|
||||
<fileDocumentSynchronizationVetoer implementation="com.intellij.codeInsight.lookup.impl.LookupDocumentSavingVetoer"/>
|
||||
<toolsProvider implementation="com.intellij.tools.LocalToolsProvider"/>
|
||||
|
||||
<favoritesListProvider implementation="com.intellij.ide.bookmarks.BookmarksFavoriteListProvider"/>
|
||||
<favoritesListProvider implementation="com.intellij.xdebugger.impl.breakpoints.BreakpointsFavoriteListProvider"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ import com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.testFramework.ProjectViewTestUtil;
|
||||
import junit.framework.Assert;
|
||||
|
||||
public class TestProjectTreeStructure extends AbstractProjectTreeStructure implements Disposable {
|
||||
protected boolean myShowMembers = false;
|
||||
@@ -32,6 +36,15 @@ public class TestProjectTreeStructure extends AbstractProjectTreeStructure imple
|
||||
Disposer.register(parentDisposable, this);
|
||||
}
|
||||
|
||||
public void checkNavigateFromSourceBehaviour(PsiElement element, VirtualFile virtualFile, AbstractProjectViewPSIPane pane) {
|
||||
Disposer.dispose(pane);
|
||||
pane.createComponent();
|
||||
Disposer.register(this, pane);
|
||||
Assert.assertNull(ProjectViewTestUtil.getNodeForElement(element, pane));
|
||||
pane.select(element, virtualFile, true);
|
||||
Assert.assertTrue(ProjectViewTestUtil.isExpanded(element, pane));
|
||||
}
|
||||
|
||||
public AbstractProjectViewPSIPane createPane() {
|
||||
final AbstractProjectViewPSIPane pane = new TestProjectViewPSIPane(myProject, this);
|
||||
pane.createComponent();
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.ide.projectView.impl.nodes.BasePsiNode;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeNode;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeStructure;
|
||||
import com.intellij.openapi.ui.Queryable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.MultiValuesMap;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -126,7 +125,7 @@ public class ProjectViewTestUtil {
|
||||
return pane.getTree().isExpanded(path.getParentPath());
|
||||
}
|
||||
|
||||
protected static DefaultMutableTreeNode getNodeForElement(PsiElement element, AbstractProjectViewPSIPane pane) {
|
||||
public static DefaultMutableTreeNode getNodeForElement(PsiElement element, AbstractProjectViewPSIPane pane) {
|
||||
JTree tree = pane.getTree();
|
||||
TreeModel model = tree.getModel();
|
||||
Object root = model.getRoot();
|
||||
@@ -148,14 +147,6 @@ public class ProjectViewTestUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void checkNavigateFromSourceBehaviour(PsiElement element, VirtualFile virtualFile, AbstractProjectViewPSIPane pane) {
|
||||
Disposer.dispose(pane);
|
||||
pane.createComponent();
|
||||
Assert.assertNull(getNodeForElement(element, pane));
|
||||
pane.select(element, virtualFile, true);
|
||||
Assert.assertTrue(isExpanded(element, pane));
|
||||
}
|
||||
|
||||
public static boolean isExpanded(PsiElement element, AbstractProjectViewPSIPane pane) {
|
||||
DefaultMutableTreeNode nodeForElement = getNodeForElement(element, pane);
|
||||
return nodeForElement != null && isExpanded((DefaultMutableTreeNode)nodeForElement.getParent(), pane);
|
||||
|
||||
@@ -75,12 +75,12 @@ public class ToolbarPanel extends JPanel implements OccurenceNavigator, Disposab
|
||||
properties, TestConsoleProperties.SORT_ALPHABETICALLY));
|
||||
actionGroup.addSeparator();
|
||||
|
||||
AnAction action = CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, parent);
|
||||
action.getTemplatePresentation().setDescription(ExecutionBundle.message("junit.runing.info.collapse.test.action.name"));
|
||||
AnAction action = CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, parent);
|
||||
action.getTemplatePresentation().setDescription(ExecutionBundle.message("junit.runing.info.expand.test.action.name"));
|
||||
actionGroup.add(action);
|
||||
|
||||
action = CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, parent);
|
||||
action.getTemplatePresentation().setDescription(ExecutionBundle.message("junit.runing.info.expand.test.action.name"));
|
||||
action = CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, parent);
|
||||
action.getTemplatePresentation().setDescription(ExecutionBundle.message("junit.runing.info.collapse.test.action.name"));
|
||||
actionGroup.add(action);
|
||||
|
||||
actionGroup.addSeparator();
|
||||
|
||||
@@ -539,8 +539,8 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
|
||||
scheduleDisposeOnClose(new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
collapseAllAction.unregisterCustomShortcutSet(component);
|
||||
expandAllAction.unregisterCustomShortcutSet(component);
|
||||
collapseAllAction.unregisterCustomShortcutSet(component);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+12
-13
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.ui.breakpoints;
|
||||
package com.intellij.xdebugger.impl.breakpoints;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.favoritesTreeView.AbstractFavoritesListProvider;
|
||||
@@ -29,9 +29,6 @@ import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule;
|
||||
import com.intellij.xdebugger.impl.DebuggerSupport;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointsDialogState;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.tree.BreakpointItemsTreeController;
|
||||
@@ -75,20 +72,12 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid
|
||||
myTreeController = new BreakpointItemsTreeController(myRulesAvailable);
|
||||
myTree = new BreakpointsSimpleTree(myProject, myTreeController);
|
||||
myTreeController.setTreeView(myTree);
|
||||
updateChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointsChanged() {
|
||||
List<BreakpointItem> items = new ArrayList<BreakpointItem>();
|
||||
for (final BreakpointPanelProvider provider : myBreakpointPanelProviders) {
|
||||
provider.provideBreakpointItems(myProject, items);
|
||||
}
|
||||
getEnabledGroupingRules(myRulesEnabled);
|
||||
myTreeController.setGroupingRules(myRulesEnabled);
|
||||
myTreeController.rebuildTree(items);
|
||||
|
||||
updateChildren();
|
||||
FavoritesManager.getInstance(myProject).fireListeners(getListName(myProject));
|
||||
}
|
||||
|
||||
private void getEnabledGroupingRules(Collection<XBreakpointGroupingRule> rules) {
|
||||
@@ -103,7 +92,16 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid
|
||||
}
|
||||
|
||||
private void updateChildren() {
|
||||
List<BreakpointItem> items = new ArrayList<BreakpointItem>();
|
||||
for (final BreakpointPanelProvider provider : myBreakpointPanelProviders) {
|
||||
provider.provideBreakpointItems(myProject, items);
|
||||
}
|
||||
getEnabledGroupingRules(myRulesEnabled);
|
||||
myTreeController.setGroupingRules(myRulesEnabled);
|
||||
myTreeController.rebuildTree(items);
|
||||
|
||||
myChildren.clear();
|
||||
|
||||
CheckedTreeNode root = myTreeController.getRoot();
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
TreeNode child = root.getChildAt(i);
|
||||
@@ -111,6 +109,7 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid
|
||||
replicate((DefaultMutableTreeNode)child, myNode, myChildren);
|
||||
}
|
||||
}
|
||||
FavoritesManager.getInstance(myProject).fireListeners(getListName(myProject));
|
||||
}
|
||||
|
||||
private void replicate(DefaultMutableTreeNode source, AbstractTreeNode destination, final List<AbstractTreeNode<Object>> destinationChildren) {
|
||||
+1
@@ -148,6 +148,7 @@ public class XBreakpointPanelProvider extends BreakpointPanelProvider<XBreakpoin
|
||||
|
||||
@Override
|
||||
public void breakpointChanged(@NotNull XBreakpoint<?> breakpoint) {
|
||||
myListener.breakpointsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,22 +15,28 @@ import java.util.Collections;
|
||||
* Date: 4/3/13
|
||||
*/
|
||||
public class JavaFxFileReferenceProvider extends PsiReferenceProvider {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull ProcessingContext context) {
|
||||
final Object value = ((PsiLiteralExpression)element).getValue();
|
||||
final PsiDirectory directory = element.getContainingFile().getOriginalFile().getParent();
|
||||
if (!(value instanceof String) || directory == null) return PsiReference.EMPTY_ARRAY;
|
||||
final boolean startsWithSlash = ((String)value).startsWith("/");
|
||||
final VirtualFileSystem fs = directory.getVirtualFile().getFileSystem();
|
||||
return new FileReferenceSet((String)value, element, 1, null, ((NewVirtualFileSystem)fs).isCaseSensitive()) {
|
||||
final FileReferenceSet fileReferenceSet = new FileReferenceSet((String)value, element, 1, null, ((NewVirtualFileSystem)fs).isCaseSensitive()) {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<PsiFileSystemItem> getDefaultContexts() {
|
||||
if (!directory.isValid()) {
|
||||
if (startsWithSlash || !directory.isValid()) {
|
||||
return super.getDefaultContexts();
|
||||
}
|
||||
return Collections.<PsiFileSystemItem>singletonList(directory);
|
||||
}
|
||||
}.getAllReferences();
|
||||
};
|
||||
if (startsWithSlash) {
|
||||
fileReferenceSet.addCustomization(FileReferenceSet.DEFAULT_PATH_EVALUATOR_OPTION, FileReferenceSet.ABSOLUTE_TOP_LEVEL);
|
||||
}
|
||||
return fileReferenceSet.getAllReferences();
|
||||
}
|
||||
}
|
||||
|
||||
+40
-4
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.javaFX.fxml.refs;
|
||||
|
||||
import com.intellij.patterns.PsiJavaElementPattern;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.filters.ElementFilter;
|
||||
import com.intellij.psi.filters.position.FilterPattern;
|
||||
@@ -30,10 +31,40 @@ import static com.intellij.patterns.PsiJavaPatterns.literalExpression;
|
||||
* Date: 2/22/13
|
||||
*/
|
||||
public class JavaFxReferencesContributor extends PsiReferenceContributor {
|
||||
public static final PsiJavaElementPattern.Capture<PsiLiteralExpression> STYLESHEET_PATTERN =
|
||||
literalExpression().and(new FilterPattern(new ElementFilter() {
|
||||
public boolean isAcceptable(Object element, PsiElement context) {
|
||||
final PsiLiteralExpression literalExpression = (PsiLiteralExpression)context;
|
||||
PsiMethodCallExpression methodCallExpression = PsiTreeUtil.getParentOfType(literalExpression, PsiMethodCallExpression.class);
|
||||
if (methodCallExpression != null) {
|
||||
final PsiMethod psiMethod = methodCallExpression.resolveMethod();
|
||||
if (psiMethod != null && "add".equals(psiMethod.getName())) {
|
||||
final PsiClass containingClass = psiMethod.getContainingClass();
|
||||
if (containingClass != null ) {
|
||||
final PsiExpression qualifierExpression = methodCallExpression.getMethodExpression().getQualifierExpression();
|
||||
if (qualifierExpression instanceof PsiMethodCallExpression) {
|
||||
final PsiReferenceExpression getStylesheetsMethodExpression = ((PsiMethodCallExpression)qualifierExpression).getMethodExpression();
|
||||
if ("getStylesheets".equals(getStylesheetsMethodExpression.getReferenceName())) {
|
||||
final PsiExpression stageExpr = getStylesheetsMethodExpression.getQualifierExpression();
|
||||
if (stageExpr != null) {
|
||||
final PsiType psiType = stageExpr.getType();
|
||||
return psiType != null && psiType.equalsToText(JavaFxCommonClassNames.JAVA_FX_PARENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isClassAcceptable(Class hintClass) {
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
|
||||
@Override
|
||||
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
|
||||
registrar.registerReferenceProvider(literalExpression().and(new FilterPattern(new ElementFilter() {
|
||||
public static final PsiJavaElementPattern.Capture<PsiLiteralExpression> FXML_PATTERN =
|
||||
literalExpression().and(new FilterPattern(new ElementFilter() {
|
||||
public boolean isAcceptable(Object element, PsiElement context) {
|
||||
final PsiLiteralExpression literalExpression = (PsiLiteralExpression)context;
|
||||
PsiMethodCallExpression callExpression = PsiTreeUtil.getParentOfType(literalExpression, PsiMethodCallExpression.class);
|
||||
@@ -72,6 +103,11 @@ public class JavaFxReferencesContributor extends PsiReferenceContributor {
|
||||
public boolean isClassAcceptable(Class hintClass) {
|
||||
return true;
|
||||
}
|
||||
})), new JavaFxFileReferenceProvider());
|
||||
}));
|
||||
|
||||
@Override
|
||||
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
|
||||
registrar.registerReferenceProvider(FXML_PATTERN, new JavaFxFileReferenceProvider());
|
||||
registrar.registerReferenceProvider(STYLESHEET_PATTERN, new JavaFxFileReferenceProvider());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -23,7 +23,6 @@ import com.intellij.projectView.BaseProjectViewTestCase;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiJavaFile;
|
||||
import com.intellij.testFramework.ProjectViewTestUtil;
|
||||
|
||||
|
||||
public class FormMergerTreeStructureProviderTest extends BaseProjectViewTestCase {
|
||||
@@ -49,11 +48,11 @@ public class FormMergerTreeStructureProviderTest extends BaseProjectViewTestCase
|
||||
" PsiFile(plain text):Form1.form\n");
|
||||
|
||||
PsiClass psiClass = ((PsiJavaFile)getPackageDirectory().findFile("Form1.java")).getClasses()[0];
|
||||
ProjectViewTestUtil.checkNavigateFromSourceBehaviour(psiClass, psiClass.getContainingFile().getVirtualFile(), pane);
|
||||
myStructure.checkNavigateFromSourceBehaviour(psiClass, psiClass.getContainingFile().getVirtualFile(), pane);
|
||||
|
||||
PsiFile psiFile = getPackageDirectory().findFile("Form1.form");
|
||||
VirtualFile virtualFile = psiFile.getContainingFile().getVirtualFile();
|
||||
ProjectViewTestUtil.checkNavigateFromSourceBehaviour(psiFile, virtualFile, pane);
|
||||
myStructure.checkNavigateFromSourceBehaviour(psiFile, virtualFile, pane);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1125,10 +1125,6 @@
|
||||
<favoriteNodeProvider implementation="com.intellij.ide.favoritesTreeView.PsiMethodFavoriteNodeProvider"/>
|
||||
<favoriteNodeProvider implementation="com.intellij.ide.favoritesTreeView.PsiPackageFavoriteNodeProvider"/>
|
||||
<favoriteNodeProvider implementation="com.intellij.ide.favoritesTreeView.UsageFavoriteNodeProvider"/>
|
||||
<!-- <favoritesListProvider implementation="com.intellij.ide.favoritesTreeView.ProjectDefaultFavoriteListProvider"/> -->
|
||||
<!-- <favoritesListProvider implementation="com.intellij.ide.favoritesTreeView.TaskDefaultFavoriteListProvider"/> -->
|
||||
<favoritesListProvider implementation="com.intellij.ide.bookmarks.BookmarksFavoriteListProvider"/>
|
||||
<favoritesListProvider implementation="com.intellij.debugger.ui.breakpoints.BreakpointsFavoriteListProvider"/>
|
||||
|
||||
<configurationType implementation="com.intellij.execution.applet.AppletConfigurationType"/>
|
||||
<configurationProducer implementation="com.intellij.execution.applet.AppletConfigurationProducer"/>
|
||||
|
||||
Reference in New Issue
Block a user