mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+11
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -308,26 +308,30 @@ public interface CodeStyleSettingsCustomizable {
|
||||
|
||||
void showStandardOptions(String... optionNames);
|
||||
|
||||
void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
|
||||
default void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
|
||||
String fieldName,
|
||||
String title,
|
||||
@Nullable String groupName,
|
||||
Object... options);
|
||||
Object... options) {
|
||||
}
|
||||
|
||||
void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
|
||||
default void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
|
||||
String fieldName,
|
||||
String title,
|
||||
@Nullable String groupName,
|
||||
@Nullable OptionAnchor anchor,
|
||||
@Nullable String anchorFieldName,
|
||||
Object... options);
|
||||
Object... options) {
|
||||
}
|
||||
|
||||
void renameStandardOption(String fieldName, String newTitle);
|
||||
default void renameStandardOption(String fieldName, String newTitle) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves a standard option to another group.
|
||||
* @param fieldName The field name of the option to move (as defined in <code>CommonCodeStyleSettings</code> class).
|
||||
* @param newGroup The new group name (the group may be one of existing ones). A custom group name can be used if supported by consumer.
|
||||
*/
|
||||
void moveStandardOption(String fieldName, String newGroup);
|
||||
default void moveStandardOption(String fieldName, String newGroup) {
|
||||
}
|
||||
}
|
||||
|
||||
+13
-29
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,12 +21,12 @@ import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -198,31 +198,29 @@ public abstract class LanguageCodeStyleSettingsProvider {
|
||||
}
|
||||
|
||||
public Set<String> getSupportedFields() {
|
||||
SupportedFieldCollector fieldCollector = new SupportedFieldCollector();
|
||||
fieldCollector.collectFields();
|
||||
return fieldCollector.getCollectedFields();
|
||||
return new SupportedFieldCollector().collectFields();
|
||||
}
|
||||
|
||||
public Set<String> getSupportedFields(SettingsType type) {
|
||||
SupportedFieldCollector fieldCollector = new SupportedFieldCollector();
|
||||
fieldCollector.collectFields(type);
|
||||
return fieldCollector.getCollectedFields();
|
||||
return new SupportedFieldCollector().collectFields(type);
|
||||
}
|
||||
|
||||
private final class SupportedFieldCollector implements CodeStyleSettingsCustomizable {
|
||||
private final Set<String> myCollectedFields = new HashSet<>();
|
||||
private final Set<String> myCollectedFields = new THashSet<>();
|
||||
private SettingsType myCurrSettingsType;
|
||||
|
||||
public void collectFields() {
|
||||
public Set<String> collectFields() {
|
||||
for (SettingsType settingsType : SettingsType.values()) {
|
||||
myCurrSettingsType = settingsType;
|
||||
LanguageCodeStyleSettingsProvider.this.customizeSettings(this, settingsType);
|
||||
customizeSettings(this, settingsType);
|
||||
}
|
||||
return myCollectedFields;
|
||||
}
|
||||
|
||||
public void collectFields(SettingsType type) {
|
||||
public Set<String> collectFields(SettingsType type) {
|
||||
myCurrSettingsType = type;
|
||||
LanguageCodeStyleSettingsProvider.this.customizeSettings(this, type);
|
||||
customizeSettings(this, type);
|
||||
return myCollectedFields;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -255,7 +253,7 @@ public abstract class LanguageCodeStyleSettingsProvider {
|
||||
|
||||
@Override
|
||||
public void showStandardOptions(String... optionNames) {
|
||||
myCollectedFields.addAll(Arrays.asList(optionNames));
|
||||
ContainerUtil.addAll(myCollectedFields, optionNames);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -277,19 +275,5 @@ public abstract class LanguageCodeStyleSettingsProvider {
|
||||
Object... options) {
|
||||
myCollectedFields.add(fieldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameStandardOption(String fieldName, String newTitle) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveStandardOption(String fieldName, String newGroup) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
public Set<String> getCollectedFields() {
|
||||
return myCollectedFields;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-32
@@ -17,11 +17,13 @@ package com.intellij.application.options.codeStyle;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.psi.codeStyle.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -100,36 +102,6 @@ public class CommenterForm implements CodeStyleSettingsCustomizable {
|
||||
myLineCommentAddSpaceCb.setVisible(isVisible);
|
||||
myBlockCommentAtFirstJBCheckBox.setVisible(isVisible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
|
||||
String fieldName,
|
||||
String title,
|
||||
@Nullable String groupName,
|
||||
Object... options) {
|
||||
// ignore, no custom options possible
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
|
||||
String fieldName,
|
||||
String title,
|
||||
@Nullable String groupName,
|
||||
@Nullable OptionAnchor anchor,
|
||||
@Nullable String anchorFieldName,
|
||||
Object... options) {
|
||||
// ignore, no custom options possible
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameStandardOption(String fieldName, String newTitle) {
|
||||
// ignore for now
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveStandardOption(String fieldName, String newGroup) {
|
||||
// ignore, unsupported
|
||||
}
|
||||
|
||||
private void customizeSettings() {
|
||||
setAllOptionsVisible(false);
|
||||
|
||||
Reference in New Issue
Block a user