Merge remote-tracking branch 'origin/master'

This commit is contained in:
Maxim.Mossienko
2012-05-19 01:07:14 +04:00
242 changed files with 5350 additions and 2060 deletions
@@ -1,117 +1,290 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.debugger.ui.breakpoints.BreakpointPropertiesPanel">
<grid id="6570" binding="myPanel" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="6570" binding="myPanel" custom-create="true" layout-manager="GridLayoutManager" row-count="3" 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="23" y="37" width="631" height="347"/>
<xy x="23" y="37" width="547" height="347"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="da86f" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="7978d" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<xy id="f3049" binding="myConditionComboPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" 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/>
<border type="none"/>
<children/>
</xy>
<component id="46592" class="javax.swing.JLabel">
<constraints>
<grid row="0" 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="Condition"/>
</properties>
</component>
</children>
</grid>
<grid id="763d0" layout-manager="GridLayoutManager" row-count="1" 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>
<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"/>
</constraints>
<properties/>
<border type="none"/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
</clientProperties>
<border type="none">
<font/>
</border>
<children>
<xy id="862d9" binding="mySpecialBoxPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<component id="f6192" class="javax.swing.JRadioButton" binding="mySuspendThreadRadio">
<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"/>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<visible value="true"/>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.thread"/>
</properties>
<border type="none"/>
<children/>
</xy>
<grid id="1d1c" binding="myActionsPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="5"/>
</component>
<component id="106f5" class="javax.swing.JRadioButton" binding="mySuspendAllRadio">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.all"/>
</properties>
</component>
<hspacer id="46ea8">
<constraints>
<grid row="0" 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="be00d" class="javax.swing.JButton" binding="myMakeDefaultButton">
<constraints>
<grid row="0" column="4" 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 resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.default"/>
</properties>
</component>
<component id="cd928" class="com.intellij.ui.components.JBCheckBox" binding="mySuspendJBCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Suspend"/>
</properties>
</component>
</children>
</grid>
<grid id="5aab2" 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>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="da86f" layout-manager="GridLayoutManager" row-count="2" 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>
<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="245" height="251"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="1d1c" binding="myActionsPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="5"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
</clientProperties>
<border type="etched" title-resource-bundle="messages/DebuggerBundle" title-key="label.breakpoint.properties.panel.group.actions"/>
<children>
<component id="185b0" class="javax.swing.JCheckBox" binding="myLogMessageCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.log.message"/>
</properties>
</component>
<vspacer id="f635a">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="42168" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="4a38" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<hspacer id="9c54c">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
</constraints>
</hspacer>
<grid id="80950" binding="myLogExpressionComboPanel" 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>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
<component id="7b0ce" class="javax.swing.JCheckBox" binding="myLogExpressionCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.log.expression"/>
</properties>
</component>
</children>
</grid>
<grid id="d7b0a" binding="myDependsOnPanel" layout-manager="GridLayoutManager" row-count="2" 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>
<grid row="2" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="bebec" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.depends.on"/>
</properties>
</component>
<grid id="4241e" layout-manager="GridLayoutManager" row-count="2" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<hspacer id="13a5b">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
</constraints>
</hspacer>
<grid id="9b21c" binding="myDependentBreakpointComboPanel" 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="15" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
<component id="7f1f0" class="javax.swing.JLabel" binding="myEnableOrDisableLabel">
<constraints>
<grid row="1" 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 resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.dependency.type.lable"/>
</properties>
</component>
<component id="e3baf" class="javax.swing.JRadioButton" binding="myDisableAgainRadio" default-binding="true">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.depends.disable.again"/>
</properties>
</component>
<component id="10e41" class="javax.swing.JRadioButton" binding="myLeaveEnabledRadioButton" default-binding="true">
<constraints>
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.depends.leave.enabled"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</children>
</grid>
<xy id="862d9" binding="mySpecialBoxPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<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"/>
</constraints>
<properties>
<visible value="true"/>
</properties>
<border type="none"/>
<children/>
</xy>
</children>
</grid>
<grid id="d03f5" binding="myConditionsPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="7">
<margin top="2" left="2" bottom="5" right="5"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
</clientProperties>
<border type="etched" title-resource-bundle="messages/DebuggerBundle" title-key="label.breakpoint.properties.panel.group.actions"/>
<border type="etched" title-resource-bundle="messages/DebuggerBundle" title-key="label.breakpoint.properties.panel.group.conditions"/>
<children>
<component id="185b0" class="javax.swing.JCheckBox" binding="myLogMessageCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.log.message"/>
</properties>
</component>
<vspacer id="f635a">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="42168" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<grid id="b404a" binding="myInstanceFiltersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="4a38" 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"/>
<component id="20b41" class="javax.swing.JCheckBox" binding="myInstanceFiltersCheckBox">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<hspacer id="9c54c">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
</constraints>
</hspacer>
<grid id="80950" binding="myLogExpressionComboPanel" 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>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
<component id="7b0ce" class="javax.swing.JCheckBox" binding="myLogExpressionCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.log.expression"/>
<margin top="2" left="2" bottom="0" right="2"/>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.instance.filters"/>
</properties>
</component>
</children>
</grid>
<grid id="d7b0a" binding="myDependsOnPanel" layout-manager="GridLayoutManager" row-count="2" 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>
<grid row="2" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="bebec" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.depends.on"/>
</properties>
</component>
<grid id="4241e" layout-manager="GridLayoutManager" row-count="2" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="d9be2" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -119,286 +292,125 @@
<properties/>
<border type="none"/>
<children>
<hspacer id="13a5b">
<hspacer id="e6448">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
</constraints>
</hspacer>
<grid id="9b21c" binding="myDependentBreakpointComboPanel" 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="15" bottom="0" right="0"/>
<xy id="1114b" binding="myInstanceFiltersFieldPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
<component id="7f1f0" class="javax.swing.JLabel" binding="myEnableOrDisableLabel">
<constraints>
<grid row="1" 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 resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.dependency.type.lable"/>
</properties>
</component>
<component id="e3baf" class="javax.swing.JRadioButton" binding="myDisableAgainRadio" default-binding="true">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.depends.disable.again"/>
</properties>
</component>
<component id="10e41" class="javax.swing.JRadioButton" binding="myLeaveEnabledRadioButton" default-binding="true">
<constraints>
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.depends.leave.enabled"/>
</properties>
</component>
</xy>
</children>
</grid>
</children>
</grid>
</children>
</grid>
<grid id="763d0" layout-manager="GridLayoutManager" row-count="1" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
</clientProperties>
<border type="none">
<font/>
</border>
<children>
<component id="f6192" class="javax.swing.JRadioButton" binding="mySuspendThreadRadio">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.thread"/>
</properties>
</component>
<component id="106f5" class="javax.swing.JRadioButton" binding="mySuspendAllRadio">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.all"/>
</properties>
</component>
<hspacer id="46ea8">
<constraints>
<grid row="0" 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="be00d" class="javax.swing.JButton" binding="myMakeDefaultButton">
<constraints>
<grid row="0" column="4" 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 resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.default"/>
</properties>
</component>
<component id="cd928" class="com.intellij.ui.components.JBCheckBox" binding="mySuspendJBCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Suspend"/>
</properties>
</component>
</children>
</grid>
<grid id="7978d" 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>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<xy id="f3049" binding="myConditionComboPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<grid id="f07fc" binding="myClassFiltersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" 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/>
<border type="none"/>
<children/>
</xy>
<component id="46592" class="javax.swing.JLabel">
<constraints>
<grid row="0" 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="Condition"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="d03f5" binding="myConditionsPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="7">
<margin top="2" left="2" bottom="5" right="5"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
</clientProperties>
<border type="etched" title-resource-bundle="messages/DebuggerBundle" title-key="label.breakpoint.properties.panel.group.conditions"/>
<children>
<grid id="b404a" binding="myInstanceFiltersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="20b41" class="javax.swing.JCheckBox" binding="myInstanceFiltersCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="2" bottom="0" right="2"/>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.instance.filters"/>
</properties>
</component>
<grid id="d9be2" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<hspacer id="e6448">
<component id="40e6b" class="javax.swing.JCheckBox" binding="myClassFiltersCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
</constraints>
</hspacer>
<xy id="1114b" binding="myInstanceFiltersFieldPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</xy>
</children>
</grid>
</children>
</grid>
<grid id="f07fc" binding="myClassFiltersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="40e6b" class="javax.swing.JCheckBox" binding="myClassFiltersCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="2" bottom="0" right="2"/>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.class.filters"/>
</properties>
</component>
<grid id="fbeb4" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<xy id="72d13" binding="myClassFiltersFieldPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</xy>
<hspacer id="1d45">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
</constraints>
</hspacer>
</children>
</grid>
</children>
</grid>
<grid id="21edd" binding="myPassCountPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="11e5a" class="javax.swing.JCheckBox" binding="myPassCountCheckbox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="2" bottom="0" right="2"/>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.pass.count"/>
</properties>
</component>
<grid id="e8cc5" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="64df8" class="javax.swing.JTextField" binding="myPassCountField">
<constraints>
<grid row="0" 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="15" height="-1"/>
</grid>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="true"/>
<horizontalAlignment value="10"/>
<margin top="2" left="2" bottom="0" right="2"/>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.class.filters"/>
</properties>
</component>
<hspacer id="9be08">
<grid id="fbeb4" 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>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<properties/>
<border type="none"/>
<children>
<xy id="72d13" binding="myClassFiltersFieldPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</xy>
<hspacer id="1d45">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
</constraints>
</hspacer>
</children>
</grid>
</children>
</grid>
<grid id="21edd" binding="myPassCountPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="11e5a" class="javax.swing.JCheckBox" binding="myPassCountCheckbox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="2" bottom="0" right="2"/>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.pass.count"/>
</properties>
</component>
<grid id="e8cc5" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="64df8" class="javax.swing.JTextField" binding="myPassCountField">
<constraints>
<grid row="0" 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="15" height="-1"/>
</grid>
</constraints>
<properties>
<enabled value="true"/>
<horizontalAlignment value="10"/>
</properties>
</component>
<hspacer id="9be08">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
</constraints>
</hspacer>
</children>
</grid>
</children>
</grid>
<vspacer id="905e2">
<constraints>
<grid row="3" 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>
</children>
</grid>
<vspacer id="905e2">
<constraints>
<grid row="3" 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>
</children>
</grid>
</children>
@@ -51,8 +51,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
@@ -178,6 +176,9 @@ public abstract class BreakpointPropertiesPanel {
if (b) {
myActionsPanel.setVisible(true);
}
if (!b) {
myPanel.setPreferredSize(new Dimension(500, -1));
}
}
public void setDelegate(Delegate delegate) {
@@ -276,24 +277,6 @@ public abstract class BreakpointPropertiesPanel {
myBreakpointComboboxHandler = new BreakpointComboboxHandler(myProject, baseBreakpointCombo);
baseBreakpointCombo.setRenderer(new BreakpointComboRenderer(baseBreakpointCombo.getRenderer()));
baseBreakpointCombo.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent event) {
event.getClass();//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent event) {
//To change body of implemented methods use File | Settings | File Templates.
event.getClass();
}
@Override
public void popupMenuCanceled(PopupMenuEvent event) {
//To change body of implemented methods use File | Settings | File Templates.
event.getClass();
}
});
baseBreakpointCombo.addItemListener(new ItemListener() {
public void itemStateChanged(final ItemEvent e) {
ComboboxItem item = (ComboboxItem)baseBreakpointCombo.getSelectedItem();
@@ -48,15 +48,6 @@ class JavaBreakpointItem extends BreakpointItem {
renderer.append(myBreakpoint.getShortName());
}
@Override
public void updateMnemonicLabel(JLabel label) {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public void execute(Project project, JBPopup popup) {
}
@Override
public String speedSearchText() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -16,12 +16,12 @@
package com.intellij.ide.util.projectWizard;
import com.intellij.CommonBundle;
import com.intellij.application.options.PathMacrosCollector;
import com.intellij.application.options.PathMacrosImpl;
import com.intellij.conversion.ConversionResult;
import com.intellij.conversion.ConversionService;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.application.PathMacros;
import com.intellij.openapi.components.impl.stores.StorageUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
@@ -83,7 +83,7 @@ public class ExistingModuleLoader extends ModuleBuilder {
}
final Document document = JDOMUtil.loadDocument(file);
final Element root = document.getRootElement();
final Set<String> usedMacros = StorageUtil.getMacroNames(root);
final Set<String> usedMacros = PathMacrosCollector.getMacroNames(root);
final Set<String> definedMacros = PathMacros.getInstance().getAllMacroNames();
usedMacros.remove("$" + PathMacrosImpl.MODULE_DIR_MACRO_NAME + "$");
usedMacros.removeAll(definedMacros);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -34,11 +34,11 @@ public class IdeaProjectStoreImpl extends ProjectWithModulesStoreImpl {
protected StateStorageManager createStateStorageManager() {
return new ProjectStateStorageManager(PathMacroManager.getInstance(getComponentManager()).createTrackingSubstitutor(), myProject) {
public XmlElementStorage.StorageData createWsStorageData() {
public StorageData createWsStorageData() {
return new IdeaWsStorageData(ROOT_TAG_NAME, myProject);
}
public XmlElementStorage.StorageData createIprStorageData() {
public StorageData createIprStorageData() {
return new IdeaIprStorageData(ROOT_TAG_NAME, myProject);
}
};
@@ -53,7 +53,7 @@ public class IdeaProjectStoreImpl extends ProjectWithModulesStoreImpl {
super(storageData);
}
public XmlElementStorage.StorageData clone() {
public StorageData clone() {
return new IdeaWsStorageData(this);
}
}
@@ -68,7 +68,7 @@ public class IdeaProjectStoreImpl extends ProjectWithModulesStoreImpl {
super(storageData);
}
public XmlElementStorage.StorageData clone() {
public StorageData clone() {
return new IdeaIprStorageData(this);
}
@@ -23,10 +23,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
import com.intellij.openapi.roots.impl.libraries.LibraryTableBase;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryProperties;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.libraries.LibraryType;
import com.intellij.openapi.roots.libraries.*;
import com.intellij.openapi.roots.libraries.ui.LibraryRootsComponentDescriptor;
import com.intellij.openapi.roots.libraries.ui.OrderRoot;
import com.intellij.openapi.roots.libraries.ui.impl.RootDetectionUtil;
@@ -82,8 +79,9 @@ public class CreateModuleLibraryChooser implements ClasspathElementChooser<Libra
}
}
private Library createLibraryFromRoots(List<OrderRoot> roots, final LibraryType libraryType) {
final Library library = ((LibraryTableBase.ModifiableModelEx)myModuleLibrariesModel).createLibrary(null, libraryType.getKind());
private Library createLibraryFromRoots(List<OrderRoot> roots, @Nullable final LibraryType libraryType) {
final PersistentLibraryKind kind = libraryType == null ? null : libraryType.getKind();
final Library library = ((LibraryTableBase.ModifiableModelEx)myModuleLibrariesModel).createLibrary(null, kind);
final LibraryEx.ModifiableModelEx libModel = (LibraryEx.ModifiableModelEx)library.getModifiableModel();
if (myDefaultPropertiesFactory != null) {
libModel.setProperties(myDefaultPropertiesFactory.fun(libraryType));
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -20,6 +20,7 @@ import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkType;
import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl;
import com.intellij.openapi.projectRoots.ui.SdkEditor;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
@@ -78,13 +79,13 @@ public class JdkConfigurable extends ProjectStructureElementConfigurable<Sdk> im
}
public Icon getIcon() {
return myProjectJdk.getSdkType().getIcon();
return ((SdkType) myProjectJdk.getSdkType()).getIcon();
}
@Nullable
@NonNls
public String getHelpTopic() {
return myProjectJdk.getSdkType().getHelpTopic();
return ((SdkType) myProjectJdk.getSdkType()).getHelpTopic();
}
@@ -21,15 +21,20 @@ package com.intellij.codeInsight.daemon.impl;
import com.intellij.codeInsight.daemon.ChangeLocalityDetector;
import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class JavaChangeLocalityDetector implements ChangeLocalityDetector {
@Override
@Nullable
public PsiElement getChangeHighlightingDirtyScopeFor(final PsiElement element) {
public PsiElement getChangeHighlightingDirtyScopeFor(@NotNull final PsiElement element) {
// optimization
PsiElement parent = element.getParent();
if (element instanceof PsiCodeBlock && parent instanceof PsiMethod && !((PsiMethod)parent).isConstructor() &&
parent.getParent() instanceof PsiClass && !(parent.getParent() instanceof PsiAnonymousClass)) {
if (element instanceof PsiCodeBlock
&& parent instanceof PsiMethod
&& !((PsiMethod)parent).isConstructor()
&& parent.getParent() instanceof PsiClass
&& !(parent.getParent() instanceof PsiAnonymousClass)) {
// for changes inside method, rehighlight codeblock only
// do not use this optimization for constructors and class initializers - to update non-initialized fields
return parent;
@@ -417,7 +417,7 @@ public class HighlightControlFlowUtil {
if (codeBlockProblems == null) {
try {
final ControlFlow controlFlow = getControlFlow(topBlock);
codeBlockProblems = ControlFlowUtil.getReadBeforeWrite(controlFlow);
codeBlockProblems = ControlFlowUtil.getReadBeforeWriteLocals(controlFlow);
}
catch (AnalysisCanceledException e) {
codeBlockProblems = Collections.emptyList();
@@ -570,7 +570,7 @@ public class HighlightControlFlowUtil {
}
@NotNull
private static Collection<ControlFlowUtil.VariableInfo> getFinalVariableProblemsInBlock(Map<PsiElement,Collection<ControlFlowUtil.VariableInfo>> finalVarProblems, PsiElement codeBlock) {
public static Collection<ControlFlowUtil.VariableInfo> getFinalVariableProblemsInBlock(Map<PsiElement,Collection<ControlFlowUtil.VariableInfo>> finalVarProblems, PsiElement codeBlock) {
Collection<ControlFlowUtil.VariableInfo> codeBlockProblems = finalVarProblems.get(codeBlock);
if (codeBlockProblems == null) {
try {
@@ -320,7 +320,7 @@ public class GenerateMembersUtil {
super.visitReferenceElement(reference);
final PsiElement resolve = reference.resolve();
if (resolve instanceof PsiTypeParameter) {
replacementMap.put(reference, factory.createReferenceElementByType((PsiClassType)substitutor.substitute((PsiTypeParameter)resolve)));
replacementMap.put(reference, factory.createReferenceElementByType((PsiClassType)substituteType(substitutor, factory.createType((PsiTypeParameter)resolve))));
}
}
});
@@ -0,0 +1,269 @@
/*
* 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.codeInspection.varScopeCanBeNarrowed;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.IJSwingUtilities;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.NotNullFunction;
import com.intellij.util.containers.HashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.Set;
/**
* refactored from {@link com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection.MyQuickFix}
*
* @author Danila Ponomarenko
*/
public abstract class BaseConvertToLocalQuickFix<V extends PsiVariable> implements LocalQuickFix {
private static final Logger LOG = Logger.getInstance(BaseConvertToLocalQuickFix.class);
@NotNull
public final String getName() {
return InspectionsBundle.message("inspection.convert.to.local.quickfix");
}
public final void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
final V variable = getVariable(descriptor);
final PsiFile myFile = variable.getContainingFile();
if (variable == null || !variable.isValid()) return; //weird. should not get here when field becomes invalid
try {
final PsiElement newDeclaration = moveDeclaration(project, variable);
if (newDeclaration == null) return;
positionCaretToDeclaration(project, myFile, newDeclaration);
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
@Nullable
protected abstract V getVariable(@NotNull ProblemDescriptor descriptor);
private static void positionCaretToDeclaration(@NotNull Project project, @NotNull PsiFile psiFile, @NotNull PsiElement declaration) {
final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
if (editor != null && (IJSwingUtilities.hasFocus(editor.getComponent()) || ApplicationManager.getApplication().isUnitTestMode())) {
final PsiFile openedFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (openedFile == psiFile) {
editor.getCaretModel().moveToOffset(declaration.getTextOffset());
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
}
}
}
protected void beforeDelete(@NotNull Project project, @NotNull V variable, @NotNull PsiElement newDeclaration) {
}
@Nullable
private PsiElement moveDeclaration(@NotNull Project project, @NotNull V variable) {
final Collection<PsiReference> references = ReferencesSearch.search(variable).findAll();
if (references.isEmpty()) return null;
final PsiCodeBlock anchorBlock = findAnchorBlock(references);
if (anchorBlock == null) return null; //was assert, but need to fix the case when obsolete inspection highlighting is left
if (!CodeInsightUtil.preparePsiElementsForWrite(anchorBlock)) return null;
final PsiElement firstElement = getLowestOffsetElement(references);
final String localName = suggestLocalName(project, variable, anchorBlock);
final PsiElement anchor = getAnchorElement(anchorBlock, firstElement);
final PsiAssignmentExpression anchorAssignmentExpression = searchAssignmentExpression(anchor);
if (anchorAssignmentExpression != null && isVariableAssignment(anchorAssignmentExpression, variable)) {
final Set<PsiReference> refsSet = new HashSet<PsiReference>(references);
refsSet.remove(anchorAssignmentExpression.getLExpression());
return applyChanges(
project,
localName,
anchorAssignmentExpression.getRExpression(),
variable,
refsSet,
new NotNullFunction<PsiDeclarationStatement, PsiElement>() {
@NotNull
@Override
public PsiElement fun(PsiDeclarationStatement declaration) {
if (!mayBeFinal(firstElement, references)) {
PsiUtil.setModifierProperty((PsiModifierListOwner)declaration.getDeclaredElements()[0], PsiModifier.FINAL, false);
}
return anchor.replace(declaration);
}
}
);
}
return applyChanges(
project,
localName,
variable.getInitializer(),
variable,
references,
new NotNullFunction<PsiDeclarationStatement, PsiElement>() {
@NotNull
@Override
public PsiElement fun(PsiDeclarationStatement declaration) {
return anchorBlock.addBefore(declaration, anchor);
}
}
);
}
@NotNull
private PsiElement applyChanges(final @NotNull Project project,
final @NotNull String localName,
final @Nullable PsiExpression initializer,
final @NotNull V variable,
final @NotNull Collection<PsiReference> references,
final @NotNull NotNullFunction<PsiDeclarationStatement, PsiElement> action) {
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
return ApplicationManager.getApplication().runWriteAction(
new Computable<PsiElement>() {
@Override
public PsiElement compute() {
final PsiDeclarationStatement declaration =
elementFactory.createVariableDeclarationStatement(localName, variable.getType(), initializer);
final PsiElement newDeclaration = action.fun(declaration);
retargetReferences(elementFactory, localName, references);
beforeDelete(project, variable, newDeclaration);
variable.normalizeDeclaration();
variable.delete();
return newDeclaration;
}
}
);
}
@Nullable
private static PsiAssignmentExpression searchAssignmentExpression(@NotNull PsiElement anchor) {
if (!(anchor instanceof PsiExpressionStatement)) {
return null;
}
final PsiExpression anchorExpression = ((PsiExpressionStatement)anchor).getExpression();
if (!(anchorExpression instanceof PsiAssignmentExpression)) {
return null;
}
return (PsiAssignmentExpression)anchorExpression;
}
private static boolean isVariableAssignment(@NotNull PsiAssignmentExpression expression, @NotNull PsiVariable variable) {
if (expression.getOperationTokenType() != JavaTokenType.EQ) {
return false;
}
if (!(expression.getLExpression() instanceof PsiReferenceExpression)) {
return false;
}
final PsiReferenceExpression leftExpression = (PsiReferenceExpression)expression.getLExpression();
if (!leftExpression.isReferenceTo(variable)) {
return false;
}
return true;
}
@NotNull
protected abstract String suggestLocalName(@NotNull Project project, @NotNull V variable, @NotNull PsiCodeBlock scope);
private static boolean mayBeFinal(PsiElement firstElement, @NotNull Collection<PsiReference> references) {
for (PsiReference reference : references) {
final PsiElement element = reference.getElement();
if (element == firstElement) continue;
if (element instanceof PsiExpression && PsiUtil.isAccessedForWriting((PsiExpression)element)) return false;
}
return true;
}
private static void retargetReferences(PsiElementFactory elementFactory, String localName, Collection<PsiReference> refs)
throws IncorrectOperationException {
final PsiReferenceExpression refExpr = (PsiReferenceExpression)elementFactory.createExpressionFromText(localName, null);
for (PsiReference ref : refs) {
if (ref instanceof PsiReferenceExpression) {
((PsiReferenceExpression)ref).replace(refExpr);
}
}
}
@NotNull
public String getFamilyName() {
return getName();
}
private static PsiElement getAnchorElement(PsiCodeBlock anchorBlock, @NotNull PsiElement firstElement) {
PsiElement element = firstElement;
while (element != null && element.getParent() != anchorBlock) {
element = element.getParent();
}
return element;
}
@Nullable
private static PsiElement getLowestOffsetElement(@NotNull Collection<PsiReference> refs) {
PsiElement firstElement = null;
for (PsiReference reference : refs) {
final PsiElement element = reference.getElement();
if (firstElement == null || firstElement.getTextRange().getStartOffset() > element.getTextRange().getStartOffset()) {
firstElement = element;
}
}
return firstElement;
}
private static PsiCodeBlock findAnchorBlock(final Collection<PsiReference> refs) {
PsiCodeBlock result = null;
for (PsiReference psiReference : refs) {
final PsiElement element = psiReference.getElement();
PsiCodeBlock block = PsiTreeUtil.getParentOfType(element, PsiCodeBlock.class);
if (result == null || block == null) {
result = block;
}
else {
final PsiElement commonParent = PsiTreeUtil.findCommonParent(result, block);
result = PsiTreeUtil.getParentOfType(commonParent, PsiCodeBlock.class, false);
}
}
return result;
}
public boolean runForWholeFile() {
return true;
}
}
@@ -16,21 +16,15 @@
package com.intellij.codeInspection.varScopeCanBeNarrowed;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInsight.daemon.ImplicitUsageProvider;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.ex.BaseLocalInspectionTool;
import com.intellij.codeInspection.util.SpecialAnnotationsUtil;
import com.intellij.lang.java.JavaCommenter;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.JDOMExternalizableStringList;
@@ -41,13 +35,9 @@ import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.controlFlow.*;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.util.IJSwingUtilities;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.HashSet;
import gnu.trove.THashSet;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -65,8 +55,6 @@ import java.util.Set;
* @author ven
*/
public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection");
@NonNls public static final String SHORT_NAME = "FieldCanBeLocal";
public final JDOMExternalizableStringList EXCLUDE_ANNOS = new JDOMExternalizableStringList();
@@ -110,13 +98,13 @@ public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
@Override
public void visitJavaFile(PsiJavaFile file) {
for (PsiClass aClass : file.getClasses()) {
docheckClass(aClass, holder, EXCLUDE_ANNOS);
doCheckClass(aClass, holder, EXCLUDE_ANNOS);
}
}
};
}
private static void docheckClass(final PsiClass aClass, ProblemsHolder holder, final List<String> excludeAnnos) {
private static void doCheckClass(final PsiClass aClass, ProblemsHolder holder, final List<String> excludeAnnos) {
if (aClass.isInterface()) return;
final PsiField[] fields = aClass.getFields();
final Set<PsiField> candidates = new LinkedHashSet<PsiField>();
@@ -129,6 +117,7 @@ public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
}
}
removeFieldsReferencedFromInitializers(aClass, candidates);
if (candidates.isEmpty()) return;
@@ -141,7 +130,7 @@ public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
for (PsiField field : candidates) {
if (usedFields.contains(field) && !hasImplicitReadOrWriteUsage(field, implicitUsageProviders)) {
final String message = InspectionsBundle.message("inspection.field.can.be.local.problem.descriptor");
holder.registerProblem(field.getNameIdentifier(), message, new MyQuickFix());
holder.registerProblem(field.getNameIdentifier(), message, new ConvertFieldToLocalQuickFix());
}
}
}
@@ -189,7 +178,7 @@ public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
final PsiElement resolved = readBeforeWrite.resolve();
if (resolved instanceof PsiField) {
final PsiField field = (PsiField)resolved;
if (!isImmutableState(field.getType()) || !PsiUtil.isConstantExpression(field.getInitializer()) || getWrittenVariables(controlFlow, writtenVariables).contains(field)){
if (!isImmutableState(field.getType()) || !PsiUtil.isConstantExpression(field.getInitializer()) || getWrittenVariables(controlFlow, writtenVariables).contains(field)) {
PsiElement parent = body.getParent();
if (!(parent instanceof PsiMethod) ||
!((PsiMethod)parent).isConstructor() ||
@@ -222,15 +211,18 @@ public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
private static void removeFieldsReferencedFromInitializers(final PsiClass aClass, final Set<PsiField> candidates) {
aClass.accept(new JavaRecursiveElementWalkingVisitor() {
@Override public void visitMethod(PsiMethod method) {
@Override
public void visitMethod(PsiMethod method) {
//do not go inside method
}
@Override public void visitClassInitializer(PsiClassInitializer initializer) {
@Override
public void visitClassInitializer(PsiClassInitializer initializer) {
//do not go inside class initializer
}
@Override public void visitReferenceExpression(PsiReferenceExpression expression) {
@Override
public void visitReferenceExpression(PsiReferenceExpression expression) {
final PsiElement resolved = expression.resolve();
if (resolved instanceof PsiField) {
final PsiField field = (PsiField)resolved;
@@ -245,7 +237,7 @@ public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
}
private static boolean hasImplicitReadOrWriteUsage(final PsiField field, ImplicitUsageProvider[] implicitUsageProviders) {
for(ImplicitUsageProvider provider: implicitUsageProviders) {
for (ImplicitUsageProvider provider : implicitUsageProviders) {
if (provider.isImplicitRead(field) || provider.isImplicitWrite(field)) {
return true;
}
@@ -253,173 +245,41 @@ public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
return false;
}
private static class MyQuickFix implements LocalQuickFix {
@NotNull
public String getName() {
return InspectionsBundle.message("inspection.field.can.be.local.quickfix");
private static class ConvertFieldToLocalQuickFix extends BaseConvertToLocalQuickFix<PsiField> {
@Override
@Nullable
protected PsiField getVariable(@NotNull ProblemDescriptor descriptor) {
return PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiField.class);
}
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiElement element = descriptor.getPsiElement();
PsiField myField = PsiTreeUtil.getParentOfType(element, PsiField.class);
if (myField == null || !myField.isValid()) return; //weird. should not get here when field becomes invalid
@Override
protected void beforeDelete(@NotNull Project project, @NotNull PsiField variable, @NotNull PsiElement newDeclaration) {
final PsiDocComment docComment = variable.getDocComment();
if (docComment != null) moveDocCommentToDeclaration(project, docComment, newDeclaration);
}
final PsiDocComment docComment = myField.getDocComment();
final Collection<PsiReference> refs = ReferencesSearch.search(myField).findAll();
if (refs.isEmpty()) return;
Set<PsiReference> refsSet = new HashSet<PsiReference>(refs);
PsiCodeBlock anchorBlock = findAnchorBlock(refs);
if (anchorBlock == null) return; //was assert, but need to fix the case when obsolete inspection highlighting is left
if (!CodeInsightUtil.preparePsiElementsForWrite(anchorBlock)) return;
final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
@NotNull
@Override
protected String suggestLocalName(@NotNull Project project, @NotNull PsiField field, @NotNull PsiCodeBlock scope) {
final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(project);
final String propertyName = styleManager.variableNameToPropertyName(myField.getName(), VariableKind.FIELD);
String localName = styleManager.propertyNameToVariableName(propertyName, VariableKind.LOCAL_VARIABLE);
localName = RefactoringUtil.suggestUniqueVariableName(localName, anchorBlock, myField);
PsiElement firstElement = getFirstElement(refs);
boolean mayBeFinal = mayBeFinal(refsSet, firstElement);
PsiElement newDeclaration = null;
try {
final PsiElement anchor = getAnchorElement(anchorBlock, firstElement);
if (anchor instanceof PsiExpressionStatement &&
((PsiExpressionStatement) anchor).getExpression() instanceof PsiAssignmentExpression) {
final PsiAssignmentExpression expression = (PsiAssignmentExpression) ((PsiExpressionStatement) anchor).getExpression();
if (expression.getOperationTokenType() == JavaTokenType.EQ &&
expression.getLExpression() instanceof PsiReferenceExpression &&
((PsiReference)expression.getLExpression()).isReferenceTo(myField)) {
final PsiExpression initializer = expression.getRExpression();
final PsiDeclarationStatement decl = elementFactory.createVariableDeclarationStatement(localName, myField.getType(), initializer);
if (!mayBeFinal) {
PsiUtil.setModifierProperty((PsiModifierListOwner)decl.getDeclaredElements()[0], PsiModifier.FINAL, false);
}
newDeclaration = anchor.replace(decl);
refsSet.remove(expression.getLExpression());
retargetReferences(elementFactory, localName, refsSet);
}
else {
newDeclaration = addDeclarationWithFieldInitializerAndRetargetReferences(elementFactory, localName, anchorBlock, anchor, refsSet,
myField);
}
}
else {
newDeclaration = addDeclarationWithFieldInitializerAndRetargetReferences(elementFactory, localName, anchorBlock, anchor, refsSet,
myField);
}
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
if (newDeclaration != null) {
if (docComment != null) {
final StringBuilder buf = new StringBuilder();
for (PsiElement psiElement : docComment.getDescriptionElements()) {
buf.append(psiElement.getText());
}
if (buf.length() > 0) {
final JavaCommenter commenter = new JavaCommenter();
final PsiComment comment = JavaPsiFacade.getElementFactory(project)
.createCommentFromText(commenter.getBlockCommentPrefix() +
buf.toString() +
commenter.getBlockCommentSuffix(), newDeclaration);
newDeclaration.getParent().addBefore(comment, newDeclaration);
}
}
final PsiFile psiFile = myField.getContainingFile();
final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
if (editor != null && IJSwingUtilities.hasFocus(editor.getComponent())) {
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == psiFile) {
editor.getCaretModel().moveToOffset(newDeclaration.getTextOffset());
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
}
}
}
try {
myField.normalizeDeclaration();
myField.delete();
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
final String propertyName = styleManager.variableNameToPropertyName(field.getName(), VariableKind.FIELD);
final String localName = styleManager.propertyNameToVariableName(propertyName, VariableKind.LOCAL_VARIABLE);
return RefactoringUtil.suggestUniqueVariableName(localName, scope, field);
}
private static boolean mayBeFinal(Set<PsiReference> refsSet, PsiElement firstElement) {
for (PsiReference ref : refsSet) {
PsiElement element = ref.getElement();
if (element == firstElement) continue;
if (element instanceof PsiExpression && PsiUtil.isAccessedForWriting((PsiExpression) element)) return false;
private static void moveDocCommentToDeclaration(@NotNull Project project, @NotNull PsiDocComment docComment, @NotNull PsiElement declaration) {
final StringBuilder buf = new StringBuilder();
for (PsiElement psiElement : docComment.getDescriptionElements()) {
buf.append(psiElement.getText());
}
return true;
}
private static void retargetReferences(final PsiElementFactory elementFactory, final String localName, final Set<PsiReference> refs)
throws IncorrectOperationException {
final PsiReferenceExpression refExpr = (PsiReferenceExpression)elementFactory.createExpressionFromText(localName, null);
for (PsiReference ref : refs) {
if (ref instanceof PsiReferenceExpression) {
((PsiReferenceExpression)ref).replace(refExpr);
}
if (buf.length() > 0) {
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
final JavaCommenter commenter = new JavaCommenter();
final PsiComment comment = elementFactory.createCommentFromText(commenter.getBlockCommentPrefix() + buf.toString() + commenter.getBlockCommentSuffix(), declaration);
declaration.getParent().addBefore(comment, declaration);
}
}
private static PsiElement addDeclarationWithFieldInitializerAndRetargetReferences(final PsiElementFactory elementFactory,
final String localName,
final PsiCodeBlock anchorBlock,
final PsiElement anchor,
final Set<PsiReference> refs,
PsiField myField)
throws IncorrectOperationException {
final PsiDeclarationStatement decl = elementFactory.createVariableDeclarationStatement(localName, myField.getType(), myField.getInitializer());
final PsiElement newDeclaration = anchorBlock.addBefore(decl, anchor);
retargetReferences(elementFactory, localName, refs);
return newDeclaration;
}
@NotNull
public String getFamilyName() {
return getName();
}
private static PsiElement getAnchorElement(final PsiCodeBlock anchorBlock, @NotNull PsiElement firstElement) {
PsiElement element = firstElement;
while (element != null && element.getParent() != anchorBlock) {
element = element.getParent();
}
return element;
}
private static PsiElement getFirstElement(Collection<PsiReference> refs) {
PsiElement firstElement = null;
for (PsiReference reference : refs) {
final PsiElement element = reference.getElement();
if (firstElement == null || firstElement.getTextRange().getStartOffset() > element.getTextRange().getStartOffset()) {
firstElement = element;
}
}
return firstElement;
}
private static PsiCodeBlock findAnchorBlock(final Collection<PsiReference> refs) {
PsiCodeBlock result = null;
for (PsiReference psiReference : refs) {
final PsiElement element = psiReference.getElement();
PsiCodeBlock block = PsiTreeUtil.getParentOfType(element, PsiCodeBlock.class);
if (result == null || block == null) {
result = block;
}
else {
final PsiElement commonParent = PsiTreeUtil.findCommonParent(result, block);
result = PsiTreeUtil.getParentOfType(commonParent, PsiCodeBlock.class, false);
}
}
return result;
}
}
public boolean runForWholeFile() {
return true;
}
}
}
@@ -0,0 +1,151 @@
/*
* 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.codeInspection.varScopeCanBeNarrowed;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.*;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.controlFlow.*;
import com.intellij.psi.search.searches.SuperMethodsSearch;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
/**
* @author Danila Ponomarenko
*/
public class ParameterCanBeLocalInspection extends BaseJavaLocalInspectionTool {
@NonNls public static final String SHORT_NAME = "ParameterCanBeLocal";
@NotNull
public String getGroupDisplayName() {
return GroupNames.CLASS_LAYOUT_GROUP_NAME;
}
@NotNull
public String getDisplayName() {
return InspectionsBundle.message("inspection.parameter.can.be.local.display.name");
}
@NotNull
public String getShortName() {
return SHORT_NAME;
}
@Override
public ProblemDescriptor[] checkMethod(@NotNull PsiMethod method, @NotNull InspectionManager manager, boolean isOnTheFly) {
final Collection<PsiParameter> parameters = filterFinal(method.getParameterList().getParameters());
final PsiCodeBlock body = method.getBody();
if (body == null || parameters.isEmpty() || isOverrides(method)) {
return ProblemDescriptor.EMPTY_ARRAY;
}
final List<ProblemDescriptor> result = new ArrayList<ProblemDescriptor>();
for (PsiParameter parameter : getWriteBeforeRead(parameters, body)) {
final PsiIdentifier identifier = parameter.getNameIdentifier();
if (identifier != null) {
result.add(createProblem(manager, identifier, isOnTheFly));
}
}
return result.toArray(new ProblemDescriptor[result.size()]);
}
@NotNull
private static List<PsiParameter> filterFinal(PsiParameter[] parameters) {
final List<PsiParameter> result = new ArrayList<PsiParameter>(parameters.length);
for (PsiParameter parameter : parameters) {
if (!parameter.hasModifierProperty(PsiModifier.FINAL)) {
result.add(parameter);
}
}
return result;
}
@NotNull
private static ProblemDescriptor createProblem(@NotNull InspectionManager manager,
@NotNull PsiIdentifier identifier,
boolean isOnTheFly) {
return manager.createProblemDescriptor(
identifier,
InspectionsBundle.message("inspection.parameter.can.be.local.problem.descriptor"),
true,
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
isOnTheFly,
new ConvertParameterToLocalQuickFix()
);
}
private static Collection<PsiParameter> getWriteBeforeRead(@NotNull Collection<PsiParameter> parameters,
@NotNull PsiCodeBlock body) {
final ControlFlow controlFlow = getControlFlow(body);
if (controlFlow == null) return Collections.emptyList();
final Set<PsiParameter> result = filterParameters(controlFlow, parameters);
for (final PsiReferenceExpression readBeforeWrite : ControlFlowUtil.getReadBeforeWrite(controlFlow)) {
final PsiElement resolved = readBeforeWrite.resolve();
if (resolved instanceof PsiParameter) {
result.remove((PsiParameter)resolved);
}
}
return result;
}
private static Set<PsiParameter> filterParameters(@NotNull ControlFlow controlFlow, @NotNull Collection<PsiParameter> parameters) {
final Set<PsiVariable> usedVars = new HashSet<PsiVariable>(ControlFlowUtil.getUsedVariables(controlFlow, 0, controlFlow.getSize()));
final Set<PsiParameter> result = new HashSet<PsiParameter>();
for (PsiParameter parameter : parameters) {
if (usedVars.contains(parameter)) {
result.add(parameter);
}
}
return result;
}
private static boolean isOverrides(PsiMethod method) {
return SuperMethodsSearch.search(method, null, true, false).findFirst() != null;
}
@Nullable
private static ControlFlow getControlFlow(final PsiElement context) {
try {
return ControlFlowFactory.getInstance(context.getProject())
.getControlFlow(context, LocalsOrMyInstanceFieldsControlFlowPolicy.getInstance());
}
catch (AnalysisCanceledException e) {
return null;
}
}
public static class ConvertParameterToLocalQuickFix extends BaseConvertToLocalQuickFix<PsiParameter> {
@Override
protected PsiParameter getVariable(@NotNull ProblemDescriptor descriptor) {
return (PsiParameter)descriptor.getPsiElement().getParent();
}
@NotNull
@Override
protected String suggestLocalName(@NotNull Project project, @NotNull PsiParameter parameter, @NotNull PsiCodeBlock scope) {
return parameter.getName();
}
}
}
@@ -132,7 +132,6 @@ public class DefUseUtil {
if (body == null) {
return null;
}
List<Info> unusedDefs = new ArrayList<Info>();
ControlFlow flow;
try {
@@ -223,6 +222,8 @@ public class DefUseUtil {
}
}
List<Info> unusedDefs = new ArrayList<Info>();
for (int i = 0; i < instructions.size(); i++) {
Instruction instruction = instructions.get(i);
if (instruction instanceof WriteVariableInstruction) {
@@ -57,11 +57,11 @@ class InlineToAnonymousConstructorProcessor {
psiElement().withText(PsiKeyword.THIS)));
private final PsiClass myClass;
private final PsiNewExpression myNewExpression;
private PsiNewExpression myNewExpression;
private final PsiType mySuperType;
private final Map<String, PsiExpression> myFieldInitializers = new HashMap<String, PsiExpression>();
private final Map<PsiParameter, PsiVariable> myLocalsForParameters = new HashMap<PsiParameter, PsiVariable>();
private final PsiStatement myNewStatement;
private PsiStatement myNewStatement;
private final PsiElementFactory myElementFactory;
private PsiMethod myConstructor;
private PsiExpressionList myConstructorArguments;
@@ -263,7 +263,23 @@ class InlineToAnonymousConstructorProcessor {
final PsiDeclarationStatement declaration = myElementFactory.createVariableDeclarationStatement(localName, type, initializer);
PsiVariable variable = (PsiVariable)declaration.getDeclaredElements()[0];
PsiUtil.setModifierProperty(variable, PsiModifier.FINAL, true);
myNewStatement.getParent().addBefore(declaration, myNewStatement);
final PsiElement parent = myNewStatement.getParent();
if (parent instanceof PsiCodeBlock) {
variable = (PsiVariable)((PsiDeclarationStatement)parent.addBefore(declaration, myNewStatement)).getDeclaredElements()[0];
}
else {
final int offsetInStatement = myNewExpression.getTextRange().getStartOffset() - myNewStatement.getTextRange().getStartOffset();
final PsiBlockStatement blockStatement = (PsiBlockStatement)myElementFactory.createStatementFromText("{}", null);
PsiCodeBlock block = blockStatement.getCodeBlock();
block.add(declaration);
block.add(myNewStatement);
block = ((PsiBlockStatement)myNewStatement.replace(blockStatement)).getCodeBlock();
variable = (PsiVariable)((PsiDeclarationStatement)block.getStatements()[0]).getDeclaredElements()[0];
myNewStatement = block.getStatements()[1];
myNewExpression = PsiTreeUtil.getParentOfType(myNewStatement.findElementAt(offsetInStatement), PsiNewExpression.class);
}
return variable;
}
catch (IncorrectOperationException e) {
@@ -136,4 +136,13 @@ public interface JVMElementFactory {
@NotNull
PsiTypeParameter createTypeParameter(String name, PsiClassType[] superTypes);
/**
* Creates a class type for the specified class.
*
* @param aClass the class for which the class type is created.
* @return the class type instance.
*/
@NotNull
PsiClassType createType(@NotNull PsiClass aClass);
}
@@ -154,14 +154,6 @@ public interface PsiElementFactory extends PsiJavaParserFacade, JVMElementFactor
*/
@NotNull PsiCodeBlock createCodeBlock();
/**
* Creates a class type for the specified class.
*
* @param aClass the class for which the class type is created.
* @return the class type instance.
*/
@NotNull PsiClassType createType(@NotNull PsiClass aClass);
/**
* Creates a class type for the specified class, using the specified substitutor
* to replace generic type parameters on the class.
@@ -26,6 +26,7 @@ import com.intellij.util.containers.IntArrayList;
import gnu.trove.THashSet;
import gnu.trove.TIntHashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
@@ -73,7 +74,7 @@ public class ControlFlowUtil {
}
public static List<PsiVariable> getSSAVariables(ControlFlow flow, int from, int to,
boolean reportVarsIfNonInitializingPathExists) {
boolean reportVarsIfNonInitializingPathExists) {
List<Instruction> instructions = flow.getInstructions();
Collection<PsiVariable> writtenVariables = getWrittenVariables(flow, from, to, false);
ArrayList<PsiVariable> result = new ArrayList<PsiVariable>(1);
@@ -147,23 +148,25 @@ public class ControlFlowUtil {
private static boolean needVariableValueAt(final PsiVariable variable, final ControlFlow flow, final int offset) {
InstructionClientVisitor<Boolean> visitor = new InstructionClientVisitor<Boolean>() {
final boolean[] neededBelow = new boolean[flow.getSize()+1];
final boolean[] neededBelow = new boolean[flow.getSize() + 1];
@Override
public void procedureEntered(int startOffset, int endOffset) {
for (int i = startOffset; i < endOffset; i++) neededBelow[i] = false;
}
@Override public void visitReadVariableInstruction(ReadVariableInstruction instruction, int offset, int nextOffset) {
@Override
public void visitReadVariableInstruction(ReadVariableInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
boolean needed = neededBelow[nextOffset];
if (instruction.variable.equals(variable)) {
needed = true;
needed = true;
}
neededBelow[offset] |= needed;
}
@Override public void visitWriteVariableInstruction(WriteVariableInstruction instruction, int offset, int nextOffset) {
@Override
public void visitWriteVariableInstruction(WriteVariableInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
boolean needed = neededBelow[nextOffset];
if (instruction.variable.equals(variable)) {
@@ -172,7 +175,8 @@ public class ControlFlowUtil {
neededBelow[offset] = needed;
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
boolean needed = neededBelow[nextOffset];
neededBelow[offset] |= needed;
@@ -182,7 +186,7 @@ public class ControlFlowUtil {
public Boolean getResult() {
return neededBelow[offset];
}
};
};
depthFirstSearch(flow, visitor, offset, flow.getSize());
return visitor.getResult().booleanValue();
}
@@ -267,26 +271,33 @@ public class ControlFlowUtil {
}
final Collection<PsiStatement> exitStatements = new THashSet<PsiStatement>();
InstructionClientVisitor visitor = new InstructionClientVisitor() {
@Override public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
//[ven]This is a hack since Extract Method doesn't want to see throw's exit points
processGotoStatement(classesFilter, exitStatements, findStatement(flow, offset));
}
@Override public void visitBranchingInstruction(BranchingInstruction instruction, int offset, int nextOffset) {
@Override
public void visitBranchingInstruction(BranchingInstruction instruction, int offset, int nextOffset) {
processGoto(flow, start, end, exitPoints, exitStatements, instruction, classesFilter, findStatement(flow, offset));
}
// call/return do not incur exit points
@Override public void visitReturnInstruction(ReturnInstruction instruction, int offset, int nextOffset) {
}
@Override public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
@Override
public void visitReturnInstruction(ReturnInstruction instruction, int offset, int nextOffset) {
}
@Override public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
}
@Override
public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
visitInstruction(instruction, offset, nextOffset);
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (offset >= end - 1) {
int exitOffset = end;
exitOffset = promoteThroughGotoChain(flow, exitOffset);
@@ -319,7 +330,8 @@ public class ControlFlowUtil {
}
if (gotoOffset >= end || gotoOffset < start) {
processGotoStatement(classesFilter, exitStatements, statement);
} else {
}
else {
boolean isReturn = instruction instanceof GoToInstruction && ((GoToInstruction)instruction).isReturn;
final Instruction gotoInstruction = flow.getInstructions().get(gotoOffset);
isReturn |= gotoInstruction instanceof GoToInstruction && ((GoToInstruction)gotoInstruction).isReturn;
@@ -357,7 +369,7 @@ public class ControlFlowUtil {
return offset;
}
public static final Class[] DEFAULT_EXIT_STATEMENTS_CLASSES = new Class[] {PsiReturnStatement.class, PsiBreakStatement.class, PsiContinueStatement.class};
public static final Class[] DEFAULT_EXIT_STATEMENTS_CLASSES = new Class[]{PsiReturnStatement.class, PsiBreakStatement.class, PsiContinueStatement.class};
private static PsiStatement findStatement(ControlFlow flow, int offset) {
PsiElement element = flow.getElement(offset);
@@ -401,22 +413,23 @@ public class ControlFlowUtil {
/**
* Checks possibility of extracting code fragment outside containing anonymous (local) class.
* Also collects variables to be passed as additional parameters.
* @return true if code fragement can be extracted outside
* @param array Vector to collect variables to be passed as additional parameters
* @param scope scope to be scanned (part of code fragement to be extracted)
* @param member member containing the code to be extracted
*
* @param array Vector to collect variables to be passed as additional parameters
* @param scope scope to be scanned (part of code fragement to be extracted)
* @param member member containing the code to be extracted
* @param targetClassMember member in target class containing code fragement
* @return true if code fragement can be extracted outside
*/
public static boolean collectOuterLocals(List<PsiVariable> array, PsiElement scope, PsiElement member,
PsiElement targetClassMember) {
if (scope instanceof PsiMethodCallExpression) {
final PsiMethodCallExpression call = (PsiMethodCallExpression)scope;
if (!checkReferenceExpressionScope (call.getMethodExpression(), targetClassMember)) {
if (!checkReferenceExpressionScope(call.getMethodExpression(), targetClassMember)) {
return false;
}
}
else if (scope instanceof PsiReferenceExpression) {
if (!checkReferenceExpressionScope ((PsiReferenceExpression)scope, targetClassMember)) {
if (!checkReferenceExpressionScope((PsiReferenceExpression)scope, targetClassMember)) {
return false;
}
}
@@ -483,10 +496,10 @@ public class ControlFlowUtil {
depthFirstSearch(flow, visitor);
return visitor.getResult().booleanValue();
}
public static boolean processReturns(final ControlFlow flow, final ReturnStatementsVisitor afterVisitor) throws IncorrectOperationException {
final ConvertReturnClientVisitor instructionsVisitor = new ConvertReturnClientVisitor(flow, afterVisitor);
depthFirstSearch(flow, instructionsVisitor);
instructionsVisitor.afterProcessing();
@@ -510,7 +523,7 @@ public class ControlFlowUtil {
if (instruction.isReturn) {
final PsiElement element = myFlow.getElement(offset);
if (element instanceof PsiReturnStatement) {
final PsiReturnStatement returnStatement = (PsiReturnStatement) element;
final PsiReturnStatement returnStatement = (PsiReturnStatement)element;
myAffectedReturns.add(returnStatement);
}
}
@@ -532,26 +545,30 @@ public class ControlFlowUtil {
isNormalCompletion[myFlow.getSize()] = true;
}
@Override public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > myFlow.getSize()) nextOffset = myFlow.getSize();
boolean isNormal = instruction.offset == nextOffset && nextOffset != offset + 1 ?
!isLeaf(nextOffset) && isNormalCompletion[nextOffset] :
isLeaf(nextOffset) || isNormalCompletion[nextOffset];
!isLeaf(nextOffset) && isNormalCompletion[nextOffset] :
isLeaf(nextOffset) || isNormalCompletion[nextOffset];
isNormalCompletion[offset] |= isNormal;
}
@Override public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > myFlow.getSize()) nextOffset = myFlow.getSize();
isNormalCompletion[offset] |= !isLeaf(nextOffset) && isNormalCompletion[nextOffset];
}
@Override public void visitGoToInstruction(GoToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitGoToInstruction(GoToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > myFlow.getSize()) nextOffset = myFlow.getSize();
isNormalCompletion[offset] |= !instruction.isReturn && isNormalCompletion[nextOffset];
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset > myFlow.getSize()) nextOffset = myFlow.getSize();
boolean isNormal = isLeaf(nextOffset) || isNormalCompletion[nextOffset];
@@ -580,7 +597,8 @@ public class ControlFlowUtil {
}
}
@Override public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (offset > endOffset) return;
int throwToOffset = instruction.offset;
@@ -599,7 +617,8 @@ public class ControlFlowUtil {
isNormalCompletion[offset] |= isNormal;
}
@Override public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (offset > endOffset) return;
if (nextOffset <= endOffset) {
@@ -608,7 +627,8 @@ public class ControlFlowUtil {
}
}
@Override public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
@Override
public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (offset > endOffset) return;
if (nextOffset > endOffset && nextOffset != offset + 1) {
@@ -618,15 +638,17 @@ public class ControlFlowUtil {
isNormalCompletion[offset] |= isNormal;
}
@Override public void visitGoToInstruction(GoToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitGoToInstruction(GoToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (offset > endOffset) return;
boolean isRethrowFromFinally = instruction instanceof ReturnInstruction && ((ReturnInstruction) instruction).isRethrowFromFinally();
boolean isRethrowFromFinally = instruction instanceof ReturnInstruction && ((ReturnInstruction)instruction).isRethrowFromFinally();
boolean isNormal = !instruction.isReturn && isNormalCompletion[nextOffset] && !isRethrowFromFinally;
isNormalCompletion[offset] |= isNormal;
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (offset > endOffset) return;
final boolean isNormal = isLeaf(nextOffset) || isNormalCompletion[nextOffset];
@@ -647,7 +669,7 @@ public class ControlFlowUtil {
InstructionClientVisitor[] visitors = new InstructionClientVisitor[]{
new ReturnPresentClientVisitor(flow),
new UnreachableStatementClientVisitor(flow),
new ReadBeforeWriteClientVisitor(flow),
new ReadBeforeWriteClientVisitor(flow, true),
new InitializedTwiceClientVisitor(flow, 0),
};
CompositeInstructionClientVisitor visitor = new CompositeInstructionClientVisitor(visitors);
@@ -664,10 +686,13 @@ public class ControlFlowUtil {
// false if control flow at this offset terminates abruptly
final boolean[] canCompleteNormally = new boolean[flow.getSize() + 1];
@Override public void visitConditionalGoToInstruction(ConditionalGoToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitConditionalGoToInstruction(ConditionalGoToInstruction instruction, int offset, int nextOffset) {
checkInstruction(offset, nextOffset, false);
}
@Override public void visitGoToInstruction(GoToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitGoToInstruction(GoToInstruction instruction, int offset, int nextOffset) {
checkInstruction(offset, nextOffset, instruction.isReturn);
}
@@ -684,7 +709,8 @@ public class ControlFlowUtil {
canCompleteNormally[offset] |= isNormal;
}
@Override public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (offset > endOffset) return;
int throwToOffset = instruction.offset;
@@ -698,7 +724,8 @@ public class ControlFlowUtil {
canCompleteNormally[offset] |= isNormal;
}
@Override public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (offset > endOffset) return;
if (nextOffset <= endOffset) {
@@ -707,7 +734,8 @@ public class ControlFlowUtil {
}
}
@Override public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
@Override
public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (offset > endOffset) return;
if (nextOffset > endOffset && nextOffset != offset + 1) {
@@ -717,7 +745,8 @@ public class ControlFlowUtil {
canCompleteNormally[offset] |= isNormal;
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
checkInstruction(offset, nextOffset, false);
}
@@ -739,6 +768,7 @@ public class ControlFlowUtil {
depthFirstSearch(flow, visitor);
return visitor.getResult();
}
private static class UnreachableStatementClientVisitor extends InstructionClientVisitor<PsiElement> {
private final ControlFlow myFlow;
@@ -760,7 +790,7 @@ public class ControlFlowUtil {
}
if (element instanceof PsiStatement
&& element.getParent() instanceof PsiForStatement
&& element == ((PsiForStatement) element.getParent()).getUpdate()) {
&& element == ((PsiForStatement)element.getParent()).getUpdate()) {
continue;
}
//filter out generated stmts
@@ -809,11 +839,13 @@ public class ControlFlowUtil {
class MyVisitor extends InstructionClientVisitor<Boolean> {
// true if from this point below there may be branch with no variable assignment
final boolean[] maybeUnassigned = new boolean[flow.getSize() + 1];
{
maybeUnassigned[maybeUnassigned.length-1] = true;
maybeUnassigned[maybeUnassigned.length - 1] = true;
}
@Override public void visitWriteVariableInstruction(WriteVariableInstruction instruction, int offset, int nextOffset) {
@Override
public void visitWriteVariableInstruction(WriteVariableInstruction instruction, int offset, int nextOffset) {
if (instruction.variable == variable) {
maybeUnassigned[offset] = false;
}
@@ -822,7 +854,8 @@ public class ControlFlowUtil {
}
}
@Override public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
boolean unassigned = offset == flow.getSize() - 1
|| !isLeaf(nextOffset) && maybeUnassigned[nextOffset];
@@ -830,21 +863,24 @@ public class ControlFlowUtil {
maybeUnassigned[offset] |= unassigned;
}
@Override public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
@Override
public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
visitInstruction(instruction, offset, nextOffset);
// clear return statements after procedure as well
for (int i = instruction.procBegin; i<instruction.procEnd+3;i++) {
for (int i = instruction.procBegin; i < instruction.procEnd + 3; i++) {
maybeUnassigned[i] = false;
}
}
@Override public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
boolean unassigned = !isLeaf(nextOffset) && maybeUnassigned[nextOffset];
maybeUnassigned[offset] |= unassigned;
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
boolean unassigned = isLeaf(nextOffset) || maybeUnassigned[nextOffset];
@@ -867,27 +903,31 @@ public class ControlFlowUtil {
// true if from this point below there may be branch with variable assignment
final boolean[] maybeAssigned = new boolean[flow.getSize() + 1];
@Override public void visitWriteVariableInstruction(WriteVariableInstruction instruction, int offset, int nextOffset) {
@Override
public void visitWriteVariableInstruction(WriteVariableInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
boolean assigned = instruction.variable == variable || maybeAssigned[nextOffset];
maybeAssigned[offset] |= assigned;
}
@Override public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitThrowToInstruction(ThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
boolean assigned = !isLeaf(nextOffset) && maybeAssigned[nextOffset];
maybeAssigned[offset] |= assigned;
}
@Override public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
@Override
public void visitConditionalThrowToInstruction(ConditionalThrowToInstruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
int throwToOffset = instruction.offset;
boolean assigned = throwToOffset == nextOffset ? !isLeaf(nextOffset) && maybeAssigned[nextOffset] :
maybeAssigned[nextOffset];
maybeAssigned[nextOffset];
maybeAssigned[offset] |= assigned;
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
boolean assigned = maybeAssigned[nextOffset];
@@ -914,7 +954,8 @@ public class ControlFlowUtil {
// set of exit posint reached from this offset
final TIntHashSet[] exitPoints = new TIntHashSet[flow.getSize()];
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (exitPoints[offset] == null) {
@@ -978,7 +1019,8 @@ public class ControlFlowUtil {
synchronized (instructions) {
final IntArrayList currentProcedureReturnOffsets = new IntArrayList();
ControlFlowInstructionVisitor getNextOffsetVisitor = new ControlFlowInstructionVisitor() {
@Override public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
@Override
public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
instruction.execute(offset + 1);
int newOffset = instruction.offset;
// 'procedure' pointed by call instruction should be processed regardless of whether it was already visited or not
@@ -997,7 +1039,8 @@ public class ControlFlowUtil {
currentProcedureReturnOffsets.add(offset + 1);
}
@Override public void visitReturnInstruction(ReturnInstruction instruction, int offset, int nextOffset) {
@Override
public void visitReturnInstruction(ReturnInstruction instruction, int offset, int nextOffset) {
int newOffset = instruction.execute(false);
if (newOffset != -1) {
oldOffsets.add(offset);
@@ -1008,7 +1051,8 @@ public class ControlFlowUtil {
}
}
@Override public void visitBranchingInstruction(BranchingInstruction instruction, int offset, int nextOffset) {
@Override
public void visitBranchingInstruction(BranchingInstruction instruction, int offset, int nextOffset) {
int newOffset = instruction.offset;
oldOffsets.add(offset);
newOffsets.add(newOffset);
@@ -1017,7 +1061,8 @@ public class ControlFlowUtil {
newOffsets.add(-1);
}
@Override public void visitConditionalBranchingInstruction(ConditionalBranchingInstruction instruction, int offset, int nextOffset) {
@Override
public void visitConditionalBranchingInstruction(ConditionalBranchingInstruction instruction, int offset, int nextOffset) {
int newOffset = instruction.offset;
oldOffsets.add(offset);
@@ -1033,7 +1078,8 @@ public class ControlFlowUtil {
newOffsets.add(-1);
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
int newOffset = offset + 1;
oldOffsets.add(offset);
newOffsets.add(newOffset);
@@ -1063,7 +1109,7 @@ public class ControlFlowUtil {
}
if (!currentProcedureReturnOffsets.isEmpty()) {
int returnOffset = currentProcedureReturnOffsets.get(currentProcedureReturnOffsets.size() - 1);
CallInstruction callInstruction = (CallInstruction) instructions.get(returnOffset - 1);
CallInstruction callInstruction = (CallInstruction)instructions.get(returnOffset - 1);
// check if we inside procedure but 'return offset' stack is empty, so
// we should push back to 'return offset' stack
synchronized (callInstruction.stack) {
@@ -1099,6 +1145,7 @@ public class ControlFlowUtil {
newList.list.add(value);
return newList;
}
public CopyOnWriteList remove(VariableInfo value) {
CopyOnWriteList newList = new CopyOnWriteList();
List<VariableInfo> list = getList();
@@ -1116,8 +1163,17 @@ public class ControlFlowUtil {
}
public CopyOnWriteList() {
list = new LinkedList<VariableInfo>();
this(Collections.<VariableInfo>emptyList());
}
public CopyOnWriteList(VariableInfo... infos) {
this(Arrays.asList(infos));
}
public CopyOnWriteList(Collection<VariableInfo> infos) {
list = new LinkedList<VariableInfo>(infos);
}
public CopyOnWriteList addAll(CopyOnWriteList addList) {
CopyOnWriteList newList = new CopyOnWriteList();
List<VariableInfo> list = getList();
@@ -1133,7 +1189,12 @@ public class ControlFlowUtil {
}
return newList;
}
public static CopyOnWriteList add(@Nullable CopyOnWriteList list, @NotNull VariableInfo value) {
return list == null ? new CopyOnWriteList(value) : list.add(value);
}
}
public static class VariableInfo {
private final PsiVariable variable;
public final PsiElement expression;
@@ -1151,68 +1212,81 @@ public class ControlFlowUtil {
return variable.hashCode();
}
}
private static void merge(int offset, CopyOnWriteList readVars, CopyOnWriteList[] readVariables) {
if (readVars != null) {
CopyOnWriteList existing = readVariables[offset];
readVariables[offset] = existing == null ? readVars : existing.addAll(readVars);
private static void merge(int offset, CopyOnWriteList source, CopyOnWriteList[] target) {
if (source != null) {
CopyOnWriteList existing = target[offset];
target[offset] = existing == null ? source : existing.addAll(source);
}
}
/**
* @return list of PsiReferenceExpression of usages of non-initialized variables
* @return list of PsiReferenceExpression of usages of non-initialized local variables
*/
public static List<PsiReferenceExpression> getReadBeforeWrite(final ControlFlow flow) {
InstructionClientVisitor<List<PsiReferenceExpression>> visitor = new ReadBeforeWriteClientVisitor(flow);
public static List<PsiReferenceExpression> getReadBeforeWriteLocals(ControlFlow flow) {
final InstructionClientVisitor<List<PsiReferenceExpression>> visitor = new ReadBeforeWriteClientVisitor(flow, true);
depthFirstSearch(flow, visitor);
return visitor.getResult();
}
public static List<PsiReferenceExpression> getReadBeforeWrite(ControlFlow flow) {
final InstructionClientVisitor<List<PsiReferenceExpression>> visitor = new ReadBeforeWriteClientVisitor(flow, false);
depthFirstSearch(flow, visitor);
return visitor.getResult();
}
private static class ReadBeforeWriteClientVisitor extends InstructionClientVisitor<List<PsiReferenceExpression>> {
// map of variable->PsiReferenceExpressions for all read before written variables for this point and below in control flow
private final CopyOnWriteList[] readVariables;
private final ControlFlow myFlow;
private boolean localVariablesOnly;
public ReadBeforeWriteClientVisitor(ControlFlow flow) {
public ReadBeforeWriteClientVisitor(ControlFlow flow, boolean localVariablesOnly) {
myFlow = flow;
readVariables = new CopyOnWriteList[myFlow.getSize()+1];
this.localVariablesOnly = localVariablesOnly;
readVariables = new CopyOnWriteList[myFlow.getSize() + 1];
}
@Override public void visitReadVariableInstruction(ReadVariableInstruction instruction, int offset, int nextOffset) {
if (nextOffset > myFlow.getSize()) nextOffset = myFlow.getSize();
CopyOnWriteList readVars = readVariables[nextOffset];
PsiElement element = myFlow.getElement(offset);
@Override
public void visitReadVariableInstruction(ReadVariableInstruction instruction, int offset, int nextOffset) {
CopyOnWriteList readVars = readVariables[Math.min(nextOffset, myFlow.getSize())];
final PsiVariable variable = instruction.variable;
if (!(variable instanceof PsiParameter) || ((PsiParameter)variable).getDeclarationScope() instanceof PsiForeachStatement) {
PsiReferenceExpression expression = getEnclosingReferenceExpression(element, variable);
if (!localVariablesOnly || !isMethodParameter(variable)) {
final PsiReferenceExpression expression = getEnclosingReferenceExpression(myFlow.getElement(offset), variable);
if (expression != null) {
VariableInfo variableInfo = new VariableInfo(variable, expression);
if (readVars == null) {
readVars = new CopyOnWriteList();
readVars.list.add(variableInfo);
}
else {
readVars = readVars.add(variableInfo);
}
readVars = CopyOnWriteList.add(readVars, new VariableInfo(variable, expression));
}
}
merge(offset, readVars, readVariables);
}
@Override public void visitWriteVariableInstruction(WriteVariableInstruction instruction, int offset, int nextOffset) {
if (nextOffset > myFlow.getSize()) nextOffset = myFlow.getSize();
CopyOnWriteList readVars = readVariables[nextOffset];
@Override
public void visitWriteVariableInstruction(WriteVariableInstruction instruction, int offset, int nextOffset) {
CopyOnWriteList readVars = readVariables[Math.min(nextOffset, myFlow.getSize())];
if (readVars == null) return;
final PsiVariable variable = instruction.variable;
if (readVars != null && (!(variable instanceof PsiParameter) || ((PsiParameter)variable).getDeclarationScope() instanceof PsiForeachStatement)) {
if (!localVariablesOnly || !isMethodParameter(variable)) {
readVars = readVars.remove(new VariableInfo(variable, null));
}
merge(offset, readVars, readVariables);
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset > myFlow.getSize()) nextOffset = myFlow.getSize();
CopyOnWriteList readVars = readVariables[nextOffset];
merge(offset, readVars, readVariables);
private static boolean isMethodParameter(@NotNull PsiVariable variable) {
if (variable instanceof PsiParameter) {
final PsiParameter parameter = (PsiParameter)variable;
return !(parameter.getDeclarationScope() instanceof PsiForeachStatement);
}
return false;
}
@Override public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
merge(offset, readVariables[Math.min(nextOffset, myFlow.getSize())], readVariables);
}
@Override
public void visitCallInstruction(CallInstruction instruction, int offset, int nextOffset) {
visitInstruction(instruction, offset, nextOffset);
for (int i = instruction.procBegin; i <= instruction.procEnd; i++) {
readVariables[i] = null;
@@ -1221,30 +1295,32 @@ public class ControlFlowUtil {
@Override
public List<PsiReferenceExpression> getResult() {
List<PsiReferenceExpression> problemsFound = new ArrayList<PsiReferenceExpression>();
CopyOnWriteList topReadVariables = readVariables[0];
if (topReadVariables != null) {
List<VariableInfo> list = topReadVariables.getList();
for (final VariableInfo variableInfo : list) {
problemsFound.add((PsiReferenceExpression)variableInfo.expression);
}
final CopyOnWriteList topReadVariables = readVariables[0];
if (topReadVariables == null) return Collections.emptyList();
final List<PsiReferenceExpression> result = new ArrayList<PsiReferenceExpression>();
List<VariableInfo> list = topReadVariables.getList();
for (final VariableInfo variableInfo : list) {
result.add((PsiReferenceExpression)variableInfo.expression);
}
return problemsFound;
return result;
}
}
public static final int NORMAL_COMPLETION_REASON = 1;
public static final int RETURN_COMPLETION_REASON = 2;
/**
* return reasons.normalCompletion when block can complete normally
* reasons.returnCalled when block can complete abruptly because of return statement executed
* reasons.returnCalled when block can complete abruptly because of return statement executed
*/
public static int getCompletionReasons(final ControlFlow flow, final int offset, final int endOffset) {
class MyVisitor extends InstructionClientVisitor<Integer> {
final boolean[] normalCompletion = new boolean[endOffset];
final boolean[] returnCalled = new boolean[endOffset];
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
boolean ret = nextOffset < endOffset && returnCalled[nextOffset];
boolean normal = nextOffset < endOffset && normalCompletion[nextOffset];
final PsiElement element = flow.getElement(offset);
@@ -1302,62 +1378,63 @@ public class ControlFlowUtil {
writtenTwiceVariables = new CopyOnWriteList[myFlow.getSize() + 1];
}
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset > myFlow.getSize()) nextOffset = myFlow.getSize();
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
final int safeNextOffset = Math.min(nextOffset, myFlow.getSize());
CopyOnWriteList writeVars = writtenVariables[nextOffset];
CopyOnWriteList writeTwiceVars = writtenTwiceVariables[nextOffset];
CopyOnWriteList writeVars = writtenVariables[safeNextOffset];
CopyOnWriteList writeTwiceVars = writtenTwiceVariables[safeNextOffset];
if (instruction instanceof WriteVariableInstruction) {
final WriteVariableInstruction writeVariableInstruction = (WriteVariableInstruction)instruction;
final PsiVariable variable = writeVariableInstruction.variable;
final PsiElement element = myFlow.getElement(offset);
final PsiVariable variable = ((WriteVariableInstruction)instruction).variable;
final PsiElement latestWriteVarExpression = getLatestWriteVarExpression(writeVars, variable);
PsiElement latestWriteVarExpression = null;
if (writeVars != null) {
List<VariableInfo> list = writeVars.getList();
for (final VariableInfo variableInfo : list) {
if (variableInfo.variable == variable) {
latestWriteVarExpression = variableInfo.expression;
break;
}
}
}
if (latestWriteVarExpression == null) {
PsiElement expression = null;
if (element instanceof PsiAssignmentExpression
&& ((PsiAssignmentExpression)element).getLExpression() instanceof PsiReferenceExpression) {
expression = ((PsiAssignmentExpression)element).getLExpression();
}
else if (element instanceof PsiPostfixExpression) {
expression = ((PsiPostfixExpression)element).getOperand();
}
else if (element instanceof PsiPrefixExpression) {
expression = ((PsiPrefixExpression)element).getOperand();
}
else if (element instanceof PsiDeclarationStatement) {
//should not happen
expression = element;
}
if (writeVars == null) {
writeVars = new CopyOnWriteList();
}
writeVars = writeVars.add(new VariableInfo(variable, expression));
final PsiElement expression = getExpression(myFlow.getElement(offset));
writeVars = CopyOnWriteList.add(writeVars, new VariableInfo(variable, expression));
}
else {
if (writeTwiceVars == null) {
writeTwiceVars = new CopyOnWriteList();
}
writeTwiceVars = writeTwiceVars.add(new VariableInfo(variable, latestWriteVarExpression));
writeTwiceVars = CopyOnWriteList.add(writeTwiceVars, new VariableInfo(variable, latestWriteVarExpression));
}
}
merge(offset, writeVars, writtenVariables);
merge(offset, writeTwiceVars, writtenTwiceVariables);
}
@Nullable
private static PsiElement getExpression(@NotNull PsiElement element) {
if (element instanceof PsiAssignmentExpression && ((PsiAssignmentExpression)element).getLExpression() instanceof PsiReferenceExpression) {
return ((PsiAssignmentExpression)element).getLExpression();
}
else if (element instanceof PsiPostfixExpression) {
return ((PsiPostfixExpression)element).getOperand();
}
else if (element instanceof PsiPrefixExpression) {
return ((PsiPrefixExpression)element).getOperand();
}
else if (element instanceof PsiDeclarationStatement) {
//should not happen
return element;
}
return null;
}
@Nullable
private static PsiElement getLatestWriteVarExpression(@Nullable CopyOnWriteList writeVars, @Nullable PsiVariable variable) {
if (writeVars == null) return null;
for (final VariableInfo variableInfo : writeVars.getList()) {
if (variableInfo.variable == variable) {
return variableInfo.expression;
}
}
return null;
}
@Override
@NotNull
public Collection<VariableInfo> getResult() {
CopyOnWriteList writtenTwiceVariable = writtenTwiceVariables[myStartOffset];
final CopyOnWriteList writtenTwiceVariable = writtenTwiceVariables[myStartOffset];
if (writtenTwiceVariable == null) return Collections.emptyList();
return writtenTwiceVariable.getList();
}
@@ -1370,7 +1447,8 @@ public class ControlFlowUtil {
class MyVisitor extends InstructionClientVisitor<Boolean> {
boolean reachable;
@Override public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset == instructionOffset) reachable = true;
}
@@ -1410,5 +1488,4 @@ public class ControlFlowUtil {
int startOffset = flow.getStartOffset(assignmentExpression);
return startOffset != -1 && isInstructionReachable(flow, startOffset, startOffset);
}
}
}
+1
View File
@@ -0,0 +1 @@
loadingTest
@@ -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,9 @@
<component name="libraryTable">
<library name="annotations">
<CLASSES>
<root url="jar://$PROJECT_DIR$/annotations.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
+79
View File
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<defaultAnt bundledAnt="true" />
</component>
<component name="ProjectKey">
<option name="state" value="project://f829118d-d467-4c31-b1e4-e464c512b84b" />
</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_3" assert-keyword="false" jdk-15="false" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="PyConsoleOptionsProvider">
<option name="myPythonConsoleState">
<PyConsoleSettings />
</option>
<option name="myDjangoConsoleState">
<PyConsoleSettings />
</option>
</component>
<component name="SvnConfiguration" maxAnnotateRevisions="500">
<option name="USER" value="" />
<option name="PASSWORD" value="" />
<option name="mySSHConnectionTimeout" value="30000" />
<option name="mySSHReadTimeout" value="30000" />
<option name="LAST_MERGED_REVISION" />
<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" />
<option name="FORCE_UPDATE" value="false" />
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
</component>
<component name="VssConfiguration">
<option name="CLIENT_PATH" value="" />
<option name="SRCSAFEINI_PATH" value="" />
<option name="USER_NAME" value="" />
<option name="PWD" value="" />
<CheckoutOptions>
<option name="COMMENT" value="" />
<option name="DO_NOT_GET_LATEST_VERSION" value="false" />
<option name="REPLACE_WRITABLE" value="false" />
<option name="RECURSIVE" value="false" />
</CheckoutOptions>
<CheckinOptions>
<option name="COMMENT" value="" />
<option name="KEEP_CHECKED_OUT" value="false" />
<option name="RECURSIVE" value="false" />
</CheckinOptions>
<AddOptions>
<option name="STORE_ONLY_LATEST_VERSION" value="false" />
<option name="CHECK_OUT_IMMEDIATELY" value="false" />
</AddOptions>
<UndocheckoutOptions>
<option name="MAKE_WRITABLE" value="false" />
<option name="REPLACE_LOCAL_COPY" value="2" />
<option name="RECURSIVE" value="false" />
</UndocheckoutOptions>
<GetOptions>
<option name="REPLACE_WRITABLE" value="0" />
<option name="MAKE_WRITABLE" value="false" />
<option name="ANSWER_NEGATIVELY" value="false" />
<option name="ANSWER_POSITIVELY" value="false" />
<option name="RECURSIVE" value="false" />
<option name="VERSION" />
</GetOptions>
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</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$/loadingTest.iml" filepath="$PROJECT_DIR$/loadingTest.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>
+7
View File
@@ -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,360 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="be23da49-7729-408e-9c3a-de15906f2aa3" name="Default" comment="" />
<ignored path="loadingTest.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="loadingTest" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="loadingTest.iml" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/loadingTest.iml">
<provider selected="true" editor-type-id="text-editor">
<state line="10" column="0" selection-start="368" selection-end="368" vertical-scroll-proportion="0.22727273">
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
<FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="false" />
</FindUsagesManager>
</component>
<component name="Git.Settings">
<option name="LINE_SEPARATORS_CONVERSION" value="ASK" />
</component>
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/loadingTest.iml" />
</list>
</option>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="x" value="197" />
<option name="y" value="133" />
<option name="width" value="1639" />
<option name="height" value="933" />
</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" />
<OptionsSetting value="true" id="Undo Check Out" />
<OptionsSetting value="true" id="Get Latest Version" />
<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="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="loadingTest" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="loadingTest" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="loadingTest" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" />
<property name="options.splitter.main.proportions" value="0.3" />
<property name="options.lastSelected" value="preferences.pluginManager" />
<property name="MemberChooser.sorted" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="options.searchVisible" value="true" />
<property name="options.splitter.details.proportions" value="0.2" />
</component>
<component name="RunManager">
<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">
<changelist id="be23da49-7729-408e-9c3a-de15906f2aa3" name="Default" comment="" />
<created>1337359306662</created>
<updated>1337359306662</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="197" y="133" width="1639" height="933" extended-state="0" />
<editor active="false" />
<layout>
<window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<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="7" 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="3" 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="3" 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="7" 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="2" 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="7" 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="3" 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="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" 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.24984147" 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="JsTestDriver Server" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" 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="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" />
<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" />
</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="CHANGE_DETAILS_ON" value="false" />
<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="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/loadingTest.iml">
<provider selected="true" editor-type-id="text-editor">
<state line="10" column="0" selection-start="368" selection-end="368" vertical-scroll-proportion="0.22727273">
<folding />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<last-edited>acts-as-taggable-on (v2.0.6, ruby-1.8.7-p334) [gem]</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.6</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>loadingTest</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.6</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.20000002" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<last-edited>annotations</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
@@ -0,0 +1,10 @@
<?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$" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="annotations" level="project" />
</component>
</module>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>Test.java</file>
<line>2</line>
<description>Parameter can be converted to a variable</description>
</problem>
</problems>
@@ -0,0 +1,8 @@
class Temp {
public Temp(int p) {
for (int i = 0; i < 10; i++) {
p = i;
System.out.print(p);
}
}
}
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>Test.java</file>
<line>4</line>
<description>Parameter can be converted to a variable</description>
</problem>
</problems>
@@ -0,0 +1,13 @@
class Temp {
public boolean flag;
void test(int p) {
if (flag) {
p = 1;
}
else {
p = 2;
}
System.out.print(p);
}
}
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>Test.java</file>
<line>3</line>
<description>Parameter can be converted to a variable</description>
</problem>
</problems>
@@ -0,0 +1,7 @@
class Temp {
void test(int p) {
p = 1;
System.out.print(p);
}
}
@@ -0,0 +1,9 @@
// "Convert to local variable" "true"
class Temp {
public Temp() {
for (int i = 0; i < 10; i++) {
<caret>int p = i;
System.out.print(p);
}
}
}
@@ -0,0 +1,15 @@
// "Convert to local variable" "true"
class Temp {
public boolean flag;
void test() {
<caret>int p;
if (flag) {
p = 1;
}
else {
p = 2;
}
System.out.print(p);
}
}
@@ -0,0 +1,8 @@
// "Convert to local variable" "true"
class Temp {
void test() {
<caret>int p = 1;
System.out.print(p);
}
}
@@ -0,0 +1,9 @@
// "Convert to local variable" "true"
class Temp {
public Temp(int <caret>p) {
for (int i = 0; i < 10; i++) {
p = i;
System.out.print(p);
}
}
}
@@ -0,0 +1,14 @@
// "Convert to local variable" "true"
class Temp {
public boolean flag;
void test(int <caret>p) {
if (flag) {
p = 1;
}
else {
p = 2;
}
System.out.print(p);
}
}
@@ -0,0 +1,8 @@
// "Convert to local variable" "true"
class Temp {
void test(int <caret>p) {
p = 1;
System.out.print(p);
}
}
@@ -0,0 +1,26 @@
public class Demo {
static class MyParent {
private final String value;
MyParent(String value) {
this.value = value;
}
}
static class MyC<caret>hild extends MyParent {
MyChild(String value) {
super(value);
}
}
public static void main(String[] args) {
String value = "something";
final MyParent p;
if (true)
p = new MyChild(value);
else
p = new MyParent("value");
}
}
@@ -0,0 +1,22 @@
public class Demo {
static class MyParent {
private final String value;
MyParent(String value) {
this.value = value;
}
}
public static void main(String[] args) {
String value = "something";
final MyParent p;
if (true) {
final String value1 = value;
p = new MyParent(value1);
}
else
p = new MyParent("value");
}
}
@@ -0,0 +1,60 @@
/*
* 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.
*/
/*
* User: anna
* Date: 16-May-2007
*/
package com.intellij.codeInspection;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
import com.intellij.codeInspection.varScopeCanBeNarrowed.ParameterCanBeLocalInspection;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NonNls;
public class ConvertParameterToLocalVariableTest extends LightQuickFixTestCase {
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() + "/inspection";
}
public void test() throws Exception {
doAllTests();
}
@Override
protected void doAction(final String text, final boolean actionShouldBeAvailable, final String testFullPath, final String testName)
throws Exception {
final LocalQuickFix fix = new ParameterCanBeLocalInspection.ConvertParameterToLocalQuickFix();
final int offset = getEditor().getCaretModel().getOffset();
final PsiElement psiElement = getFile().findElementAt(offset);
assert psiElement != null;
final InspectionManager manager = InspectionManager.getInstance(getProject());
final ProblemDescriptor descriptor = manager.createProblemDescriptor(psiElement, "", fix, ProblemHighlightType.LIKE_UNUSED_SYMBOL, true);
fix.applyFix(getProject(), descriptor);
final String expectedFilePath = getBasePath() + "/after" + testName;
checkResultByFile("In file :" + expectedFilePath, expectedFilePath, false);
}
@Override
@NonNls
protected String getBasePath() {
return "/quickFix/ConvertParameterToLocalVariable";
}
}
@@ -0,0 +1,36 @@
/*
* 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.codeInspection;
import com.intellij.JavaTestUtil;
import com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection;
import com.intellij.codeInspection.varScopeCanBeNarrowed.ParameterCanBeLocalInspection;
import com.intellij.testFramework.InspectionTestCase;
public class ParameterCanBeLocalTest extends InspectionTestCase {
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() + "/inspection";
}
private void doTest() throws Exception {
doTest("parameterCanBeLocal/" + getTestName(true), new ParameterCanBeLocalInspection());
}
public void testSimple () throws Exception { doTest(); }
public void testIf () throws Exception { doTest(); }
public void testFor () throws Exception { doTest(); }
}
@@ -226,6 +226,10 @@ public class InlineToAnonymousClassTest extends LightRefactoringTestCase {
doTest(false, true);
}
public void testBraces() throws Exception {
doTest(false, false);
}
public void testNoInlineAbstract() throws Exception {
doTestNoInline("Abstract classes cannot be inlined");
}
@@ -324,11 +324,13 @@ public interface Application extends ComponentManager {
boolean isActive();
/**
* @deprecated use {@link #runReadAction(Runnable)} instead
* Returns lock used for read operations, should be closed in finally block
*/
AccessToken acquireReadActionLock();
/**
* @deprecated use {@link #runWriteAction(Runnable)} instead
* Returns lock used for write operations, should be closed in finally block
*/
AccessToken acquireWriteActionLock(@Nullable Class marker);
@@ -0,0 +1,26 @@
/*
* 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.openapi.components;
import org.jetbrains.annotations.NonNls;
/**
* @author yole
*/
public class ExtensionAreas {
@NonNls public static final String IDEA_PROJECT = "IDEA_PROJECT";
@NonNls public static final String IDEA_MODULE = "IDEA_MODULE";
}
@@ -0,0 +1,23 @@
/*
* 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.openapi.vfs;
/**
* @author yole
*/
public interface JarCopyingFileSystem {
void setNoCopyJarForPath(String pathInJar);
}
@@ -28,6 +28,7 @@ public class StandardFileSystems {
public static String FILE_PROTOCOL = "file";
public static String JAR_PROTOCOL = "jar";
public static String JAR_SEPARATOR = "!/";
public static String HTTP_PROTOCOL = "http";
private static final NotNullLazyValue<VirtualFileSystem> ourLocal = new NotNullLazyValue<VirtualFileSystem>() {
@NotNull
@@ -222,4 +222,9 @@ public class VfsUtilCore {
public static File virtualToIoFile(@NotNull VirtualFile file) {
return new File(PathUtil.toPresentableUrl(file.getUrl()));
}
@NotNull
public static String pathToUrl(@NonNls @NotNull String path) {
return VirtualFileManager.constructUrl(StandardFileSystems.FILE_PROTOCOL, path);
}
}
@@ -21,6 +21,7 @@ import com.intellij.mock.*;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.components.ExtensionAreas;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.impl.DocumentImpl;
import com.intellij.openapi.extensions.ExtensionPoint;
@@ -97,7 +98,7 @@ public class CoreEnvironment {
myLocalFileSystem = new CoreLocalFileSystem();
myJarFileSystem = new CoreJarFileSystem();
Extensions.registerAreaClass("IDEA_PROJECT", null);
Extensions.registerAreaClass(ExtensionAreas.IDEA_PROJECT, null);
myProject = new MockProject(myApplication.getPicoContainer(), myParentDisposable);
final MutablePicoContainer appContainer = myApplication.getPicoContainer();
@@ -131,11 +132,10 @@ public class CoreEnvironment {
myApplication.registerService(StubTreeLoader.class, new CoreStubTreeLoader());
myApplication.registerService(PsiReferenceService.class, new PsiReferenceServiceImpl());
registerExtensionPoint(Extensions.getRootArea(), ContentBasedFileSubstitutor.EP_NAME, ContentBasedFileSubstitutor.class);
registerApplicationExtensionPoint(ContentBasedFileSubstitutor.EP_NAME, ContentBasedFileSubstitutor.class);
registerExtensionPoint(Extensions.getRootArea(), BinaryFileStubBuilders.EP_NAME, FileTypeExtensionPoint.class);
myFileIndexFacade = new MockFileIndexFacade(myProject);
final MutablePicoContainer projectContainer = myProject.getPicoContainer();
PsiModificationTrackerImpl modificationTracker = new PsiModificationTrackerImpl(myProject);
myProject.registerService(PsiModificationTracker.class, modificationTracker);
@@ -175,6 +175,10 @@ public class CoreEnvironment {
};
}
public MockApplication getApplication() {
return myApplication;
}
public Disposable getParentDisposable() {
return myParentDisposable;
}
@@ -199,7 +203,7 @@ public class CoreEnvironment {
addExplicitExtension(LanguageParserDefinitions.INSTANCE, definition.getFileNodeType().getLanguage(), definition);
}
protected <T> void registerComponentInstance(final MutablePicoContainer container, final Class<T> key, final T implementation) {
public static <T> void registerComponentInstance(final MutablePicoContainer container, final Class<T> key, final T implementation) {
container.unregisterComponent(key);
container.registerComponentInstance(key, implementation);
}
@@ -235,20 +239,25 @@ public class CoreEnvironment {
});
}
protected <T> void registerExtensionPoint(final ExtensionsArea area, final ExtensionPointName<T> extensionPointName,
final Class<? extends T> aClass) {
public static <T> void registerExtensionPoint(final ExtensionsArea area, final ExtensionPointName<T> extensionPointName,
final Class<? extends T> aClass) {
final String name = extensionPointName.getName();
registerExtensionPoint(area, name, aClass);
}
protected <T> void registerExtensionPoint(ExtensionsArea area, String name, Class<? extends T> aClass) {
public static <T> void registerExtensionPoint(ExtensionsArea area, String name, Class<? extends T> aClass) {
if (!area.hasExtensionPoint(name)) {
ExtensionPoint.Kind kind = aClass.isInterface() || (aClass.getModifiers() & Modifier.ABSTRACT) != 0 ? ExtensionPoint.Kind.INTERFACE : ExtensionPoint.Kind.BEAN_CLASS;
area.registerExtensionPoint(name, aClass.getName(), kind);
}
}
protected <T> void registerProjectExtensionPoint(final ExtensionPointName<T> extensionPointName,
public static <T> void registerApplicationExtensionPoint(final ExtensionPointName<T> extensionPointName, final Class<? extends T> aClass) {
final String name = extensionPointName.getName();
registerExtensionPoint(Extensions.getRootArea(), name, aClass);
}
public <T> void registerProjectExtensionPoint(final ExtensionPointName<T> extensionPointName,
final Class<? extends T> aClass) {
registerExtensionPoint(Extensions.getArea(myProject), extensionPointName, aClass);
}
@@ -16,6 +16,7 @@
package com.intellij.mock;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.ExtensionAreas;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
@@ -35,7 +36,7 @@ public class MockProject extends MockComponentManager implements Project {
public MockProject(PicoContainer parent, @NotNull Disposable parentDisposable) {
super(parent, parentDisposable);
Extensions.instantiateArea("IDEA_PROJECT", this, null);
Extensions.instantiateArea(ExtensionAreas.IDEA_PROJECT, this, null);
Disposer.register(parentDisposable, new Disposable() {
@Override
public void dispose() {
@@ -73,6 +73,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
private IElementType myElementType;
protected IElementType myContentElementType;
private long myModificationStamp;
protected PsiFile myOriginalFile = null;
private final FileViewProvider myViewProvider;
@@ -354,7 +355,9 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
myStub = null;
}
public void clearCaches() {}
public void clearCaches() {
myModificationStamp ++;
}
@Override
public String getText() {
@@ -386,7 +389,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
@Override
public long getModificationStamp() {
return getViewProvider().getModificationStamp();
return myModificationStamp;
}
@Override
@@ -180,7 +180,7 @@ public class BlockSupportImpl extends BlockSupport {
viewProvider.getLanguages();
FileType fileType = viewProvider.getVirtualFile().getFileType();
final LightVirtualFile lightFile = new LightVirtualFile(fileImpl.getName(), fileType, newFileText, viewProvider.getVirtualFile().getCharset(),
fileImpl.getModificationStamp());
fileImpl.getViewProvider().getModificationStamp());
lightFile.setOriginalFile(viewProvider.getVirtualFile());
FileViewProvider copy = viewProvider.createCopy(lightFile);
@@ -20,9 +20,17 @@
package com.intellij.codeInsight.daemon;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface ChangeLocalityDetector {
/**
* @param changedElement
* @return the psi element (ancestor of the changedElement) which should be re-highlighted, or null if unsure.
* e.g. in Java we re-highlight enclosing code block only when element inside has changed.
* Note: do not traverse PSI tree upwards here,
* since this ChangeLocalityDetector will be called for the changed element and all its parents anyway.
*/
@Nullable
PsiElement getChangeHighlightingDirtyScopeFor(PsiElement changedElement);
PsiElement getChangeHighlightingDirtyScopeFor(@NotNull PsiElement changedElement);
}
@@ -33,7 +33,7 @@ public class LineRange {
public LineRange(final int startLine, final int endLine) {
this.startLine = startLine;
this.endLine = endLine;
LOG.assertTrue(startLine > 0, "Negative start line");
LOG.assertTrue(startLine >= 0, "Negative start line");
if (startLine > endLine) {
LOG.error("start > end: start=" + startLine+"; end="+endLine);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* 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.
@@ -50,9 +50,9 @@ public class EnvironmentVariablesComponent extends LabeledComponent<TextFieldWit
private boolean myPassParentEnvs;
private Map<String, String> myEnvs = new THashMap<String, String>();
@NonNls private static final String ENVS = "envs";
@NonNls private static final String ENV = "env";
@NonNls private static final String NAME = "name";
@NonNls private static final String VALUE = "value";
@NonNls public static final String ENV = "env";
@NonNls public static final String NAME = "name";
@NonNls public static final String VALUE = "value";
@NonNls private static final String OPTION = "option";
@NonNls private static final String ENV_VARIABLES = "ENV_VARIABLES";
@@ -65,6 +65,7 @@ public abstract class SdkType implements SdkTypeId {
public abstract boolean isValidSdkHome(String path);
@Override
@Nullable
public String getVersionString(Sdk sdk) {
return getVersionString(sdk.getHomePath());
@@ -92,8 +93,6 @@ public abstract class SdkType implements SdkTypeId {
@Nullable
public abstract AdditionalDataConfigurable createAdditionalDataConfigurable(SdkModel sdkModel, SdkModificator sdkModificator);
public abstract void saveAdditionalData(SdkAdditionalData additionalData, Element additional);
@Nullable
public SdkAdditionalData loadAdditionalData(Element additional) {
return null;
@@ -31,7 +31,8 @@ import javax.swing.*;
*/
public interface ItemWrapper {
void setupRenderer(ColoredListCellRenderer renderer, Project project, boolean selected);
void updateMnemonicLabel(JLabel label);
void updateAccessoryView(JComponent label);
void execute(Project project, JBPopup popup);
@@ -46,7 +46,7 @@ public class SplitterItem implements ItemWrapper {
}
@Override
public void updateMnemonicLabel(JLabel label) {
public void updateAccessoryView(JComponent label) {
//To change body of implemented methods use File | Settings | File Templates.
}
@@ -55,6 +55,7 @@ public abstract class TextEditorHighlightingPass implements HighlightingPass {
this(project, document, true);
}
@Override
public final void collectInformation(ProgressIndicator progress) {
if (!isValid()) return; //Document has changed.
myDumb = DumbService.getInstance(myProject).isDumb();
@@ -88,6 +89,7 @@ public abstract class TextEditorHighlightingPass implements HighlightingPass {
return true;
}
@Override
public final void applyInformationToEditor() {
if (!isValid()) return; // Document has changed.
if (DumbService.getInstance(myProject).isDumb() && !(this instanceof DumbAware)) {
@@ -785,7 +785,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
final Pair<PsiFile, Document> pair = reference.get();
if (pair != null && pair.first.isValid() && pair.first.getClass().equals(file.getClass())) {
final PsiFile copy = pair.first;
if (copy.getModificationStamp() > file.getModificationStamp()) {
if (copy.getViewProvider().getModificationStamp() > file.getViewProvider().getModificationStamp()) {
((PsiModificationTrackerImpl) file.getManager().getModificationTracker()).incCounter();
}
final Document document = pair.second;
@@ -59,10 +59,10 @@ public class OffsetTranslator implements Disposable {
});
originalFile.getProject().getMessageBus().connect(this).subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() {
long lastModCount = originalFile.getModificationStamp();
long lastModCount = originalFile.getViewProvider().getModificationStamp();
@Override
public void modificationCountChanged() {
if (isUpToDate() && lastModCount != originalFile.getModificationStamp()) {
if (isUpToDate() && lastModCount != originalFile.getViewProvider().getModificationStamp()) {
myTranslation.addAll(sinceCommit);
sinceCommit.clear();
}
@@ -26,6 +26,7 @@ import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.daemon.ReferenceImporter;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.codeInsight.intention.impl.IntentionHintComponent;
import com.intellij.codeInspection.ex.InspectionProfileWrapper;
import com.intellij.concurrency.Job;
import com.intellij.ide.PowerSaveMode;
import com.intellij.lang.annotation.HighlightSeverity;
@@ -53,6 +54,7 @@ import com.intellij.openapi.util.*;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.packageDependencies.DependencyValidationManager;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.psi.PsiCompiledElement;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
@@ -471,7 +473,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
if (myDisposed) return false;
Document document = PsiDocumentManager.getInstance(myProject).getCachedDocument(file);
return document != null &&
document.getModificationStamp() == file.getModificationStamp() &&
document.getModificationStamp() == file.getViewProvider().getModificationStamp() &&
myFileStatusMap.allDirtyScopesAreNull(document);
}
@@ -479,7 +481,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
if (myDisposed) return false;
Document document = PsiDocumentManager.getInstance(myProject).getCachedDocument(file);
return document != null &&
document.getModificationStamp() == file.getModificationStamp() &&
document.getModificationStamp() == file.getViewProvider().getModificationStamp() &&
myFileStatusMap.getFileDirtyScope(document, Pass.UPDATE_ALL) == null;
}
@@ -749,10 +751,31 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
myPassExecutorService.submitPasses(passes, progress, Job.DEFAULT_PRIORITY);
}
};
if (activeEditor == null) {
runnable.run();
}
else {
final InspectionProfileWrapper profile = InspectionProjectProfileManager.getInstance(myProject).getProfileWrapper();
final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(activeEditor.getDocument());
if (psiFile != null && profile != null && !profile.areToolsInstantiated()) {
// optimization: do expensive classloading outside readaction
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
try {
if (!psiFile.getManager().isDisposed() && !profile.areToolsInstantiated()) {
profile.preInstantiateTools(psiFile);
}
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
});
}
((PsiDocumentManagerImpl)PsiDocumentManager.getInstance(myProject)).cancelAndRunWhenAllCommitted(
"start daemon when all committed", runnable);
}
@@ -0,0 +1,35 @@
/*
* 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.codeInsight.daemon.impl;
import com.intellij.codeInsight.daemon.ChangeLocalityDetector;
import com.intellij.codeInspection.SuppressionUtil;
import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiWhiteSpace;
import org.jetbrains.annotations.NotNull;
public class DefaultChangeLocalityDetector implements ChangeLocalityDetector {
@Override
public PsiElement getChangeHighlightingDirtyScopeFor(@NotNull PsiElement changedElement) {
if (changedElement instanceof PsiWhiteSpace ||
changedElement instanceof PsiComment
&& !changedElement.getText().contains(SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME)) {
return changedElement;
}
return null;
}
}
@@ -709,7 +709,8 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
return new ArrayList<PsiElement>(result);
}
List<LocalInspectionToolWrapper> getInspectionTools(InspectionProfileWrapper profile) {
@NotNull
List<LocalInspectionToolWrapper> getInspectionTools(@NotNull InspectionProfileWrapper profile) {
final List<LocalInspectionToolWrapper> tools = profile.getHighlightingLocalInspectionTools(myFile);
for (Iterator<LocalInspectionToolWrapper> iterator = tools.iterator(); iterator.hasNext(); ) {
LocalInspectionToolWrapper tool = iterator.next();
@@ -17,7 +17,6 @@
package com.intellij.codeInsight.daemon.impl;
import com.intellij.codeInsight.daemon.ChangeLocalityDetector;
import com.intellij.codeInspection.SuppressionUtil;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
@@ -214,18 +213,9 @@ public class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable
return;
}
// optimization
if (whitespaceOptimizationAllowed && UpdateHighlightersUtil.isWhitespaceOptimizationAllowed(document)) {
if (child instanceof PsiWhiteSpace ||
child instanceof PsiComment && !child.getText().contains(SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME)) {
myFileStatusMap.markFileScopeDirty(document, child.getTextRange(), fileLength);
return;
}
}
PsiElement element = child;
PsiElement element = whitespaceOptimizationAllowed && UpdateHighlightersUtil.isWhitespaceOptimizationAllowed(document) ? child : child.getParent();
while (true) {
if (element instanceof PsiFile || element instanceof PsiDirectory) {
if (element == null || element instanceof PsiFile || element instanceof PsiDirectory) {
myFileStatusMap.markAllFilesDirty();
return;
}
@@ -242,10 +232,18 @@ public class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable
@Nullable
private static PsiElement getChangeHighlightingScope(PsiElement element) {
DefaultChangeLocalityDetector defaultDetector = null;
for (ChangeLocalityDetector detector : Extensions.getExtensions(EP_NAME)) {
if (detector instanceof DefaultChangeLocalityDetector) {
// run default detector last
assert defaultDetector == null : defaultDetector;
defaultDetector = (DefaultChangeLocalityDetector)detector;
continue;
}
final PsiElement scope = detector.getChangeHighlightingDirtyScopeFor(element);
if (scope != null) return scope;
}
return null;
assert defaultDetector != null : "com.intellij.codeInsight.daemon.impl.DefaultChangeLocalityDetector is unregistered";
return defaultDetector.getChangeHighlightingDirtyScopeFor(element);
}
}
@@ -22,8 +22,10 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.util.Function;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@@ -66,9 +68,9 @@ public class InspectionProfileWrapper {
return enabled;
}
// check whether some inspection got registered twice by accident. Bit only once.
// check whether some inspection got registered twice by accident. 've bit once.
private static boolean alreadyChecked;
private static void checkInspectionsDuplicates(InspectionTool[] tools) {
private static void checkInspectionsDuplicates(@NotNull InspectionTool[] tools) {
if (alreadyChecked) return;
alreadyChecked = true;
Set<InspectionTool> uniqTools = new THashSet<InspectionTool>(tools.length);
@@ -79,6 +81,22 @@ public class InspectionProfileWrapper {
}
}
private volatile boolean toolsInstantiated;
public void preInstantiateTools(PsiFile psiFile) {
if (toolsInstantiated) return;
toolsInstantiated = true;
InspectionTool[] tools = getInspectionTools(psiFile);
for (InspectionTool tool : tools) {
if (tool instanceof InspectionToolWrapper) {
((InspectionToolWrapper)tool).getTool();
}
}
}
public boolean areToolsInstantiated() {
return toolsInstantiated;
}
public String getName() {
return myProfile.getName();
}
@@ -105,13 +123,10 @@ public class InspectionProfileWrapper {
}
public void cleanup(final Project project){
myProfile.cleanup(project);
}
public InspectionProfile getInspectionProfile() {
return myProfile;
}
}
@@ -0,0 +1,46 @@
/*
* 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.execution.configuration;
import com.intellij.openapi.application.PathMacroFilter;
import org.jdom.Attribute;
import org.jdom.Element;
/**
* @author yole
*/
public class RunConfigurationPathMacroFilter extends PathMacroFilter {
@Override
public boolean skipPathMacros(Attribute attribute) {
final Element parent = attribute.getParent();
final String attrName = attribute.getName();
if (parent.getName().equals(EnvironmentVariablesComponent.ENV) &&
(attrName.equals(EnvironmentVariablesComponent.NAME) || attrName.equals(EnvironmentVariablesComponent.VALUE))) {
return true;
}
return false;
}
@Override
public boolean recursePathMacros(Attribute attribute) {
final Element parent = attribute.getParent();
if (parent != null && "option".equals(parent.getName())) {
final Element grandParent = parent.getParentElement();
return grandParent != null && "configuration".equals(grandParent.getName());
}
return false;
}
}
@@ -89,7 +89,8 @@ public class BookmarkItem implements ItemWrapper {
}
}
public void updateMnemonicLabel(JLabel label) {
public void updateAccessoryView(JComponent component) {
JLabel label = (JLabel)component;
final char mnemonic = myBookmark.getMnemonic();
if (mnemonic != 0) {
label.setText(Character.toString(mnemonic) + '.');
@@ -34,6 +34,7 @@ import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.ui.components.JBList;
import com.intellij.ui.popup.util.MasterDetailPopupBuilder;
import com.intellij.ui.speedSearch.FilteringListModel;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.event.KeyEvent;
@@ -99,6 +100,19 @@ public class BookmarksAction extends AnAction implements DumbAware, MasterDetail
}
}
@Nullable
public JComponent createAccessoryView(Project project) {
if (!BookmarkManager.getInstance(project).hasBookmarksWithMnemonics()) {
return null;
}
final JLabel mnemonicLabel = new JLabel();
mnemonicLabel.setFont(Bookmark.MNEMONIC_FONT);
mnemonicLabel.setPreferredSize(new JLabel("W.").getPreferredSize());
mnemonicLabel.setOpaque(false);
return mnemonicLabel;
}
private static DefaultListModel buildModel(Project project) {
final DefaultListModel model = new DefaultListModel();
@@ -109,10 +123,6 @@ public class BookmarksAction extends AnAction implements DumbAware, MasterDetail
return model;
}
public boolean hasItemsWithMnemonic(Project project) {
return BookmarkManager.getInstance(project).hasBookmarksWithMnemonics();
}
protected static class BookmarkInContextInfo {
private final DataContext myDataContext;
private final Project myProject;
@@ -59,7 +59,12 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
private Pattern myCompiledPattern;
private final PatternMatcher myMatcher = new Perl5Matcher();
private Map<AnAction, String> myActionsMap = new HashMap<AnAction, String>();
private Map<AnAction, String> myActionsMap = new TreeMap<AnAction, String>(new Comparator<AnAction>() {
@Override
public int compare(AnAction o1, AnAction o2) {
return Comparing.compare(o1.getTemplatePresentation().getText(), o2.getTemplatePresentation().getText());
}
});
private final SearchableOptionsRegistrar myIndex;
@@ -289,6 +294,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
}
}
final Object[] descriptions = optionDescriptions.toArray();
Arrays.sort(descriptions);
objects = ArrayUtil.mergeArrays(objects, descriptions);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -32,7 +32,7 @@ class ModuleStateStorageManager extends StateStorageManagerImpl {
myModule = module;
}
protected XmlElementStorage.StorageData createStorageData(String storageSpec) {
protected StorageData createStorageData(String storageSpec) {
return new ModuleStoreImpl.ModuleFileData(ROOT_TAG_NAME, myModule);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -112,7 +112,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
myModule = storageData.myModule;
}
protected void load(@NotNull final Element rootElement) throws IOException {
public void load(@NotNull final Element rootElement) throws IOException {
super.load(rootElement);
final List attributes = rootElement.getAttributes();
@@ -145,7 +145,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
return root;
}
public XmlElementStorage.StorageData clone() {
public StorageData clone() {
return new ModuleFileData(this);
}
@@ -154,7 +154,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
}
@Nullable
public Set<String> getDifference(final XmlElementStorage.StorageData storageData, PathMacroSubstitutor substitutor) {
public Set<String> getDifference(final StorageData storageData, PathMacroSubstitutor substitutor) {
final ModuleFileData data = (ModuleFileData)storageData;
if (!myOptions.equals(data.myOptions)) return null;
return super.getDifference(storageData, substitutor);
@@ -20,6 +20,7 @@ import com.intellij.ide.highlighter.ModuleFileType;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.components.ExtensionAreas;
import com.intellij.openapi.components.impl.ComponentManagerImpl;
import com.intellij.openapi.components.impl.ModulePathMacroManager;
import com.intellij.openapi.components.impl.stores.IComponentStore;
@@ -85,7 +86,7 @@ public class ModuleImpl extends ComponentManagerImpl implements ModuleEx {
}
protected void bootstrapPicoContainer() {
Extensions.instantiateArea(PluginManager.AREA_IDEA_MODULE, this, (AreaInstance)getParentComponentManager());
Extensions.instantiateArea(ExtensionAreas.IDEA_MODULE, this, (AreaInstance)getParentComponentManager());
super.bootstrapPicoContainer();
getPicoContainer().registerComponentImplementation(IComponentStore.class, ModuleStoreImpl.class);
getPicoContainer().registerComponentImplementation(ModulePathMacroManager.class);
@@ -24,7 +24,6 @@ import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.*;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.vfs.*;
@@ -164,29 +163,6 @@ public class ProjectJdkTableImpl extends ProjectJdkTable implements PersistentSt
return result;
}
@Override
public Sdk findMostRecentSdkOfType(final SdkTypeId type) {
return findMostRecentSdk(new Condition<Sdk>() {
public boolean value(Sdk sdk) {
return sdk.getSdkType() == type;
}
});
}
@Override
public Sdk findMostRecentSdk(Condition<Sdk> condition) {
Sdk found = null;
for (Sdk each : getAllJdks()) {
if (!condition.value(each)) continue;
if (found == null) {
found = each;
continue;
}
if (Comparing.compare(each.getVersionString(), found.getVersionString()) > 0) found = each;
}
return found;
}
public void addJdk(Sdk jdk) {
ApplicationManager.getApplication().assertWriteAccessAllowed();
mySdks.add(jdk);
@@ -223,8 +199,23 @@ public class ProjectJdkTableImpl extends ProjectJdkTable implements PersistentSt
return UnknownSdkType.getInstance(null);
}
@Override
public SdkTypeId getSdkTypeByName(String sdkTypeName) {
return findSdkTypeByName(sdkTypeName);
}
public static SdkTypeId findSdkTypeByName(String sdkTypeName) {
final SdkType[] allSdkTypes = SdkType.getAllTypes();
for (final SdkType type : allSdkTypes) {
if (type.getName().equals(sdkTypeName)) {
return type;
}
}
return UnknownSdkType.getInstance(sdkTypeName);
}
public Sdk createSdk(final String name, final SdkTypeId sdkType) {
return new ProjectJdkImpl(name, (SdkType) sdkType);
return new ProjectJdkImpl(name, sdkType);
}
public void loadState(Element element) {
@@ -117,7 +117,7 @@ public class DirectoryIndexComponent extends DirectoryIndexImpl {
VirtualFile f = file.findFileByRelativePath(rel);
if (f != null) {
if (state == originalState) state = state.copy();
state.fillMapWithModuleContent(f, eachModule, f);
state.fillMapWithModuleContent(f, eachModule, f, null);
}
}
}
@@ -133,29 +133,29 @@ public class DirectoryIndexComponent extends DirectoryIndexImpl {
}
if (state == originalState) state = state.copy();
state.fillMapWithModuleContent(file, module, parentInfo.contentRoot);
state.fillMapWithModuleContent(file, module, parentInfo.contentRoot, null);
String parentPackage = state.myDirToPackageName.get(parent);
if (module != null) {
if (parentInfo.isInModuleSource) {
String newDirPackageName = getPackageNameForSubdir(parentPackage, file.getName());
state.fillMapWithModuleSource(file, module, newDirPackageName, parentInfo.sourceRoot, parentInfo.isTestSource);
state.fillMapWithModuleSource(file, module, newDirPackageName, parentInfo.sourceRoot, parentInfo.isTestSource, null);
}
}
if (parentInfo.libraryClassRoot != null) {
String newDirPackageName = getPackageNameForSubdir(parentPackage, file.getName());
state.fillMapWithLibraryClasses(file, newDirPackageName, parentInfo.libraryClassRoot);
state.fillMapWithLibraryClasses(file, newDirPackageName, parentInfo.libraryClassRoot, null);
}
if (parentInfo.isInLibrarySource) {
String newDirPackageName = getPackageNameForSubdir(parentPackage, file.getName());
state.fillMapWithLibrarySources(file, newDirPackageName, parentInfo.sourceRoot);
state.fillMapWithLibrarySources(file, newDirPackageName, parentInfo.sourceRoot, null);
}
if (!parentInfo.getOrderEntries().isEmpty()) {
state.fillMapWithOrderEntries(file, parentInfo.getOrderEntries(), null, null, null, parentInfo);
state.fillMapWithOrderEntries(file, parentInfo.getOrderEntries(), null, null, null, parentInfo, null);
}
return state;
}
@@ -0,0 +1,45 @@
/*
* 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.openapi.roots.impl.libraries;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.project.ProjectBundle;
import org.jetbrains.annotations.NotNull;
import java.io.File;
/**
* @author yole
*/
@State(
name = "libraryTable",
roamingType = RoamingType.DISABLED,
storages = {
@Storage( file = StoragePathMacros.APP_CONFIG + "/applicationLibraries.xml")
}
)
public class ExportableApplicationLibraryTable extends ApplicationLibraryTable implements ExportableComponent {
@NotNull
public File[] getExportFiles() {
return new File[]{PathManager.getOptionsFile(getExternalFileName())};
}
@NotNull
public String getPresentableName() {
return ProjectBundle.message("library.global.settings");
}
}
@@ -72,14 +72,17 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb
myMainPanel = new JPanel(new BorderLayout());
myMainPanel.setOpaque(false);
myMainPanel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
myEventDispatcher.getMulticaster().editingStarted(ContentEntryEditor.this);
}
@Override
public void mouseEntered(MouseEvent e) {
if (!myIsSelected) {
highlight(true);
}
}
@Override
public void mouseExited(MouseEvent e) {
if (!myIsSelected) {
highlight(false);
@@ -106,6 +109,7 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb
protected abstract ModifiableRootModel getModel();
@Override
public void deleteContentEntry() {
final String path = FileUtil.toSystemDependentName(VfsUtil.urlToPath(myContentEntryUrl));
final int answer = Messages.showYesNoDialog(ProjectBundle.message("module.paths.remove.content.prompt", path),
@@ -120,6 +124,7 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb
}
}
@Override
public void deleteContentFolder(ContentEntry contentEntry, ContentFolder folder) {
if (folder instanceof SourceFolder) {
removeSourceFolder((SourceFolder)folder);
@@ -132,6 +137,7 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb
}
@Override
public void navigateFolder(ContentEntry contentEntry, ContentFolder contentFolder) {
final VirtualFile file = contentFolder.getFile();
if (file != null) { // file can be deleted externally
@@ -139,6 +145,7 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb
}
}
@Override
public void setPackagePrefix(SourceFolder folder, String prefix) {
folder.setPackagePrefix(prefix);
update();
@@ -96,7 +96,7 @@ public class PsiToDocumentSynchronizer extends PsiTreeChangeAdapter {
final boolean insideTransaction = myTransactionsMap.containsKey(document);
if (!insideTransaction) {
document.setModificationStamp(psiFile.getModificationStamp());
document.setModificationStamp(psiFile.getViewProvider().getModificationStamp());
if (LOG.isDebugEnabled()) {
PsiDocumentManagerImpl.checkConsistency(psiFile, document);
}
@@ -54,7 +54,7 @@ public class DetailViewImpl extends JPanel implements DetailView {
public DetailViewImpl(Project project) {
super(new BorderLayout());
myProject = project;
setPreferredSize(new Dimension(600, 400));
setPreferredSize(new Dimension(700, 400));
myNothingToShow.setHorizontalAlignment(JLabel.CENTER);
myNothingToShowInEditor.setHorizontalAlignment(JLabel.CENTER);
}
@@ -164,17 +164,12 @@ public class DetailViewImpl extends JPanel implements DetailView {
if (panel != null) {
if (myDetailScrollPanel == null) {
myDetailPanelWrapper = new JPanel(new GridLayout(1, 1));
myDetailPanelWrapper.setBorder(BorderFactory.createEmptyBorder(5, 30, 5, 10));
myDetailPanelWrapper.setBorder(BorderFactory.createEmptyBorder(5, 30, 5, 30));
myDetailPanelWrapper.add(panel);
myDetailScrollPanel =
new JBScrollPane(myDetailPanelWrapper, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) {
@Override
public Dimension getPreferredSize() {
final Dimension size = panel.getPreferredSize();
return new Dimension(size.width, size.height + 10);
}
};
new JBScrollPane(myDetailPanelWrapper, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
myDetailScrollPanel.setPreferredSize(myDetailPanelWrapper.getPreferredSize());
myDetailScrollPanel.setBorder(null);
add(myDetailScrollPanel, BorderLayout.SOUTH);
} else {
@@ -15,7 +15,6 @@
*/
package com.intellij.ui.popup.util;
import com.intellij.ide.bookmarks.Bookmark;
import com.intellij.ide.bookmarks.BookmarkItem;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.ActionManager;
@@ -33,6 +32,7 @@ import com.intellij.ui.speedSearch.FilteringListModel;
import com.intellij.util.Alarm;
import com.intellij.util.Function;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@@ -80,7 +80,7 @@ public class MasterDetailPopupBuilder {
final Alarm updateAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
final DetailViewImpl detailView = new DetailViewImpl(myProject);
myList.setCellRenderer(new ItemRenderer(myProject));
myList.setCellRenderer(new ItemRenderer(myDelegate, myProject));
final ListSelectionModel selectionModel = myList.getSelectionModel();
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@@ -301,26 +301,24 @@ public class MasterDetailPopupBuilder {
void handleMnemonic(KeyEvent e, Project project, JBPopup popup);
boolean hasItemsWithMnemonic(Project project);
@Nullable
JComponent createAccessoryView(Project project);
}
public class ItemRenderer extends JPanel implements ListCellRenderer {
public static class ItemRenderer extends JPanel implements ListCellRenderer {
private final Project myProject;
private final ColoredListCellRenderer myRenderer;
private Delegate myDelegate;
private ItemRenderer(Project project) {
private ItemRenderer(Delegate delegate, Project project) {
super(new BorderLayout());
myProject = project;
setBackground(UIUtil.getListBackground());
final JLabel mnemonicLabel = new JLabel();
mnemonicLabel.setFont(Bookmark.MNEMONIC_FONT);
this.myDelegate = delegate;
final JComponent accessory = myDelegate.createAccessoryView(project);
mnemonicLabel.setPreferredSize(new JLabel("W.").getPreferredSize());
mnemonicLabel.setOpaque(false);
final boolean hasMnemonics = myDelegate.hasItemsWithMnemonic(project);
if (hasMnemonics) {
add(mnemonicLabel, BorderLayout.WEST);
if (accessory != null) {
add(accessory, BorderLayout.WEST);
}
myRenderer = new ColoredListCellRenderer() {
@@ -329,8 +327,8 @@ public class MasterDetailPopupBuilder {
if (value instanceof ItemWrapper) {
final ItemWrapper wrapper = (ItemWrapper)value;
wrapper.setupRenderer(this, myProject, selected);
if (hasMnemonics) {
wrapper.updateMnemonicLabel(mnemonicLabel);
if (accessory != null) {
wrapper.updateAccessoryView(accessory);
}
}
}
@@ -338,7 +336,6 @@ public class MasterDetailPopupBuilder {
add(myRenderer, BorderLayout.CENTER);
}
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value instanceof SplitterItem) {
String label = ((SplitterItem)value).getText();
@@ -349,8 +346,8 @@ public class MasterDetailPopupBuilder {
}
myRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
myRenderer.revalidate();
return this;
}
}
}
@@ -1384,7 +1384,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
@Override
public String getText() {
if (myFile.getModificationStamp() != myDocument.getModificationStamp()) {
if (myFile.getViewProvider().getModificationStamp() != myDocument.getModificationStamp()) {
final ASTNode node = myFile.getNode();
assert node != null;
return node.getText();
@@ -1394,7 +1394,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
@Override
public long getModificationStamp() {
return myFile.getModificationStamp();
return myFile.getViewProvider().getModificationStamp();
}
}
@@ -1418,7 +1418,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
final PsiFile dominantContentFile = findDominantPsiForDocument(document, project);
final DocumentContent content;
if (dominantContentFile != null && dominantContentFile.getModificationStamp() != document.getModificationStamp()) {
if (dominantContentFile != null && dominantContentFile.getViewProvider().getModificationStamp() != document.getModificationStamp()) {
content = new PsiContent(document, dominantContentFile);
}
else {
+1 -1
View File
@@ -28,7 +28,7 @@
</library>
</orderEntry>
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="module" module-name="projectModel-api" />
<orderEntry type="module" module-name="projectModel-api" exported="" />
</component>
</module>
@@ -202,9 +202,16 @@ public class PopupChooserBuilder {
}
final JList finalList = list;
(list != null ? list : myChooserComponent).addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
final Point onScreen = e.getLocationOnScreen();
SwingUtilities.convertPointFromScreen(onScreen, finalList);
final int index = finalList.locationToIndex(onScreen);
if (finalList.getSelectedIndex() != index) return;
if (UIUtil.isActionClick(e, MouseEvent.MOUSE_RELEASED) && !UIUtil.isSelectionButtonDown(e) && !e.isConsumed()) {
if (myCloseOnEnter) {
closePopup(true, e, true);
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.zip.ZipFile;
public abstract class JarFileSystem extends NewVirtualFileSystem {
public abstract class JarFileSystem extends NewVirtualFileSystem implements JarCopyingFileSystem {
@NonNls public static final String PROTOCOL = StandardFileSystems.JAR_PROTOCOL;
@NonNls public static final String PROTOCOL_PREFIX = "jar://";
@NonNls public static final String JAR_SEPARATOR = StandardFileSystems.JAR_SEPARATOR;
@@ -36,8 +36,6 @@ public abstract class JarFileSystem extends NewVirtualFileSystem {
public abstract VirtualFile getVirtualFileForJar(@Nullable VirtualFile entryVFile);
public abstract ZipFile getJarFile(VirtualFile entryVFile) throws IOException;
public abstract void setNoCopyJarForPath(String pathInJar);
@SuppressWarnings("MethodMayBeStatic")
@Nullable
public VirtualFile getJarRootForLocalFile(@NotNull VirtualFile virtualFile) {
@@ -403,11 +403,6 @@ public class VfsUtil extends VfsUtilCore {
return protocol + "://" + path;
}
@NotNull
public static String pathToUrl(@NonNls @NotNull String path) {
return VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, path);
}
@NotNull
public static IFile virtualToIFile(@NotNull VirtualFile file) {
return FileSystem.FILE_SYSTEM.createFile(PathUtil.toPresentableUrl(file.getUrl()));
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -18,13 +18,14 @@ package com.intellij.openapi.vfs.ex.http;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.vfs.DeprecatedVirtualFileSystem;
import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public abstract class HttpFileSystem extends DeprecatedVirtualFileSystem implements ApplicationComponent {
@NonNls public static final String PROTOCOL = "http";
@NonNls public static final String PROTOCOL = StandardFileSystems.HTTP_PROTOCOL;
public static HttpFileSystem getInstance() {
return (HttpFileSystem)VirtualFileManager.getInstance().getFileSystem(PROTOCOL);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* 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.
@@ -28,6 +28,7 @@ import com.intellij.notification.Notifications;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.ExtensionAreas;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.LogProvider;
@@ -74,8 +75,6 @@ import java.util.zip.ZipInputStream;
@SuppressWarnings({"UseOfSystemOutOrSystemErr", "CallToPrintStackTrace"}) // No logger is loaded at this time so we have to use these.
public class PluginManager {
@NonNls public static final String AREA_IDEA_PROJECT = "IDEA_PROJECT";
@NonNls public static final String AREA_IDEA_MODULE = "IDEA_MODULE";
@NonNls private static final String PROPERTY_PLUGIN_PATH = "plugin.path";
private static final Object PLUGIN_CLASSES_LOCK = new Object();
private static String myPluginError = null;
@@ -318,8 +317,8 @@ public class PluginManager {
private static void configureExtensions() {
Extensions.setLogProvider(new IdeaLogProvider());
Extensions.registerAreaClass(AREA_IDEA_PROJECT, null);
Extensions.registerAreaClass(AREA_IDEA_MODULE, AREA_IDEA_PROJECT);
Extensions.registerAreaClass(ExtensionAreas.IDEA_PROJECT, null);
Extensions.registerAreaClass(ExtensionAreas.IDEA_MODULE, ExtensionAreas.IDEA_PROJECT);
}
private static boolean shouldLoadPlugins() {
@@ -197,8 +197,8 @@ public class SearchableOptionsRegistrarImpl extends SearchableOptionsRegistrar {
myStorage.put(new String(option), configs);
}
configs.add(new OptionDescription(null, myIdentifierTable.intern(id), hit != null ? myIdentifierTable.intern(hit) : null,
path != null ? myIdentifierTable.intern(path) : null));
configs.add(new OptionDescription(null, myIdentifierTable.intern(id).trim(), hit != null ? myIdentifierTable.intern(hit).trim() : null,
path != null ? myIdentifierTable.intern(path).trim() : null));
}
@NotNull
@@ -48,7 +48,7 @@ class ApplicationStoreImpl extends ComponentStoreImpl implements IApplicationSto
public ApplicationStoreImpl(final ApplicationImpl application, PathMacroManager pathMacroManager) {
myApplication = application;
myStateStorageManager = new StateStorageManagerImpl(pathMacroManager.createTrackingSubstitutor(), ROOT_ELEMENT_NAME, application, application.getPicoContainer()) {
protected XmlElementStorage.StorageData createStorageData(String storageSpec) {
protected StorageData createStorageData(String storageSpec) {
return new FileBasedStorage.FileStorageData(ROOT_ELEMENT_NAME);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -62,7 +62,7 @@ abstract class BaseFileConfigurableStoreImpl extends ComponentStoreImpl {
}
@Override
protected void load(@NotNull final Element rootElement) throws IOException {
public void load(@NotNull final Element rootElement) throws IOException {
super.load(rootElement);
final String v = rootElement.getAttributeValue(VERSION_OPTION);
@@ -83,7 +83,7 @@ abstract class BaseFileConfigurableStoreImpl extends ComponentStoreImpl {
}
@Override
public XmlElementStorage.StorageData clone() {
public StorageData clone() {
return new BaseStorageData(this);
}
@@ -96,7 +96,7 @@ abstract class BaseFileConfigurableStoreImpl extends ComponentStoreImpl {
@Override
@Nullable
public Set<String> getDifference(final XmlElementStorage.StorageData storageData, PathMacroSubstitutor substitutor) {
public Set<String> getDifference(final StorageData storageData, PathMacroSubstitutor substitutor) {
final BaseStorageData data = (BaseStorageData)storageData;
if (myVersion != data.myVersion) return null;
return super.getDifference(storageData, substitutor);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -21,7 +21,6 @@ import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.util.text.StringUtil;
@@ -30,14 +29,9 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileAdapter;
import com.intellij.openapi.vfs.VirtualFileEvent;
import com.intellij.openapi.vfs.tracker.VirtualFileTracker;
import com.intellij.util.PairConsumer;
import com.intellij.util.io.fs.IFile;
import com.intellij.util.messages.MessageBus;
import gnu.trove.THashMap;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.picocontainer.PicoContainer;
@@ -59,9 +53,7 @@ public class DirectoryBasedStorage implements StateStorage, Disposable {
private final StateSplitter mySplitter;
private Object mySession;
private MyStorageData myStorageData = null;
@NonNls private static final String COMPONENT = "component";
@NonNls private static final String NAME = "name";
private DirectoryStorageData myStorageData = null;
private static final IFile[] EMPTY_FILES = new IFile[0];
@@ -116,66 +108,15 @@ public class DirectoryBasedStorage implements StateStorage, Disposable {
if (!myStorageData.containsComponent(componentName)) {
return DefaultStateSerializer.deserializeState(new Element(COMPONENT), stateClass, mergeInto);
return DefaultStateSerializer.deserializeState(new Element(StorageData.COMPONENT), stateClass, mergeInto);
}
final List<Element> subElements = new ArrayList<Element>();
myStorageData.processComponent(componentName, new PairConsumer<IFile, Element>() {
public void consume(final IFile iFile, final Element element) {
final List children = element.getChildren();
assert children.size() == 1 : JDOMUtil.writeElement(element, File.separator);
final Element subElement = (Element)children.get(0);
subElement.detach();
subElements.add(subElement);
}
});
final Element state = new Element(COMPONENT);
mySplitter.mergeStatesInto(state, subElements.toArray(new Element[subElements.size()]));
myStorageData.removeComponent(componentName);
return DefaultStateSerializer.deserializeState(state, stateClass, mergeInto);
return myStorageData.getMergedState(componentName, stateClass, mySplitter, mergeInto);
}
private MyStorageData loadState() throws StateStorageException {
MyStorageData storageData = new MyStorageData();
if (!myDir.exists()) {
return storageData;
}
final IFile[] files = myDir.listFiles();
for (IFile file : files) {
if (!StringUtil.endsWithIgnoreCase(file.getName(), ".xml")) {
//do not load system files like .DS_Store on Mac
continue;
}
try {
final Document document = JDOMUtil.loadDocument(file);
final Element element = document.getRootElement();
assert element.getName().equals(COMPONENT);
String componentName = element.getAttributeValue(NAME);
assert componentName != null;
if (myPathMacroSubstitutor != null) {
myPathMacroSubstitutor.expandPaths(element);
final Set<String> unknownMacros = StorageUtil.getMacroNames(element);
myPathMacroSubstitutor.addUnknownMacros(componentName, unknownMacros);
}
storageData.put(componentName, file, element, true);
}
catch (IOException e) {
LOG.info("Unable to load state", e);
}
catch (JDOMException e) {
LOG.info("Unable to load state", e);
}
}
private DirectoryStorageData loadState() throws StateStorageException {
DirectoryStorageData storageData = new DirectoryStorageData();
storageData.loadFrom(myDir, myPathMacroSubstitutor);
return storageData;
}
@@ -228,10 +169,10 @@ public class DirectoryBasedStorage implements StateStorage, Disposable {
}
private class MySaveSession implements SaveSession {
private final MyStorageData myStorageData;
private final DirectoryStorageData myStorageData;
private final TrackingPathMacroSubstitutor myPathMacroSubstitutor;
private MySaveSession(final MyStorageData storageData, final TrackingPathMacroSubstitutor pathMacroSubstitutor) {
private MySaveSession(final DirectoryStorageData storageData, final TrackingPathMacroSubstitutor pathMacroSubstitutor) {
myStorageData = storageData;
myPathMacroSubstitutor = pathMacroSubstitutor;
}
@@ -248,7 +189,7 @@ public class DirectoryBasedStorage implements StateStorage, Disposable {
}
}
myStorageData.process(new StorageDataProcessor() {
myStorageData.process(new DirectoryStorageData.StorageDataProcessor() {
public void process(final String componentName, final IFile file, final Element element) {
currentNames.remove(file.getName());
@@ -318,7 +259,7 @@ public class DirectoryBasedStorage implements StateStorage, Disposable {
if (myStorageData.getComponentNames().size() == 0) {
// no state yet, so try to initialize it now
final MyStorageData storageData = loadState();
final DirectoryStorageData storageData = loadState();
return new HashSet<String>(storageData.getComponentNames());
}
@@ -339,7 +280,7 @@ public class DirectoryBasedStorage implements StateStorage, Disposable {
if (!myFileTypeManager.isFileIgnored(child.getName())) currentChildNames.add(child.getName());
}
myStorageData.process(new StorageDataProcessor() {
myStorageData.process(new DirectoryStorageData.StorageDataProcessor() {
public void process(final String componentName, final IFile file, final Element element) {
if (currentChildNames.contains(file.getName())) {
currentChildNames.remove(file.getName());
@@ -369,97 +310,10 @@ public class DirectoryBasedStorage implements StateStorage, Disposable {
}
}
private interface StorageDataProcessor {
void process(String componentName, IFile file, Element element);
}
private static class MyStorageData {
private Map<String, Map<IFile, Element>> myStates = new HashMap<String, Map<IFile, Element>>();
private long myLastTimestamp = 0;
private MyStorageData myOriginalData;
public Set<String> getComponentNames() {
return myStates.keySet();
}
public void put(final String componentName, final IFile file, final Element element, final boolean updateTimestamp) {
LOG.assertTrue(componentName != null, String.format("Component name should not be null for file: %s", file == null ? "NULL!" : file.getPath()));
Map<IFile, Element> stateMap = myStates.get(componentName);
if (stateMap == null) {
stateMap = new HashMap<IFile, Element>();
myStates.put(componentName, stateMap);
}
stateMap.put(file, element);
if (updateTimestamp) updateLastTimestamp(file);
}
public void updateLastTimestamp(final IFile file) {
myLastTimestamp = Math.max(myLastTimestamp, file.getTimeStamp());
if (myOriginalData != null) myOriginalData.myLastTimestamp = myLastTimestamp;
}
public long getLastTimeStamp() {
return myLastTimestamp;
}
public Map<IFile, Long> getAllStorageFiles() {
final Map<IFile, Long> allStorageFiles = new THashMap<IFile, Long>();
process(new StorageDataProcessor() {
public void process(final String componentName, final IFile file, final Element element) {
allStorageFiles.put(file, file.getTimeStamp());
}
});
return allStorageFiles;
}
public void processComponent(@NotNull final String componentName, @NotNull final PairConsumer<IFile, Element> consumer) {
final Map<IFile, Element> map = myStates.get(componentName);
if (map != null) {
for (IFile file : map.keySet()) {
consumer.consume(file, map.get(file));
}
}
}
public void process(@NotNull final StorageDataProcessor processor) {
for (final String componentName : myStates.keySet()) {
processComponent(componentName, new PairConsumer<IFile, Element>() {
public void consume(final IFile iFile, final Element element) {
processor.process(componentName, iFile, element);
}
});
}
}
protected MyStorageData clone() {
final MyStorageData result = new MyStorageData();
result.myStates = new HashMap<String, Map<IFile, Element>>(myStates);
result.myLastTimestamp = myLastTimestamp;
result.myOriginalData = this;
return result;
}
public void clear() {
myStates.clear();
myOriginalData = null;
}
public boolean containsComponent(final String componentName) {
return myStates.get(componentName) != null;
}
public void removeComponent(final String componentName) {
myStates.remove(componentName);
}
}
private class MyExternalizationSession implements ExternalizationSession {
private final MyStorageData myStorageData;
private final DirectoryStorageData myStorageData;
private MyExternalizationSession(final TrackingPathMacroSubstitutor pathMacroSubstitutor, final MyStorageData storageData) {
private MyExternalizationSession(final TrackingPathMacroSubstitutor pathMacroSubstitutor, final DirectoryStorageData storageData) {
myStorageData = storageData;
}
@@ -478,8 +332,8 @@ public class DirectoryBasedStorage implements StateStorage, Disposable {
Element e = pair.first;
String name = pair.second;
Element statePart = new Element(COMPONENT);
statePart.setAttribute(NAME, componentName);
Element statePart = new Element(StorageData.COMPONENT);
statePart.setAttribute(StorageData.NAME, componentName);
e.detach();
statePart.addContent(e);
@@ -32,17 +32,17 @@ class ProjectStateStorageManager extends StateStorageManagerImpl {
myProject = project;
}
protected XmlElementStorage.StorageData createStorageData(String storageSpec) {
protected StorageData createStorageData(String storageSpec) {
if (storageSpec.equals(StoragePathMacros.PROJECT_FILE)) return createIprStorageData();
if (storageSpec.equals(StoragePathMacros.WORKSPACE_FILE)) return createWsStorageData();
return new ProjectStoreImpl.ProjectStorageData(ROOT_TAG_NAME, myProject);
}
public XmlElementStorage.StorageData createWsStorageData() {
public StorageData createWsStorageData() {
return new ProjectStoreImpl.WsStorageData(ROOT_TAG_NAME, myProject);
}
public XmlElementStorage.StorageData createIprStorageData() {
public StorageData createIprStorageData() {
return new ProjectStoreImpl.IprStorageData(ROOT_TAG_NAME, myProject);
}
@@ -418,7 +418,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
myProject = storageData.myProject;
}
public XmlElementStorage.StorageData clone() {
public StorageData clone() {
return new ProjectStorageData(this);
}
}
@@ -432,7 +432,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
super(storageData);
}
public XmlElementStorage.StorageData clone() {
public StorageData clone() {
return new WsStorageData(this);
}
}
@@ -446,7 +446,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
super(storageData);
}
protected void load(@NotNull final Element root) throws IOException {
public void load(@NotNull final Element root) throws IOException {
final String v = root.getAttributeValue(VERSION_OPTION);
//noinspection AssignmentToStaticFieldFromInstanceMethod
originalVersion = v != null ? Integer.parseInt(v) : 0;
@@ -461,7 +461,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
protected void convert(final Element root, final int originalVersion) {
}
public XmlElementStorage.StorageData clone() {
public StorageData clone() {
return new IprStorageData(this);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -376,7 +376,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
}
protected abstract XmlElementStorage.StorageData createStorageData(String storageSpec);
protected abstract StorageData createStorageData(String storageSpec);
private static final Pattern MACRO_PATTERN = Pattern.compile("(\\$[^\\$]*\\$)");
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -15,7 +15,6 @@
*/
package com.intellij.openapi.components.impl.stores;
import com.intellij.application.options.PathMacrosCollector;
import com.intellij.notification.*;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
@@ -39,18 +38,23 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.NotNullFunction;
import com.intellij.util.SystemProperties;
import com.intellij.util.UniqueFileNamesProvider;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.io.fs.FileSystem;
import com.intellij.util.io.fs.IFile;
import org.jdom.*;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.Parent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.event.HyperlinkEvent;
import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
@@ -225,45 +229,6 @@ public class StorageUtil {
return JDOMUtil.writeElement(element, lineSeparator);
}
@NotNull
public static Set<String> getMacroNames(@NotNull final Element e) {
return PathMacrosCollector.getMacroNames(e, new NotNullFunction<Object, Boolean>() {
@NotNull
public Boolean fun(Object o) {
if (o instanceof Attribute) {
final Attribute attribute = (Attribute)o;
final Element parent = attribute.getParent();
final String parentName = parent.getName();
if (("value".equals(attribute.getName()) || "name".equals(attribute.getName())) && "env".equals(parentName)) {
return false; // do not proceed environment variables from run configurations
}
if ("MESSAGE".equals(parentName) && "value".equals(attribute.getName())) return false;
if ("option".equals(parentName) && "LAST_COMMIT_MESSAGE".equals(parent.getAttributeValue("name"))) return false;
// do not proceed macros in searchConfigurations (structural search)
if ("replaceConfiguration".equals(parentName) || "searchConfiguration".equals(parentName)) return false;
}
return true;
}
}, new NotNullFunction<Object, Boolean>() {
@NotNull
public Boolean fun(Object o) {
if (o instanceof Attribute) {
// process run configuration's options recursively
final Element parent = ((Attribute)o).getParent();
if (parent != null && "option".equals(parent.getName())) {
final Element grandParent = parent.getParentElement();
return grandParent != null && "configuration".equals(grandParent.getName());
}
}
return false;
}
});
}
@Nullable
public static Document loadDocument(final byte[] bytes) {
try {

Some files were not shown because too many files have changed in this diff Show More