Merge remote-tracking branch 'origin/master'

This commit is contained in:
Evgeny Zakrevsky
2012-05-04 21:45:24 +04:00
46 changed files with 993 additions and 57 deletions
@@ -120,6 +120,9 @@ public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler
public boolean isEnabled(@NotNull Project project, AnActionEvent event) {
DataContext dataContext = event.getDataContext();
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
if (editor == null) {
return false;
}
final Pair<GutterIconRenderer,Object> pair = XBreakpointUtil.findSelectedBreakpoint(project, editor);
return pair.first != null && pair.second instanceof BreakpointWithHighlighter;
}
@@ -172,6 +172,7 @@ public class JavaDebuggerSupport extends DebuggerSupport {
return context != null ? context.getDebuggerSession() : null;
}
@NotNull
@Override
public EditBreakpointActionHandler getEditBreakpointAction() {
return myEditBreakpointActionHandler;
@@ -0,0 +1,12 @@
Cleaning output files:
out/production/classAsArgument/A.class
End of files
Compiling files:
src/A.java
End of files
Cleaning output files:
out/production/classAsArgument/Annotated.class
End of files
Compiling files:
src/Annotated.java
End of files
@@ -0,0 +1 @@
classAsArgument
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<defaultAnt bundledAnt="true" />
</component>
</project>
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<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>
@@ -0,0 +1,5 @@
<component name="CopyrightManager">
<settings default="">
<module2copyright />
</settings>
</component>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA jdk" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>IDEA jdk</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.20000002" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/classAsArgument.iml" filepath="$PROJECT_DIR$/classAsArgument.iml" />
</modules>
</component>
</project>
@@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
@@ -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>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>
@@ -0,0 +1,431 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="52759f58-b48a-4568-b233-402d0cf3517c" name="Default" comment="" />
<ignored path="classAsArgument.iws" />
<ignored path=".idea/workspace.xml" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
<component name="DebuggerManager">
<breakpoint_any>
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true" />
<option name="NOTIFY_UNCAUGHT" value="true" />
<option name="ENABLED" value="false" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
<option name="SUSPEND_POLICY" value="SuspendAll" />
<option name="COUNT_FILTER_ENABLED" value="false" />
<option name="COUNT_FILTER" value="0" />
<option name="CONDITION_ENABLED" value="false" />
<option name="CLASS_FILTERS_ENABLED" value="false" />
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true" />
<option name="NOTIFY_UNCAUGHT" value="true" />
<option name="ENABLED" value="false" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
<option name="SUSPEND_POLICY" value="SuspendAll" />
<option name="COUNT_FILTER_ENABLED" value="false" />
<option name="COUNT_FILTER" value="0" />
<option name="CONDITION_ENABLED" value="false" />
<option name="CLASS_FILTERS_ENABLED" value="false" />
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
</breakpoint_any>
<breakpoint_rules />
<ui_properties />
</component>
<component name="FavoritesManager">
<favorites_list name="classAsArgument" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="A.java" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/A.java">
<provider selected="true" editor-type-id="text-editor">
<state line="7" column="14" selection-start="163" selection-end="163" vertical-scroll-proportion="0.12915128">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Ann.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Ann.java">
<provider selected="true" editor-type-id="text-editor">
<state line="10" column="52" selection-start="286" selection-end="286" vertical-scroll-proportion="0.0">
<folding>
<element signature="n#!!doc" expanded="true" />
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Annotated.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Annotated.java">
<provider selected="true" editor-type-id="text-editor">
<state line="10" column="35" selection-start="190" selection-end="190" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
<FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="false" />
</FindUsagesManager>
</component>
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/src/Ann.java" />
<option value="$PROJECT_DIR$/src/Annotated.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="y" value="25" />
<option name="width" value="1280" />
<option name="height" value="974" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="classAsArgument" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="classAsArgument" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="classAsArgument" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="classAsArgument" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="classAsArgument" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="MemberChooser.sorted" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="MemberChooser.copyJavadoc" value="false" />
</component>
<component name="RunManager">
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m" />
<option name="PROGRAM_PARAMETERS" />
<method>
<option name="BuildArtifacts" enabled="false" />
<option name="AntTarget" enabled="false" />
<option name="Make" enabled="true" />
<option name="Maven.BeforeRunTask" enabled="false" />
<option name="RunConfigurationTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<method>
<option name="BuildArtifacts" enabled="false" />
<option name="AntTarget" enabled="false" />
<option name="Maven.BeforeRunTask" enabled="false" />
<option name="RunConfigurationTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method>
<option name="BuildArtifacts" enabled="false" />
<option name="AntTarget" enabled="false" />
<option name="Make" enabled="true" />
<option name="Maven.BeforeRunTask" enabled="false" />
<option name="RunConfigurationTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<method>
<option name="BuildArtifacts" enabled="false" />
<option name="AntTarget" enabled="false" />
<option name="Make" enabled="true" />
<option name="Maven.BeforeRunTask" enabled="false" />
<option name="RunConfigurationTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method>
<option name="BuildArtifacts" enabled="false" />
<option name="AntTarget" enabled="false" />
<option name="Make" enabled="true" />
<option name="Maven.BeforeRunTask" enabled="false" />
<option name="RunConfigurationTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
<method>
<option name="BuildArtifacts" enabled="false" />
<option name="AntTarget" enabled="false" />
<option name="Make" enabled="true" />
<option name="Maven.BeforeRunTask" enabled="false" />
<option name="RunConfigurationTask" enabled="false" />
</method>
</configuration>
<list size="0" />
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
<Port>5050</Port>
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<created>1336138927353</created>
<updated>1336138927353</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="25" width="1280" height="974" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="JetGradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="CHECK_NEW_TODO" value="true" />
<option name="myTodoPanelSettings">
<value>
<are-packages-shown value="false" />
<are-modules-shown value="false" />
<flatten-packages value="false" />
<is-autoscroll-to-source value="false" />
</value>
</option>
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
<option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
<option name="DEFAULT_PATCH_EXTENSION" value="patch" />
<option name="SHORT_DIFF_HORISONTALLY" value="true" />
<option name="SHORT_DIFF_EXTRA_LINES" value="2" />
<option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
<option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
<option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
<option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
<option name="LAST_COMMIT_MESSAGE" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
<option name="ACTIVE_VCS_NAME" />
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/Annotated.java">
<provider selected="true" editor-type-id="text-editor">
<state line="10" column="35" selection-start="190" selection-end="190" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Ann.java">
<provider selected="true" editor-type-id="text-editor">
<state line="10" column="52" selection-start="286" selection-end="286" vertical-scroll-proportion="0.0">
<folding>
<element signature="n#!!doc" expanded="true" />
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/A.java">
<provider selected="true" editor-type-id="text-editor">
<state line="7" column="14" selection-start="163" selection-end="163" vertical-scroll-proportion="0.12915128">
<folding />
</state>
</provider>
</entry>
</component>
</project>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<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 jdk" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
@@ -0,0 +1,9 @@
/**
* Created with IntelliJ IDEA.
* User: db
* Date: 04.05.12
* Time: 17:42
* To change this template use File | Settings | File Templates.
*/
public class A {
}
@@ -0,0 +1,13 @@
/**
* Created with IntelliJ IDEA.
* User: db
* Date: 04.05.12
* Time: 17:42
* To change this template use File | Settings | File Templates.
*/
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.CLASS) public @interface Ann {
Class[] value();
}
@@ -0,0 +1,10 @@
/**
* Created with IntelliJ IDEA.
* User: db
* Date: 04.05.12
* Time: 17:43
* To change this template use File | Settings | File Templates.
*/
@Ann({A.class})
public class Annotated {
}
@@ -234,46 +234,51 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
}
void onChunkBuildComplete(@NotNull ModuleChunk chunk) throws IOException {
getDataManager().closeSourceToOutputStorages(chunk, isCompilingTests());
getDataManager().flush(true);
final boolean compilingTests = isCompilingTests();
myProjectDescriptor.fsState.clearContextRoundData();
myProjectDescriptor.fsState.clearContextChunk();
if (!myErrorsFound && !myCancelStatus.isCanceled()) {
final boolean compilingTests = isCompilingTests();
final DirtyMarkScope dirtyScope = compilingTests ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION;
boolean marked = false;
for (Module module : chunk.getModules()) {
if (isMake()) {
// ensure non-incremental flag cleared
myNonIncrementalModules.remove(new Pair<Module, DirtyMarkScope>(module, dirtyScope));
}
if (isProjectRebuild()) {
myProjectDescriptor.fsState.markInitialScanPerformed(module.getName(), compilingTests);
}
final List<RootDescriptor> roots = myProjectDescriptor.rootsIndex.getModuleRoots(module);
for (RootDescriptor descriptor : roots) {
if (compilingTests? descriptor.isTestRoot : !descriptor.isTestRoot) {
marked |= myProjectDescriptor.fsState.markAllUpToDate(getScope(), descriptor, myTimestamps, myCompilationStartStamp);
final BuildDataManager dataManager = getDataManager();
try {
if (!myErrorsFound && !myCancelStatus.isCanceled()) {
final DirtyMarkScope dirtyScope = compilingTests ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION;
boolean marked = false;
for (Module module : chunk.getModules()) {
if (isMake()) {
// ensure non-incremental flag cleared
myNonIncrementalModules.remove(new Pair<Module, DirtyMarkScope>(module, dirtyScope));
}
if (isProjectRebuild()) {
myProjectDescriptor.fsState.markInitialScanPerformed(module.getName(), compilingTests);
}
final List<RootDescriptor> roots = myProjectDescriptor.rootsIndex.getModuleRoots(module);
for (RootDescriptor descriptor : roots) {
if (compilingTests? descriptor.isTestRoot : !descriptor.isTestRoot) {
marked |= myProjectDescriptor.fsState.markAllUpToDate(getScope(), descriptor, myTimestamps, myCompilationStartStamp);
}
}
}
}
// clean mapping only after everything else is processed
final Map<String, Collection<String>> map = Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.get(this);
if (map != null) {
for (Map.Entry<String, Collection<String>> entry : map.entrySet()) {
final SourceToOutputMapping mapping = getDataManager().getSourceToOutputMap(entry.getKey(), isCompilingTests());
for (String path : entry.getValue()) {
mapping.remove(path);
// clean mapping only after everything else is processed
final Map<String, Collection<String>> map = Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.get(this);
if (map != null) {
for (Map.Entry<String, Collection<String>> entry : map.entrySet()) {
final SourceToOutputMapping mapping = dataManager.getSourceToOutputMap(entry.getKey(), isCompilingTests());
for (String path : entry.getValue()) {
mapping.remove(path);
}
}
}
}
if (marked) {
processMessage(UptoDateFilesSavedEvent.INSTANCE);
if (marked) {
processMessage(UptoDateFilesSavedEvent.INSTANCE);
}
}
}
finally {
dataManager.closeSourceToOutputStorages(chunk, compilingTests);
dataManager.flush(true);
}
}
public CompileScope getScope() {
@@ -489,7 +489,8 @@ public class IncProjectBuilder {
final Map<String, Collection<String>> perModuleRemovedSources = new HashMap<String, Collection<String>>();
for (Module module : chunk.getModules()) {
final Collection<String> deletedPaths = myProjectDescriptor.fsState.getDeletedPaths(module.getName(), context.isCompilingTests());
final Collection<String> deletedPaths = myProjectDescriptor.fsState.getAndClearDeletedPaths(module.getName(),
context.isCompilingTests());
if (deletedPaths.isEmpty()) {
continue;
}
@@ -525,7 +526,6 @@ public class IncProjectBuilder {
new File(output).delete();
}
}
//sourceToOutputStorage.remove(deletedSource);
// check if deleted source was associated with a form
final SourceToFormMapping sourceToFormMap = context.getDataManager().getSourceToFormMap();
@@ -545,10 +545,20 @@ public class IncProjectBuilder {
allChunkRemovedSources.addAll(currentData);
}
Utils.CHUNK_REMOVED_SOURCES_KEY.set(context, allChunkRemovedSources);
Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.set(context, perModuleRemovedSources);
for (Module module : chunk.getModules()) {
myProjectDescriptor.fsState.clearDeletedPaths(module.getName(), context.isCompilingTests());
final Map<String, Collection<String>> existing = Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.get(context);
if (existing != null) {
for (Map.Entry<String, Collection<String>> entry : existing.entrySet()) {
final Collection<String> paths = perModuleRemovedSources.get(entry.getKey());
if (paths != null) {
paths.addAll(entry.getValue());
}
else {
perModuleRemovedSources.put(entry.getKey(), entry.getValue());
}
}
}
Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.set(context, perModuleRemovedSources);
}
}
catch (IOException e) {
@@ -113,6 +113,14 @@ public class FSState {
}
}
public Collection<String> getAndClearDeletedPaths(final String moduleName, final boolean forTests) {
final FilesDelta delta = myDeltas.get(moduleName);
if (delta != null) {
return delta.getAndClearDeletedPaths(forTests);
}
return Collections.emptyList();
}
@NotNull
protected final FilesDelta getDelta(final String moduleName) {
synchronized (myDeltas) {
@@ -127,6 +127,18 @@ final class FilesDelta {
deleted.clear();
}
public Set<String> getAndClearDeletedPaths(boolean isTest) {
final Set<String> deleted = isTest? myDeletedTests : myDeletedProduction;
synchronized (deleted) {
try {
return new HashSet<String>(deleted);
}
finally {
deleted.clear();
}
}
}
public Map<File, Set<File>> getSourcesToRecompile(boolean forTests) {
return forTests? myTestsToRecompile : mySourcesToRecompile;
}
@@ -56,6 +56,10 @@ public class AnnotationTest extends IncrementalTestCase {
doTest();
}
public void testClassAsArgument() throws Exception {
doTest();
}
/* Discussion is needed --- unnecessarily conservative
public void testMetaAnnotationChanged() throws Exception {
doTest();
@@ -154,6 +154,14 @@ class ClassfileAnalyzer {
final String methodDescr = getMethodDescr(value);
final int methodName = context.get(name);
if (value instanceof Type) {
final String className = ((Type)value).getClassName();
if (className != null) {
usages.addUsage(residence, UsageRepr.createClassUsage(context, context.get(className)));
}
}
usages.addUsage(residence, UsageRepr.createMethodUsage(context, methodName, type.className, methodDescr));
usages.addUsage(residence, UsageRepr.createMetaMethodUsage(context, methodName, type.className, methodDescr));
@@ -230,7 +230,7 @@ public class FileReferenceSet {
if (str.equals(separatorString)) {
final FileReference fileReference =
createFileReference(new TextRange(myStartInElement, myStartInElement + 1), index++, separatorString);
createFileReference(new TextRange(myStartInElement, myStartInElement + sepLen), index++, separatorString);
referencesList.add(fileReference);
}
@@ -635,6 +635,7 @@ action.ToggleBreakpointEnabled.text=Toggle _Breakpoint Enabled
action.ToggleBreakpointEnabled.description=Enable/disable breakpoint at the current line
action.ViewBreakpoints.text=View Brea_kpoints...
action.ViewBreakpoints.description=View and manage all breakpoints and watchpoints
action.EditBreakpoint.text=Edit
action.ExportThreads.text=Export T_hreads...
action.ExportThreads.description=Save all threads information to a text file or clipboard
action.Runner.RestoreLayout.text=Restore Layout
@@ -627,7 +627,7 @@
icon="/debugger/showCurrentFrame.png"/>
<separator/>
<action id="ToggleLineBreakpoint" class="com.intellij.xdebugger.impl.actions.ToggleLineBreakpointAction"/>
<action id="EditBreakpoint" class="com.intellij.xdebugger.impl.actions.EditBreakpointAction" text="Edit"/>
<action id="EditBreakpoint" class="com.intellij.xdebugger.impl.actions.EditBreakpointAction"/>
<action id="ViewBreakpoints" class="com.intellij.xdebugger.impl.actions.ViewBreakpointsAction" icon="/debugger/viewBreakpoints.png"/>
<separator/>
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.vcs.changes.ui;
import com.intellij.CommonBundle;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
@@ -117,6 +118,7 @@ public class RollbackChangesDialog extends DialogWrapper {
setTitle(VcsBundle.message("changes.action.rollback.custom.title", operationName).replace("_", ""));
setOKButtonText(operationName);
setCancelButtonText(CommonBundle.getCloseButtonText());
myBrowser.setToggleActionTitle("Include in " + operationName.toLowerCase());
for (Change c : changes) {
@@ -102,6 +102,6 @@ public abstract class DebuggerSupport {
@Nullable
public abstract AbstractDebuggerSession getCurrentSession(@NotNull Project project);
@Nullable
@NotNull
public abstract EditBreakpointActionHandler getEditBreakpointAction();
}
@@ -207,6 +207,7 @@ public class XDebuggerSupport extends DebuggerSupport {
return XDebuggerManager.getInstance(project).getCurrentSession();
}
@NotNull
@Override
public EditBreakpointActionHandler getEditBreakpointAction() {
return myEditBreakpointActoinHandler;
@@ -15,11 +15,16 @@
*/
package com.intellij.xdebugger.impl.actions;
import com.intellij.idea.ActionsBundle;
import com.intellij.xdebugger.impl.DebuggerSupport;
import org.jetbrains.annotations.NotNull;
public class EditBreakpointAction extends XDebuggerActionBase {
public EditBreakpointAction() {
getTemplatePresentation().setText(ActionsBundle.actionText("EditBreakpoint"));
}
@NotNull
@Override
protected DebuggerActionHandler getHandler(@NotNull DebuggerSupport debuggerSupport) {
@@ -46,7 +46,7 @@ public class ViewBreakpointsAction extends AnAction implements AnAction.Transpar
if (project == null) return;
if (myInitialBreakpoint == null) {
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
if (editor != null) {
myInitialBreakpoint = XBreakpointUtil.findSelectedBreakpoint(project, editor).second;
}
@@ -48,6 +48,7 @@ public class XDebuggerEditBreakpointActionHandler extends EditBreakpointActionHa
public boolean isEnabled(@NotNull Project project, AnActionEvent event) {
DataContext dataContext = event.getDataContext();
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
if (editor == null) return false;
final Pair<GutterIconRenderer,Object> pair = XBreakpointUtil.findSelectedBreakpoint(project, editor);
return pair.first != null && pair.second instanceof XLineBreakpointImpl;
}
@@ -61,7 +61,7 @@ public class XBreakpointUtil {
}
@NotNull
public static Pair<GutterIconRenderer, Object> findSelectedBreakpoint(final Project project, final Editor editor) {
public static Pair<GutterIconRenderer, Object> findSelectedBreakpoint(@NotNull final Project project, @NotNull final Editor editor) {
int offset = editor.getCaretModel().getOffset();
Document editorDocument = editor.getDocument();
@@ -74,7 +74,7 @@ public class BaselineSnapPoint extends SnapPoint {
@Override
public void run() {
XmlTag tag = ((RadViewComponent)components.get(0)).getTag();
tag.setAttribute("android:layout_alignBaseline", myComponent.getId());
tag.setAttribute("android:layout_alignBaseline", myComponent.ensureId());
}
});
}
@@ -186,11 +186,11 @@ public class ComponentSnapPoint extends SnapPoint {
return;
}
final String componentId = myComponent.getId();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
final String componentId = myComponent.ensureId();
for (RadComponent component : components) {
XmlTag tag = ((RadViewComponent)component).getTag();
tag.setAttribute(attribute, componentId);
@@ -0,0 +1,93 @@
/*
* Copyright 2000-2012 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.android.designer.model;
import com.intellij.designer.model.RadComponent;
import com.intellij.designer.model.RadComponentVisitor;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.text.StringUtil;
import java.util.HashSet;
import java.util.Set;
/**
* @author Alexander Lobas
*/
public class IdManager {
public static final String KEY = "IdManager";
private final Set<String> myIdList = new HashSet<String>();
public static IdManager get(RadComponent component) {
return component.getRoot().getClientProperty(KEY);
}
public void addComponent(RadViewComponent component) {
String id = component.getId();
if (id != null) {
myIdList.add(id);
}
}
public void removeComponent(RadViewComponent component, boolean withChildren) {
String id = component.getId();
if (id != null) {
myIdList.remove(id);
}
if (withChildren) {
for (RadComponent child : component.getChildren()) {
removeComponent((RadViewComponent)child, true);
}
}
}
public String createId(RadViewComponent component) {
String id = StringUtil.decapitalize(component.getMetaModel().getTag());
String idValue = "@id/" + id;
String nextIdValue = idValue;
int index = 0;
while (myIdList.contains(nextIdValue)) {
nextIdValue = idValue + Integer.toString(++index);
}
myIdList.add(nextIdValue);
String newId = "@+id/" + id + (index == 0 ? "" : Integer.toString(index));
component.getTag().setAttribute("android:id", newId);
return newId;
}
public void ensurePasteIds(final RadViewComponent component) {
// TODO: rename all references
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
component.accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
RadViewComponent viewComponent = (RadViewComponent)component;
String idValue = viewComponent.getId();
if (idValue != null && myIdList.contains(idValue)) {
createId(viewComponent);
}
}
}, true);
}
});
}
}
@@ -53,6 +53,8 @@ public class ModelParser extends XmlRecursiveElementVisitor {
private static final int EMPTY_COMPONENT_SIZE = 5;
private final IdManager myIdManager = new IdManager();
private final MetaManager myMetaManager;
private final XmlFile myXmlFile;
private RadViewComponent myRootComponent;
@@ -94,6 +96,7 @@ public class ModelParser extends XmlRecursiveElementVisitor {
}
RadViewComponent component = createComponent(tag, metaModel);
myIdManager.addComponent(component);
if (myRootComponent == null) {
myRootComponent = component;
@@ -176,7 +179,7 @@ public class ModelParser extends XmlRecursiveElementVisitor {
public String compute() {
return newComponent.getMetaModel().getCreation();
}
});
}, true);
PropertyParser propertyParser = container.getRoot().getClientProperty(PropertyParser.KEY);
propertyParser.load(newComponent);
@@ -188,6 +191,8 @@ public class ModelParser extends XmlRecursiveElementVisitor {
PropertyParser propertyParser = container.getRoot().getClientProperty(PropertyParser.KEY);
pasteComponent(newComponent, container.getTag(), insertBefore == null ? null : insertBefore.getTag(), propertyParser);
IdManager.get(container).ensurePasteIds(newComponent);
}
private static void pasteComponent(final RadViewComponent component,
@@ -231,7 +236,7 @@ public class ModelParser extends XmlRecursiveElementVisitor {
return builder.append("/>").toString();
}
});
}, false);
XmlTag xmlTag = component.getTag();
List<RadComponent> children = component.getChildren();
@@ -253,7 +258,8 @@ public class ModelParser extends XmlRecursiveElementVisitor {
public static void addComponentTag(final XmlTag parentTag,
final RadViewComponent component,
final XmlTag nextTag,
final Computable<String> tagBuilder) {
final Computable<String> tagBuilder,
final boolean createId) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
@@ -291,6 +297,10 @@ public class ModelParser extends XmlRecursiveElementVisitor {
}
component.setTag(xmlTag);
if (createId) {
component.ensureId();
}
}
});
}
@@ -340,6 +350,7 @@ public class ModelParser extends XmlRecursiveElementVisitor {
}
updateRootComponent(myRootComponent, session, nativeComponent);
myRootComponent.setClientProperty(IdManager.KEY, myIdManager);
}
public static void updateRootComponent(RadViewComponent rootComponent,
@@ -164,7 +164,12 @@ public class PropertyParser {
property = new FlagProperty(name, definition);
}
else {
property = new AttributeProperty(name, definition);
if ("id".equals(name) && "View".equals(component)) {
property = new IdProperty(name, definition);
}
else {
property = new AttributeProperty(name, definition);
}
}
if (model != null) {
@@ -75,8 +75,15 @@ public class RadViewComponent extends RadVisualComponent {
myMargins = null;
}
public String ensureId() {
String id = getId();
if (id == null) {
id = IdManager.get(this).createId(this);
}
return id;
}
public String getId() {
// TODO: ensure id
return getId(myTag.getAttributeValue("android:id"));
}
@@ -123,6 +130,8 @@ public class RadViewComponent extends RadVisualComponent {
@Override
public void delete() throws Exception {
IdManager.get(this).removeComponent(this, true);
removeFromParent();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@@ -19,7 +19,6 @@ import com.intellij.android.designer.model.RadViewComponent;
import com.intellij.android.designer.propertyTable.editors.ResourceEditor;
import com.intellij.android.designer.propertyTable.editors.StringsComboEditor;
import com.intellij.android.designer.propertyTable.renderers.ResourceRenderer;
import com.intellij.designer.model.RadComponent;
import com.intellij.designer.propertyTable.Property;
import com.intellij.designer.propertyTable.PropertyEditor;
import com.intellij.designer.propertyTable.PropertyRenderer;
@@ -33,7 +32,6 @@ import org.jetbrains.android.dom.attrs.AttributeFormat;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Set;
/**
@@ -141,9 +139,4 @@ public class AttributeProperty extends Property<RadViewComponent> {
public PropertyEditor getEditor() {
return myEditor;
}
@Override
public boolean availableFor(List<RadComponent> components) {
return !"id".equals(getName());
}
}
@@ -0,0 +1,64 @@
/*
* Copyright 2000-2012 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.android.designer.propertyTable;
import com.intellij.android.designer.model.IdManager;
import com.intellij.android.designer.model.RadViewComponent;
import com.intellij.designer.model.RadComponent;
import com.intellij.designer.propertyTable.Property;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.android.dom.attrs.AttributeDefinition;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author Alexander Lobas
*/
public class IdProperty extends AttributeProperty {
public IdProperty(@NotNull String name, @NotNull AttributeDefinition definition) {
super(name, definition);
}
public IdProperty(@Nullable Property parent, @NotNull String name, @NotNull AttributeDefinition definition) {
super(parent, name, definition);
}
@Override
public Property<RadViewComponent> createForNewPresentation(@Nullable Property parent, @NotNull String name) {
return new IdProperty(parent, name, myDefinition);
}
@Override
public void setValue(RadViewComponent component, Object value) throws Exception {
// TODO: rename all references
IdManager idManager = IdManager.get(component);
idManager.removeComponent(component, false);
super.setValue(component, value);
if (!StringUtil.isEmpty((String)value)) {
idManager.addComponent(component);
}
}
@Override
public boolean availableFor(List<RadComponent> components) {
return false;
}
}
@@ -358,7 +358,7 @@ reset.type=Reset &Type:
reset.validate.tooltip=Validate the commit pointer and check the content of referenced commit.
reset.validate=&Validate
resetting.title=Resetting HEAD...
revert.action.name=Revert
revert.action.name=&Revert
revert.reverting.mulitple=Reverting {0} files
revert.reverting=Reverting files...
revision.graph=RevisionGraph
@@ -646,7 +646,9 @@ public class Main {
File[] files = systemRoot.listFiles()
if (files != null) {
for (File file : files) {
FileUtil.delete(file);
if (file.isDirectory()) {
FileUtil.delete(file);
}
}
}
}
@@ -17,7 +17,7 @@ action.hg4idea.mq.rebase.description=Update and rebase patches
hg4idea.mercurial=Mercurial
hg4idea.error=Error
hg4idea.revert=Revert
hg4idea.revert=&Revert
hg4idea.commit=Commit
hg4idea.add.title=Add files to Mercurial