mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-88505 cosmetics
This commit is contained in:
+6
-8
@@ -33,9 +33,9 @@ public class EditMavenPropertyDialog extends DialogWrapper {
|
||||
private JTextField myValueField;
|
||||
private final Map<String, String> myAvailableProperties;
|
||||
|
||||
public EditMavenPropertyDialog(Pair<String, String> value, Map<String, String> availableProperties) {
|
||||
public EditMavenPropertyDialog(@Nullable Pair<String, String> value, Map<String, String> availableProperties) {
|
||||
super(false);
|
||||
setTitle("Edit Maven Property");
|
||||
setTitle(value == null ? "Add Maven Property" : "Edit Maven Property");
|
||||
|
||||
myAvailableProperties = availableProperties;
|
||||
|
||||
@@ -43,7 +43,10 @@ public class EditMavenPropertyDialog extends DialogWrapper {
|
||||
installPropertySelectionListener();
|
||||
fillAvailableProperties();
|
||||
|
||||
setValue(value);
|
||||
if (value != null) {
|
||||
myNameBox.getEditor().setItem(value.getFirst());
|
||||
myValueField.setText(value.getSecond());
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -89,11 +92,6 @@ public class EditMavenPropertyDialog extends DialogWrapper {
|
||||
return myNameBox;
|
||||
}
|
||||
|
||||
private void setValue(Pair<String, String> value) {
|
||||
myNameBox.getEditor().setItem(value.getFirst());
|
||||
myValueField.setText(value.getSecond());
|
||||
}
|
||||
|
||||
public Pair<String, String> getValue() {
|
||||
return new Pair<String, String>((String)myNameBox.getEditor().getItem(), myValueField.getText());
|
||||
}
|
||||
|
||||
+6
-3
@@ -17,6 +17,8 @@ package org.jetbrains.idea.maven.execution;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.ui.AddEditRemovePanel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
@@ -35,18 +37,19 @@ public class MavenPropertiesPanel extends AddEditRemovePanel<Pair<String, String
|
||||
}
|
||||
|
||||
protected Pair<String, String> addItem() {
|
||||
return doAddOrEdit(new Pair<String, String>("", ""));
|
||||
return doAddOrEdit(null);
|
||||
}
|
||||
|
||||
protected boolean removeItem(Pair<String, String> o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Pair<String, String> editItem(Pair<String, String> o) {
|
||||
protected Pair<String, String> editItem(@NotNull Pair<String, String> o) {
|
||||
return doAddOrEdit(o);
|
||||
}
|
||||
|
||||
private Pair<String, String> doAddOrEdit(Pair<String, String> o) {
|
||||
@Nullable
|
||||
private Pair<String, String> doAddOrEdit(@Nullable Pair<String, String> o) {
|
||||
EditMavenPropertyDialog d = new EditMavenPropertyDialog(o, myAvailableProperties);
|
||||
d.show();
|
||||
if (!d.isOK()) return null;
|
||||
|
||||
Reference in New Issue
Block a user