mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# This script updates your IntelliJ IDEA CE installation from the latest compiled classes. This way you can easily
|
||||
# upgrade your working IDEA to the latest changes.
|
||||
#
|
||||
# Before you run the script, ensure you have the following:
|
||||
# 1. Your project for IntelliJ IDEA CE is fully built (do 'Rebuild Project' if you're not sure)
|
||||
# 2. WORK_IDEA_HOME points to the directory of IntelliJ IDEA build you want to upgrade
|
||||
# 3. DEV_IDEA_HOME points to the directory of the project you built at step 1
|
||||
# 4. You quit IntelliJ IDEA
|
||||
#
|
||||
|
||||
if [ -z "$WORK_IDEA_HOME" ]; then
|
||||
echo WORK_IDEA_HOME must be defined and point to build you're updating
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -z "$DEV_IDEA_HOME" ]; then
|
||||
echo DEV_IDEA_HOME must be defined and point to source base your're updating from
|
||||
exit
|
||||
fi
|
||||
|
||||
echo Updating $WORK_IDEA_HOME from compiled classes in $DEV_IDEA_HOME
|
||||
|
||||
rm -rf $WORK_IDEA_HOME/lib
|
||||
rm -rf $WORK_IDEA_HOME/plugins
|
||||
|
||||
ant -f update.xml
|
||||
|
||||
cd $DEV_IDEA_HOME
|
||||
cp -R $DEV_IDEA_HOME/out/deploy/* $WORK_IDEA_HOME
|
||||
|
||||
cd $WORK_IDEA_HOME/bin
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<!--
|
||||
~ Copyright 2000-2010 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.
|
||||
-->
|
||||
<project name="IntelliJ IDEA CE build file" default="layout">
|
||||
<dirname property="build" file="${ant.file}"/>
|
||||
<property name="project.home" value="${build}/../"/>
|
||||
<property name="gant.home" value="${project.home}/build/lib/gant"/>
|
||||
<property name="modules.output" value="${project.home}/out"/>
|
||||
|
||||
<macrodef name="run">
|
||||
<attribute name="script"/>
|
||||
<attribute name="deploy"/>
|
||||
<sequential>
|
||||
<java failonerror="true" classname="org.apache.tools.ant.Main" fork="true">
|
||||
<jvmarg line="-Xms64m -Xmx512m"/>
|
||||
<jvmarg line=""-Ddeploy=@{deploy}""/>
|
||||
<jvmarg line=""-Dmodules.output=${modules.output}""/>
|
||||
<jvmarg line=""-Dgant.script=@{script}""/>
|
||||
|
||||
<classpath>
|
||||
<fileset dir="${project.home}/lib/ant/lib">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<pathelement location="../build/lib/gant_patches.jar"/>
|
||||
<fileset dir="${gant.home}/lib">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
|
||||
<arg value="-f"/>
|
||||
<arg value="gant.xml"/>
|
||||
</java>
|
||||
|
||||
<java classname="com.intellij.util.io.zip.ReorderJarsMain" fork="true">
|
||||
<arg value="${build}/order.txt"/>
|
||||
<arg value="@{deploy}"/>
|
||||
<arg value="@{deploy}"/>
|
||||
<arg value="${project.home}/lib"/>
|
||||
<classpath>
|
||||
<pathelement location="${modules.output}/production/util"/>
|
||||
</classpath>
|
||||
</java>
|
||||
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="layout">
|
||||
<run script="${project.home}/build/scripts/layouts.gant"
|
||||
deploy="${project.home}/out/deploy"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -0,0 +1,49 @@
|
||||
alloy.jar
|
||||
ant.jar
|
||||
asm-commons.jar
|
||||
asm.jar
|
||||
asm-tree-3.0.jar
|
||||
bcel.jar
|
||||
cglib-nodep-2.1_3.jar
|
||||
coverage-agent.jar
|
||||
coverage-report.jar
|
||||
coverage-report-idea.jar
|
||||
commons-codec-1.3.jar
|
||||
commons-collections.jar
|
||||
commons-lang-2.4.jar
|
||||
emma.jar
|
||||
freemarker.jar
|
||||
jdom.jar
|
||||
jgoodies-forms.jar
|
||||
looks-2.2.2.jar
|
||||
jcip-annotations.jar
|
||||
jh.jar
|
||||
JNIWrap.jar
|
||||
jsf-api.jar
|
||||
jsp-api.jar
|
||||
junit.jar
|
||||
junit-4.6.jar
|
||||
log4j.jar
|
||||
microba.jar
|
||||
nanoxml-2.2.3.jar
|
||||
org.eclipse.jdt.core_3.4.4.v_894_R34x.jar
|
||||
oromatcher.jar
|
||||
picocontainer.jar
|
||||
resolver.jar
|
||||
servlet-api.jar
|
||||
trove4j.jar
|
||||
velocity.jar
|
||||
xerces.jar
|
||||
xml-apis.jar
|
||||
xmlrpc-2.0.jar
|
||||
xstream.jar
|
||||
xpp3-1.1.4-min.jar
|
||||
yjp-controller-api-redist.jar
|
||||
jna.jar
|
||||
jna-utils.jar
|
||||
groovy-all-1.6.3.jar
|
||||
jaxen-1.1.1.jar
|
||||
commons-net-1.4.1.jar
|
||||
serviceMessages.jar
|
||||
xbean.jar
|
||||
jsr173_1.0_api.jar
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.codeStyle;
|
||||
|
||||
import com.intellij.application.options.CodeStyleAbstractConfigurable;
|
||||
import com.intellij.application.options.CodeStyleAbstractPanel;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
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";
|
||||
}
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.codeStyle;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorSettings;
|
||||
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.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();
|
||||
}
|
||||
}
|
||||
+561
@@ -0,0 +1,561 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.codeStyle;
|
||||
|
||||
import com.intellij.application.options.CodeStyleAbstractPanel;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
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.LanguageFileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public abstract class OptionTreeWithPreviewPanel extends CodeStyleAbstractPanel {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.application.options.CodeStyleSpacesPanel");
|
||||
private final JTree myOptionsTree;
|
||||
private final HashMap myKeyToFieldMap = new HashMap();
|
||||
private final ArrayList myKeys = new ArrayList();
|
||||
private final JPanel myPanel = new JPanel(new GridBagLayout());
|
||||
private static LanguageFileType myFileType = StdFileTypes.JSP;
|
||||
|
||||
public OptionTreeWithPreviewPanel(CodeStyleSettings settings) {
|
||||
super(settings);
|
||||
|
||||
initTables();
|
||||
|
||||
myOptionsTree = createOptionsTree();
|
||||
myOptionsTree.setCellRenderer(new MyTreeCellRenderer());
|
||||
myPanel.add(new JScrollPane(myOptionsTree),
|
||||
new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH,
|
||||
new Insets(7, 7, 3, 4), 0, 0));
|
||||
|
||||
JPanel previewPanel = new JPanel(new BorderLayout()) {
|
||||
public Dimension getPreferredSize() {
|
||||
return new Dimension(200, 0);
|
||||
}
|
||||
};
|
||||
previewPanel.setBorder(IdeBorderFactory.createTitledBorder(ApplicationBundle.message("title.preview")));
|
||||
|
||||
myPanel.add(previewPanel,
|
||||
new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH,
|
||||
new Insets(0, 0, 0, 4), 0, 0));
|
||||
|
||||
installPreviewPanel(previewPanel);
|
||||
addPanelToWatch(myPanel);
|
||||
|
||||
}
|
||||
|
||||
protected JTree createOptionsTree() {
|
||||
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
|
||||
String groupName = "";
|
||||
DefaultMutableTreeNode groupNode = null;
|
||||
for (int i = 0; i < myKeys.size(); i++) {
|
||||
if (myKeys.get(i) instanceof BooleanOptionKey) {
|
||||
BooleanOptionKey key = (BooleanOptionKey)myKeys.get(i);
|
||||
String newGroupName = key.groupName;
|
||||
if (!newGroupName.equals(groupName) || groupNode == null) {
|
||||
groupName = newGroupName;
|
||||
groupNode = new DefaultMutableTreeNode(newGroupName);
|
||||
rootNode.add(groupNode);
|
||||
}
|
||||
groupNode.add(new MyToggleTreeNode(key, key.cbName));
|
||||
}
|
||||
else if (myKeys.get(i) instanceof IntSelectionOptionKey) {
|
||||
IntSelectionOptionKey key = (IntSelectionOptionKey)myKeys.get(i);
|
||||
String newGroupName = key.groupName;
|
||||
if (!newGroupName.equals(groupName) || groupNode == null) {
|
||||
groupName = newGroupName;
|
||||
groupNode = new DefaultMutableTreeNode(newGroupName);
|
||||
rootNode.add(groupNode);
|
||||
}
|
||||
MyToggleTreeNode[] nodes = new MyToggleTreeNode[key.rbNames.length];
|
||||
for (int j = 0; j < nodes.length; j++) {
|
||||
nodes[j] = new MyToggleTreeNode(key, key.rbNames[j]);
|
||||
groupNode.add(nodes[j]);
|
||||
}
|
||||
key.setCreatedNodes(nodes);
|
||||
}
|
||||
}
|
||||
|
||||
DefaultTreeModel model = new DefaultTreeModel(rootNode);
|
||||
|
||||
final Tree optionsTree = new Tree(model);
|
||||
TreeUtil.installActions(optionsTree);
|
||||
optionsTree.setRootVisible(false);
|
||||
UIUtil.setLineStyleAngled(optionsTree);
|
||||
optionsTree.setShowsRootHandles(true);
|
||||
|
||||
|
||||
optionsTree.addKeyListener(new KeyAdapter() {
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (!optionsTree.isEnabled()) return;
|
||||
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
|
||||
TreePath treePath = optionsTree.getLeadSelectionPath();
|
||||
selectCheckbox(treePath);
|
||||
e.consume();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
optionsTree.addMouseListener(new MouseAdapter() {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (!optionsTree.isEnabled()) return;
|
||||
TreePath treePath = optionsTree.getPathForLocation(e.getX(), e.getY());
|
||||
selectCheckbox(treePath);
|
||||
}
|
||||
});
|
||||
|
||||
int row = 0;
|
||||
while (row < optionsTree.getRowCount()) {
|
||||
optionsTree.expandRow(row);
|
||||
row++;
|
||||
}
|
||||
|
||||
return optionsTree;
|
||||
}
|
||||
|
||||
private void selectCheckbox(TreePath treePath) {
|
||||
if (treePath == null) {
|
||||
return;
|
||||
}
|
||||
Object o = treePath.getLastPathComponent();
|
||||
if (o instanceof MyToggleTreeNode) {
|
||||
MyToggleTreeNode node = (MyToggleTreeNode)o;
|
||||
if (node.isCheckbox()) {
|
||||
node.setSelected(!node.isSelected());
|
||||
}
|
||||
else {
|
||||
MyToggleTreeNode[] group = node.getGroup();
|
||||
for (int i = 0; i < group.length; i++) {
|
||||
MyToggleTreeNode groupNode = group[i];
|
||||
groupNode.setSelected(false);
|
||||
int row = myOptionsTree.getRowForPath(new TreePath(groupNode.getPath()));
|
||||
myOptionsTree.repaint(myOptionsTree.getRowBounds(row));
|
||||
}
|
||||
node.setSelected(true);
|
||||
}
|
||||
int row = myOptionsTree.getRowForPath(treePath);
|
||||
myOptionsTree.repaint(myOptionsTree.getRowBounds(row));
|
||||
//updatePreview();
|
||||
somethingChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected EditorHighlighter createHighlighter(final EditorColorsScheme scheme) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
|
||||
if (project == null) {
|
||||
project = ProjectManager.getInstance().getDefaultProject();
|
||||
}
|
||||
return myFileType.getEditorHighlighter(project, null, scheme);
|
||||
}
|
||||
|
||||
protected abstract void initTables();
|
||||
|
||||
protected int getRightMargin() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@NonNls
|
||||
protected abstract String getPreviewText();
|
||||
|
||||
protected void resetImpl(final CodeStyleSettings settings) {
|
||||
TreeModel treeModel = myOptionsTree.getModel();
|
||||
TreeNode root = (TreeNode)treeModel.getRoot();
|
||||
resetNode(root, settings);
|
||||
}
|
||||
|
||||
private void resetNode(TreeNode node, final CodeStyleSettings settings) {
|
||||
if (node instanceof MyToggleTreeNode) {
|
||||
resetMyTreeNode((MyToggleTreeNode)node, settings);
|
||||
return;
|
||||
}
|
||||
for (int j = 0; j < node.getChildCount(); j++) {
|
||||
TreeNode child = node.getChildAt(j);
|
||||
resetNode(child, settings);
|
||||
}
|
||||
}
|
||||
|
||||
private void resetMyTreeNode(MyToggleTreeNode childNode, final CodeStyleSettings settings) {
|
||||
try {
|
||||
if (childNode.getKey() instanceof BooleanOptionKey) {
|
||||
BooleanOptionKey key = (BooleanOptionKey)childNode.getKey();
|
||||
Field field = (Field)myKeyToFieldMap.get(key);
|
||||
childNode.setSelected(field.getBoolean(settings));
|
||||
}
|
||||
else if (childNode.getKey() instanceof IntSelectionOptionKey) {
|
||||
IntSelectionOptionKey key = (IntSelectionOptionKey)childNode.getKey();
|
||||
Field field = (Field)myKeyToFieldMap.get(key);
|
||||
int fieldValue = field.getInt(settings);
|
||||
for (int i = 0; i < key.rbNames.length; i++) {
|
||||
if (childNode.getText().equals(key.rbNames[i])) {
|
||||
childNode.setSelected(fieldValue == key.values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void apply(CodeStyleSettings settings) {
|
||||
TreeModel treeModel = myOptionsTree.getModel();
|
||||
TreeNode root = (TreeNode)treeModel.getRoot();
|
||||
applyNode(root, settings);
|
||||
}
|
||||
|
||||
private void applyNode(TreeNode node, final CodeStyleSettings settings) {
|
||||
if (node instanceof MyToggleTreeNode) {
|
||||
applyToggleNode((MyToggleTreeNode)node, settings);
|
||||
return;
|
||||
}
|
||||
for (int j = 0; j < node.getChildCount(); j++) {
|
||||
TreeNode child = node.getChildAt(j);
|
||||
applyNode(child, settings);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyToggleNode(MyToggleTreeNode childNode, final CodeStyleSettings settings) {
|
||||
try {
|
||||
if (childNode.getKey() instanceof BooleanOptionKey) {
|
||||
BooleanOptionKey key = (BooleanOptionKey)childNode.getKey();
|
||||
Field field = (Field)myKeyToFieldMap.get(key);
|
||||
field.set(settings, childNode.isSelected() ? Boolean.TRUE : Boolean.FALSE);
|
||||
}
|
||||
else if (childNode.getKey() instanceof IntSelectionOptionKey) {
|
||||
if (!childNode.isSelected()) return;
|
||||
IntSelectionOptionKey key = (IntSelectionOptionKey)childNode.getKey();
|
||||
Field field = (Field)myKeyToFieldMap.get(key);
|
||||
for (int i = 0; i < key.rbNames.length; i++) {
|
||||
if (childNode.getText().equals(key.rbNames[i])) {
|
||||
field.set(settings, new Integer(key.values[i]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isModified(CodeStyleSettings settings) {
|
||||
TreeModel treeModel = myOptionsTree.getModel();
|
||||
TreeNode root = (TreeNode)treeModel.getRoot();
|
||||
if (isModified(root, settings)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private boolean isModified(TreeNode node, final CodeStyleSettings settings) {
|
||||
if (node instanceof MyToggleTreeNode) {
|
||||
if (isToggleNodeModified((MyToggleTreeNode)node, settings)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < node.getChildCount(); j++) {
|
||||
TreeNode child = node.getChildAt(j);
|
||||
if (isModified(child, settings)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isToggleNodeModified(MyToggleTreeNode childNode, final CodeStyleSettings settings) {
|
||||
try {
|
||||
if (childNode.getKey() instanceof BooleanOptionKey) {
|
||||
BooleanOptionKey key = (BooleanOptionKey)childNode.getKey();
|
||||
Field field = (Field)myKeyToFieldMap.get(key);
|
||||
return childNode.isSelected() != field.getBoolean(settings);
|
||||
}
|
||||
else if (childNode.getKey() instanceof IntSelectionOptionKey) {
|
||||
if (!childNode.isSelected()) return false;
|
||||
IntSelectionOptionKey key = (IntSelectionOptionKey)childNode.getKey();
|
||||
Field field = (Field)myKeyToFieldMap.get(key);
|
||||
for (int i = 0; i < key.rbNames.length; i++) {
|
||||
if (childNode.getText().equals(key.rbNames[i])) {
|
||||
return field.getInt(settings) != key.values[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void initBooleanField(@NonNls String fieldName, String cbName, String groupName) {
|
||||
try {
|
||||
Class styleSettingsClass = CodeStyleSettings.class;
|
||||
Field field = styleSettingsClass.getField(fieldName);
|
||||
BooleanOptionKey key = new BooleanOptionKey(groupName, cbName);
|
||||
myKeyToFieldMap.put(key, field);
|
||||
myKeys.add(key);
|
||||
}
|
||||
catch (NoSuchFieldException e) {
|
||||
}
|
||||
catch (SecurityException e) {
|
||||
}
|
||||
}
|
||||
|
||||
protected void initRadioGroupField(String fieldName, String groupName, String[] rbNames, int[] values) {
|
||||
try {
|
||||
Class styleSettingsClass = CodeStyleSettings.class;
|
||||
Field field = styleSettingsClass.getField(fieldName);
|
||||
IntSelectionOptionKey key = new IntSelectionOptionKey(groupName, rbNames, values);
|
||||
myKeyToFieldMap.put(key, field);
|
||||
myKeys.add(key);
|
||||
}
|
||||
catch (NoSuchFieldException e) {
|
||||
}
|
||||
catch (SecurityException e) {
|
||||
}
|
||||
}
|
||||
|
||||
protected void prepareForReformat(final PsiFile psiFile) {
|
||||
//psiFile.putUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY, LanguageLevel.HIGHEST);
|
||||
}
|
||||
|
||||
protected class MyTreeCellRenderer implements TreeCellRenderer {
|
||||
private final MyLabelPanel myLabel;
|
||||
private final JCheckBox myCheckBox;
|
||||
private final JRadioButton myRadioButton;
|
||||
|
||||
public MyTreeCellRenderer() {
|
||||
myLabel = new MyLabelPanel();
|
||||
myCheckBox = new JCheckBox();
|
||||
myRadioButton = new JRadioButton();
|
||||
myCheckBox.setMargin(new Insets(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean isSelected, boolean expanded,
|
||||
boolean leaf, int row, boolean hasFocus) {
|
||||
|
||||
if (value instanceof MyToggleTreeNode) {
|
||||
MyToggleTreeNode treeNode = (MyToggleTreeNode)value;
|
||||
JToggleButton button = treeNode.isCheckbox() ? (JToggleButton)myCheckBox : (JToggleButton)myRadioButton;
|
||||
button.setText(treeNode.getText());
|
||||
button.setSelected(treeNode.isSelected);
|
||||
if (isSelected) {
|
||||
button.setForeground(UIUtil.getTreeSelectionForeground());
|
||||
button.setBackground(UIUtil.getTreeSelectionBackground());
|
||||
}
|
||||
else {
|
||||
button.setForeground(UIUtil.getTreeTextForeground());
|
||||
button.setBackground(UIUtil.getTreeTextBackground());
|
||||
}
|
||||
|
||||
button.setEnabled(tree.isEnabled());
|
||||
|
||||
return button;
|
||||
}
|
||||
else {
|
||||
Font font = tree.getFont();
|
||||
Font boldFont = new Font(font.getName(), Font.BOLD, font.getSize());
|
||||
myLabel.setFont(boldFont);
|
||||
myLabel.setText(value.toString());
|
||||
|
||||
if (isSelected) {
|
||||
myLabel.setForeground(UIUtil.getTreeSelectionForeground());
|
||||
myLabel.setBackground(UIUtil.getTreeSelectionBackground());
|
||||
}
|
||||
else {
|
||||
myLabel.setForeground(UIUtil.getTreeTextForeground());
|
||||
myLabel.setBackground(UIUtil.getTreeTextBackground());
|
||||
}
|
||||
|
||||
myLabel.setEnabled(tree.isEnabled());
|
||||
|
||||
return myLabel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyLabelPanel extends JPanel {
|
||||
private String myText = "";
|
||||
private final boolean hasFocus = false;
|
||||
|
||||
public MyLabelPanel() {
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
myText = text;
|
||||
if (myText == null) {
|
||||
myText = "";
|
||||
}
|
||||
}
|
||||
|
||||
protected void paintComponent(Graphics g) {
|
||||
g.setFont(getMyFont());
|
||||
FontMetrics fontMetrics = getFontMetrics(getMyFont());
|
||||
int h = fontMetrics.getHeight();
|
||||
int w = fontMetrics.charsWidth(myText.toCharArray(), 0, myText.length());
|
||||
g.setColor(getBackground());
|
||||
g.fillRect(0, 1, w + 2, h);
|
||||
if (hasFocus) {
|
||||
g.setColor(UIUtil.getTreeTextBackground());
|
||||
g.drawRect(0, 1, w + 2, h);
|
||||
}
|
||||
g.setColor(getForeground());
|
||||
g.drawString(myText, 2, h - fontMetrics.getDescent() + 1);
|
||||
}
|
||||
|
||||
private Font getMyFont() {
|
||||
Font font = UIUtil.getTreeFont();
|
||||
return new Font(font.getName(), Font.BOLD, font.getSize());
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
FontMetrics fontMetrics = getFontMetrics(getMyFont());
|
||||
if (fontMetrics == null) {
|
||||
return new Dimension(0, 0);
|
||||
}
|
||||
int h = fontMetrics.getHeight();
|
||||
int w = fontMetrics.charsWidth(myText.toCharArray(), 0, myText.length());
|
||||
return new Dimension(w + 4, h + 2);
|
||||
}
|
||||
}
|
||||
|
||||
private static class BooleanOptionKey {
|
||||
final String groupName;
|
||||
final String cbName;
|
||||
|
||||
public BooleanOptionKey(String groupName, String cbName) {
|
||||
this.groupName = groupName;
|
||||
this.cbName = cbName;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof BooleanOptionKey)) return false;
|
||||
BooleanOptionKey key = (BooleanOptionKey)obj;
|
||||
return groupName.equals(key.groupName) && cbName.equals(key.cbName);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return cbName.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
private static class IntSelectionOptionKey {
|
||||
final String groupName;
|
||||
final String[] rbNames;
|
||||
final int[] values;
|
||||
private MyToggleTreeNode[] myNodes;
|
||||
|
||||
public IntSelectionOptionKey(String groupName, String[] rbNames, int[] values) {
|
||||
this.groupName = groupName;
|
||||
this.rbNames = rbNames;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof IntSelectionOptionKey)) return false;
|
||||
|
||||
final IntSelectionOptionKey intSelectionOptionKey = (IntSelectionOptionKey)o;
|
||||
|
||||
if (!groupName.equals(intSelectionOptionKey.groupName)) return false;
|
||||
if (!Arrays.equals(rbNames, intSelectionOptionKey.rbNames)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return groupName.hashCode() + rbNames[0].hashCode() * 29;
|
||||
}
|
||||
|
||||
public void setCreatedNodes(MyToggleTreeNode[] nodes) { myNodes = nodes; }
|
||||
|
||||
public MyToggleTreeNode[] getNodes() { return myNodes; }
|
||||
}
|
||||
|
||||
private static class MyToggleTreeNode extends DefaultMutableTreeNode {
|
||||
private final Object myKey;
|
||||
private final String myText;
|
||||
private boolean isSelected;
|
||||
private final boolean isCheckbox;
|
||||
|
||||
public MyToggleTreeNode(Object key, String text) {
|
||||
myKey = key;
|
||||
myText = text;
|
||||
isCheckbox = true;
|
||||
}
|
||||
|
||||
public Object getKey() { return myKey; }
|
||||
|
||||
public String getText() { return myText; }
|
||||
|
||||
public boolean isCheckbox() { return isCheckbox; }
|
||||
|
||||
public void setSelected(boolean val) { isSelected = val; }
|
||||
|
||||
public boolean isSelected() { return isSelected; }
|
||||
|
||||
public MyToggleTreeNode[] getGroup() {
|
||||
return ((IntSelectionOptionKey)myKey).getNodes();
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected FileType getFileType() {
|
||||
return myFileType;
|
||||
}
|
||||
|
||||
public JComponent getInternalPanel() {
|
||||
return myPanel;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.codeStyle;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark0Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark0Action() {
|
||||
super(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark1Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark1Action() {
|
||||
super(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark2Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark2Action() {
|
||||
super(2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark3Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark3Action() {
|
||||
super(3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark4Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark4Action() {
|
||||
super(4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark5Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark5Action() {
|
||||
super(5);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark6Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark6Action() {
|
||||
super(6);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark7Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark7Action() {
|
||||
super(7);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark8Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark8Action() {
|
||||
super(8);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
public class ToggleBookmark9Action extends ToggleNumberedBookmarkActionBase {
|
||||
public ToggleBookmark9Action() {
|
||||
super(9);
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ide.bookmarks.actions;
|
||||
|
||||
import com.intellij.ide.bookmarks.Bookmark;
|
||||
import com.intellij.ide.bookmarks.BookmarkManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
public abstract class ToggleNumberedBookmarkActionBase extends AnAction implements DumbAware {
|
||||
private int myNumber;
|
||||
|
||||
public ToggleNumberedBookmarkActionBase(int n) {
|
||||
myNumber = n;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
e.getPresentation().setEnabled(project != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
|
||||
final BookmarkManager manager = BookmarkManager.getInstance(project);
|
||||
BookmarksAction.BookmarkInContextInfo info = new BookmarksAction.BookmarkInContextInfo(dataContext, project).invoke();
|
||||
final Bookmark oldBookmark = info.getBookmarkAtPlace();
|
||||
|
||||
if (oldBookmark != null) {
|
||||
manager.removeBookmark(oldBookmark);
|
||||
}
|
||||
|
||||
if (oldBookmark == null || oldBookmark.getMnemonic() != '0' + myNumber) {
|
||||
final Bookmark bookmark = BookmarkManager.getInstance(project).addTextBookmark(info.getFile(), info.getLine(), "");
|
||||
bookmark.setMnemonic((char)('0' + myNumber));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,6 +146,7 @@
|
||||
<mouse-shortcut keystroke="ctrl shift button1"/>
|
||||
<mouse-shortcut keystroke="shift button2"/>
|
||||
</action>
|
||||
|
||||
<action id="GotoBookmark0">
|
||||
<keyboard-shortcut first-keystroke="control 0"/>
|
||||
</action>
|
||||
@@ -177,6 +178,37 @@
|
||||
<keyboard-shortcut first-keystroke="control 9"/>
|
||||
</action>
|
||||
|
||||
<action id="ToggleBookmark0">
|
||||
<keyboard-shortcut first-keystroke="control shift 0"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark1">
|
||||
<keyboard-shortcut first-keystroke="control shift 1"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark2">
|
||||
<keyboard-shortcut first-keystroke="control shift 2"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark3">
|
||||
<keyboard-shortcut first-keystroke="control shift 3"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark4">
|
||||
<keyboard-shortcut first-keystroke="control shift 4"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark5">
|
||||
<keyboard-shortcut first-keystroke="control shift 5"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark6">
|
||||
<keyboard-shortcut first-keystroke="control shift 6"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark7">
|
||||
<keyboard-shortcut first-keystroke="control shift 7"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark8">
|
||||
<keyboard-shortcut first-keystroke="control shift 8"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark9">
|
||||
<keyboard-shortcut first-keystroke="control shift 9"/>
|
||||
</action>
|
||||
|
||||
<action id="$Undo">
|
||||
<keyboard-shortcut first-keystroke="control Z"/>
|
||||
<keyboard-shortcut first-keystroke="alt BACK_SPACE"/>
|
||||
|
||||
@@ -41,6 +41,18 @@
|
||||
<action id="GotoBookmark7" />
|
||||
<action id="GotoBookmark8" />
|
||||
<action id="GotoBookmark9" />
|
||||
|
||||
<action id="ToggleBookmark0" />
|
||||
<action id="ToggleBookmark1" />
|
||||
<action id="ToggleBookmark2" />
|
||||
<action id="ToggleBookmark3" />
|
||||
<action id="ToggleBookmark4" />
|
||||
<action id="ToggleBookmark5" />
|
||||
<action id="ToggleBookmark6" />
|
||||
<action id="ToggleBookmark7" />
|
||||
<action id="ToggleBookmark8" />
|
||||
<action id="ToggleBookmark9" />
|
||||
|
||||
<action id="HighlightUsagesInFile">
|
||||
<keyboard-shortcut first-keystroke="shift control 7" />
|
||||
</action>
|
||||
|
||||
@@ -126,6 +126,37 @@
|
||||
<keyboard-shortcut first-keystroke="control 9"/>
|
||||
</action>
|
||||
|
||||
<action id="ToggleBookmark0">
|
||||
<keyboard-shortcut first-keystroke="control shift 0"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark1">
|
||||
<keyboard-shortcut first-keystroke="control shift 1"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark2">
|
||||
<keyboard-shortcut first-keystroke="control shift 2"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark3">
|
||||
<keyboard-shortcut first-keystroke="control shift 3"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark4">
|
||||
<keyboard-shortcut first-keystroke="control shift 4"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark5">
|
||||
<keyboard-shortcut first-keystroke="control shift 5"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark6">
|
||||
<keyboard-shortcut first-keystroke="control shift 6"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark7">
|
||||
<keyboard-shortcut first-keystroke="control shift 7"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark8">
|
||||
<keyboard-shortcut first-keystroke="control shift 8"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark9">
|
||||
<keyboard-shortcut first-keystroke="control shift 9"/>
|
||||
</action>
|
||||
|
||||
<action id="MethodUp">
|
||||
<keyboard-shortcut first-keystroke="control UP"/>
|
||||
</action>
|
||||
|
||||
@@ -126,6 +126,37 @@
|
||||
<keyboard-shortcut first-keystroke="control 9"/>
|
||||
</action>
|
||||
|
||||
<action id="ToggleBookmark0">
|
||||
<keyboard-shortcut first-keystroke="control shift 0"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark1">
|
||||
<keyboard-shortcut first-keystroke="control shift 1"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark2">
|
||||
<keyboard-shortcut first-keystroke="control shift 2"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark3">
|
||||
<keyboard-shortcut first-keystroke="control shift 3"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark4">
|
||||
<keyboard-shortcut first-keystroke="control shift 4"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark5">
|
||||
<keyboard-shortcut first-keystroke="control shift 5"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark6">
|
||||
<keyboard-shortcut first-keystroke="control shift 6"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark7">
|
||||
<keyboard-shortcut first-keystroke="control shift 7"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark8">
|
||||
<keyboard-shortcut first-keystroke="control shift 8"/>
|
||||
</action>
|
||||
<action id="ToggleBookmark9">
|
||||
<keyboard-shortcut first-keystroke="control shift 9"/>
|
||||
</action>
|
||||
|
||||
<action id="MethodUp">
|
||||
<keyboard-shortcut first-keystroke="control UP"/>
|
||||
</action>
|
||||
|
||||
@@ -159,6 +159,18 @@
|
||||
<action id="GotoBookmark7" />
|
||||
<action id="GotoBookmark8" />
|
||||
<action id="GotoBookmark9" />
|
||||
|
||||
<action id="ToggleBookmark0" />
|
||||
<action id="ToggleBookmark1" />
|
||||
<action id="ToggleBookmark2" />
|
||||
<action id="ToggleBookmark3" />
|
||||
<action id="ToggleBookmark4" />
|
||||
<action id="ToggleBookmark5" />
|
||||
<action id="ToggleBookmark6" />
|
||||
<action id="ToggleBookmark7" />
|
||||
<action id="ToggleBookmark8" />
|
||||
<action id="ToggleBookmark9" />
|
||||
|
||||
<action id="GotoClass">
|
||||
<keyboard-shortcut first-keystroke="control O" />
|
||||
</action>
|
||||
|
||||
@@ -366,6 +366,17 @@
|
||||
<action id="GotoBookmark8" class="com.intellij.ide.bookmarks.actions.GotoBookmark8Action"/>
|
||||
<action id="GotoBookmark9" class="com.intellij.ide.bookmarks.actions.GotoBookmark9Action"/>
|
||||
|
||||
<action id="ToggleBookmark0" class="com.intellij.ide.bookmarks.actions.ToggleBookmark0Action"/>
|
||||
<action id="ToggleBookmark1" class="com.intellij.ide.bookmarks.actions.ToggleBookmark1Action"/>
|
||||
<action id="ToggleBookmark2" class="com.intellij.ide.bookmarks.actions.ToggleBookmark2Action"/>
|
||||
<action id="ToggleBookmark3" class="com.intellij.ide.bookmarks.actions.ToggleBookmark3Action"/>
|
||||
<action id="ToggleBookmark4" class="com.intellij.ide.bookmarks.actions.ToggleBookmark4Action"/>
|
||||
<action id="ToggleBookmark5" class="com.intellij.ide.bookmarks.actions.ToggleBookmark5Action"/>
|
||||
<action id="ToggleBookmark6" class="com.intellij.ide.bookmarks.actions.ToggleBookmark6Action"/>
|
||||
<action id="ToggleBookmark7" class="com.intellij.ide.bookmarks.actions.ToggleBookmark7Action"/>
|
||||
<action id="ToggleBookmark8" class="com.intellij.ide.bookmarks.actions.ToggleBookmark8Action"/>
|
||||
<action id="ToggleBookmark9" class="com.intellij.ide.bookmarks.actions.ToggleBookmark9Action"/>
|
||||
|
||||
</group>
|
||||
|
||||
<group id="ProjectViewPopupMenuRefactoringGroup">
|
||||
|
||||
+1
-1
@@ -200,7 +200,7 @@ public class XLineBreakpointManager {
|
||||
if (line >= 0 && line < document.getLineCount() && file != null) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (!myProject.isDisposed() && file.isValid()) {
|
||||
if (!myProject.isDisposed() && myProject.isInitialized() && file.isValid()) {
|
||||
XDebuggerUtil.getInstance().toggleLineBreakpoint(myProject, file, line);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user