summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2013-01-08 11:11:20 -0800
committerJean-Baptiste Queru <jbq@google.com>2013-01-08 11:11:20 -0800
commitb56ea2a18f232d79481e778085fd64e8ae486fc3 (patch)
tree44e1f6eb4864a45033f865b74fe783e3d784dd6a /samples
downloadidea-b56ea2a18f232d79481e778085fd64e8ae486fc3.tar.gz
Snapshot of commit d5ec1d5018ed24f1b4f32b1d09df6dbd7e2fc425
from branch master of git://git.jetbrains.org/idea/community.git
Diffstat (limited to 'samples')
-rw-r--r--samples/actions/actions.iml13
-rw-r--r--samples/actions/actions.ipr203
-rw-r--r--samples/actions/src/META-INF/plugin.xml59
-rw-r--r--samples/actions/src/icons/garbage.pngbin0 -> 1094 bytes
-rw-r--r--samples/actions/src/myActions/ActionsPlugin.java52
-rw-r--r--samples/actions/src/myActions/GarbageCollectionAction.java47
-rw-r--r--samples/actions/src/myActions/HelloWorldAction.java29
-rw-r--r--samples/applicationConfigurable/.idea/ant.xml7
-rw-r--r--samples/applicationConfigurable/.idea/compiler.xml24
-rw-r--r--samples/applicationConfigurable/.idea/copyright/profiles_settings.xml5
-rw-r--r--samples/applicationConfigurable/.idea/encodings.xml5
-rw-r--r--samples/applicationConfigurable/.idea/misc.xml27
-rw-r--r--samples/applicationConfigurable/.idea/modules.xml9
-rw-r--r--samples/applicationConfigurable/.idea/uiDesigner.xml125
-rw-r--r--samples/applicationConfigurable/.idea/vcs.xml7
-rw-r--r--samples/applicationConfigurable/META-INF/plugin.xml23
-rw-r--r--samples/applicationConfigurable/applicationConfigurable.iml13
-rw-r--r--samples/applicationConfigurable/src/META-INF/plugin.xml27
-rw-r--r--samples/applicationConfigurable/src/fontConfigurable/ImagesConfigurable.pngbin0 -> 1958 bytes
-rw-r--r--samples/applicationConfigurable/src/fontConfigurable/MyButtonListener.java39
-rw-r--r--samples/applicationConfigurable/src/fontConfigurable/MyExtensConfigurable.java88
-rw-r--r--samples/applicationConfigurable/src/fontConfigurable/MyUIForm.form65
-rw-r--r--samples/comparingReferences/comparingReferences.iml15
-rw-r--r--samples/comparingReferences/comparingReferences.ipr217
-rw-r--r--samples/comparingReferences/source/META-INF/plugin.xml14
-rw-r--r--samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesInspection.java152
-rw-r--r--samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesProvider.java10
-rw-r--r--samples/comparingReferences/source/inspectionDescriptions/ComparingReferences.html7
-rw-r--r--samples/comparingReferences/testData/before.after.java6
-rw-r--r--samples/comparingReferences/testData/before.java6
-rw-r--r--samples/comparingReferences/testData/before1.after.java6
-rw-r--r--samples/comparingReferences/testData/before1.java6
-rw-r--r--samples/comparingReferences/testSource/testPlugin/TestThisPlugin.java67
-rw-r--r--samples/conditionalOperatorConvertor/META-INF/plugin.xml27
-rw-r--r--samples/conditionalOperatorConvertor/conditionalOperatorConvertor.iml16
-rw-r--r--samples/conditionalOperatorConvertor/conditionalOperatorConvertor.ipr203
-rw-r--r--samples/conditionalOperatorConvertor/source/com/intellij/codeInsight/intention/ConditionalOperatorConvertor.java110
-rw-r--r--samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/after.java.template11
-rw-r--r--samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/before.java.template6
-rw-r--r--samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/description.html5
-rw-r--r--samples/conditionalOperatorConvertor/testData/before.template.after.java11
-rw-r--r--samples/conditionalOperatorConvertor/testData/before.template.java6
-rw-r--r--samples/conditionalOperatorConvertor/testSource/testPlugin/YourTest.java62
-rw-r--r--samples/plugin/build/build.xml28
-rw-r--r--samples/plugin/plugin.iml14
-rw-r--r--samples/plugin/plugin.ipr205
-rw-r--r--samples/plugin/readme.html91
-rw-r--r--samples/plugin/src/META-INF/plugin.xml29
-rw-r--r--samples/plugin/src/com/intellij/openapi/samples/DateTimeClass.java38
-rw-r--r--samples/plugin/src/com/intellij/openapi/samples/SampleApplicationPlugin.java61
-rw-r--r--samples/plugin/src/com/intellij/openapi/samples/SampleProjectPlugin.java65
-rw-r--r--samples/textEditor/src/META-INF/plugin.xml30
-rw-r--r--samples/textEditor/src/myDocumentFiles/MyActionClass.java18
-rw-r--r--samples/textEditor/src/myDocumentFiles/MyVisualPanel.java137
-rw-r--r--samples/textEditor/src/myDocumentFiles/OpenFileForm.form144
-rw-r--r--samples/textEditor/textEditor.iml13
-rw-r--r--samples/textEditor/textEditor.ipr203
-rw-r--r--samples/toolWindow/.idea/ant.xml7
-rw-r--r--samples/toolWindow/.idea/compiler.xml24
-rw-r--r--samples/toolWindow/.idea/copyright/profiles_settings.xml5
-rw-r--r--samples/toolWindow/.idea/encodings.xml5
-rw-r--r--samples/toolWindow/.idea/misc.xml47
-rw-r--r--samples/toolWindow/.idea/modules.xml9
-rw-r--r--samples/toolWindow/.idea/uiDesigner.xml125
-rw-r--r--samples/toolWindow/.idea/vcs.xml7
-rw-r--r--samples/toolWindow/src/META-INF/plugin.xml28
-rw-r--r--samples/toolWindow/src/myToolWindow/Calendar-icon.pngbin0 -> 2126 bytes
-rw-r--r--samples/toolWindow/src/myToolWindow/MyToolWindow.form63
-rw-r--r--samples/toolWindow/src/myToolWindow/MyToolWindowFactory.java79
-rw-r--r--samples/toolWindow/src/myToolWindow/Time-icon.pngbin0 -> 3320 bytes
-rw-r--r--samples/toolWindow/src/myToolWindow/Time-zone-icon.pngbin0 -> 3925 bytes
-rw-r--r--samples/toolWindow/toolWindow.iml13
-rw-r--r--samples/vfs/src/META-INF/plugin.xml27
-rw-r--r--samples/vfs/src/myVFS/VfsSamplePlugin.java111
-rw-r--r--samples/vfs/vfs.iml13
-rw-r--r--samples/vfs/vfs.ipr244
76 files changed, 3713 insertions, 0 deletions
diff --git a/samples/actions/actions.iml b/samples/actions/actions.iml
new file mode 100644
index 000000000000..09647c68eae8
--- /dev/null
+++ b/samples/actions/actions.iml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PLUGIN_MODULE" version="4">
+ <component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/src/META-INF/plugin.xml" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="jdk" jdkName="IDEA IC-96.1068" jdkType="IDEA JDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/samples/actions/actions.ipr b/samples/actions/actions.ipr
new file mode 100644
index 000000000000..100a83133f7d
--- /dev/null
+++ b/samples/actions/actions.ipr
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ <entry name="?*.ftl" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+ <component name="CopyrightManager" default="">
+ <module2copyright />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="Git.Settings">
+ <option name="GIT_EXECUTABLE" value="C:\Program Files (x86)\Git\bin\git.exe" />
+ <option name="CHECKOUT_INCLUDE_TAGS" value="false" />
+ <option name="UPDATE_CHANGES_POLICY" value="STASH" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/actions.iml" filepath="$PROJECT_DIR$/actions.iml" />
+ </modules>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA IC-96.1068" project-jdk-type="IDEA JDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+ <component name="SvnConfiguration" maxAnnotateRevisions="500">
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="LAST_MERGED_REVISION" />
+ <option name="UPDATE_RUN_STATUS" value="false" />
+ <option name="MERGE_DRY_RUN" value="false" />
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
+ <option name="DETECT_NESTED_COPIES" value="true" />
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
+ </component>
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+</project>
+
diff --git a/samples/actions/src/META-INF/plugin.xml b/samples/actions/src/META-INF/plugin.xml
new file mode 100644
index 000000000000..003606ef6912
--- /dev/null
+++ b/samples/actions/src/META-INF/plugin.xml
@@ -0,0 +1,59 @@
+<idea-plugin>
+ <!-- Plugin name -->
+ <name>ActionsSample</name>
+
+ <!-- Description -->
+ <description>Sample plugin which demonstrates integration with IntelliJ IDEA action system</description>
+
+ <!-- Plugin version -->
+ <version>1.0</version>
+
+ <!-- Plugin's vendor -->
+ <vendor>IntelliJ</vendor>
+
+ <!-- the IDEA build number which works with plugin -->
+ <!--
+ <idea-version since-build="2000" />
+ -->
+ <!-- Plugin's application components -->
+ <application-components>
+ <component>
+ <!-- Component's implementation class -->
+ <implementation-class>myActions.ActionsPlugin</implementation-class>
+
+ <!-- Component's interface class -->
+ <interface-class>myActions.ActionsPlugin</interface-class>
+ </component>
+ </application-components>
+
+ <!-- Component's actions -->
+ <actions>
+ <!-- We use "PluginName.ComponentName.ActionName" notation for "id" to avoid conflicts -->
+ <action id="ActionsSample.ActionsPlugin.GarbageCollection" class="myActions.GarbageCollectionAction" text="Collect _garbage" description="Run garbage collector">
+ <keyboard-shortcut first-keystroke="control alt G" second-keystroke="C" keymap="$default"/>
+ <mouse-shortcut keystroke="ctrl alt button2" keymap="$default"/>
+ </action>
+
+ <action id="Actions.ActionsPlugin.HelloWorld1" class="myActions.HelloWorldAction" text="Hello World" icon ="/general/add.png" description=""/>
+
+ <group id="Actions.ActionsPlugin.SampleGroup" text="Sample _Menu" description="Sample group">
+ <reference ref="ActionsSample.ActionsPlugin.GarbageCollection"/>
+ <separator/>
+ <reference ref="Actions.ActionsPlugin.HelloWorld1"/>
+
+ <!--adds this group to the main menu-->
+ <add-to-group group-id="MainMenu" anchor="last"/>
+ <!--adds this group to the main toolbar before the Help action-->
+ <add-to-group group-id="MainToolBar" anchor="before" relative-to-action="HelpTopics"/>
+ </group>
+
+ <!--the group below contains only the "Hello World" action defined above -->
+ <group>
+ <reference ref="Actions.ActionsPlugin.HelloWorld1"/>
+ <!--the group is added to the editor popup menu-->
+ <add-to-group group-id="EditorPopupMenu" anchor="after" relative-to-action="CutCopyPasteGroup"/>
+ </group>
+
+ </actions>
+
+</idea-plugin>
diff --git a/samples/actions/src/icons/garbage.png b/samples/actions/src/icons/garbage.png
new file mode 100644
index 000000000000..a132055329a8
--- /dev/null
+++ b/samples/actions/src/icons/garbage.png
Binary files differ
diff --git a/samples/actions/src/myActions/ActionsPlugin.java b/samples/actions/src/myActions/ActionsPlugin.java
new file mode 100644
index 000000000000..a5829933f0df
--- /dev/null
+++ b/samples/actions/src/myActions/ActionsPlugin.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2000-2005 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 myActions;
+
+
+import com.intellij.openapi.components.ApplicationComponent;
+
+/**
+ * <h3>SampleApplicationPlugin</h3>
+ *
+ * Application level plugin sample showing IDEA <b>OpenAPI</b> basics.<br>
+ * Implements <code>ApplicationComponent</code> interface.
+ *
+ */
+public class ActionsPlugin implements ApplicationComponent {
+
+ /**
+ * Method is called after plugin is already created and configured. Plugin can start to communicate with
+ * other plugins only in this method.
+ */
+ public void initComponent() {
+ }
+
+ /**
+ * This method is called on plugin disposal.
+ */
+ public void disposeComponent() {
+ }
+
+ /**
+ * Returns the name of component
+ *
+ * @return String representing component name. Use PluginName.ComponentName notation
+ * to avoid conflicts.
+ */
+ public String getComponentName() {
+ return "ActionsSample.ActionsPlugin";
+ }
+}
diff --git a/samples/actions/src/myActions/GarbageCollectionAction.java b/samples/actions/src/myActions/GarbageCollectionAction.java
new file mode 100644
index 000000000000..eb095665c1d0
--- /dev/null
+++ b/samples/actions/src/myActions/GarbageCollectionAction.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2000-2005 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 myActions;
+
+import com.intellij.openapi.actionSystem.ActionPlaces;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.Presentation;
+
+import javax.swing.*;
+
+public class GarbageCollectionAction extends AnAction {
+ private ImageIcon myIcon;
+
+ public GarbageCollectionAction() {
+ super("GC", "Run garbage collection", null);
+ }
+
+ public void actionPerformed(AnActionEvent event) {
+ System.gc();
+ }
+
+ public void update(AnActionEvent event) {
+ super.update(event);
+ Presentation presentation = event.getPresentation();
+ if (ActionPlaces.MAIN_TOOLBAR.equals(event.getPlace())) {
+ if (myIcon == null) {
+ java.net.URL resource = GarbageCollectionAction.class.getResource("/icons/garbage.png");
+ myIcon = new ImageIcon(resource);
+ }
+ presentation.setIcon(myIcon);
+ }
+ }
+}
diff --git a/samples/actions/src/myActions/HelloWorldAction.java b/samples/actions/src/myActions/HelloWorldAction.java
new file mode 100644
index 000000000000..cc3623b0f132
--- /dev/null
+++ b/samples/actions/src/myActions/HelloWorldAction.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2000-2005 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 myActions;
+
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.PlatformDataKeys;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
+
+public class HelloWorldAction extends AnAction {
+ public void actionPerformed(AnActionEvent event) {
+ // Project project = event.getData(PlatformDataKeys.PROJECT);
+ Messages.showMessageDialog("Hello World!", "Information", Messages.getInformationIcon());
+ }
+}
diff --git a/samples/applicationConfigurable/.idea/ant.xml b/samples/applicationConfigurable/.idea/ant.xml
new file mode 100644
index 000000000000..2581ca3fe84c
--- /dev/null
+++ b/samples/applicationConfigurable/.idea/ant.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+</project>
+
diff --git a/samples/applicationConfigurable/.idea/compiler.xml b/samples/applicationConfigurable/.idea/compiler.xml
new file mode 100644
index 000000000000..97c9ca5c8b0a
--- /dev/null
+++ b/samples/applicationConfigurable/.idea/compiler.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ <entry name="?*.ftl" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+</project>
+
diff --git a/samples/applicationConfigurable/.idea/copyright/profiles_settings.xml b/samples/applicationConfigurable/.idea/copyright/profiles_settings.xml
new file mode 100644
index 000000000000..3572571ad83c
--- /dev/null
+++ b/samples/applicationConfigurable/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,5 @@
+<component name="CopyrightManager">
+ <settings default="">
+ <module2copyright />
+ </settings>
+</component> \ No newline at end of file
diff --git a/samples/applicationConfigurable/.idea/encodings.xml b/samples/applicationConfigurable/.idea/encodings.xml
new file mode 100644
index 000000000000..e206d70d8595
--- /dev/null
+++ b/samples/applicationConfigurable/.idea/encodings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+
diff --git a/samples/applicationConfigurable/.idea/misc.xml b/samples/applicationConfigurable/.idea/misc.xml
new file mode 100644
index 000000000000..47c15629633a
--- /dev/null
+++ b/samples/applicationConfigurable/.idea/misc.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA IC-96.705" project-jdk-type="IDEA JDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+</project>
+
diff --git a/samples/applicationConfigurable/.idea/modules.xml b/samples/applicationConfigurable/.idea/modules.xml
new file mode 100644
index 000000000000..c1ce2c1e48e4
--- /dev/null
+++ b/samples/applicationConfigurable/.idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/applicationConfigurable.iml" filepath="$PROJECT_DIR$/applicationConfigurable.iml" />
+ </modules>
+ </component>
+</project>
+
diff --git a/samples/applicationConfigurable/.idea/uiDesigner.xml b/samples/applicationConfigurable/.idea/uiDesigner.xml
new file mode 100644
index 000000000000..3b0002030884
--- /dev/null
+++ b/samples/applicationConfigurable/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+</project>
+
diff --git a/samples/applicationConfigurable/.idea/vcs.xml b/samples/applicationConfigurable/.idea/vcs.xml
new file mode 100644
index 000000000000..def6a6a18457
--- /dev/null
+++ b/samples/applicationConfigurable/.idea/vcs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+</project>
+
diff --git a/samples/applicationConfigurable/META-INF/plugin.xml b/samples/applicationConfigurable/META-INF/plugin.xml
new file mode 100644
index 000000000000..cf40204e43d6
--- /dev/null
+++ b/samples/applicationConfigurable/META-INF/plugin.xml
@@ -0,0 +1,23 @@
+<idea-plugin version="2">
+ <name>Plugin name</name>
+ <description></description>
+ <version>1.0</version>
+ <vendor>YourCompany</vendor>
+ <idea-version since-build="8000"/>
+
+ <application-components>
+ <!-- Add your application components here -->
+ </application-components>
+
+ <project-components>
+ <!-- Add your project components here -->
+ </project-components>
+
+ <actions>
+ <!-- Add your actions here -->
+ </actions>
+
+ <extensions defaultExtensionNs="com.intellij">
+ <!-- Add your extensions here -->
+ </extensions>
+</idea-plugin> \ No newline at end of file
diff --git a/samples/applicationConfigurable/applicationConfigurable.iml b/samples/applicationConfigurable/applicationConfigurable.iml
new file mode 100644
index 000000000000..6bada6d4c479
--- /dev/null
+++ b/samples/applicationConfigurable/applicationConfigurable.iml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PLUGIN_MODULE" version="4">
+ <component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/src/META-INF/plugin.xml" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="jdk" jdkName="IDEA IC-96.705" jdkType="IDEA JDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/samples/applicationConfigurable/src/META-INF/plugin.xml b/samples/applicationConfigurable/src/META-INF/plugin.xml
new file mode 100644
index 000000000000..324a800cd437
--- /dev/null
+++ b/samples/applicationConfigurable/src/META-INF/plugin.xml
@@ -0,0 +1,27 @@
+<idea-plugin version="2">
+ <name>applicationConfigurable</name>
+ <description>This sample plugin illustrates how to contribute to the applicationConfigurable
+ extension point available in the IDEA core.
+ </description>
+ <version>1.0</version>
+ <vendor>JetBrains</vendor>
+ <!--
+ <idea-version since-build="8000"/>
+ -->
+ <application-components>
+ <!-- Add your application components here -->
+ </application-components>
+
+ <project-components>
+ <!-- Add your project components here -->
+ </project-components>
+
+ <actions>
+ <!-- Add your actions here -->
+ </actions>
+
+ <extensions defaultExtensionNs="com.intellij">
+ <!-- Add your extensions here -->
+ <applicationConfigurable implementation="fontConfigurable.MyExtensConfigurable"></applicationConfigurable>
+ </extensions>
+</idea-plugin> \ No newline at end of file
diff --git a/samples/applicationConfigurable/src/fontConfigurable/ImagesConfigurable.png b/samples/applicationConfigurable/src/fontConfigurable/ImagesConfigurable.png
new file mode 100644
index 000000000000..c9b4e307e4c3
--- /dev/null
+++ b/samples/applicationConfigurable/src/fontConfigurable/ImagesConfigurable.png
Binary files differ
diff --git a/samples/applicationConfigurable/src/fontConfigurable/MyButtonListener.java b/samples/applicationConfigurable/src/fontConfigurable/MyButtonListener.java
new file mode 100644
index 000000000000..87e4a624edb0
--- /dev/null
+++ b/samples/applicationConfigurable/src/fontConfigurable/MyButtonListener.java
@@ -0,0 +1,39 @@
+package fontConfigurable;
+
+import com.intellij.ide.ui.LafManager;
+import com.intellij.ide.ui.UISettings;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Alexey.Chursin
+ * Date: Aug 7, 2010
+ * Time: 9:36:45 PM
+ */
+public class MyButtonListener implements ActionListener {
+
+
+ public JComboBox myFontName;
+ public JComboBox myFontSize;
+
+
+ public void actionPerformed(ActionEvent e) {
+
+ UISettings settings = UISettings.getInstance();
+ LafManager lafManager = LafManager.getInstance();
+ // Restore default font
+ settings.FONT_FACE = "Segoe UI";
+ settings.FONT_SIZE = 12;
+ myFontName.setSelectedItem(settings.FONT_FACE);
+ myFontSize.setSelectedItem(String.valueOf(settings.FONT_SIZE));
+ settings.fireUISettingsChanged();
+ lafManager.updateUI();
+
+
+ }
+
+}
+
diff --git a/samples/applicationConfigurable/src/fontConfigurable/MyExtensConfigurable.java b/samples/applicationConfigurable/src/fontConfigurable/MyExtensConfigurable.java
new file mode 100644
index 000000000000..2d9b48277924
--- /dev/null
+++ b/samples/applicationConfigurable/src/fontConfigurable/MyExtensConfigurable.java
@@ -0,0 +1,88 @@
+package fontConfigurable;
+
+
+import com.intellij.ide.ui.LafManager;
+import com.intellij.ide.ui.UISettings;
+import com.intellij.openapi.options.Configurable;
+import com.intellij.util.ui.UIUtil;
+
+
+import javax.swing.*;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Alexey.Chursin
+ * Date: Jul 30, 2010
+ * Time: 5:59:43 PM
+ */
+public class MyExtensConfigurable implements Configurable {
+ private JComponent myComponent;
+ private JComboBox myFontName;
+ private JComboBox myFontSize;
+ private JButton MyDefaultFontButton;
+ private JPanel myPanel;
+
+ public String getDisplayName() {
+ return "Menu Font";
+ }
+
+ public boolean isModified() {
+
+
+ return true;
+ }
+
+ public JComponent createComponent() {
+ // Add listener to the Default Font button
+ MyButtonListener actionListener = new MyButtonListener();
+ actionListener.myFontName = myFontName;
+ actionListener.myFontSize = myFontSize;
+ MyDefaultFontButton.addActionListener(actionListener);
+ // Define a set of possible values for combo boxes.
+ UISettings settings = UISettings.getInstance();
+ myFontName.setModel(new DefaultComboBoxModel(UIUtil.getValidFontNames(false)));
+ myFontSize.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes()));
+ myFontName.setSelectedItem(settings.FONT_FACE);
+ myFontSize.setSelectedItem(String.valueOf(settings.FONT_SIZE));
+
+
+ myComponent = (JComponent) myPanel;
+ return myComponent;
+
+ }
+
+ public Icon getIcon() {
+ return null;
+
+ }
+
+ public void apply() {
+ UISettings settings = UISettings.getInstance();
+ LafManager lafManager = LafManager.getInstance();
+ String _fontFace = (String) myFontName.getSelectedItem();
+ String _fontSize_STR = (String) myFontSize.getSelectedItem();
+ int _fontSize = Integer.parseInt(_fontSize_STR);
+
+ if (_fontSize != settings.FONT_SIZE || !settings.FONT_FACE.equals(_fontFace)) {
+ settings.FONT_SIZE = _fontSize;
+ settings.FONT_FACE = _fontFace;
+ settings.fireUISettingsChanged();
+ lafManager.updateUI();
+ }
+
+ }
+
+ public void disposeUIResources() {
+
+ }
+
+ public String getHelpTopic() {
+ return "preferences.lookFeel";
+ }
+
+ public void reset() {
+
+ }
+
+
+}
diff --git a/samples/applicationConfigurable/src/fontConfigurable/MyUIForm.form b/samples/applicationConfigurable/src/fontConfigurable/MyUIForm.form
new file mode 100644
index 000000000000..12f0f51e12b6
--- /dev/null
+++ b/samples/applicationConfigurable/src/fontConfigurable/MyUIForm.form
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="fontConfigurable.MyExtensConfigurable">
+ <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="500" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="574ae" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <font name="Segoe UI" size="14"/>
+ <text value="Current menu font settings:"/>
+ </properties>
+ </component>
+ <component id="caf6b" class="javax.swing.JComboBox" binding="myFontName">
+ <constraints>
+ <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ </component>
+ <component id="cc83d" class="javax.swing.JComboBox" binding="myFontSize">
+ <constraints>
+ <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ </component>
+ <component id="d75e2" class="javax.swing.JButton" binding="MyDefaultFontButton">
+ <constraints>
+ <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
+ <maximum-size width="150" height="30"/>
+ </grid>
+ </constraints>
+ <properties>
+ <text value="Default Font"/>
+ </properties>
+ </component>
+ <vspacer id="e99c">
+ <constraints>
+ <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="20f5e" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Font name:"/>
+ </properties>
+ </component>
+ <component id="defdb" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Font size:"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+</form>
diff --git a/samples/comparingReferences/comparingReferences.iml b/samples/comparingReferences/comparingReferences.iml
new file mode 100644
index 000000000000..f38326667e00
--- /dev/null
+++ b/samples/comparingReferences/comparingReferences.iml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="PLUGIN_MODULE" version="4">
+ <component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/source/META-INF/plugin.xml" />
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/classes" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/source" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/testSource" isTestSource="true" />
+ </content>
+ <orderEntry type="jdk" jdkName="IDEA IC-96.1124" jdkType="IDEA JDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/samples/comparingReferences/comparingReferences.ipr b/samples/comparingReferences/comparingReferences.ipr
new file mode 100644
index 000000000000..001dcf91c3c5
--- /dev/null
+++ b/samples/comparingReferences/comparingReferences.ipr
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+ <component name="CopyrightManager" default="">
+ <module2copyright />
+ </component>
+ <component name="DependenciesAnalyzeManager">
+ <option name="myForwardDirection" value="false" />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="EntryPointsManager">
+ <entry_points />
+ </component>
+ <component name="ExportToHTMLSettings">
+ <option name="PRINT_LINE_NUMBERS" value="false" />
+ <option name="OPEN_IN_BROWSER" value="false" />
+ <option name="OUTPUT_DIRECTORY" />
+ </component>
+ <component name="InspectionProjectProfileManager">
+ <profiles>
+ <profile version="1.0" is_locked="false">
+ <option name="myName" value="Project Default" />
+ <option name="myLocal" value="false" />
+ <inspection_tool class="ComparingReferences" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="CHECKED_CLASSES" value="java.lang.String;java.util.Date;javax.swing.JDialog" />
+ </inspection_tool>
+ </profile>
+ </profiles>
+ <option name="PROJECT_PROFILE" value="Project Default" />
+ <option name="USE_PROJECT_PROFILE" value="true" />
+ <version value="1.0" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/comparingReferences.iml" filepath="$PROJECT_DIR$/comparingReferences.iml" />
+ </modules>
+ </component>
+ <component name="ProjectResources">
+ <default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA IC-96.1097" project-jdk-type="IDEA JDK" />
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ <mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
+ <mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
+ <mapping directory="$PROJECT_DIR$/../../../contrib" vcs="Git" />
+ </component>
+ <component name="copyright">
+ <option name="body" value="/*&#10; * Copyright (c) $today.year Your Corporation. All Rights Reserved.&#10; */" />
+ <option name="location" value="1" />
+ <option name="remove" value="true" />
+ <option name="replace" value="2" />
+ </component>
+</project>
+
diff --git a/samples/comparingReferences/source/META-INF/plugin.xml b/samples/comparingReferences/source/META-INF/plugin.xml
new file mode 100644
index 000000000000..36bf3d61f834
--- /dev/null
+++ b/samples/comparingReferences/source/META-INF/plugin.xml
@@ -0,0 +1,14 @@
+<idea-plugin version="2">
+ <name>Comparing References Inspection</name>
+ <description>Inspection for (probably) inappropriate use of equality relation operation.</description>
+ <version>1.0</version>
+ <vendor>JetBrains</vendor>
+ <!--
+ <idea-version since-build="3000"/>
+ -->
+
+ <extensions defaultExtensionNs="com.intellij">
+ <inspectionToolProvider implementation="com.intellij.codeInspection.ComparingReferencesProvider"/>
+ </extensions>
+
+</idea-plugin>
diff --git a/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesInspection.java b/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesInspection.java
new file mode 100644
index 000000000000..941fc702cae4
--- /dev/null
+++ b/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesInspection.java
@@ -0,0 +1,152 @@
+package com.intellij.codeInspection;
+
+import com.intellij.codeInsight.daemon.GroupNames;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Ref;
+import com.intellij.psi.*;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.ui.DocumentAdapter;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import javax.swing.event.DocumentEvent;
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.StringTokenizer;
+
+/**
+ * @author max
+ */
+public class ComparingReferencesInspection extends BaseJavaLocalInspectionTool {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ComparingReferencesInspection");
+
+ private final LocalQuickFix myQuickFix = new MyQuickFix();
+
+ @SuppressWarnings({"WeakerAccess"}) @NonNls public String CHECKED_CLASSES = "java.lang.String;java.util.Date";
+ @NonNls private static final String DESCRIPTION_TEMPLATE = InspectionsBundle.message("inspection.comparing.references.problem.descriptor");
+
+ @NotNull
+ public String getDisplayName() {
+
+ return "'==' or '!=' instead of 'equals()'";
+ }
+
+ @NotNull
+ public String getGroupDisplayName() {
+ return GroupNames.BUGS_GROUP_NAME;
+ }
+
+ @NotNull
+ public String getShortName() {
+ return "ComparingReferences";
+ }
+
+ private boolean isCheckedType(PsiType type) {
+ if (!(type instanceof PsiClassType)) return false;
+
+ StringTokenizer tokenizer = new StringTokenizer(CHECKED_CLASSES, ";");
+ while (tokenizer.hasMoreTokens()) {
+ String className = tokenizer.nextToken();
+ if (type.equalsToText(className)) return true;
+ }
+
+ return false;
+ }
+
+ @NotNull
+ @Override
+ public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
+ return new JavaElementVisitor() {
+
+ @Override
+ public void visitReferenceExpression(PsiReferenceExpression psiReferenceExpression) {
+ }
+
+
+ @Override public void visitBinaryExpression(PsiBinaryExpression expression) {
+ super.visitBinaryExpression(expression);
+ IElementType opSign = expression.getOperationTokenType();
+ if (opSign == JavaTokenType.EQEQ || opSign == JavaTokenType.NE) {
+ PsiExpression lOperand = expression.getLOperand();
+ PsiExpression rOperand = expression.getROperand();
+ if (rOperand == null || isNullLiteral(lOperand) || isNullLiteral(rOperand)) return;
+
+ PsiType lType = lOperand.getType();
+ PsiType rType = rOperand.getType();
+
+ if (isCheckedType(lType) || isCheckedType(rType)) {
+ holder.registerProblem(expression,
+ DESCRIPTION_TEMPLATE, myQuickFix);
+ }
+ }
+ }
+ };
+ }
+
+ private static boolean isNullLiteral(PsiExpression expr) {
+ return expr instanceof PsiLiteralExpression && "null".equals(expr.getText());
+ }
+
+ private static class MyQuickFix implements LocalQuickFix {
+ @NotNull
+ public String getName() {
+ // The test (see the TestThisPlugin class) uses this string to identify the quick fix action.
+ return InspectionsBundle.message("inspection.comparing.references.use.quickfix");
+ }
+
+
+ public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
+ try {
+ PsiBinaryExpression binaryExpression = (PsiBinaryExpression)descriptor.getPsiElement();
+ IElementType opSign = binaryExpression.getOperationTokenType();
+ PsiExpression lExpr = binaryExpression.getLOperand();
+ PsiExpression rExpr = binaryExpression.getROperand();
+ if (rExpr == null)
+ return;
+
+ PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
+ PsiMethodCallExpression equalsCall = (PsiMethodCallExpression)factory.createExpressionFromText("a.equals(b)", null);
+
+ equalsCall.getMethodExpression().getQualifierExpression().replace(lExpr);
+ equalsCall.getArgumentList().getExpressions()[0].replace(rExpr);
+
+ PsiExpression result = (PsiExpression)binaryExpression.replace(equalsCall);
+
+ if (opSign == JavaTokenType.NE) {
+ PsiPrefixExpression negation = (PsiPrefixExpression)factory.createExpressionFromText("!a", null);
+ negation.getOperand().replace(result);
+ result.replace(negation);
+ }
+ }
+ catch (IncorrectOperationException e) {
+ LOG.error(e);
+ }
+ }
+
+ @NotNull
+ public String getFamilyName() {
+ return getName();
+ }
+ }
+
+ public JComponent createOptionsPanel() {
+ JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ final JTextField checkedClasses = new JTextField(CHECKED_CLASSES);
+ checkedClasses.getDocument().addDocumentListener(new DocumentAdapter() {
+ public void textChanged(DocumentEvent event) {
+ CHECKED_CLASSES = checkedClasses.getText();
+ }
+ });
+
+ panel.add(checkedClasses);
+ return panel;
+ }
+
+ public boolean isEnabledByDefault() {
+ return true;
+ }
+}
diff --git a/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesProvider.java b/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesProvider.java
new file mode 100644
index 000000000000..37f091454ba2
--- /dev/null
+++ b/samples/comparingReferences/source/com/intellij/codeInspection/ComparingReferencesProvider.java
@@ -0,0 +1,10 @@
+package com.intellij.codeInspection;
+
+/**
+ * @author max
+ */
+public class ComparingReferencesProvider implements InspectionToolProvider {
+ public Class[] getInspectionClasses() {
+ return new Class[] { ComparingReferencesInspection.class};
+ }
+}
diff --git a/samples/comparingReferences/source/inspectionDescriptions/ComparingReferences.html b/samples/comparingReferences/source/inspectionDescriptions/ComparingReferences.html
new file mode 100644
index 000000000000..7c8ffd576c0f
--- /dev/null
+++ b/samples/comparingReferences/source/inspectionDescriptions/ComparingReferences.html
@@ -0,0 +1,7 @@
+<html>
+<body>
+<font face="verdana" size="-1">This inspection reports when the '==' or '!=' operator was used between expressions of
+reference types. <br>
+In the text field below, specify the semicolon separated list of classes to be considered as suspicious. </font>
+</body>
+</html>
diff --git a/samples/comparingReferences/testData/before.after.java b/samples/comparingReferences/testData/before.after.java
new file mode 100644
index 000000000000..a3058effc73d
--- /dev/null
+++ b/samples/comparingReferences/testData/before.after.java
@@ -0,0 +1,6 @@
+public class X {
+ public boolean compare2Strings(java.lang.String s1, java.lang.String s2) {
+ return (s1.equals(s2));
+ }
+
+} \ No newline at end of file
diff --git a/samples/comparingReferences/testData/before.java b/samples/comparingReferences/testData/before.java
new file mode 100644
index 000000000000..23095bcfa097
--- /dev/null
+++ b/samples/comparingReferences/testData/before.java
@@ -0,0 +1,6 @@
+public class X {
+ public boolean compare2Strings(java.lang.String s1, java.lang.String s2) {
+ return (<caret>s1 == s2);
+ }
+
+} \ No newline at end of file
diff --git a/samples/comparingReferences/testData/before1.after.java b/samples/comparingReferences/testData/before1.after.java
new file mode 100644
index 000000000000..acedf90e0537
--- /dev/null
+++ b/samples/comparingReferences/testData/before1.after.java
@@ -0,0 +1,6 @@
+public class X {
+public boolean compare2Dates(java.util.Date dt1, java.util.Date dt2){
+ return (!dt1.equals(dt2));
+ }
+
+} \ No newline at end of file
diff --git a/samples/comparingReferences/testData/before1.java b/samples/comparingReferences/testData/before1.java
new file mode 100644
index 000000000000..325c4ebf58df
--- /dev/null
+++ b/samples/comparingReferences/testData/before1.java
@@ -0,0 +1,6 @@
+public class X {
+public boolean compare2Dates(java.util.Date dt1, java.util.Date dt2){
+ return (dt1 <caret>!= dt2);
+ }
+
+} \ No newline at end of file
diff --git a/samples/comparingReferences/testSource/testPlugin/TestThisPlugin.java b/samples/comparingReferences/testSource/testPlugin/TestThisPlugin.java
new file mode 100644
index 000000000000..bf3769c2a43f
--- /dev/null
+++ b/samples/comparingReferences/testSource/testPlugin/TestThisPlugin.java
@@ -0,0 +1,67 @@
+package testPlugin;
+
+
+import com.intellij.codeInsight.daemon.impl.HighlightInfo;
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.codeInspection.ComparingReferencesInspection;
+import com.intellij.testFramework.UsefulTestCase;
+import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
+import com.intellij.testFramework.fixtures.*;
+import junit.framework.Assert;
+
+import java.util.List;
+
+/**
+ * @see JavaCodeInsightFixtureTestCase
+ * @see LightCodeInsightFixtureTestCase
+ */
+public class TestThisPlugin extends UsefulTestCase {
+
+ protected CodeInsightTestFixture myFixture;
+ // Specify path to your test data directory
+ // e.g. final String dataPath = "c:\\users\\john.doe\\idea\\community\\samples\\ComparingReferences/testData";
+ final String dataPath = "c:\\users\\John.Doe\\idea\\community\\samples\\comparingReferences/testData";
+
+
+ public void setUp() throws Exception {
+
+ final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
+ final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getName());
+ myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(testFixtureBuilder.getFixture());
+ myFixture.setTestDataPath(dataPath);
+ final JavaModuleFixtureBuilder builder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
+
+ builder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot("");
+ builder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
+ myFixture.setUp();
+ }
+
+ public void tearDown() throws Exception {
+ myFixture.tearDown();
+ myFixture = null;
+ }
+
+ protected void doTest(String testName, String hint) throws Throwable {
+ myFixture.configureByFile(testName + ".java");
+ myFixture.enableInspections(ComparingReferencesInspection.class);
+ List<HighlightInfo> highlightInfos = myFixture.doHighlighting();
+ Assert.assertTrue(!highlightInfos.isEmpty());
+
+ final IntentionAction action = myFixture.findSingleIntention(hint);
+
+ Assert.assertNotNull(action);
+ myFixture.launchAction(action);
+ myFixture.checkResultByFile(testName + ".after.java");
+ }
+
+ // Test the "==" case
+ public void test() throws Throwable {
+ doTest("before", "Use equals()");
+ }
+
+ // Test the "!=" case
+ public void test1() throws Throwable {
+ doTest("before1", "Use equals()");
+ }
+
+}
diff --git a/samples/conditionalOperatorConvertor/META-INF/plugin.xml b/samples/conditionalOperatorConvertor/META-INF/plugin.xml
new file mode 100644
index 000000000000..17c55b92a200
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/META-INF/plugin.xml
@@ -0,0 +1,27 @@
+<idea-plugin version="2">
+ <name>Conditional Operator Converter</name>
+ <id>ConditionalOperatorConverter</id>
+ <description>Intention action that suggests to convert a conditional operator into
+ 'if' block.
+ </description>
+ <version>1.3</version>
+ <vendor>JetBrains</vendor>
+ <!--
+ <idea-version since-build="2000"/>
+ -->
+
+ <extensions defaultExtensionNs="com.intellij">
+ <intentionAction>
+ <className>com.intellij.codeInsight.intention.ConditionalOperatorConvertor</className>
+ <category>Conditional Operator</category>
+ <descriptionDirectoryName>ConditionalOperatorConvertor</descriptionDirectoryName>
+
+ </intentionAction>
+ </extensions>
+
+ <project-components>
+ <component>
+ <implementation-class>com.intellij.codeInsight.intention.ConditionalOperatorConvertor</implementation-class>
+ </component>
+ </project-components>
+</idea-plugin>
diff --git a/samples/conditionalOperatorConvertor/conditionalOperatorConvertor.iml b/samples/conditionalOperatorConvertor/conditionalOperatorConvertor.iml
new file mode 100644
index 000000000000..16a756ac2d47
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/conditionalOperatorConvertor.iml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="PLUGIN_MODULE" version="4">
+ <component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/META-INF/plugin.xml" />
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/out" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/source" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/testSource" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/META-INF" isTestSource="false" />
+ </content>
+ <orderEntry type="jdk" jdkName="IDEA IC-96.1124" jdkType="IDEA JDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/samples/conditionalOperatorConvertor/conditionalOperatorConvertor.ipr b/samples/conditionalOperatorConvertor/conditionalOperatorConvertor.ipr
new file mode 100644
index 000000000000..dca74c112276
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/conditionalOperatorConvertor.ipr
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ <entry name="?*.template" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+ <component name="CopyrightManager" default="">
+ <module2copyright />
+ </component>
+ <component name="DependenciesAnalyzeManager">
+ <option name="myForwardDirection" value="false" />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="EntryPointsManager">
+ <entry_points />
+ </component>
+ <component name="ExportToHTMLSettings">
+ <option name="PRINT_LINE_NUMBERS" value="false" />
+ <option name="OPEN_IN_BROWSER" value="false" />
+ <option name="OUTPUT_DIRECTORY" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/conditionalOperatorConvertor.iml" filepath="$PROJECT_DIR$/conditionalOperatorConvertor.iml" />
+ </modules>
+ </component>
+ <component name="ProjectResources">
+ <default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA IC-96.1124" project-jdk-type="IDEA JDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+ <component name="copyright">
+ <option name="body" value="/*&#10; * Copyright (c) $today.year Your Corporation. All Rights Reserved.&#10; */" />
+ <option name="location" value="1" />
+ <option name="remove" value="true" />
+ <option name="replace" value="2" />
+ </component>
+</project>
+
diff --git a/samples/conditionalOperatorConvertor/source/com/intellij/codeInsight/intention/ConditionalOperatorConvertor.java b/samples/conditionalOperatorConvertor/source/com/intellij/codeInsight/intention/ConditionalOperatorConvertor.java
new file mode 100644
index 000000000000..ffee0ad54d4c
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/source/com/intellij/codeInsight/intention/ConditionalOperatorConvertor.java
@@ -0,0 +1,110 @@
+package com.intellij.codeInsight.intention;
+
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author dsl
+ */
+@NonNls public class ConditionalOperatorConvertor extends PsiElementBaseIntentionAction implements IntentionAction {
+
+ @NotNull
+ public String getText() {
+ return "Convert ternary operator to if statement";
+ }
+
+ @NotNull
+ public String getFamilyName() {
+ return getText();
+ }
+
+ public boolean isAvailable(@NotNull Project project, Editor editor, @Nullable PsiElement element) {
+ if (element == null) return false;
+ if (!element.isWritable()) return false;
+
+ if (element instanceof PsiJavaToken) {
+ final PsiJavaToken token = (PsiJavaToken)element;
+ if (token.getTokenType() != JavaTokenType.QUEST) return false;
+ if (token.getParent() instanceof PsiConditionalExpression) {
+ final PsiConditionalExpression conditionalExpression = (PsiConditionalExpression)token.getParent();
+ if (conditionalExpression.getThenExpression() == null
+ || conditionalExpression.getElseExpression() == null) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+ return false;
+ }
+
+ public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
+ final int offset = editor.getCaretModel().getOffset();
+ final PsiElement element = file.findElementAt(offset);
+ PsiConditionalExpression conditionalExpression = PsiTreeUtil.getParentOfType(element,
+ PsiConditionalExpression.class, false);
+ if (conditionalExpression == null) return;
+ if (conditionalExpression.getThenExpression() == null || conditionalExpression.getElseExpression() == null) return;
+
+ final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
+
+ PsiElement originalStatement = PsiTreeUtil.getParentOfType(conditionalExpression, PsiStatement.class, false);
+ while (originalStatement instanceof PsiForStatement) {
+ originalStatement = PsiTreeUtil.getParentOfType(originalStatement, PsiStatement.class, true);
+ }
+ if (originalStatement == null) return;
+
+ // Maintain declrations
+ if (originalStatement instanceof PsiDeclarationStatement) {
+ final PsiDeclarationStatement declaration = (PsiDeclarationStatement)originalStatement;
+ final PsiElement[] declaredElements = declaration.getDeclaredElements();
+ PsiLocalVariable variable = null;
+ for (PsiElement declaredElement : declaredElements) {
+ if (declaredElement instanceof PsiLocalVariable && PsiTreeUtil.isAncestor(declaredElement, conditionalExpression, true)) {
+ variable = (PsiLocalVariable)declaredElement;
+ break;
+ }
+ }
+ if (variable == null) return;
+ variable.normalizeDeclaration();
+ final Object marker = new Object();
+ PsiTreeUtil.mark(conditionalExpression, marker);
+ PsiExpressionStatement statement =
+ (PsiExpressionStatement)factory.createStatementFromText(variable.getName() + " = 0;", null);
+ statement = (PsiExpressionStatement)CodeStyleManager.getInstance(project).reformat(statement);
+ ((PsiAssignmentExpression)statement.getExpression()).getRExpression().replace(variable.getInitializer());
+ variable.getInitializer().delete();
+ final PsiElement variableParent = variable.getParent();
+ originalStatement = variableParent.getParent().addAfter(statement, variableParent);
+ conditionalExpression = (PsiConditionalExpression)PsiTreeUtil.releaseMark(originalStatement, marker);
+ }
+
+ // create then and else branches
+ final PsiElement[] originalElements = new PsiElement[]{originalStatement, conditionalExpression};
+ final PsiExpression condition = (PsiExpression)conditionalExpression.getCondition().copy();
+ final PsiElement[] thenElements = PsiTreeUtil.copyElements(originalElements);
+ final PsiElement[] elseElements = PsiTreeUtil.copyElements(originalElements);
+ thenElements[1].replace(conditionalExpression.getThenExpression());
+ elseElements[1].replace(conditionalExpression.getElseExpression());
+
+ PsiIfStatement statement = (PsiIfStatement)factory.createStatementFromText("if (true) { a = b } else { c = d }",
+ null);
+ statement = (PsiIfStatement)CodeStyleManager.getInstance(project).reformat(statement);
+ statement.getCondition().replace(condition);
+ statement = (PsiIfStatement)originalStatement.replace(statement);
+
+ ((PsiBlockStatement)statement.getThenBranch()).getCodeBlock().getStatements()[0].replace(thenElements[0]);
+ ((PsiBlockStatement)statement.getElseBranch()).getCodeBlock().getStatements()[0].replace(elseElements[0]);
+ }
+
+ public boolean startInWriteAction() {
+ return true;
+ }
+}
diff --git a/samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/after.java.template b/samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/after.java.template
new file mode 100644
index 000000000000..9cf0cf2d2222
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/after.java.template
@@ -0,0 +1,11 @@
+public class X {
+ void f(boolean isMale) {
+ String title;
+ if (isMale) {
+ title = "Mr.";
+ } else {
+ title = "Ms.";
+ }
+ System.out.println("title = " + title);
+ }
+}
diff --git a/samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/before.java.template b/samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/before.java.template
new file mode 100644
index 000000000000..ef611ed1c0e8
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/before.java.template
@@ -0,0 +1,6 @@
+public class X {
+ void f(boolean isMale) {
+ String title = isMale <spot>?</spot> "Mr." : "Ms.";
+ System.out.println("title = " + title);
+ }
+} \ No newline at end of file
diff --git a/samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/description.html b/samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/description.html
new file mode 100644
index 000000000000..3d6efdd8d7c5
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/source/intentionDescriptions/ConditionalOperatorConvertor/description.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+ This intention converts a ternary operator to a corresponding if statement. <br>
+</body>
+</html> \ No newline at end of file
diff --git a/samples/conditionalOperatorConvertor/testData/before.template.after.java b/samples/conditionalOperatorConvertor/testData/before.template.after.java
new file mode 100644
index 000000000000..6682628f7ea2
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/testData/before.template.after.java
@@ -0,0 +1,11 @@
+public class X {
+ void f(boolean isMale) {
+ String title;
+ if (isMale) {
+ title = "Mr.";
+ } else {
+ title = "Ms.";
+ }
+ System.out.println("title = " + title);
+ }
+} \ No newline at end of file
diff --git a/samples/conditionalOperatorConvertor/testData/before.template.java b/samples/conditionalOperatorConvertor/testData/before.template.java
new file mode 100644
index 000000000000..74107ea2d439
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/testData/before.template.java
@@ -0,0 +1,6 @@
+public class X {
+ void f(boolean isMale) {
+ String title = isMale <caret>? "Mr." : "Ms.";
+ System.out.println("title = " + title);
+ }
+} \ No newline at end of file
diff --git a/samples/conditionalOperatorConvertor/testSource/testPlugin/YourTest.java b/samples/conditionalOperatorConvertor/testSource/testPlugin/YourTest.java
new file mode 100644
index 000000000000..1b2114b71a4c
--- /dev/null
+++ b/samples/conditionalOperatorConvertor/testSource/testPlugin/YourTest.java
@@ -0,0 +1,62 @@
+package testPlugin;
+
+import com.intellij.codeInsight.intention.IntentionAction;
+
+import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
+import com.intellij.testFramework.fixtures.*;
+import junit.framework.Assert;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Alexey.Chursin
+ * Date: Sep 13, 2010
+ * Time: 9:35:50 PM
+ * To change this template use File | Settings | File Templates.
+ */
+
+public class YourTest {
+ protected CodeInsightTestFixture myFixture;
+ // Specify path to your test data
+ // e.g. final String dataPath = "c:\\users\\john.doe\\idea\\community\\samples\\conditionalOperatorConvertor/testData";
+ final String dataPath = "c:\\users\\John.Doe\\idea\\community\\samples\\conditionalOperatorConvertor/testData";
+
+ @Before
+
+ public void setUp() throws Exception {
+
+ final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
+ final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder();
+ myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(testFixtureBuilder.getFixture());
+ myFixture.setTestDataPath(dataPath);
+ final JavaModuleFixtureBuilder builder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
+
+ builder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot("");
+ builder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
+ myFixture.setUp();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ myFixture.tearDown();
+ myFixture = null;
+ }
+
+ protected void doTest(String testName, String hint) throws Throwable {
+ // Messages.showInfoMessage("Test started", "Info");
+ myFixture.configureByFile(testName + ".java");
+ final IntentionAction action = myFixture.findSingleIntention(hint);
+ Assert.assertNotNull(action);
+ myFixture.launchAction(action);
+ myFixture.checkResultByFile(testName + ".after.java");
+ }
+
+ @Test
+ public void test() throws Throwable {
+ doTest("before.template", "Convert ternary operator to if statement");
+ }
+
+}
diff --git a/samples/plugin/build/build.xml b/samples/plugin/build/build.xml
new file mode 100644
index 000000000000..1df611fe8348
--- /dev/null
+++ b/samples/plugin/build/build.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project name="deploy" default="jar_plugin" basedir="..">
+ <property name="plugname" value="Sample"/>
+ <property name="build.path" value="${project.path}/build_out"/>
+
+ <target name="jar_plugin">
+
+ <delete includeEmptyDirs="true" failonerror="false">
+ <fileset dir="${build.path}/com" />
+ <fileset dir="${build.path}/META-INF" />
+ </delete>
+
+ <mkdir dir="${build.path}"/>
+
+ <copy todir="${build.path}/META-INF">
+ <fileset dir="${project.path}/src/META-INF"/>
+ </copy>
+
+ <copy todir="${build.path}/com">
+ <fileset dir="${project.path}/classes/com"/>
+ </copy>
+
+ <jar jarfile="${build.path}/${plugname}.jar" basedir="${build.path}"
+ excludes="${plugname}.jar"
+ />
+
+ </target>
+</project> \ No newline at end of file
diff --git a/samples/plugin/plugin.iml b/samples/plugin/plugin.iml
new file mode 100644
index 000000000000..74945e395e44
--- /dev/null
+++ b/samples/plugin/plugin.iml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="PLUGIN_MODULE" version="4">
+ <component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/src/META-INF/plugin.xml" />
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/classes" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/samples/plugin/plugin.ipr b/samples/plugin/plugin.ipr
new file mode 100644
index 000000000000..b18429377f44
--- /dev/null
+++ b/samples/plugin/plugin.ipr
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+ <component name="CopyrightManager" default="">
+ <module2copyright />
+ </component>
+ <component name="DependenciesAnalyzeManager">
+ <option name="myForwardDirection" value="false" />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="EntryPointsManager">
+ <entry_points />
+ </component>
+ <component name="ExportToHTMLSettings">
+ <option name="PRINT_LINE_NUMBERS" value="false" />
+ <option name="OPEN_IN_BROWSER" value="false" />
+ <option name="OUTPUT_DIRECTORY" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="JikesSettings">
+ <option name="JIKES_PATH" value="" />
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="DEPRECATION" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="false" />
+ <option name="IS_EMACS_ERRORS_MODE" value="true" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ </component>
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/plugin.iml" filepath="$PROJECT_DIR$/plugin.iml" />
+ </modules>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" assert-keyword="false" jdk-15="false" project-jdk-name="IDEA IC-96.1068" project-jdk-type="IDEA JDK" />
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+ <component name="copyright">
+ <option name="body" value="/*&#10; * Copyright (c) $today.year Your Corporation. All Rights Reserved.&#10; */" />
+ <option name="location" value="1" />
+ <option name="remove" value="true" />
+ <option name="replace" value="2" />
+ </component>
+</project>
+
diff --git a/samples/plugin/readme.html b/samples/plugin/readme.html
new file mode 100644
index 000000000000..8c2698f8acae
--- /dev/null
+++ b/samples/plugin/readme.html
@@ -0,0 +1,91 @@
+<html>
+<title>Readme</title>
+<style type="text/css">
+.S0 {
+ font-family: Verdana;
+ color: #000000;
+ font-size: 10pt;
+}
+.S1 {
+ color: #000080;
+}
+.S3 {
+ color: #008080;
+}
+.S6 {
+ color: #7F007F;
+}
+.S8 {
+ color: #800080;
+}
+.S9 {
+ color: #808000;
+}
+.S11 {
+ color: #000080;
+}
+span {
+ font-family: Verdana;
+ font-size: 10pt;
+}
+</style>
+<body bgcolor="#FFFFFF">
+<h1>Installation</h1>
+<p>Every plugin should be placed to the IDEA_HOME\plugins folder. It may be in
+ jar or just a folder.<br>
+</p>
+<p>Plugin is in jar:</p>
+<pre>IDEA_HOME<br> Plugins
+ Sample.jar/
+ com.intellij.....
+ ...
+ ...
+ META-INF
+ plugin.xml
+</pre>
+<p><br>
+ Plugin is a folder: </p>
+<pre>IDEA_HOME<br> Plugins
+ Sample
+ lib
+ classes
+ com.intellij.....
+ ...
+ ...
+ META-INF
+ plugin.xml
+</pre>
+<p>Classes and lib folders are automatically added to the classpath.</p>
+<h1>Plugin configuration (plugin.xml)</h1>
+<p><span><span class="S1">&lt;idea-plugin&gt;</span><span class="S0"><br />
+ </span> <span class="S9">&lt;!-- plugin name --&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;</span><span class="S1">&lt;name&gt;</span><span class="S0">Sample</span><span class="S1">&lt;/name&gt;</span><span class="S0"><br />
+ </span> <span class="S9">&lt;!-- description --&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;</span><span class="S1">&lt;description&gt;</span><span class="S0">SamplePlugin</span><span class="S1">&lt;/description&gt;</span><span class="S0"><br />
+ </span> <span class="S9">&lt;!-- plugin versuin --&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;</span><span class="S1">&lt;version&gt;</span><span class="S0">1.0</span><span class="S1">&lt;/version&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;</span><span class="S1">&lt;vendor&gt;</span><span class="S0">IntelliJ</span><span class="S1">&lt;/vendor&gt;</span><span class="S0"><br />
+ </span> <span class="S9">&lt;!-- minimum and maximum IDEA version plugin is
+ supposed to work with --&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;</span><span class="S1">&lt;idea-version</span><span class="S8">
+ </span><span class="S3">min</span><span class="S8">=</span><span class="S6">"3.0"</span><span class="S8">
+ </span><span class="S3">max</span><span class="S8">=</span><span class="S6">"3.1"</span><span class="S11">/&gt;</span><span class="S0"><br />
+ </span> <span class="S9">&lt;!-- application components of the plugin --&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;</span><span class="S1">&lt;application-components&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S1">&lt;component&gt;</span><span class="S0"><br />
+ </span> <span class="S9">&lt;!-- component implementation class --&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S1">&lt;implementation-class&gt;</span><span class="S0">com.intellij.openapi.samples.SampleApplicationPlugin</span><span class="S1">&lt;/implementation-class&gt;</span><span class="S0"><br />
+ </span> <span class="S9">&lt;!-- component interface class --&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S1">&lt;interface-class&gt;</span><span class="S0">com.intellij.openapi.samples.SampleApplicationPlugin</span><span class="S1">&lt;/interface-class&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S1">&lt;/component&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;</span><span class="S1">&lt;/application-components&gt;</span><span class="S0"><br />
+ </span> <span class="S9">&lt;!-- project components of the plugin --&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;</span><span class="S1">&lt;project-components&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S1">&lt;component&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S1">&lt;implementation-class&gt;</span><span class="S0">com.intellij.openapi.samples.SampleProjectPlugin</span><span class="S1">&lt;/implementation-class&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S1">&lt;interface-class&gt;</span><span class="S0">com.intellij.openapi.samples.SampleProjectPlugin</span><span class="S1">&lt;/interface-class&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S1">&lt;/component&gt;</span><span class="S0"><br />
+ </span> <span class="S0">&nbsp;&nbsp;</span><span class="S1">&lt;/project-components&gt;</span><span class="S0"><br />
+ </span> <span class="S1">&lt;/idea-plugin&gt;</span></span> </p>
+</body>
+</html> \ No newline at end of file
diff --git a/samples/plugin/src/META-INF/plugin.xml b/samples/plugin/src/META-INF/plugin.xml
new file mode 100644
index 000000000000..e6d2cf0c7146
--- /dev/null
+++ b/samples/plugin/src/META-INF/plugin.xml
@@ -0,0 +1,29 @@
+<idea-plugin>
+<!-- plugin name -->
+ <name>Sample</name>
+<!-- description -->
+ <description>A minimalistic sample plugin for IntelliJ IDEA</description>
+<!-- plugin version -->
+ <version>1.0</version>
+ <vendor>IntelliJ</vendor>
+<!-- minimum IDEA build number with which the plugin is compatible -->
+ <!--
+ <idea-version since-build="2000"/>
+ -->
+<!-- application components of the plugin -->
+ <application-components>
+ <component>
+<!-- component implementation class -->
+ <implementation-class>com.intellij.openapi.samples.SampleApplicationPlugin</implementation-class>
+<!-- component interface class -->
+ <interface-class>com.intellij.openapi.samples.SampleApplicationPlugin</interface-class>
+ </component>
+ </application-components>
+<!-- project components of the plugin -->
+ <project-components>
+ <component>
+ <implementation-class>com.intellij.openapi.samples.SampleProjectPlugin</implementation-class>
+ <interface-class>com.intellij.openapi.samples.SampleProjectPlugin</interface-class>
+ </component>
+ </project-components>
+</idea-plugin>
diff --git a/samples/plugin/src/com/intellij/openapi/samples/DateTimeClass.java b/samples/plugin/src/com/intellij/openapi/samples/DateTimeClass.java
new file mode 100644
index 000000000000..23c4b3ce7174
--- /dev/null
+++ b/samples/plugin/src/com/intellij/openapi/samples/DateTimeClass.java
@@ -0,0 +1,38 @@
+package com.intellij.openapi.samples;
+
+import java.util.Calendar;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Alexey.Chursin
+ * Date: Sep 3, 2010
+ * Time: 3:48:51 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class DateTimeClass {
+ protected String currentDate;
+ protected String currentTime;
+
+ DateTimeClass(){
+ this.currentDateTime();
+ }
+
+ public void currentDateTime() {
+ // Get current date and time
+ Calendar instance = Calendar.getInstance();
+ currentDate =String.valueOf(instance.get(Calendar.DAY_OF_MONTH)) + "/"
+ + String.valueOf(instance.get(Calendar.MONTH) + 1) + "/" + String.valueOf(instance.get(Calendar.YEAR));
+ int min = instance.get(Calendar.MINUTE);
+ String strMin;
+ if (min < 10) {
+ strMin = "0" + String.valueOf(min);
+ } else {
+ strMin = String.valueOf(min);
+ }
+ currentTime=instance.get(Calendar.HOUR_OF_DAY) + ":" + strMin;
+
+
+
+ }
+
+}
diff --git a/samples/plugin/src/com/intellij/openapi/samples/SampleApplicationPlugin.java b/samples/plugin/src/com/intellij/openapi/samples/SampleApplicationPlugin.java
new file mode 100644
index 000000000000..29c7d3f3e8f6
--- /dev/null
+++ b/samples/plugin/src/com/intellij/openapi/samples/SampleApplicationPlugin.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2005 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.openapi.samples;
+
+
+import com.intellij.openapi.components.ApplicationComponent;
+import com.intellij.openapi.ui.Messages;
+
+
+
+
+/**
+ * <h3>SampleApplicationPlugin</h3>
+ * Application level plugin sample showing IDEA <b>OpenAPI</b> basics.<br>
+ * Implements <code>ApplicationComponent</code> interface.
+ */
+public class SampleApplicationPlugin implements ApplicationComponent {
+ /**
+ * Method is called after plugin is already created and configured. Plugin can start to communicate with
+ * other plugins only in this method.
+ *
+ */
+ public void initComponent() {
+ //System.out.println("SampleApplicationPlugin: initComponent");
+ DateTimeClass dateTime = new DateTimeClass();
+ Messages.showMessageDialog("Welcome to IntelliJ IDEA!\nToday: " +
+ dateTime.currentDate + " " + dateTime.currentTime, "IntelliJ IDEA",Messages.getInformationIcon() );
+ }
+
+ /**
+ * This method is called on plugin disposal.
+ */
+ public void disposeComponent() {
+ //System.out.println("SampleApplicationPlugin: disposeComponent");
+ Messages.showMessageDialog("Thank you for using IntelliJ IDEA!", "IntelliJ IDEA",Messages.getInformationIcon() );
+ }
+
+ /**
+ * Returns the name of component
+ * @return String representing component name. Use plugin_name.component_name notation.
+ */
+ public String getComponentName() {
+ return "Sample.SampleApplicationPlugin";
+ }
+
+
+
+}
diff --git a/samples/plugin/src/com/intellij/openapi/samples/SampleProjectPlugin.java b/samples/plugin/src/com/intellij/openapi/samples/SampleProjectPlugin.java
new file mode 100644
index 000000000000..5f1df56f0e9c
--- /dev/null
+++ b/samples/plugin/src/com/intellij/openapi/samples/SampleProjectPlugin.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2000-2005 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.openapi.samples;
+
+import com.intellij.openapi.components.ProjectComponent;
+import com.intellij.openapi.ui.Messages;
+
+/**
+ * <h3>SampleProjectPlugin</h3>
+ * Project level plugin sample showing IDEA <b>OpenAPI</b> basics.<br>
+ * Implements <code>ApplicationComponent</code> interface.
+ */
+public class SampleProjectPlugin implements ProjectComponent {
+ /**
+ * Method is called after plugin is already created and configured. Plugin can start to communicate with
+ * other plugins only in this method.
+ */
+ public void initComponent() {
+ //System.out.println("SampleProjectPlugin: initComponent");
+ }
+
+ /**
+ * This method is called on plugin disposal.
+ */
+ public void disposeComponent() {
+ //System.out.println("SampleProjectPlugin: disposeComponent");
+ }
+
+ /**
+ * Invoked when project is opened.
+ */
+ public void projectOpened() {
+ DateTimeClass dateTime = new DateTimeClass();
+ Messages.showMessageDialog("Project opened at " +
+ dateTime.currentDate + " " + dateTime.currentTime, "IntelliJ IDEA",Messages.getInformationIcon() );
+ }
+
+ /**
+ * Invoked when project is closed.
+ */
+ public void projectClosed() {
+ // System.out.println("SampleProjectPlugin: projectClosed");
+ }
+
+ /**
+ * Returns the name of component
+ * @return String representing component name. Use plugin_name.component_name notation.
+ */
+ public String getComponentName() {
+ return "Sample.SampleProjectPlugin";
+ }
+}
diff --git a/samples/textEditor/src/META-INF/plugin.xml b/samples/textEditor/src/META-INF/plugin.xml
new file mode 100644
index 000000000000..bfa824c31907
--- /dev/null
+++ b/samples/textEditor/src/META-INF/plugin.xml
@@ -0,0 +1,30 @@
+<idea-plugin version="2">
+ <name>Text Editor</name>
+ <description>This plugin illustrates how to create a simple text editor and work with document files.</description>
+ <version>1.0</version>
+ <vendor>JetBrains</vendor>
+ <!--
+ <idea-version since-build="8000"/>
+ -->
+ <application-components>
+ <!-- Add your application components here -->
+ </application-components>
+
+ <project-components>
+ <!-- Add your project components here -->
+
+ </project-components>
+
+ <actions>
+ <!-- Add your actions here -->
+ <action id="documentFiles.myActionID" class="myDocumentFiles.MyActionClass" text="Text _Editor"
+ description="Sample custom editor for text files">
+ <add-to-group group-id="FileMenu" anchor="after" relative-to-action="PowerSaveGroup"/>
+ <keyboard-shortcut keymap="$default" first-keystroke="ctrl F10"/>
+ </action>
+ </actions>
+
+ <extensions defaultExtensionNs="com.intellij">
+ <!-- Add your extensions here -->
+ </extensions>
+</idea-plugin> \ No newline at end of file
diff --git a/samples/textEditor/src/myDocumentFiles/MyActionClass.java b/samples/textEditor/src/myDocumentFiles/MyActionClass.java
new file mode 100644
index 000000000000..1f12da711a19
--- /dev/null
+++ b/samples/textEditor/src/myDocumentFiles/MyActionClass.java
@@ -0,0 +1,18 @@
+package myDocumentFiles;
+
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Alexey.Chursin
+ * Date: Aug 30, 2010
+ * Time: 6:29:02 PM
+ */
+public class MyActionClass extends AnAction {
+ public void actionPerformed(AnActionEvent e) {
+ MyVisualPanel myEditor = new MyVisualPanel(false);
+ myEditor.getPeer().setTitle("Sample Text File Editor");
+ myEditor.show();
+ }
+}
diff --git a/samples/textEditor/src/myDocumentFiles/MyVisualPanel.java b/samples/textEditor/src/myDocumentFiles/MyVisualPanel.java
new file mode 100644
index 000000000000..2a627a05af2a
--- /dev/null
+++ b/samples/textEditor/src/myDocumentFiles/MyVisualPanel.java
@@ -0,0 +1,137 @@
+package myDocumentFiles;
+
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+
+import javax.swing.*;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Alexey.Chursin
+ * Date: Aug 30, 2010
+ * Time: 1:42:38 PM
+ */
+public class MyVisualPanel extends DialogWrapper {
+ private JTabbedPane viewFileTab;
+ private JTextField fileName;
+ private JButton buttonBrowse;
+ private JTextField directoryName;
+ private JFileChooser fileChooser = new JFileChooser("");
+ private VirtualFile selectedVFile;
+ private Document docFile;
+ // Set maximum allowed number of lines in a text file to edit.
+ private final int maxNumberofLines = 250;
+
+
+ private JPanel myVisualUI;
+ private JEditorPane myFileEditor;
+ private JPanel viewFilePanel;
+ private String initialFileContent = null;
+ private boolean nFocus;
+
+
+ public MyVisualPanel(boolean canBeParent) {
+ super(canBeParent);
+ init();
+
+
+ // The Browse button listener.
+ buttonBrowse.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+
+ if (OpenFile()) {
+ if (docFile.getLineCount() > maxNumberofLines) {
+ Messages.showMessageDialog("File too long! Maximum allowed number of lines: " +
+ String.valueOf(maxNumberofLines) + ".\n"+
+ "To change this setting, modify the MyVisualPanel.maxNumberofLines field.", "Error", Messages.getErrorIcon());
+ return;
+ }
+ // Read the text file content.
+ initialFileContent = docFile.getText();
+ // Enable the View File tab
+ viewFileTab.setEnabled(true);
+ // Fill the "File name" and "Directory" text fields.
+ fileName.setText(selectedVFile.getName());
+ directoryName.setText(selectedVFile.getParent().getUrl());
+ myFileEditor.setText(initialFileContent);
+ }
+
+
+ }
+ });
+
+ // The file editor focus listener.
+ myFileEditor.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ if (!docFile.isWritable() && nFocus) {
+ nFocus = false;
+ Messages.showMessageDialog("This file is read-only. You cannot save your changes.", "Warning",
+ Messages.getWarningIcon());
+ return;
+
+ } else return;
+ }
+ });
+ }
+
+ // Display the Open dialog and open the selected file.
+ public boolean OpenFile() {
+ FileNameExtensionFilter filter = new FileNameExtensionFilter("Text files", "txt");
+ fileChooser.setFileFilter(filter);
+ //... Open a file dialog.
+ int retval = fileChooser.showOpenDialog(null);
+ if (retval == JFileChooser.APPROVE_OPTION) {
+ // Get virtual file
+ selectedVFile = LocalFileSystem.getInstance().findFileByIoFile(fileChooser.getSelectedFile());
+ // Get document file
+ docFile = FileDocumentManager.getInstance().getDocument(selectedVFile);
+ nFocus = true;
+
+ return true;
+ }
+ viewFilePanel.setEnabled(false);
+ return false;
+ }
+
+
+ public JComponent createCenterPanel() {
+
+ return (JComponent) myVisualUI;
+
+ }
+ // The OK button handler.
+ protected void doOKAction() {
+ if (initialFileContent == null) {
+ this.close(0);
+ return;
+ }
+ if (!initialFileContent.equals(myFileEditor.getText())) {
+ if (Messages.showYesNoDialog("The file " + selectedVFile.getName() +
+ " has been changed. Are you sure you want to overwrite it?", "File Changed", Messages.getQuestionIcon()) == 0) {
+ if (docFile.isWritable()) {
+ docFile.setText(myFileEditor.getText());
+ } else {
+ Messages.showMessageDialog("This file is read-only! You cannot save your changes.", "Error", Messages.getErrorIcon());
+ return;
+ }
+
+
+ } else return;
+ }
+
+ this.close(0);
+ this.dispose();
+
+
+ }
+
+}
diff --git a/samples/textEditor/src/myDocumentFiles/OpenFileForm.form b/samples/textEditor/src/myDocumentFiles/OpenFileForm.form
new file mode 100644
index 000000000000..87939cdd951b
--- /dev/null
+++ b/samples/textEditor/src/myDocumentFiles/OpenFileForm.form
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="myDocumentFiles.MyVisualPanel">
+ <grid id="27dc6" binding="myVisualUI" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="1176" height="400"/>
+ </constraints>
+ <properties>
+ <name value=""/>
+ <visible value="true"/>
+ </properties>
+ <border type="none" title-justification="2" title-position="1"/>
+ <children>
+ <tabbedpane id="7b4c" class="com.intellij.ui.components.JBTabbedPane" binding="viewFileTab">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
+ <preferred-size width="200" height="200"/>
+ </grid>
+ </constraints>
+ <properties>
+ <enabled value="false"/>
+ <inheritsPopupMenu value="false"/>
+ <name value="ffff"/>
+ </properties>
+ <border type="none"/>
+ <children>
+ <grid id="57ce9" layout-manager="GridLayoutManager" row-count="5" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <tabbedpane title="Open File"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <vspacer id="32d8d">
+ <constraints>
+ <grid row="4" column="3" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="89e63" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="File name:"/>
+ </properties>
+ </component>
+ <component id="a784e" class="javax.swing.JTextField" binding="fileName">
+ <constraints>
+ <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <preferred-size width="300" height="-1"/>
+ <maximum-size width="300" height="30"/>
+ </grid>
+ </constraints>
+ <properties>
+ <background color="-2697514"/>
+ <enabled value="false"/>
+ <text value=""/>
+ </properties>
+ </component>
+ <hspacer id="7e5cb">
+ <constraints>
+ <grid row="3" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </hspacer>
+ <component id="b3f9e" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Directory name:"/>
+ </properties>
+ </component>
+ <component id="1bada" class="javax.swing.JTextField" binding="directoryName">
+ <constraints>
+ <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <preferred-size width="300" height="-1"/>
+ <maximum-size width="300" height="30"/>
+ </grid>
+ </constraints>
+ <properties>
+ <background color="-2697514"/>
+ <enabled value="false"/>
+ <text value=""/>
+ </properties>
+ </component>
+ <component id="37758" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Click Browse to select a text file. To view/edit file, open the View File tab. "/>
+ </properties>
+ </component>
+ <vspacer id="4385">
+ <constraints>
+ <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="ab2fa" class="javax.swing.JButton" binding="buttonBrowse">
+ <constraints>
+ <grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Browse"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+ <grid id="c2756" binding="viewFilePanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <tabbedpane title="View File"/>
+ </constraints>
+ <properties>
+ <enabled value="false"/>
+ </properties>
+ <border type="none"/>
+ <children>
+ <vspacer id="ad8c6">
+ <constraints>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <scrollpane id="ecde2">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="6cada" class="javax.swing.JEditorPane" binding="myFileEditor">
+ <constraints/>
+ <properties/>
+ </component>
+ </children>
+ </scrollpane>
+ </children>
+ </grid>
+ </children>
+ </tabbedpane>
+ </children>
+ </grid>
+</form>
diff --git a/samples/textEditor/textEditor.iml b/samples/textEditor/textEditor.iml
new file mode 100644
index 000000000000..09647c68eae8
--- /dev/null
+++ b/samples/textEditor/textEditor.iml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PLUGIN_MODULE" version="4">
+ <component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/src/META-INF/plugin.xml" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="jdk" jdkName="IDEA IC-96.1068" jdkType="IDEA JDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/samples/textEditor/textEditor.ipr b/samples/textEditor/textEditor.ipr
new file mode 100644
index 000000000000..a3de060824a2
--- /dev/null
+++ b/samples/textEditor/textEditor.ipr
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ <entry name="?*.ftl" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+ <component name="CopyrightManager" default="">
+ <module2copyright />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="Git.Settings">
+ <option name="GIT_EXECUTABLE" value="C:\Program Files (x86)\Git\bin\git.exe" />
+ <option name="CHECKOUT_INCLUDE_TAGS" value="false" />
+ <option name="UPDATE_CHANGES_POLICY" value="STASH" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/textEditor.iml" filepath="$PROJECT_DIR$/textEditor.iml" />
+ </modules>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA IC-96.1068" project-jdk-type="IDEA JDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+ <component name="SvnConfiguration" maxAnnotateRevisions="500">
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="LAST_MERGED_REVISION" />
+ <option name="UPDATE_RUN_STATUS" value="false" />
+ <option name="MERGE_DRY_RUN" value="false" />
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
+ <option name="DETECT_NESTED_COPIES" value="true" />
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
+ </component>
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+</project>
+
diff --git a/samples/toolWindow/.idea/ant.xml b/samples/toolWindow/.idea/ant.xml
new file mode 100644
index 000000000000..2581ca3fe84c
--- /dev/null
+++ b/samples/toolWindow/.idea/ant.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+</project>
+
diff --git a/samples/toolWindow/.idea/compiler.xml b/samples/toolWindow/.idea/compiler.xml
new file mode 100644
index 000000000000..97c9ca5c8b0a
--- /dev/null
+++ b/samples/toolWindow/.idea/compiler.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ <entry name="?*.ftl" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+</project>
+
diff --git a/samples/toolWindow/.idea/copyright/profiles_settings.xml b/samples/toolWindow/.idea/copyright/profiles_settings.xml
new file mode 100644
index 000000000000..3572571ad83c
--- /dev/null
+++ b/samples/toolWindow/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,5 @@
+<component name="CopyrightManager">
+ <settings default="">
+ <module2copyright />
+ </settings>
+</component> \ No newline at end of file
diff --git a/samples/toolWindow/.idea/encodings.xml b/samples/toolWindow/.idea/encodings.xml
new file mode 100644
index 000000000000..e206d70d8595
--- /dev/null
+++ b/samples/toolWindow/.idea/encodings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+
diff --git a/samples/toolWindow/.idea/misc.xml b/samples/toolWindow/.idea/misc.xml
new file mode 100644
index 000000000000..f10bc702e278
--- /dev/null
+++ b/samples/toolWindow/.idea/misc.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Git.Settings">
+ <option name="GIT_EXECUTABLE" value="C:\Program Files (x86)\Git\bin\git.exe" />
+ <option name="CHECKOUT_INCLUDE_TAGS" value="false" />
+ <option name="UPDATE_CHANGES_POLICY" value="STASH" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA IC-96.1068" project-jdk-type="IDEA JDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+ <component name="SvnConfiguration" maxAnnotateRevisions="500">
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="LAST_MERGED_REVISION" />
+ <option name="UPDATE_RUN_STATUS" value="false" />
+ <option name="MERGE_DRY_RUN" value="false" />
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
+ <option name="DETECT_NESTED_COPIES" value="true" />
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
+ </component>
+</project>
+
diff --git a/samples/toolWindow/.idea/modules.xml b/samples/toolWindow/.idea/modules.xml
new file mode 100644
index 000000000000..77f0f0f79aaa
--- /dev/null
+++ b/samples/toolWindow/.idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/toolWindow.iml" filepath="$PROJECT_DIR$/toolWindow.iml" />
+ </modules>
+ </component>
+</project>
+
diff --git a/samples/toolWindow/.idea/uiDesigner.xml b/samples/toolWindow/.idea/uiDesigner.xml
new file mode 100644
index 000000000000..3b0002030884
--- /dev/null
+++ b/samples/toolWindow/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+</project>
+
diff --git a/samples/toolWindow/.idea/vcs.xml b/samples/toolWindow/.idea/vcs.xml
new file mode 100644
index 000000000000..def6a6a18457
--- /dev/null
+++ b/samples/toolWindow/.idea/vcs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+</project>
+
diff --git a/samples/toolWindow/src/META-INF/plugin.xml b/samples/toolWindow/src/META-INF/plugin.xml
new file mode 100644
index 000000000000..0f5f27fc04c8
--- /dev/null
+++ b/samples/toolWindow/src/META-INF/plugin.xml
@@ -0,0 +1,28 @@
+<idea-plugin version="2">
+ <name>Tool Window</name>
+ <description>This sample plugin illustrates how to create your custom tool window.</description>
+ <version>1.0</version>
+ <vendor>JetBrains</vendor>
+ <!--
+ <idea-version since-build="8000"/>
+ -->
+ <application-components>
+ <!-- Add your application components here -->
+ </application-components>
+
+ <project-components>
+ <!-- Add your project components here -->
+
+ </project-components>
+
+ <actions>
+ <!-- Add your actions here -->
+ </actions>
+
+ <extensions defaultExtensionNs="com.intellij">
+ <!-- Add your extensions here -->
+ <toolWindow id="Sample Calendar" secondary="true" icon="/general/add.png" anchor="right" factoryClass="myToolWindow.MyToolWindowFactory" >
+
+ </toolWindow>
+ </extensions>
+</idea-plugin> \ No newline at end of file
diff --git a/samples/toolWindow/src/myToolWindow/Calendar-icon.png b/samples/toolWindow/src/myToolWindow/Calendar-icon.png
new file mode 100644
index 000000000000..4d8110fd62c0
--- /dev/null
+++ b/samples/toolWindow/src/myToolWindow/Calendar-icon.png
Binary files differ
diff --git a/samples/toolWindow/src/myToolWindow/MyToolWindow.form b/samples/toolWindow/src/myToolWindow/MyToolWindow.form
new file mode 100644
index 000000000000..515e60337889
--- /dev/null
+++ b/samples/toolWindow/src/myToolWindow/MyToolWindow.form
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="myToolWindow.MyToolWindowFactory">
+ <grid id="27dc6" binding="myToolWindowContent" layout-manager="GridLayoutManager" row-count="2" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="500" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="9aa3f" class="javax.swing.JLabel" binding="currentDate">
+ <constraints>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Date"/>
+ </properties>
+ </component>
+ <component id="44be3" class="javax.swing.JLabel" binding="timeZone">
+ <constraints>
+ <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="TimeZone"/>
+ </properties>
+ </component>
+ <component id="f02af" class="javax.swing.JLabel" binding="currentTime">
+ <constraints>
+ <grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Time"/>
+ </properties>
+ </component>
+ <component id="5fceb" class="javax.swing.JButton" binding="refreshToolWindowButton">
+ <constraints>
+ <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Refresh"/>
+ </properties>
+ </component>
+ <component id="3edc1" class="javax.swing.JButton" binding="hideToolWindowButton">
+ <constraints>
+ <grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Hide"/>
+ </properties>
+ </component>
+ <hspacer id="8bf9c">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </hspacer>
+ <hspacer id="26841">
+ <constraints>
+ <grid row="1" column="4" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </hspacer>
+ </children>
+ </grid>
+</form>
diff --git a/samples/toolWindow/src/myToolWindow/MyToolWindowFactory.java b/samples/toolWindow/src/myToolWindow/MyToolWindowFactory.java
new file mode 100644
index 000000000000..2800ad4d9417
--- /dev/null
+++ b/samples/toolWindow/src/myToolWindow/MyToolWindowFactory.java
@@ -0,0 +1,79 @@
+package myToolWindow;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.wm.ToolWindow;
+import com.intellij.openapi.wm.ToolWindowFactory;
+import com.intellij.ui.content.Content;
+import com.intellij.ui.content.ContentFactory;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Alexey.Chursin
+ * Date: Aug 25, 2010
+ * Time: 2:09:00 PM
+ */
+public class MyToolWindowFactory implements ToolWindowFactory {
+
+ private JButton refreshToolWindowButton;
+ private JButton hideToolWindowButton;
+ private JLabel currentDate;
+ private JLabel currentTime;
+ private JLabel timeZone;
+ private JPanel myToolWindowContent;
+ private ToolWindow myToolWindow;
+
+
+ public MyToolWindowFactory() {
+ hideToolWindowButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ myToolWindow.hide(null);
+ }
+ });
+ refreshToolWindowButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ MyToolWindowFactory.this.currentDateTime();
+ }
+ });
+ }
+
+ // Create the tool window content.
+ public void createToolWindowContent(Project project, ToolWindow toolWindow) {
+ myToolWindow = toolWindow;
+ this.currentDateTime();
+ ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
+ Content content = contentFactory.createContent(myToolWindowContent, "", false);
+ toolWindow.getContentManager().addContent(content);
+
+ }
+
+ public void currentDateTime() {
+ // Get current date and time
+ Calendar instance = Calendar.getInstance();
+ currentDate.setText(String.valueOf(instance.get(Calendar.DAY_OF_MONTH)) + "/"
+ + String.valueOf(instance.get(Calendar.MONTH) + 1) + "/" + String.valueOf(instance.get(Calendar.YEAR)));
+ currentDate.setIcon(new ImageIcon(getClass().getResource("/myToolWindow/Calendar-icon.png")));
+ int min = instance.get(Calendar.MINUTE);
+ String strMin;
+ if (min < 10) {
+ strMin = "0" + String.valueOf(min);
+ } else {
+ strMin = String.valueOf(min);
+ }
+ currentTime.setText(instance.get(Calendar.HOUR_OF_DAY) + ":" + strMin);
+ currentTime.setIcon(new ImageIcon(getClass().getResource("/myToolWindow/Time-icon.png")));
+ // Get time zone
+ long gmt_Offset = instance.get(Calendar.ZONE_OFFSET); // offset from GMT in milliseconds
+ String str_gmt_Offset = String.valueOf(gmt_Offset / 3600000);
+ str_gmt_Offset = (gmt_Offset > 0) ? "GMT + " + str_gmt_Offset : "GMT - " + str_gmt_Offset;
+ timeZone.setText(str_gmt_Offset);
+ timeZone.setIcon(new ImageIcon(getClass().getResource("/myToolWindow/Time-zone-icon.png")));
+
+
+ }
+
+}
diff --git a/samples/toolWindow/src/myToolWindow/Time-icon.png b/samples/toolWindow/src/myToolWindow/Time-icon.png
new file mode 100644
index 000000000000..c5d82eff44b7
--- /dev/null
+++ b/samples/toolWindow/src/myToolWindow/Time-icon.png
Binary files differ
diff --git a/samples/toolWindow/src/myToolWindow/Time-zone-icon.png b/samples/toolWindow/src/myToolWindow/Time-zone-icon.png
new file mode 100644
index 000000000000..7d5797395e0a
--- /dev/null
+++ b/samples/toolWindow/src/myToolWindow/Time-zone-icon.png
Binary files differ
diff --git a/samples/toolWindow/toolWindow.iml b/samples/toolWindow/toolWindow.iml
new file mode 100644
index 000000000000..09647c68eae8
--- /dev/null
+++ b/samples/toolWindow/toolWindow.iml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PLUGIN_MODULE" version="4">
+ <component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/src/META-INF/plugin.xml" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="jdk" jdkName="IDEA IC-96.1068" jdkType="IDEA JDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/samples/vfs/src/META-INF/plugin.xml b/samples/vfs/src/META-INF/plugin.xml
new file mode 100644
index 000000000000..19f425524c50
--- /dev/null
+++ b/samples/vfs/src/META-INF/plugin.xml
@@ -0,0 +1,27 @@
+<idea-plugin>
+ <!-- Plugin name -->
+ <name>VfsSample</name>
+
+ <!-- Description -->
+ <description>This plugin monitors the number of Java files in source paths.</description>
+
+ <!-- Plugin version -->
+ <version>1.0</version>
+
+ <!-- Plugin's vendor -->
+ <vendor>IntelliJ</vendor>
+
+ <!-- Minimum IDEA build number with which the plugin is compatible -->
+ <!--
+ <idea-version since-build="2000"/>
+ -->
+ <!-- Plugin's application components -->
+ <project-components>
+ <component>
+ <!-- Component's implementation class -->
+ <implementation-class> myVFS.VfsSamplePlugin</implementation-class>
+ <!-- Component's interface class -->
+ <interface-class> myVFS.VfsSamplePlugin</interface-class>
+ </component>
+ </project-components>
+</idea-plugin>
diff --git a/samples/vfs/src/myVFS/VfsSamplePlugin.java b/samples/vfs/src/myVFS/VfsSamplePlugin.java
new file mode 100644
index 000000000000..64287932f4d1
--- /dev/null
+++ b/samples/vfs/src/myVFS/VfsSamplePlugin.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2000-2005 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 myVFS;
+
+import com.intellij.openapi.components.ProjectComponent;
+import com.intellij.openapi.fileTypes.FileTypeManager;
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileAdapter;
+import com.intellij.openapi.vfs.VirtualFileEvent;
+import com.intellij.openapi.vfs.VirtualFileManager;
+import org.jetbrains.annotations.NotNull;
+
+public class VfsSamplePlugin implements ProjectComponent {
+ private final Project myProject;
+
+ private static int ourJavaFilesCount;
+
+ public VfsSamplePlugin(Project project) {
+ myProject = project;
+ }
+
+ public void projectOpened() {
+ ProjectRootManager projectRootManager = ProjectRootManager.getInstance(myProject);
+ VirtualFile[] sourceRoots = projectRootManager.getContentSourceRoots();
+
+ ourJavaFilesCount = 0;
+ // Count the current number of Java files in the opened project.
+ for (VirtualFile sourceRoot : sourceRoots) {
+ countJavaFiles(sourceRoot);
+ }
+ // Add the Virtual File listener
+ MyVfsListener vfsListener = new MyVfsListener();
+ VirtualFileManager.getInstance().addVirtualFileListener(vfsListener, myProject);
+ }
+
+ public void projectClosed() {
+ }
+
+ public void initComponent() {
+ // empty
+ }
+
+ public void disposeComponent() {
+ // empty
+ }
+
+ @NotNull
+ public String getComponentName() {
+ return "VfsSample.VfsSamplePlugin";
+ }
+ // Increase or decrease the current number of Java files. Return true when a Java file has been added or removed from the opened project.
+ private static boolean updateCount(VirtualFile file, int increase) {
+
+ FileTypeManager fileTypeManager = FileTypeManager.getInstance();
+ if (!fileTypeManager.isFileIgnored(file)
+ && file.getFileType() == StdFileTypes.JAVA) {
+ ourJavaFilesCount += increase;
+ return true;
+ //System.out.println("ourJavaFilesCount = " + ourJavaFilesCount);
+ }
+ return false;
+ }
+ // Count current number of Java file in the project.
+ private static void countJavaFiles(VirtualFile virtualFile) {
+ VirtualFile[] children = virtualFile.getChildren();
+ if (children == null) return;
+
+ for (VirtualFile child : children) {
+ updateCount(child, +1);
+ countJavaFiles(child);
+ }
+
+ }
+
+ // -------------------------------------------------------------------------
+ // MyVfsListener
+ // -------------------------------------------------------------------------
+
+ private static class MyVfsListener extends VirtualFileAdapter {
+ public void fileCreated(VirtualFileEvent event) {
+ if (updateCount(event.getFile(), +1)) {
+ Messages.showMessageDialog("A new Java file added. Now " + String.valueOf(ourJavaFilesCount) +
+ " Java files in this project.", "Notification", Messages.getInformationIcon());
+ }
+ }
+
+ public void fileDeleted(VirtualFileEvent event) {
+ if (updateCount(event.getFile(), -1)) {
+ Messages.showMessageDialog("A Java file deleted. Now " + String.valueOf(ourJavaFilesCount) +
+ " Java files in this project.", "Notification", Messages.getInformationIcon());
+ }
+ }
+ }
+}
diff --git a/samples/vfs/vfs.iml b/samples/vfs/vfs.iml
new file mode 100644
index 000000000000..09647c68eae8
--- /dev/null
+++ b/samples/vfs/vfs.iml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PLUGIN_MODULE" version="4">
+ <component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/src/META-INF/plugin.xml" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="jdk" jdkName="IDEA IC-96.1068" jdkType="IDEA JDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/samples/vfs/vfs.ipr b/samples/vfs/vfs.ipr
new file mode 100644
index 000000000000..5b460280c13b
--- /dev/null
+++ b/samples/vfs/vfs.ipr
@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ <entry name="?*.ftl" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+ <component name="CopyrightManager" default="">
+ <module2copyright />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="Git.Settings">
+ <option name="GIT_EXECUTABLE" value="C:\Program Files (x86)\Git\bin\git.exe" />
+ <option name="CHECKOUT_INCLUDE_TAGS" value="false" />
+ <option name="UPDATE_CHANGES_POLICY" value="STASH" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/vfs.iml" filepath="$PROJECT_DIR$/vfs.iml" />
+ </modules>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA IC-96.1068" project-jdk-type="IDEA JDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+ <component name="SvnConfiguration" maxAnnotateRevisions="500">
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="LAST_MERGED_REVISION" />
+ <option name="UPDATE_RUN_STATUS" value="false" />
+ <option name="MERGE_DRY_RUN" value="false" />
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
+ <option name="DETECT_NESTED_COPIES" value="true" />
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
+ </component>
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+ <component name="masterDetails">
+ <states>
+ <state key="ArtifactsStructureConfigurable.UI">
+ <UIState>
+ <splitter-proportions>
+ <SplitterProportionsDataImpl />
+ </splitter-proportions>
+ <settings />
+ </UIState>
+ </state>
+ <state key="Copyright.UI">
+ <UIState>
+ <splitter-proportions>
+ <SplitterProportionsDataImpl />
+ </splitter-proportions>
+ </UIState>
+ </state>
+ <state key="ProjectJDKs.UI">
+ <UIState>
+ <splitter-proportions>
+ <SplitterProportionsDataImpl>
+ <option name="proportions">
+ <list>
+ <option value="0.2" />
+ </list>
+ </option>
+ </SplitterProportionsDataImpl>
+ </splitter-proportions>
+ <last-edited>IDEA IC-96.705</last-edited>
+ </UIState>
+ </state>
+ <state key="ScopeChooserConfigurable.UI">
+ <UIState>
+ <splitter-proportions>
+ <SplitterProportionsDataImpl />
+ </splitter-proportions>
+ <settings />
+ </UIState>
+ </state>
+ </states>
+ </component>
+</project>
+