schemes ui: move supportsProjectSchemes() back to AbstractSchemesPanel

This commit is contained in:
Dmitry Batkovich
2017-02-16 11:00:06 +03:00
parent 40b5239ea1
commit 1bc1617e2a
10 changed files with 26 additions and 26 deletions
@@ -76,11 +76,6 @@ public class CodeStyleSchemesModel implements SchemesModel<CodeStyleScheme> {
}
}
@Override
public boolean supportsProjectSchemes() {
return true;
}
public CodeStyleSettings getCloneSettings(final CodeStyleScheme scheme) {
if (!mySettingsToClone.containsKey(scheme)) {
mySettingsToClone.put(scheme, scheme.getCodeStyleSettings().clone());
@@ -122,4 +122,9 @@ public class CodeStyleSchemesPanel extends SimpleSchemesPanel<CodeStyleScheme> {
public SchemesModel<CodeStyleScheme> getModel() {
return myModel;
}
@Override
protected boolean supportsProjectSchemes() {
return true;
}
}
@@ -276,12 +276,6 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
mySomeSchemesDeleted = mySomeSchemesDeleted || !deletedNewlyCreated;
}
@Override
public boolean supportsProjectSchemes() {
return false;
}
private void selectDefaultScheme() {
DefaultColorsScheme defaultScheme =
(DefaultColorsScheme)EditorColorsManager.getInstance().getScheme(EditorColorsManager.DEFAULT_SCHEME_NAME);
@@ -108,4 +108,9 @@ public class SchemesPanel extends SimpleSchemesPanel<EditorColorsScheme> impleme
public SchemesModel<EditorColorsScheme> getModel() {
return myOptions;
}
@Override
protected boolean supportsProjectSchemes() {
return false;
}
}
@@ -76,7 +76,7 @@ public abstract class AbstractSchemeActions<T extends Scheme> {
public final Collection<AnAction> getActions() {
List<AnAction> actions = new ArrayList<>();
if (mySchemesPanel.getModel().supportsProjectSchemes()) {
if (mySchemesPanel.supportsProjectSchemes()) {
actions.add(new CopyToProjectAction());
actions.add(new CopyToIDEAction());
actions.add(new Separator());
@@ -188,7 +188,7 @@ public abstract class AbstractSchemeActions<T extends Scheme> {
T currentScheme = getCurrentScheme();
if (currentScheme != null) {
mySchemesPanel.cancelEdit();
final boolean isProjectScheme = mySchemesPanel.getModel().supportsProjectSchemes() && getModel().isProjectScheme(currentScheme);
final boolean isProjectScheme = mySchemesPanel.supportsProjectSchemes() && getModel().isProjectScheme(currentScheme);
duplicateScheme(currentScheme,
SchemeNameGenerator.getUniqueName(
SchemeManager.getDisplayName(currentScheme),
@@ -133,6 +133,7 @@ public abstract class AbstractSchemesPanel<T extends Scheme, InfoComponent exten
mySchemesCombo.startEdit();
}
public final void cancelEdit() {
mySchemesCombo.cancelEdit();
}
@@ -166,6 +167,13 @@ public abstract class AbstractSchemesPanel<T extends Scheme, InfoComponent exten
mySchemesCombo.updateSelected();
}
/**
* @return True if the panel supports project-level schemes along with IDE ones. In this case there will be
* additional "Copy to Project" and "Copy to IDE" actions for IDE and project schemes respectively and Project/IDE schemes
* separators.
*/
protected abstract boolean supportsProjectSchemes();
public void showStatus(final String message, MessageType messageType) {
BalloonBuilder balloonBuilder = JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder(message, messageType.getDefaultIcon(),
@@ -151,7 +151,7 @@ public class EditableSchemesCombo<T extends Scheme> {
myComboBox = new SchemesCombo<T>() {
@Override
protected boolean supportsProjectSchemes() {
return mySchemesPanel.getModel().supportsProjectSchemes();
return mySchemesPanel.supportsProjectSchemes();
}
@Override
@@ -75,11 +75,4 @@ public interface SchemesModel<T extends Scheme> {
boolean differsFromDefault(@NotNull T scheme);
void removeScheme(@NotNull T scheme);
/**
* @return True if the panel supports project-level schemes along with IDE ones. In this case there will be
* additional "Copy to Project" and "Copy to IDE" actions for IDE and project schemes respectively and Project/IDE schemes
* separators.
*/
boolean supportsProjectSchemes();
}
@@ -100,11 +100,6 @@ public abstract class InspectionProfileSchemesModel implements SchemesModel<Insp
protected abstract void onProfileRemoved(@NotNull SingleInspectionProfilePanel profilePanel);
@Override
public boolean supportsProjectSchemes() {
return true;
}
void addProfile(InspectionProfileModifiableModel profile) {
myProfilePanels.add(createPanel(profile));
}
@@ -94,6 +94,11 @@ public class InspectionProfileSchemesPanel extends AbstractDescriptionAwareSchem
return myModel;
}
@Override
protected boolean supportsProjectSchemes() {
return true;
}
@Override
protected AbstractSchemeActions<InspectionProfileModifiableModel> createSchemeActions() {
return new DescriptionAwareSchemeActions<InspectionProfileModifiableModel>(this) {