This commit is contained in:
Rustam Vishnyakov
2016-12-08 16:50:49 +03:00
parent 21a7883a04
commit 505320bd74
3 changed files with 24 additions and 21 deletions
@@ -145,19 +145,20 @@ public class CodeStyleSchemesPanel {
}
private void createUIComponents() {
ManageSchemesComboAction manageSchemesComboAction = new ManageSchemesComboAction(new CodeStyleSchemesActions(myModel) {
@NotNull
@Override
protected JComponent getParentComponent() {
return myPanel;
}
ManageSchemesComboAction<CodeStyleScheme> manageSchemesComboAction =
new ManageSchemesComboAction<>(new CodeStyleSchemesActions(myModel) {
@NotNull
@Override
protected JComponent getParentComponent() {
return myPanel;
}
@Nullable
@Override
protected CodeStyleScheme getCurrentScheme() {
return getSelectedScheme();
}
});
@Nullable
@Override
protected CodeStyleScheme getCurrentScheme() {
return getSelectedScheme();
}
});
myManageButton = manageSchemesComboAction.createCombo();
}
@@ -87,13 +87,14 @@ public class SchemesPanel extends JPanel implements SkipSelfSearchComponent {
panel.add(mySchemeComboBox,
new GridBagConstraints(gridx++, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new JBInsets(0, 0, 5, 10),
0, 0));
ManageSchemesComboAction schemesComboAction = new ManageSchemesComboAction(new ColorSchemeActions(this, myOptions) {
@Nullable
@Override
protected EditorColorsScheme getCurrentScheme() {
return myOptions.getScheme(getSelectedSchemeName());
}
});
ManageSchemesComboAction<EditorColorsScheme> schemesComboAction =
new ManageSchemesComboAction<>(new ColorSchemeActions(this, myOptions) {
@Nullable
@Override
protected EditorColorsScheme getCurrentScheme() {
return myOptions.getScheme(getSelectedSchemeName());
}
});
JButton manageButton = schemesComboAction.createCombo();
panel.add(manageButton,
new GridBagConstraints(gridx++, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new JBInsets(0, 0, 5, 5),
@@ -22,16 +22,17 @@ import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
import com.intellij.application.options.DefaultSchemeActions;
import com.intellij.openapi.options.Scheme;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.Collection;
public class ManageSchemesComboAction extends ComboBoxAction {
public class ManageSchemesComboAction<T extends Scheme> extends ComboBoxAction {
private Collection<AnAction> myActions;
public ManageSchemesComboAction(@NotNull DefaultSchemeActions schemeActions) {
public ManageSchemesComboAction(@NotNull DefaultSchemeActions<T> schemeActions) {
myActions = schemeActions.getActions();
}