Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
e76e51b9
Commit
e76e51b9
authored
7 years ago
by
Mikhail Sokolov
Browse files
Options
Download
Email Patches
Plain Diff
UX-1 new SearchEverywhere popup
* mouse selection for list items
parent
a1bce496
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/SearchEverywhereManagerImpl.java
+0
-7
...actions/searcheverywhere/SearchEverywhereManagerImpl.java
platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/SearchEverywhereUI.java
+37
-32
...llij/ide/actions/searcheverywhere/SearchEverywhereUI.java
with
37 additions
and
39 deletions
+37
-39
platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/SearchEverywhereManagerImpl.java
+
0
-
7
View file @
e76e51b9
...
...
@@ -2,8 +2,6 @@
package
com.intellij.ide.actions.searcheverywhere
;
import
com.intellij.ide.ui.UISettings
;
import
com.intellij.openapi.actionSystem.*
;
import
com.intellij.openapi.project.DumbAwareAction
;
import
com.intellij.openapi.project.Project
;
import
com.intellij.openapi.ui.popup.JBPopup
;
import
com.intellij.openapi.ui.popup.JBPopupFactory
;
...
...
@@ -59,11 +57,6 @@ public class SearchEverywhereManagerImpl implements SearchEverywhereManager {
.
createPopup
();
mySearchEverywhereUI
.
setSearchFinishedHandler
(()
->
myBalloon
.
cancel
());
AnAction
escape
=
ActionManager
.
getInstance
().
getAction
(
"EditorEscape"
);
DumbAwareAction
.
create
(
__
->
myBalloon
.
cancel
())
.
registerCustomShortcutSet
(
escape
==
null
?
CommonShortcuts
.
ESCAPE
:
escape
.
getShortcutSet
(),
myBalloon
.
getContent
(),
myBalloon
);
RelativePoint
showingPoint
=
calculateShowingPoint
();
if
(
showingPoint
!=
null
)
{
myBalloon
.
show
(
showingPoint
);
...
...
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/SearchEverywhereUI.java
+
37
-
32
View file @
e76e51b9
...
...
@@ -8,15 +8,14 @@ import com.intellij.ide.actions.SearchEverywhereAction;
import
com.intellij.ide.ui.UISettings
;
import
com.intellij.openapi.Disposable
;
import
com.intellij.openapi.actionSystem.*
;
import
com.intellij.openapi.actionSystem.ex.AnActionListener
;
import
com.intellij.openapi.actionSystem.impl.ActionButton
;
import
com.intellij.openapi.actionSystem.impl.ActionToolbarImpl
;
import
com.intellij.openapi.application.ApplicationManager
;
import
com.intellij.openapi.diagnostic.Logger
;
import
com.intellij.openapi.editor.actions.TextComponentEditorAction
;
import
com.intellij.openapi.progress.ProcessCanceledException
;
import
com.intellij.openapi.progress.ProgressIndicator
;
import
com.intellij.openapi.progress.util.ProgressIndicatorBase
;
import
com.intellij.openapi.project.DumbAwareAction
;
import
com.intellij.openapi.project.DumbService
;
import
com.intellij.openapi.project.Project
;
import
com.intellij.openapi.ui.popup.ComponentPopupBuilder
;
...
...
@@ -111,7 +110,8 @@ public class SearchEverywhereUI extends BorderLayoutPanel {
addToBottom
(
mySearchField
);
myResultsList
.
setCellRenderer
(
new
CompositeCellRenderer
());
initListActions
();
initSearchActions
();
}
public
JTextField
getSearchField
()
{
...
...
@@ -172,6 +172,7 @@ public class SearchEverywhereUI extends BorderLayoutPanel {
}
myNonProjectCB
.
setSelected
(
false
);
repaint
();
rebuildList
(
mySearchField
!=
null
?
mySearchField
.
getText
()
:
""
);
}
private
JTextField
createSearchField
()
{
...
...
@@ -217,24 +218,7 @@ public class SearchEverywhereUI extends BorderLayoutPanel {
true
);
searchField
.
setBorder
(
border
);
searchField
.
setBackground
(
JBUI
.
CurrentTheme
.
SearchEverywhere
.
searchFieldBackground
());
searchField
.
setFocusTraversalKeysEnabled
(
false
);
searchField
.
addKeyListener
(
new
KeyAdapter
()
{
@Override
public
void
keyPressed
(
KeyEvent
e
)
{
if
(
e
.
getKeyCode
()
==
KeyEvent
.
VK_TAB
&&
e
.
getModifiers
()
==
0
)
{
switchToNextTab
();
e
.
consume
();
}
}
});
searchField
.
getDocument
().
addDocumentListener
(
new
DocumentAdapter
()
{
@Override
protected
void
textChanged
(
DocumentEvent
e
)
{
rebuildList
(
searchField
.
getText
());
}
});
return
searchField
;
}
...
...
@@ -375,7 +359,28 @@ public class SearchEverywhereUI extends BorderLayoutPanel {
}
}
private
void
initListActions
()
{
private
void
initSearchActions
()
{
mySearchField
.
addKeyListener
(
new
KeyAdapter
()
{
@Override
public
void
keyPressed
(
KeyEvent
e
)
{
if
(
e
.
getKeyCode
()
==
KeyEvent
.
VK_TAB
&&
e
.
getModifiers
()
==
0
)
{
switchToNextTab
();
e
.
consume
();
}
}
});
AnAction
escape
=
ActionManager
.
getInstance
().
getAction
(
"EditorEscape"
);
DumbAwareAction
.
create
(
__
->
searchFinishedHandler
.
run
())
.
registerCustomShortcutSet
(
escape
==
null
?
CommonShortcuts
.
ESCAPE
:
escape
.
getShortcutSet
(),
this
);
mySearchField
.
getDocument
().
addDocumentListener
(
new
DocumentAdapter
()
{
@Override
protected
void
textChanged
(
DocumentEvent
e
)
{
rebuildList
(
mySearchField
.
getText
());
}
});
myResultsList
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseClicked
(
MouseEvent
e
)
{
...
...
@@ -610,17 +615,17 @@ public class SearchEverywhereUI extends BorderLayoutPanel {
updateResultsPopupBounds
();
myResultsPopup
.
show
(
new
RelativePoint
(
SearchEverywhereUI
.
this
,
new
Point
(
0
,
getHeight
())));
ActionManager
.
getInstance
().
addAnActionListener
(
new
AnActionListener
.
Adapter
()
{
@Override
public
void
beforeActionPerformed
(
AnAction
action
,
DataContext
dataContext
,
AnActionEvent
event
)
{
if
(
action
instanceof
TextComponentEditorAction
)
{
return
;
}
if
(
myResultsPopup
!=
null
)
{
myResultsPopup
.
cancel
();
}
}
},
myResultsPopup
);
//
ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
//
@Override
//
public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
//
if (action instanceof TextComponentEditorAction) {
//
return;
//
}
//
if (myResultsPopup != null) {
//
myResultsPopup.cancel();
//
}
//
}
//
}, myResultsPopup);
}
else
{
myResultsList
.
revalidate
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help