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
bf87b59f
Commit
bf87b59f
authored
9 years ago
by
Vladimir Krivosheev
Browse files
Options
Download
Email Patches
Plain Diff
extract ComboBoxModelEditor to reuse in editor color scheme editor
parent
26c1dc53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/KeymapPanel.java
+4
-1
.../src/com/intellij/openapi/keymap/impl/ui/KeymapPanel.java
platform/platform-impl/src/com/intellij/util/ui/ComboBoxModelEditor.java
+8
-11
...rm-impl/src/com/intellij/util/ui/ComboBoxModelEditor.java
with
12 additions
and
12 deletions
+12
-12
platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/KeymapPanel.java
+
4
-
1
View file @
bf87b59f
...
...
@@ -55,6 +55,7 @@ import com.intellij.ui.FilterComponent;
import
com.intellij.ui.awt.RelativePoint
;
import
com.intellij.util.Alarm
;
import
com.intellij.util.IJSwingUtilities
;
import
com.intellij.util.ui.ComboBoxModelEditor
;
import
com.intellij.util.ui.FormBuilder
;
import
com.intellij.util.ui.ListItemEditor
;
import
com.intellij.util.ui.UIUtil
;
...
...
@@ -84,7 +85,9 @@ public class KeymapPanel extends JPanel implements SearchableConfigurable, Confi
}
};
private
final
KeymapListModelEditor
<
Keymap
>
myEditor
=
new
KeymapListModelEditor
<
Keymap
>(
new
ListItemEditor
<
Keymap
>()
{
// Name editor calls "setName" to apply new name. It is scheme name, not presentable name —
// but only bundled scheme name could be different from presentable and bundled scheme is not editable (could not be renamed). So, it is ok.
private
final
ComboBoxModelEditor
<
Keymap
>
myEditor
=
new
ComboBoxModelEditor
<
Keymap
>(
new
ListItemEditor
<
Keymap
>()
{
@NotNull
@Override
public
String
getName
(
@NotNull
Keymap
item
)
{
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/
openapi/keymap/impl/ui/KeymapList
ModelEditor.java
→
platform/platform-impl/src/com/intellij/
util/ui/ComboBox
ModelEditor.java
+
8
-
11
View file @
bf87b59f
...
...
@@ -13,30 +13,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.intellij.
openapi.keymap.imp
l.ui
;
package
com.intellij.
uti
l.ui
;
import
com.intellij.openapi.keymap.Keymap
;
import
com.intellij.openapi.keymap.impl.KeymapImpl
;
import
com.intellij.openapi.ui.ComboBox
;
import
com.intellij.openapi.ui.FixedComboBoxEditor
;
import
com.intellij.ui.DocumentAdapter
;
import
com.intellij.ui.ListCellRendererWrapper
;
import
com.intellij.ui.MutableCollectionComboBoxModel
;
import
com.intellij.util.ui.ListItemEditor
;
import
com.intellij.util.ui.ListModelEditorBase
;
import
org.jetbrains.annotations.NotNull
;
import
javax.swing.*
;
import
javax.swing.event.DocumentEvent
;
public
class
KeymapListModelEditor
<
T
extends
Keymap
>
extends
ListModelEditorBase
<
T
>
{
public
final
class
ComboBoxModelEditor
<
T
>
extends
ListModelEditorBase
<
T
>
{
private
final
ComboBox
comboBox
;
public
KeymapList
ModelEditor
(
@NotNull
final
ListItemEditor
<
T
>
itemEditor
)
{
public
ComboBox
ModelEditor
(
@NotNull
ListItemEditor
<
T
>
itemEditor
)
{
super
(
itemEditor
);
comboBox
=
new
ComboBox
((
ComboBoxModel
)
model
);
comboBox
.
setEditor
(
new
My
Editor
());
comboBox
.
setEditor
(
new
Name
Editor
());
comboBox
.
setRenderer
(
new
MyListCellRenderer
());
}
...
...
@@ -51,17 +48,17 @@ public class KeymapListModelEditor<T extends Keymap> extends ListModelEditorBase
return
comboBox
;
}
private
class
My
Editor
extends
FixedComboBoxEditor
{
private
class
Name
Editor
extends
FixedComboBoxEditor
{
private
T
item
=
null
;
private
boolean
mutated
;
public
My
Editor
()
{
public
Name
Editor
()
{
getField
().
getDocument
().
addDocumentListener
(
new
DocumentAdapter
()
{
@Override
protected
void
textChanged
(
DocumentEvent
e
)
{
if
(
item
!=
null
&&
item
.
canModify
(
))
{
if
(
item
!=
null
&&
item
Editor
.
isEditable
(
item
))
{
String
newName
=
getField
().
getText
();
if
(
newName
.
equals
(
item
.
getName
()))
{
if
(
newName
.
equals
(
item
Editor
.
getName
(
item
)))
{
return
;
}
...
...
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