mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't allow edit action if not editable
This commit is contained in:
@@ -96,6 +96,12 @@ public class TableModelEditor<T> implements ElementProducer<T> {
|
||||
table.requestFocus();
|
||||
}
|
||||
}
|
||||
}).setEditActionUpdater(new AnActionButtonUpdater() {
|
||||
@Override
|
||||
public boolean isEnabled(AnActionEvent e) {
|
||||
T item = table.getSelectedObject();
|
||||
return item != null && ((DialogItemEditor<T>)TableModelEditor.this.itemEditor).isEditable(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -142,6 +148,10 @@ public class TableModelEditor<T> implements ElementProducer<T> {
|
||||
public abstract void edit(@NotNull T item, @NotNull Function<T, T> mutator);
|
||||
|
||||
public abstract void applyEdited(@NotNull T oldItem, @NotNull T newItem);
|
||||
|
||||
public boolean isEditable(@NotNull T item) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -256,6 +256,11 @@ public class BrowserSettingsPanel {
|
||||
oldItem.setSpecificSettings(newItem.getSpecificSettings());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable(@NotNull ConfigurableWebBrowser browser) {
|
||||
return browser.getSpecificSettings() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRemovable(@NotNull ConfigurableWebBrowser item) {
|
||||
return !WebBrowserManager.getInstance().isPredefinedBrowser(item);
|
||||
|
||||
@@ -47,6 +47,7 @@ public final class ChromeSettings extends BrowserSpecificSettings {
|
||||
return myUseCustomProfile;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Tag("command-line-options")
|
||||
public String getCommandLineOptions() {
|
||||
return myCommandLineOptions;
|
||||
|
||||
Reference in New Issue
Block a user