mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
I see dead code (TM)
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class BlankLinesSettingsProvider extends CodeStyleSettingsProvider {
|
||||
@NotNull
|
||||
public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings originalSettings) {
|
||||
return new CodeStyleBlankLinesConfigurable(settings, originalSettings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigurableDisplayName() {
|
||||
return ApplicationBundle.message("title.blank.lines");
|
||||
}
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class CodeStyleBlankLinesConfigurable extends CodeStyleAbstractConfigurable {
|
||||
public CodeStyleBlankLinesConfigurable(CodeStyleSettings settings, CodeStyleSettings cloneSettings) {
|
||||
super(settings, cloneSettings, ApplicationBundle.message("title.blank.lines"));
|
||||
}
|
||||
|
||||
protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) {
|
||||
return new CodeStyleBlankLinesPanel(settings);
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
return StdFileTypes.JAVA.getIcon();
|
||||
}
|
||||
|
||||
public String getHelpTopic() {
|
||||
return "reference.settingsdialog.IDE.globalcodestyle.blanklines";
|
||||
}
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.ide.highlighter.JavaHighlighterFactory;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.OptionGroup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class CodeStyleBlankLinesPanel extends CodeStyleAbstractPanel {
|
||||
private JTextField myKeepBlankLinesInDeclarations;
|
||||
private JTextField myKeepBlankLinesInCode;
|
||||
private JTextField myBlankLinesBeforePackage;
|
||||
private JTextField myBlankLinesAfterPackage;
|
||||
private JTextField myBlankLinesBeforeImports;
|
||||
private JTextField myBlankLinesAfterImports;
|
||||
private JTextField myBlankLinesAroundClass;
|
||||
private JTextField myBlankLinesAroundField;
|
||||
private JTextField myBlankLinesAroundMethod;
|
||||
private JTextField myBlankLinesAroundFieldI;
|
||||
private JTextField myBlankLinesAroundMethodI;
|
||||
private JTextField myBlankLinesAfterClassHeader;
|
||||
private JTextField myKeepBlankLinesBeforeRBrace;
|
||||
|
||||
private final JPanel myPanel = new JPanel(new GridBagLayout());
|
||||
|
||||
public CodeStyleBlankLinesPanel(CodeStyleSettings settings) {
|
||||
super(settings);
|
||||
|
||||
myPanel
|
||||
.add(createKeepBlankLinesPanel(),
|
||||
new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 4, 0, 4), 0, 0));
|
||||
myPanel
|
||||
.add(createBlankLinesPanel(),
|
||||
new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 4, 0, 4), 0, 0));
|
||||
|
||||
final JPanel previewPanel = createPreviewPanel();
|
||||
myPanel
|
||||
.add(previewPanel,
|
||||
new GridBagConstraints(1, 0, 1, 2, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 4), 0, 0));
|
||||
|
||||
installPreviewPanel(previewPanel);
|
||||
addPanelToWatch(myPanel);
|
||||
|
||||
}
|
||||
|
||||
private JPanel createBlankLinesPanel() {
|
||||
OptionGroup optionGroup = new OptionGroup(ApplicationBundle.message("title.blank.lines"));
|
||||
|
||||
myBlankLinesBeforePackage = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.blanklines.before.package.statement")), myBlankLinesBeforePackage);
|
||||
|
||||
myBlankLinesAfterPackage = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.blanklines.after.package.statement")), myBlankLinesAfterPackage);
|
||||
|
||||
myBlankLinesBeforeImports = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.blanklines.before.imports")), myBlankLinesBeforeImports);
|
||||
|
||||
myBlankLinesAfterImports = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.blanklines.after.imports")), myBlankLinesAfterImports);
|
||||
|
||||
myBlankLinesAroundClass = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.blanklines.around.class")), myBlankLinesAroundClass);
|
||||
|
||||
myBlankLinesAroundField = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.blanklines.around.field")), myBlankLinesAroundField);
|
||||
|
||||
myBlankLinesAroundMethod = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.blanklines.around.method")), myBlankLinesAroundMethod);
|
||||
|
||||
myBlankLinesAroundFieldI = createTextField();
|
||||
optionGroup.add(new JLabel("Around field in interface:"), myBlankLinesAroundFieldI);
|
||||
|
||||
myBlankLinesAroundMethodI = createTextField();
|
||||
optionGroup.add(new JLabel("Around method in interface:"), myBlankLinesAroundMethodI);
|
||||
|
||||
myBlankLinesAfterClassHeader = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.blanklines.after.class.header")), myBlankLinesAfterClassHeader);
|
||||
|
||||
return optionGroup.createPanel();
|
||||
}
|
||||
|
||||
private JPanel createKeepBlankLinesPanel() {
|
||||
OptionGroup optionGroup = new OptionGroup(ApplicationBundle.message("title.keep.blank.lines"));
|
||||
|
||||
myKeepBlankLinesInDeclarations = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.keep.blanklines.in.declarations")), myKeepBlankLinesInDeclarations);
|
||||
|
||||
myKeepBlankLinesInCode = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.keep.blanklines.in.code")), myKeepBlankLinesInCode);
|
||||
|
||||
myKeepBlankLinesBeforeRBrace = createTextField();
|
||||
optionGroup.add(new JLabel(ApplicationBundle.message("editbox.keep.blanklines.before.rbrace")), myKeepBlankLinesBeforeRBrace);
|
||||
|
||||
return optionGroup.createPanel();
|
||||
}
|
||||
|
||||
private static JPanel createPreviewPanel() {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBorder(IdeBorderFactory.createTitledBorder(ApplicationBundle.message("title.preview")));
|
||||
panel.setPreferredSize(new Dimension(200, 0));
|
||||
return panel;
|
||||
}
|
||||
|
||||
protected EditorHighlighter createHighlighter(final EditorColorsScheme scheme) {
|
||||
return JavaHighlighterFactory.createJavaHighlighter(scheme, LanguageLevel.HIGHEST);
|
||||
}
|
||||
|
||||
protected String getPreviewText() {
|
||||
return "/*\n" +
|
||||
" * This is a sample file.\n" +
|
||||
" */\n" +
|
||||
"package com.intellij.samples;\n" +
|
||||
"import com.intellij.idea.Main;\n" +
|
||||
"import javax.swing.*;\n" +
|
||||
"import java.util.Vector;\n" +
|
||||
"public class Foo {\n" +
|
||||
" private int field1;\n" +
|
||||
" private int field2;\n" +
|
||||
" public void foo1() {\n\n" +
|
||||
" }\n" +
|
||||
" public void foo2() {\n" +
|
||||
" }\n\n" +
|
||||
"}";
|
||||
}
|
||||
|
||||
protected void resetImpl(final CodeStyleSettings settings) {
|
||||
myKeepBlankLinesInDeclarations.setText(String.valueOf(settings.KEEP_BLANK_LINES_IN_DECLARATIONS));
|
||||
myKeepBlankLinesInCode.setText(String.valueOf(settings.KEEP_BLANK_LINES_IN_CODE));
|
||||
myKeepBlankLinesBeforeRBrace.setText(String.valueOf(settings.KEEP_BLANK_LINES_BEFORE_RBRACE));
|
||||
myBlankLinesBeforePackage.setText(String.valueOf(settings.BLANK_LINES_BEFORE_PACKAGE));
|
||||
myBlankLinesAfterPackage.setText(String.valueOf(settings.BLANK_LINES_AFTER_PACKAGE));
|
||||
myBlankLinesBeforeImports.setText(String.valueOf(settings.BLANK_LINES_BEFORE_IMPORTS));
|
||||
myBlankLinesAfterImports.setText(String.valueOf(settings.BLANK_LINES_AFTER_IMPORTS));
|
||||
myBlankLinesAroundClass.setText(String.valueOf(settings.BLANK_LINES_AROUND_CLASS));
|
||||
myBlankLinesAroundField.setText(String.valueOf(settings.BLANK_LINES_AROUND_FIELD));
|
||||
myBlankLinesAroundMethod.setText(String.valueOf(settings.BLANK_LINES_AROUND_METHOD));
|
||||
myBlankLinesAroundFieldI.setText(String.valueOf(settings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE));
|
||||
myBlankLinesAroundMethodI.setText(String.valueOf(settings.BLANK_LINES_AROUND_METHOD_IN_INTERFACE));
|
||||
myBlankLinesAfterClassHeader.setText(String.valueOf(settings.BLANK_LINES_AFTER_CLASS_HEADER));
|
||||
|
||||
}
|
||||
|
||||
public void apply(CodeStyleSettings settings) {
|
||||
settings.KEEP_BLANK_LINES_IN_DECLARATIONS = getValue(myKeepBlankLinesInDeclarations);
|
||||
settings.KEEP_BLANK_LINES_IN_CODE = getValue(myKeepBlankLinesInCode);
|
||||
settings.KEEP_BLANK_LINES_BEFORE_RBRACE = getValue(myKeepBlankLinesBeforeRBrace);
|
||||
settings.BLANK_LINES_BEFORE_PACKAGE = getValue(myBlankLinesBeforePackage);
|
||||
settings.BLANK_LINES_AFTER_PACKAGE = getValue(myBlankLinesAfterPackage);
|
||||
settings.BLANK_LINES_BEFORE_IMPORTS = getValue(myBlankLinesBeforeImports);
|
||||
settings.BLANK_LINES_AFTER_IMPORTS = getValue(myBlankLinesAfterImports);
|
||||
settings.BLANK_LINES_AROUND_CLASS = getValue(myBlankLinesAroundClass);
|
||||
settings.BLANK_LINES_AROUND_FIELD = getValue(myBlankLinesAroundField);
|
||||
settings.BLANK_LINES_AROUND_METHOD = getValue(myBlankLinesAroundMethod);
|
||||
|
||||
settings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE = getValue(myBlankLinesAroundFieldI);
|
||||
settings.BLANK_LINES_AROUND_METHOD_IN_INTERFACE = getValue(myBlankLinesAroundMethodI);
|
||||
|
||||
settings.BLANK_LINES_AFTER_CLASS_HEADER = getValue(myBlankLinesAfterClassHeader);
|
||||
|
||||
}
|
||||
|
||||
public boolean isModified(CodeStyleSettings settings) {
|
||||
boolean isModified;
|
||||
isModified = settings.KEEP_BLANK_LINES_IN_DECLARATIONS != getValue(myKeepBlankLinesInDeclarations);
|
||||
isModified |= settings.KEEP_BLANK_LINES_IN_CODE != getValue(myKeepBlankLinesInCode);
|
||||
isModified |= settings.KEEP_BLANK_LINES_BEFORE_RBRACE != getValue(myKeepBlankLinesBeforeRBrace);
|
||||
isModified |= settings.BLANK_LINES_BEFORE_PACKAGE != getValue(myBlankLinesBeforePackage);
|
||||
isModified |= settings.BLANK_LINES_AFTER_PACKAGE != getValue(myBlankLinesAfterPackage);
|
||||
isModified |= settings.BLANK_LINES_BEFORE_IMPORTS != getValue(myBlankLinesBeforeImports);
|
||||
isModified |= settings.BLANK_LINES_AFTER_IMPORTS != getValue(myBlankLinesAfterImports);
|
||||
isModified |= settings.BLANK_LINES_AROUND_CLASS != getValue(myBlankLinesAroundClass);
|
||||
isModified |= settings.BLANK_LINES_AROUND_FIELD != getValue(myBlankLinesAroundField);
|
||||
isModified |= settings.BLANK_LINES_AROUND_METHOD != getValue(myBlankLinesAroundMethod);
|
||||
isModified |= settings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE != getValue(myBlankLinesAroundFieldI);
|
||||
isModified |= settings.BLANK_LINES_AROUND_METHOD_IN_INTERFACE != getValue(myBlankLinesAroundMethodI);
|
||||
isModified |= settings.BLANK_LINES_AFTER_CLASS_HEADER != getValue(myBlankLinesAfterClassHeader);
|
||||
return isModified;
|
||||
|
||||
}
|
||||
|
||||
private static int getValue(JTextField textField) {
|
||||
int ret = 0;
|
||||
try {
|
||||
ret = Integer.parseInt(textField.getText());
|
||||
if (ret < 0) {
|
||||
ret = 0;
|
||||
}
|
||||
if (ret > 10) {
|
||||
ret = 10;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
//bad number entered
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static JTextField createTextField() {
|
||||
|
||||
return new JTextField(6);
|
||||
}
|
||||
|
||||
protected int getRightMargin() {
|
||||
return 37;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected FileType getFileType() {
|
||||
return StdFileTypes.JAVA;
|
||||
}
|
||||
|
||||
public JComponent getPanel() {
|
||||
return myPanel;
|
||||
}
|
||||
|
||||
protected void prepareForReformat(final PsiFile psiFile) {
|
||||
psiFile.putUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY, LanguageLevel.HIGHEST);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class CodeStyleSpacesConfigurable extends CodeStyleAbstractConfigurable {
|
||||
public CodeStyleSpacesConfigurable(CodeStyleSettings settings, CodeStyleSettings cloneSettings) {
|
||||
super(settings, cloneSettings, ApplicationBundle.message("title.spaces"));
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
return StdFileTypes.JAVA.getIcon();
|
||||
}
|
||||
|
||||
protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) {
|
||||
return new CodeStyleSpacesPanel(settings);
|
||||
}
|
||||
|
||||
public String getHelpTopic() {
|
||||
return "reference.settingsdialog.IDE.globalcodestyle.spaces";
|
||||
}
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorSettings;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class CodeStyleSpacesPanel extends OptionTreeWithPreviewPanel {
|
||||
public CodeStyleSpacesPanel(CodeStyleSettings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
private static final String AROUND_OPERATORS = ApplicationBundle.message("group.spaces.around.operators");
|
||||
private static final String BEFORE_PARENTHESES = ApplicationBundle.message("group.spaces.before.parentheses");
|
||||
private static final String BEFORE_LEFT_BRACE = ApplicationBundle.message("group.spaces.before.left.brace");
|
||||
private static final String WITHIN_PARENTHESES = ApplicationBundle.message("group.spaces.within.parentheses");
|
||||
private static final String TERNARY_OPERATOR = ApplicationBundle.message("group.spaces.in.ternary.operator");
|
||||
private static final String OTHER = ApplicationBundle.message("group.spaces.other");
|
||||
|
||||
protected void initTables() {
|
||||
initBooleanField("SPACE_BEFORE_METHOD_CALL_PARENTHESES", ApplicationBundle.message("checkbox.spaces.method.call.parentheses"), BEFORE_PARENTHESES);
|
||||
initBooleanField("SPACE_BEFORE_METHOD_PARENTHESES", ApplicationBundle.message("checkbox.spaces.method.declaration.parentheses"), BEFORE_PARENTHESES);
|
||||
initBooleanField("SPACE_BEFORE_IF_PARENTHESES", ApplicationBundle.message("checkbox.spaces.if.parentheses"), BEFORE_PARENTHESES);
|
||||
initBooleanField("SPACE_BEFORE_WHILE_PARENTHESES", ApplicationBundle.message("checkbox.spaces.while.parentheses"), BEFORE_PARENTHESES);
|
||||
initBooleanField("SPACE_BEFORE_FOR_PARENTHESES", ApplicationBundle.message("checkbox.spaces.for.parentheses"), BEFORE_PARENTHESES);
|
||||
initBooleanField("SPACE_BEFORE_CATCH_PARENTHESES", ApplicationBundle.message("checkbox.spaces.catch.parentheses"), BEFORE_PARENTHESES);
|
||||
initBooleanField("SPACE_BEFORE_SWITCH_PARENTHESES", ApplicationBundle.message("checkbox.spaces.switch.parentheses"), BEFORE_PARENTHESES);
|
||||
initBooleanField("SPACE_BEFORE_SYNCHRONIZED_PARENTHESES", ApplicationBundle.message("checkbox.spaces.synchronized.parentheses"), BEFORE_PARENTHESES);
|
||||
initBooleanField("SPACE_BEFORE_ANOTATION_PARAMETER_LIST", ApplicationBundle.message("checkbox.spaces.annotation.parameters"), BEFORE_PARENTHESES);
|
||||
|
||||
initBooleanField("SPACE_AROUND_ASSIGNMENT_OPERATORS", ApplicationBundle.message("checkbox.spaces.assignment.operators"), AROUND_OPERATORS);
|
||||
initBooleanField("SPACE_AROUND_LOGICAL_OPERATORS", ApplicationBundle.message("checkbox.spaces.logical.operators"), AROUND_OPERATORS);
|
||||
initBooleanField("SPACE_AROUND_EQUALITY_OPERATORS", ApplicationBundle.message("checkbox.spaces.equality.operators"), AROUND_OPERATORS);
|
||||
initBooleanField("SPACE_AROUND_RELATIONAL_OPERATORS", ApplicationBundle.message("checkbox.spaces.relational.operators"), AROUND_OPERATORS);
|
||||
initBooleanField("SPACE_AROUND_BITWISE_OPERATORS", ApplicationBundle.message("checkbox.spaces.bitwise.operators"), AROUND_OPERATORS);
|
||||
initBooleanField("SPACE_AROUND_ADDITIVE_OPERATORS", ApplicationBundle.message("checkbox.spaces.additive.operators"), AROUND_OPERATORS);
|
||||
initBooleanField("SPACE_AROUND_MULTIPLICATIVE_OPERATORS", ApplicationBundle.message("checkbox.spaces.multiplicative.operators"), AROUND_OPERATORS);
|
||||
initBooleanField("SPACE_AROUND_SHIFT_OPERATORS", ApplicationBundle.message("checkbox.spaces.shift.operators"), AROUND_OPERATORS);
|
||||
|
||||
initBooleanField("SPACE_BEFORE_CLASS_LBRACE", ApplicationBundle.message("checkbox.spaces.class.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_METHOD_LBRACE", ApplicationBundle.message("checkbox.spaces.method.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_IF_LBRACE", ApplicationBundle.message("checkbox.spaces.if.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_ELSE_LBRACE", ApplicationBundle.message("checkbox.spaces.else.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_WHILE_LBRACE", ApplicationBundle.message("checkbox.spaces.while.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_FOR_LBRACE", ApplicationBundle.message("checkbox.spaces.for.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_DO_LBRACE", ApplicationBundle.message("checkbox.spaces.do.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_SWITCH_LBRACE", ApplicationBundle.message("checkbox.spaces.switch.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_TRY_LBRACE", ApplicationBundle.message("checkbox.spaces.try.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_CATCH_LBRACE", ApplicationBundle.message("checkbox.spaces.catch.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_FINALLY_LBRACE", ApplicationBundle.message("checkbox.spaces.finally.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_SYNCHRONIZED_LBRACE", ApplicationBundle.message("checkbox.spaces.synchronized.left.brace"), BEFORE_LEFT_BRACE);
|
||||
initBooleanField("SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE", ApplicationBundle.message("checkbox.spaces.array.initializer.left.brace"), BEFORE_LEFT_BRACE);
|
||||
|
||||
initBooleanField("SPACE_WITHIN_PARENTHESES", ApplicationBundle.message("checkbox.spaces.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_METHOD_CALL_PARENTHESES", ApplicationBundle.message("checkbox.spaces.checkbox.spaces.method.call.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_METHOD_PARENTHESES", ApplicationBundle.message("checkbox.spaces.checkbox.spaces.method.declaration.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_IF_PARENTHESES", ApplicationBundle.message("checkbox.spaces.if.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_WHILE_PARENTHESES", ApplicationBundle.message("checkbox.spaces.while.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_FOR_PARENTHESES", ApplicationBundle.message("checkbox.spaces.for.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_CATCH_PARENTHESES", ApplicationBundle.message("checkbox.spaces.catch.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_SWITCH_PARENTHESES", ApplicationBundle.message("checkbox.spaces.switch.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_SYNCHRONIZED_PARENTHESES", ApplicationBundle.message("checkbox.spaces.synchronized.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_CAST_PARENTHESES", ApplicationBundle.message("checkbox.spaces.type.cast.parentheses"), WITHIN_PARENTHESES);
|
||||
initBooleanField("SPACE_WITHIN_ANNOTATION_PARENTHESES", ApplicationBundle.message("checkbox.spaces.annotation.parentheses"), WITHIN_PARENTHESES);
|
||||
|
||||
initBooleanField("SPACE_BEFORE_QUEST", ApplicationBundle.message("checkbox.spaces.before.question"), TERNARY_OPERATOR);
|
||||
initBooleanField("SPACE_AFTER_QUEST", ApplicationBundle.message("checkbox.spaces.after.question"), TERNARY_OPERATOR);
|
||||
initBooleanField("SPACE_BEFORE_COLON", ApplicationBundle.message("checkbox.spaces.before.colon"), TERNARY_OPERATOR);
|
||||
initBooleanField("SPACE_AFTER_COLON", ApplicationBundle.message("checkbox.spaces.after.colon"), TERNARY_OPERATOR);
|
||||
|
||||
initBooleanField("SPACE_AFTER_LABEL", ApplicationBundle.message("checkbox.spaces.after.colon.in.label.declaration"), OTHER);
|
||||
initBooleanField("SPACE_WITHIN_BRACKETS", ApplicationBundle.message("checkbox.spaces.within.brackets"), OTHER);
|
||||
initBooleanField("SPACE_WITHIN_ARRAY_INITIALIZER_BRACES", ApplicationBundle.message("checkbox.spaces.within.array.initializer.braces"), OTHER);
|
||||
initBooleanField("SPACE_AFTER_COMMA", ApplicationBundle.message("checkbox.spaces.after.comma"), OTHER);
|
||||
initBooleanField("SPACE_BEFORE_COMMA", ApplicationBundle.message("checkbox.spaces.before.comma"), OTHER);
|
||||
initBooleanField("SPACE_AFTER_SEMICOLON", ApplicationBundle.message("checkbox.spaces.after.semicolon"), OTHER);
|
||||
initBooleanField("SPACE_BEFORE_SEMICOLON", ApplicationBundle.message("checkbox.spaces.before.semicolon"), OTHER);
|
||||
initBooleanField("SPACE_AFTER_TYPE_CAST", ApplicationBundle.message("checkbox.spaces.after.type.cast"), OTHER);
|
||||
}
|
||||
|
||||
protected void setupEditorSettings(Editor editor) {
|
||||
EditorSettings editorSettings = editor.getSettings();
|
||||
editorSettings.setWhitespacesShown(true);
|
||||
editorSettings.setLineMarkerAreaShown(false);
|
||||
editorSettings.setIndentGuidesShown(false);
|
||||
editorSettings.setLineNumbersShown(false);
|
||||
editorSettings.setFoldingOutlineShown(false);
|
||||
editorSettings.setAdditionalColumnsCount(0);
|
||||
editorSettings.setAdditionalLinesCount(1);
|
||||
}
|
||||
|
||||
protected String getPreviewText() {
|
||||
return "@Annotation(param1=\"value1\", param2=\"value2\") public class Foo {\n" +
|
||||
" int[] X = new int[]{1,3,5,6,7,87,1213,2};\n\n" +
|
||||
" public void foo(int x, int y) {\n" +
|
||||
" for(int i = 0; i < x; i++){\n" +
|
||||
" y += (y ^ 0x123) << 2;\n" +
|
||||
" }\n" +
|
||||
" do {\n" +
|
||||
" try {\n" +
|
||||
" if(0 < x && x < 10) {\n" +
|
||||
" while(x != y){\n" +
|
||||
" x = f(x * 3 + 5);\n" +
|
||||
" }\n" +
|
||||
" } else {\n" +
|
||||
" synchronized(this){\n" +
|
||||
" switch(e.getCode()){\n" +
|
||||
" //...\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" catch(MyException e) {\n" +
|
||||
" }\n" +
|
||||
" finally {\n" +
|
||||
" int[] arr = (int[])g(y);\n" +
|
||||
" x = y >= 0 ? arr[y] : -1;\n" +
|
||||
" }\n" +
|
||||
" }while(true);\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
}
|
||||
|
||||
public JComponent getPanel() {
|
||||
return getInternalPanel();
|
||||
}
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class IndentAndBracesSettingsProvider extends CodeStyleSettingsProvider {
|
||||
@NotNull
|
||||
public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings originalSettings) {
|
||||
return new CodeStyleIndentAndBracesConfigurable(settings, originalSettings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigurableDisplayName() {
|
||||
return ApplicationBundle.message("title.alignment.and.braces");
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class SpacesSettingsProvider extends CodeStyleSettingsProvider {
|
||||
@NotNull
|
||||
public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings originalSettings) {
|
||||
return new CodeStyleSpacesConfigurable(settings, originalSettings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigurableDisplayName() {
|
||||
return ApplicationBundle.message("title.spaces");
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class WrappingConfigurable extends CodeStyleAbstractConfigurable {
|
||||
public WrappingConfigurable(CodeStyleSettings settings, CodeStyleSettings cloneSettings) {
|
||||
super(settings, cloneSettings, ApplicationBundle.message("title.wrapping"));
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
return StdFileTypes.JAVA.getIcon();
|
||||
}
|
||||
|
||||
protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) {
|
||||
return new WrappingPanel(settings);
|
||||
}
|
||||
|
||||
public String getHelpTopic() {
|
||||
return "reference.settingsdialog.IDE.globalcodestyle.wrap";
|
||||
}
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class WrappingPanel extends OptionTableWithPreviewPanel {
|
||||
private static final String METHOD_PARAMETERS_WRAPPING = ApplicationBundle.message("combobox.wrap.method.declaration.parameters");
|
||||
private static final String CALL_PARAMETERS_WRAPPING = ApplicationBundle.message("combobox.wrap.method.call.arguments");
|
||||
private static final String CALL_CHAIN_WRAPPING = ApplicationBundle.message("combobox.wrap.chained.method.calls");
|
||||
private static final String FOR_STATEMENT_WRAPPING = ApplicationBundle.message("combobox.wrap.for.statement");
|
||||
private static final String BINARY_OPERATION_WRAPPING = ApplicationBundle.message("combobox.wrap.binary.operations");
|
||||
private static final String[] FULL_WRAP_OPTIONS = new String[] {
|
||||
ApplicationBundle.message("combobox.codestyle.do.not.wrap"),
|
||||
ApplicationBundle.message("combobox.codestyle.wrap.if.long"),
|
||||
ApplicationBundle.message("combobox.codestyle.chop.down.if.long"),
|
||||
ApplicationBundle.message("combobox.codestyle.wrap.always")
|
||||
};
|
||||
private static final String[] SINGLE_ITEM_WRAP_OPTIONS = new String[]{
|
||||
ApplicationBundle.message("combobox.codestyle.do.not.wrap"),
|
||||
ApplicationBundle.message("combobox.codestyle.wrap.if.long"),
|
||||
ApplicationBundle.message("combobox.codestyle.wrap.always")
|
||||
};
|
||||
private static final int[] FULL_WRAP_VALUES = new int[]{CodeStyleSettings.DO_NOT_WRAP,
|
||||
CodeStyleSettings.WRAP_AS_NEEDED,
|
||||
CodeStyleSettings.WRAP_AS_NEEDED |
|
||||
CodeStyleSettings.WRAP_ON_EVERY_ITEM,
|
||||
CodeStyleSettings.WRAP_ALWAYS};
|
||||
private static final int[] SINGLE_ITEM_WRAP_VALUES = new int[]{CodeStyleSettings.DO_NOT_WRAP,
|
||||
CodeStyleSettings.WRAP_AS_NEEDED,
|
||||
CodeStyleSettings.WRAP_ALWAYS};
|
||||
private static final String EXTENDS_LIST_WRAPPING = ApplicationBundle.message("combobox.wrap.extends.implements.list");
|
||||
private static final String EXTENDS_KEYWORD_WRAPPING = ApplicationBundle.message("combobox.wrap.extends.implements.keyword");
|
||||
private static final String THROWS_LIST_WRAPPING = ApplicationBundle.message("combobox.wrap.throws.list");
|
||||
private static final String THROWS_KEYWORD_WRAPPING = ApplicationBundle.message("combobox.wrap.throws.keyword");
|
||||
private static final String PARENTHESIZED_EXPRESSION = ApplicationBundle.message("combobox.wrap.parenthesized.expression");
|
||||
private static final String TERNARY_OPERATION_WRAPPING = ApplicationBundle.message("combobox.wrap.ternary.operation");
|
||||
private static final String ASSIGNMENT_WRAPPING = ApplicationBundle.message("combobox.wrap.assignment.statement");
|
||||
private static final String ARRAY_INITIALIZER_WRAPPING = ApplicationBundle.message("combobox.wrap.array.initializer");
|
||||
private static final String LABELED_STATEMENT_WRAPPING = ApplicationBundle.message("combobox.wrap.label.declaration");
|
||||
private static final String MODIFIER_LIST_WRAPPING = ApplicationBundle.message("combobox.wrap.modifier.list");
|
||||
private static final String ASSERT_STATEMENT_WRAPPING = ApplicationBundle.message("combobox.wrap.assert.statement");
|
||||
|
||||
public WrappingPanel(CodeStyleSettings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
protected void initTables() {
|
||||
initRadioGroupField("EXTENDS_LIST_WRAP", EXTENDS_LIST_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initRadioGroupField("EXTENDS_KEYWORD_WRAP", EXTENDS_KEYWORD_WRAPPING, SINGLE_ITEM_WRAP_OPTIONS,
|
||||
SINGLE_ITEM_WRAP_VALUES);
|
||||
|
||||
initRadioGroupField("METHOD_PARAMETERS_WRAP", METHOD_PARAMETERS_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initBooleanField("METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.new.line.after.lpar"), METHOD_PARAMETERS_WRAPPING);
|
||||
initBooleanField("METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.place.rpar.on.new.line"), METHOD_PARAMETERS_WRAPPING);
|
||||
|
||||
initRadioGroupField("THROWS_LIST_WRAP", THROWS_LIST_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initRadioGroupField("THROWS_KEYWORD_WRAP", THROWS_KEYWORD_WRAPPING, SINGLE_ITEM_WRAP_OPTIONS,
|
||||
SINGLE_ITEM_WRAP_VALUES);
|
||||
|
||||
initRadioGroupField("CALL_PARAMETERS_WRAP", CALL_PARAMETERS_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initBooleanField("PREFER_PARAMETERS_WRAP", ApplicationBundle.message("checkbox.wrap.take.priority.over.call.chain.wrapping"), CALL_PARAMETERS_WRAPPING);
|
||||
initBooleanField("CALL_PARAMETERS_LPAREN_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.new.line.after.lpar"), CALL_PARAMETERS_WRAPPING);
|
||||
initBooleanField("CALL_PARAMETERS_RPAREN_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.place.rpar.on.new.line"), CALL_PARAMETERS_WRAPPING);
|
||||
|
||||
initRadioGroupField("METHOD_CALL_CHAIN_WRAP", CALL_CHAIN_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
|
||||
initRadioGroupField("FOR_STATEMENT_WRAP", FOR_STATEMENT_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initBooleanField("FOR_STATEMENT_LPAREN_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.new.line.after.lpar"), FOR_STATEMENT_WRAPPING);
|
||||
initBooleanField("FOR_STATEMENT_RPAREN_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.place.rpar.on.new.line"), FOR_STATEMENT_WRAPPING);
|
||||
|
||||
initRadioGroupField("BINARY_OPERATION_WRAP", BINARY_OPERATION_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initBooleanField("BINARY_OPERATION_SIGN_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.operation.sign.on.next.line"), BINARY_OPERATION_WRAPPING);
|
||||
|
||||
initRadioGroupField("ASSIGNMENT_WRAP", ASSIGNMENT_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initBooleanField("PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.assignment.sign.on.next.line"), ASSIGNMENT_WRAPPING);
|
||||
|
||||
initRadioGroupField("TERNARY_OPERATION_WRAP", TERNARY_OPERATION_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initBooleanField("TERNARY_OPERATION_SIGNS_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.quest.and.colon.signs.on.next.line"),
|
||||
TERNARY_OPERATION_WRAPPING);
|
||||
|
||||
initBooleanField("PARENTHESES_EXPRESSION_LPAREN_WRAP", ApplicationBundle.message("checkbox.wrap.new.line.after.lpar"), PARENTHESIZED_EXPRESSION);
|
||||
initBooleanField("PARENTHESES_EXPRESSION_RPAREN_WRAP", ApplicationBundle.message("checkbox.wrap.place.rpar.on.new.line"), PARENTHESIZED_EXPRESSION);
|
||||
|
||||
initRadioGroupField("ARRAY_INITIALIZER_WRAP", ARRAY_INITIALIZER_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initBooleanField("ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.new.line.after.lbrace"), ARRAY_INITIALIZER_WRAPPING);
|
||||
initBooleanField("ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.place.rbrace.on.new.line"), ARRAY_INITIALIZER_WRAPPING);
|
||||
|
||||
initRadioGroupField("LABELED_STATEMENT_WRAP", LABELED_STATEMENT_WRAPPING, SINGLE_ITEM_WRAP_OPTIONS, SINGLE_ITEM_WRAP_VALUES);
|
||||
|
||||
initBooleanField("MODIFIER_LIST_WRAP", ApplicationBundle.message("checkbox.wrap.after.modifier.list"), MODIFIER_LIST_WRAPPING);
|
||||
|
||||
initRadioGroupField("ASSERT_STATEMENT_WRAP", ASSERT_STATEMENT_WRAPPING, FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initBooleanField("ASSERT_STATEMENT_COLON_ON_NEXT_LINE", ApplicationBundle.message("checkbox.wrap.colon.signs.on.next.line"), ASSERT_STATEMENT_WRAPPING);
|
||||
|
||||
initRadioGroupField("CLASS_ANNOTATION_WRAP", ApplicationBundle.message("checkbox.wrap.classes.annotation"), FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initRadioGroupField("METHOD_ANNOTATION_WRAP", ApplicationBundle.message("checkbox.wrap.methods.annotation"), FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initRadioGroupField("FIELD_ANNOTATION_WRAP", ApplicationBundle.message("checkbox.wrap.fields.annotation"), FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initRadioGroupField("PARAMETER_ANNOTATION_WRAP", ApplicationBundle.message("checkbox.wrap.parameters.annotation"), FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initRadioGroupField("VARIABLE_ANNOTATION_WRAP", ApplicationBundle.message("checkbox.wrap.local.variables.annotation"), FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
initRadioGroupField("ENUM_CONSTANTS_WRAP", ApplicationBundle.message("checkbox.wrap.enum.constants"), FULL_WRAP_OPTIONS, FULL_WRAP_VALUES);
|
||||
|
||||
}
|
||||
|
||||
protected int getRightMargin() {
|
||||
return 37;
|
||||
}
|
||||
|
||||
protected String getPreviewText() { //| Margin is here
|
||||
return "/*\n" +
|
||||
" * This is a sample file.\n" +
|
||||
" */\n" +
|
||||
"\n" +
|
||||
"public class ThisIsASampleClass extends C1 implements I1, I2, I3, I4, I5 {\n" +
|
||||
" private int f1;\n" +
|
||||
" private int f2;\n" +
|
||||
" public void foo1(int i1, int i2, int i3, int i4, int i5, int i6, int i7) {}\n" +
|
||||
" public static void longerMethod() throws Exception1, Exception2, Exception3 {\n" +
|
||||
" int[] a = new int[] {1, 2, 0x0052, 0x0053, 0x0054};\n" +
|
||||
" foo1(0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057);\n" +
|
||||
" int x = (3 + 4 + 5 + 6) * (7 + 8 + 9 + 10) * (11 + 12 + 13 + 14 + 0xFFFFFFFF);\n" +
|
||||
" String s1, s2, s3;\n" +
|
||||
" s1 = s2 = s3 = \"012345678901456\";\n" +
|
||||
" assert i + j + k + l + n+ m <= 2 : \"assert description\";" +
|
||||
" int y = 2 > 3 ? 7 + 8 + 9 : 11 + 12 + 13;\n" +
|
||||
" label: " +
|
||||
" for (int i = 0; i < 0xFFFFFF; i += 2) {\n" +
|
||||
" super.getFoo().foo().getBar().bar();\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"enum Breed {\n" +
|
||||
" Dalmatian(), Labrador(), Dachshund()\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"@Annotation1 @Annotation2 @Annotation3(param1=\"value1\", param2=\"value2\") @Annotation4 class Foo {\n" +
|
||||
" @Annotation1 @Annotation3(param1=\"value1\", param2=\"value2\") public static void foo(){\n" +
|
||||
" }\n" +
|
||||
" @Annotation1 @Annotation3(param1=\"value1\", param2=\"value2\") public static int myFoo;\n" +
|
||||
" public void method(@Annotation1 @Annotation3(param1=\"value1\", param2=\"value2\") final int param){\n" +
|
||||
" @Annotation1 @Annotation3(param1=\"value1\", param2=\"value2\") final int localVariable;" +
|
||||
" }\n" +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class WrappingSettingsProvider extends CodeStyleSettingsProvider {
|
||||
@NotNull
|
||||
public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings originalSettings) {
|
||||
return new WrappingConfigurable(settings, originalSettings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigurableDisplayName() {
|
||||
return ApplicationBundle.message("title.wrapping");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user