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:
@@ -24,6 +24,7 @@ import com.intellij.ide.ui.LafManagerListener;
|
||||
import com.intellij.ide.ui.search.BooleanOptionDescription;
|
||||
import com.intellij.ide.ui.search.OptionDescription;
|
||||
import com.intellij.ide.ui.search.SearchableOptionsRegistrarImpl;
|
||||
import com.intellij.ide.util.DefaultPsiElementCellRenderer;
|
||||
import com.intellij.ide.util.gotoByName.*;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
@@ -56,6 +57,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.codeStyle.MinusculeMatcher;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
@@ -302,6 +304,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
final Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(field.getTextEditor()));
|
||||
|
||||
assert project != null;
|
||||
myRenderer.myProject = project;
|
||||
myCalcThread = new CalcThread(project, pattern);
|
||||
myCalcThread.start();
|
||||
}
|
||||
@@ -350,7 +353,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
}
|
||||
};
|
||||
private String myLocationString;
|
||||
private DefaultPsiElementCellRenderer myPsiRenderer = new DefaultPsiElementCellRenderer();
|
||||
private Icon myLocationIcon;
|
||||
private Project myProject;
|
||||
private JPanel myMainPanel = new JPanel(new BorderLayout());
|
||||
private JLabel myTitle = new JLabel();
|
||||
private JPanel myLeftPanel = new JPanel(new BorderLayout()) {
|
||||
@@ -383,7 +388,16 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component cmp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
Component cmp;
|
||||
PsiFile file;
|
||||
myLocationString = null;
|
||||
if (value instanceof VirtualFile && myProject != null && (file = PsiManager.getInstance(myProject).findFile((VirtualFile)value)) != null) {
|
||||
cmp = new GotoFileCellRenderer(list.getWidth()).getListCellRendererComponent(list, file, index, isSelected, cellHasFocus);
|
||||
} else if (value instanceof PsiElement) {
|
||||
cmp = myPsiRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
} else {
|
||||
cmp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
}
|
||||
if (myLocationString != null || value instanceof BooleanOptionDescription) {
|
||||
final JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.add(cmp, BorderLayout.CENTER);
|
||||
@@ -490,7 +504,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
index++;
|
||||
}
|
||||
|
||||
myLeftWidth += 10;
|
||||
//myLeftWidth += 10;
|
||||
myTitle.setForeground(Gray._122);
|
||||
myTitle.setAlignmentY(BOTTOM_ALIGNMENT);
|
||||
myLeftPanel.setBorder(new CompoundBorder(new CustomLineBorder(getSeparatorColor(), 0, 0, 0, 1), new EmptyBorder(0, 0, 0, 5)));
|
||||
@@ -863,9 +877,11 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
|
||||
@SuppressWarnings("SSBasedInspection")
|
||||
private void updatePopup() {
|
||||
myProgressIndicator.checkCanceled();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myProgressIndicator.checkCanceled();
|
||||
myListModel.update();
|
||||
myList.revalidate();
|
||||
myList.repaint();
|
||||
@@ -911,8 +927,8 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
sz.width++;
|
||||
sz.width++;
|
||||
}
|
||||
sz.width = 600;
|
||||
sz.height = 800;
|
||||
sz.width = Math.max(600, sz.width);
|
||||
sz.height = Math.max(800, sz.height);
|
||||
myPopup.setSize(sz);
|
||||
final Point screen = field.getLocationOnScreen();
|
||||
final int x = screen.x + field.getWidth() - myPopup.getSize().width;
|
||||
|
||||
+18
-3
@@ -28,16 +28,21 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
public class ContentEntryTreeCellRenderer extends NodeRenderer {
|
||||
protected final ContentEntryTreeEditor myTreeEditor;
|
||||
private final List<ModuleSourceRootEditHandler<?>> myEditHandlers;
|
||||
|
||||
public ContentEntryTreeCellRenderer(@NotNull final ContentEntryTreeEditor treeEditor) {
|
||||
public ContentEntryTreeCellRenderer(@NotNull final ContentEntryTreeEditor treeEditor, List<ModuleSourceRootEditHandler<?>> editHandlers) {
|
||||
myTreeEditor = treeEditor;
|
||||
myEditHandlers = editHandlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,7 +91,7 @@ public class ContentEntryTreeCellRenderer extends NodeRenderer {
|
||||
final SourceFolder[] sourceFolders = entry.getSourceFolders();
|
||||
for (SourceFolder sourceFolder : sourceFolders) {
|
||||
if (file.equals(sourceFolder.getFile())) {
|
||||
return IconSet.getSourceRootIcon(sourceFolder.isTestSource());
|
||||
return IconSet.getSourceRootIcon(sourceFolder.getRootType(), myEditHandlers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,10 +103,20 @@ public class ContentEntryTreeCellRenderer extends NodeRenderer {
|
||||
if (currentRoot != null && VfsUtilCore.isAncestor(sourcePath, currentRoot, false)) {
|
||||
continue;
|
||||
}
|
||||
icon = IconSet.getSourceFolderIcon(sourceFolder.isTestSource());
|
||||
icon = getSourceFolderIcon(sourceFolder.getRootType());
|
||||
currentRoot = sourcePath;
|
||||
}
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Icon getSourceFolderIcon(JpsModuleSourceRootType<?> type) {
|
||||
for (ModuleSourceRootEditHandler<?> handler : myEditHandlers) {
|
||||
if (handler.getRootType().equals(type)) {
|
||||
return handler.getFolderUnderRootIcon();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -111,8 +111,12 @@ public class ContentEntryTreeEditor {
|
||||
setupExcludedAction();
|
||||
}
|
||||
|
||||
protected List<ModuleSourceRootEditHandler<?>> getEditHandlers() {
|
||||
return myEditHandlers;
|
||||
}
|
||||
|
||||
protected TreeCellRenderer getContentEntryCellRenderer() {
|
||||
return new ContentEntryTreeCellRenderer(this);
|
||||
return new ContentEntryTreeCellRenderer(this, myEditHandlers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-3
@@ -57,9 +57,7 @@ import java.util.List;
|
||||
* Date: Jan 19, 2004
|
||||
*/
|
||||
public abstract class ContentRootPanel extends JPanel {
|
||||
public static final Color SOURCES_COLOR = new JBColor(new Color(0x0A50A1), DarculaColors.BLUE);
|
||||
public static final Color TESTS_COLOR = new Color(0x008C2E);
|
||||
protected static final Color EXCLUDED_COLOR = new JBColor(new Color(0x992E00), DarculaColors.RED);
|
||||
private static final Color EXCLUDED_COLOR = new JBColor(new Color(0x992E00), DarculaColors.RED);
|
||||
private static final Color SELECTED_HEADER_COLOR = new JBColor(new Color(0xDEF2FF), UIUtil.getPanelBackground().darker());
|
||||
private static final Color HEADER_COLOR = new JBColor(new Color(0xF5F5F5), Gray._82);
|
||||
private static final Color SELECTED_CONTENT_COLOR = new Color(0xF0F9FF);
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -31,7 +34,13 @@ public class IconSet {
|
||||
return isTestSource ? AllIcons.Modules.TestRoot : AllIcons.Modules.SourceRoot;
|
||||
}
|
||||
|
||||
public static Icon getSourceFolderIcon(boolean isTestSource) {
|
||||
return isTestSource ? AllIcons.Modules.TestSourceFolder : AllIcons.Modules.SourceFolder;
|
||||
@Nullable
|
||||
public static Icon getSourceRootIcon(JpsModuleSourceRootType<?> type, List<ModuleSourceRootEditHandler<?>> handlers) {
|
||||
for (ModuleSourceRootEditHandler<?> handler : handlers) {
|
||||
if (handler.getRootType().equals(type)) {
|
||||
return handler.getRootIcon();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-1
@@ -18,7 +18,10 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.ui.DarculaColors;
|
||||
import com.intellij.ui.JBColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -30,6 +33,8 @@ import java.awt.event.KeyEvent;
|
||||
* @author nik
|
||||
*/
|
||||
public class JavaModuleSourceRootEditHandler extends JavaSourceRootEditHandlerBase {
|
||||
private static final Color SOURCES_COLOR = new JBColor(new Color(0x0A50A1), DarculaColors.BLUE);
|
||||
|
||||
public JavaModuleSourceRootEditHandler() {
|
||||
super(JavaSourceRootType.SOURCE);
|
||||
}
|
||||
@@ -52,6 +57,12 @@ public class JavaModuleSourceRootEditHandler extends JavaSourceRootEditHandlerBa
|
||||
return AllIcons.Modules.SourceRoot;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon getFolderUnderRootIcon() {
|
||||
return AllIcons.Modules.SourceFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomShortcutSet getMarkRootShortcutSet() {
|
||||
return new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK));
|
||||
@@ -60,7 +71,7 @@ public class JavaModuleSourceRootEditHandler extends JavaSourceRootEditHandlerBa
|
||||
@NotNull
|
||||
@Override
|
||||
public Color getRootsGroupColor() {
|
||||
return ContentRootPanel.SOURCES_COLOR;
|
||||
return SOURCES_COLOR;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+10
-1
@@ -19,6 +19,7 @@ import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -30,6 +31,8 @@ import java.awt.event.KeyEvent;
|
||||
* @author nik
|
||||
*/
|
||||
public class JavaTestSourceRootEditHandler extends JavaSourceRootEditHandlerBase {
|
||||
private static final Color TESTS_COLOR = new Color(0x008C2E);
|
||||
|
||||
public JavaTestSourceRootEditHandler() {
|
||||
super(JavaSourceRootType.TEST_SOURCE);
|
||||
}
|
||||
@@ -53,6 +56,12 @@ public class JavaTestSourceRootEditHandler extends JavaSourceRootEditHandlerBase
|
||||
return AllIcons.Modules.TestRoot;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon getFolderUnderRootIcon() {
|
||||
return AllIcons.Modules.TestSourceFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomShortcutSet getMarkRootShortcutSet() {
|
||||
return new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.ALT_MASK));
|
||||
@@ -61,7 +70,7 @@ public class JavaTestSourceRootEditHandler extends JavaSourceRootEditHandlerBase
|
||||
@NotNull
|
||||
@Override
|
||||
public Color getRootsGroupColor() {
|
||||
return ContentRootPanel.TESTS_COLOR;
|
||||
return TESTS_COLOR;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+4
-1
@@ -47,6 +47,9 @@ public abstract class ModuleSourceRootEditHandler<P extends JpsElement> {
|
||||
@NotNull
|
||||
public abstract Icon getRootIcon();
|
||||
|
||||
@Nullable
|
||||
public abstract Icon getFolderUnderRootIcon();
|
||||
|
||||
@Nullable
|
||||
public abstract CustomShortcutSet getMarkRootShortcutSet();
|
||||
|
||||
@@ -56,10 +59,10 @@ public abstract class ModuleSourceRootEditHandler<P extends JpsElement> {
|
||||
@NotNull
|
||||
public abstract Color getRootsGroupColor();
|
||||
|
||||
|
||||
@NotNull
|
||||
public abstract String getUnmarkRootActionName();
|
||||
|
||||
|
||||
@NotNull
|
||||
public abstract P createDefaultProperties();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user