2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.uiDesigner
.propertyInspector
.editors
.string
;
18 import com
.intellij
.openapi
.ui
.DialogWrapper
;
19 import com
.intellij
.uiDesigner
.UIDesignerBundle
;
22 import javax
.swing
.event
.DocumentListener
;
23 import javax
.swing
.event
.DocumentEvent
;
29 public class NewKeyDialog
extends DialogWrapper
{
30 private JTextField myKeyNameEdit
;
31 private JTextField myKeyValueEdit
;
32 private JPanel myPanel
;
34 public NewKeyDialog(Component parent
) {
36 setTitle(UIDesignerBundle
.message("key.chooser.new.property.title"));
39 myKeyNameEdit
.getDocument().addDocumentListener(new DocumentListener() {
40 public void insertUpdate(DocumentEvent e
) {
44 public void removeUpdate(DocumentEvent e
) {
48 public void changedUpdate(DocumentEvent e
) {
54 private void updateButton() {
55 setOKActionEnabled(myKeyNameEdit
.getText().length() > 0);
58 @Override public JComponent
getPreferredFocusedComponent() {
62 protected JComponent
createCenterPanel() {
66 public String
getName() {
67 return myKeyNameEdit
.getText();
70 public String
getValue() {
71 return myKeyValueEdit
.getText();