mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 19:02:13 +07:00
+13
-1
@@ -26,6 +26,7 @@ import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.ui.popup.BalloonBuilder;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.ui.JBColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -138,7 +139,7 @@ public abstract class AbstractSchemesPanel<T extends Scheme> extends JPanel {
|
||||
|
||||
public final void showInfo(@Nullable String message, @NotNull MessageType messageType) {
|
||||
myInfoLabel.setText(message);
|
||||
myInfoLabel.setForeground(messageType.getTitleForeground());
|
||||
myInfoLabel.setForeground(messageTypeToColor(messageType));
|
||||
}
|
||||
|
||||
public final void clearInfo() {
|
||||
@@ -179,4 +180,15 @@ public abstract class AbstractSchemesPanel<T extends Scheme> extends JPanel {
|
||||
balloon.showInCenterOf(myToolbar);
|
||||
Disposer.register(ProjectManager.getInstance().getDefaultProject(), balloon);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UseJBColor")
|
||||
private static Color messageTypeToColor(@NotNull MessageType messageType) {
|
||||
if (messageType == MessageType.INFO) {
|
||||
return Color.GRAY;
|
||||
}
|
||||
else if (messageType == MessageType.ERROR) {
|
||||
return Color.RED;
|
||||
}
|
||||
return JBColor.BLACK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class SchemesCombo<T extends Scheme> {
|
||||
public static final String IDE_LEVEL = "IDE";
|
||||
public static final String EMPTY_NAME_MESSAGE = "The name must not be empty";
|
||||
public static final String NAME_ALREADY_EXISTS_MESSAGE = "Name is already in use. Please change to unique name.";
|
||||
private static final String EDITING_HINT = "Enter to save, Esc to cancel.";
|
||||
// endregion
|
||||
|
||||
private ComboBox<MySchemeListItem<T>> myComboBox;
|
||||
@@ -136,6 +137,7 @@ public class SchemesCombo<T extends Scheme> {
|
||||
public void startEdit() {
|
||||
T scheme = getSelectedScheme();
|
||||
if (scheme != null) {
|
||||
mySchemesPanel.showInfo(EDITING_HINT, MessageType.INFO);
|
||||
myNameEditorField.setText(scheme.getName());
|
||||
myLayout.last(myRootPanel);
|
||||
myNameEditorField.requestFocus();
|
||||
|
||||
Reference in New Issue
Block a user