mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
move some tests to the platform
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
class AClass{
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class Test {
|
||||
AClass field;
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4" relativePaths="true">
|
||||
<component name="AntConfiguration">
|
||||
<defaultAnt bundledAnt="true" />
|
||||
</component>
|
||||
<component name="BuildJarProjectSettings">
|
||||
<option name="BUILD_JARS_ON_MAKE" value="false" />
|
||||
</component>
|
||||
<component name="CodeStyleProjectProfileManger">
|
||||
<option name="PROJECT_PROFILE" />
|
||||
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
||||
<scopes />
|
||||
<profiles />
|
||||
</component>
|
||||
<component name="CodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS" />
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="false" />
|
||||
</component>
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<option name="DEPLOY_AFTER_MAKE" value="0" />
|
||||
<resourceExtensions>
|
||||
<entry name=".+\.(properties|xml|html|dtd|tld)" />
|
||||
<entry name=".+\.(gif|png|jpeg|jpg)" />
|
||||
</resourceExtensions>
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="?*.properties" />
|
||||
<entry name="?*.xml" />
|
||||
<entry name="?*.gif" />
|
||||
<entry name="?*.png" />
|
||||
<entry name="?*.jpeg" />
|
||||
<entry name="?*.jpg" />
|
||||
<entry name="?*.html" />
|
||||
<entry name="?*.dtd" />
|
||||
<entry name="?*.tld" />
|
||||
</wildcardResourcePatterns>
|
||||
</component>
|
||||
<component name="DataSourceManagerImpl" />
|
||||
<component name="DependenciesAnalyzeManager">
|
||||
<option name="myForwardDirection" value="false" />
|
||||
</component>
|
||||
<component name="DependencyValidationManager" />
|
||||
<component name="EclipseCompilerSettings">
|
||||
<option name="DEBUGGING_INFO" value="true" />
|
||||
<option name="GENERATE_NO_WARNINGS" value="true" />
|
||||
<option name="DEPRECATION" value="false" />
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
||||
<option name="MAXIMUM_HEAP_SIZE" value="128" />
|
||||
</component>
|
||||
<component name="EclipseEmbeddedCompilerSettings">
|
||||
<option name="DEBUGGING_INFO" value="true" />
|
||||
<option name="GENERATE_NO_WARNINGS" value="true" />
|
||||
<option name="DEPRECATION" value="false" />
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
||||
<option name="MAXIMUM_HEAP_SIZE" value="128" />
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points />
|
||||
</component>
|
||||
<component name="ExportToHTMLSettings">
|
||||
<option name="PRINT_LINE_NUMBERS" value="false" />
|
||||
<option name="OPEN_IN_BROWSER" value="false" />
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
</component>
|
||||
<component name="GUI Designer component loader factory" />
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
||||
<scopes />
|
||||
<profiles>
|
||||
<profile version="1.0" is_locked="false">
|
||||
<option name="myName" value="Project Default" />
|
||||
<option name="myLocal" value="false" />
|
||||
</profile>
|
||||
</profiles>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="DEBUGGING_INFO" value="true" />
|
||||
<option name="GENERATE_NO_WARNINGS" value="false" />
|
||||
<option name="DEPRECATION" value="true" />
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
||||
<option name="MAXIMUM_HEAP_SIZE" value="128" />
|
||||
</component>
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="OPTION_SCOPE" value="protected" />
|
||||
<option name="OPTION_HIERARCHY" value="true" />
|
||||
<option name="OPTION_NAVIGATOR" value="true" />
|
||||
<option name="OPTION_INDEX" value="true" />
|
||||
<option name="OPTION_SEPARATE_INDEX" value="true" />
|
||||
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
|
||||
<option name="OPTION_DEPRECATED_LIST" value="true" />
|
||||
<option name="OTHER_OPTIONS" value="" />
|
||||
<option name="HEAP_SIZE" />
|
||||
<option name="LOCALE" />
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
</component>
|
||||
<component name="JikesSettings">
|
||||
<option name="JIKES_PATH" value="" />
|
||||
<option name="DEBUGGING_INFO" value="true" />
|
||||
<option name="DEPRECATION" value="true" />
|
||||
<option name="GENERATE_NO_WARNINGS" value="false" />
|
||||
<option name="IS_EMACS_ERRORS_MODE" value="true" />
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
||||
</component>
|
||||
<component name="LogConsolePreferences">
|
||||
<option name="FILTER_ERRORS" value="false" />
|
||||
<option name="FILTER_WARNINGS" value="false" />
|
||||
<option name="FILTER_INFO" value="true" />
|
||||
<option name="CUSTOM_FILTER" />
|
||||
</component>
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/test1/test1.iml" filepath="$PROJECT_DIR$/test1/test1.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/test2/test2.iml" filepath="$PROJECT_DIR$/test2/test2.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/test3/test3.iml" filepath="$PROJECT_DIR$/test3/test3.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/classes" />
|
||||
</component>
|
||||
<component name="ProjectRunConfigurationManager" />
|
||||
<component name="RmicSettings">
|
||||
<option name="IS_EANABLED" value="false" />
|
||||
<option name="DEBUGGING_INFO" value="true" />
|
||||
<option name="GENERATE_NO_WARNINGS" value="false" />
|
||||
<option name="GENERATE_IIOP_STUBS" value="false" />
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
||||
</component>
|
||||
<component name="StarteamVcsAdapter" />
|
||||
<component name="VssVcs" />
|
||||
<component name="libraryTable" />
|
||||
<component name="uidesigner-configuration">
|
||||
<option name="INSTRUMENT_CLASSES" value="true" />
|
||||
<option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
|
||||
<option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" />
|
||||
</component>
|
||||
<UsedPathMacros />
|
||||
</project>
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: cdr
|
||||
* Date: Aug 14, 2006
|
||||
* Time: 3:35:18 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public interface TestI {//jjjkjh kljh lk
|
||||
void test(/* */);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: cdr
|
||||
* Date: Aug 14, 2006
|
||||
* Time: 3:35:52 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class TestIImpl1 implements TestI {
|
||||
public void test() {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: cdr
|
||||
* Date: Aug 14, 2006
|
||||
* Time: 3:36:03 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class TestIImpl2 implements TestI {
|
||||
public void test() {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4" relativePaths="true" type="JAVA_MODULE">
|
||||
<component name="ModuleRootManager" />
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntryProperties />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: cdr
|
||||
* Date: Aug 14, 2006
|
||||
* Time: 3:35:11 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public interface TestI {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: cdr
|
||||
* Date: Aug 14, 2006
|
||||
* Time: 3:36:22 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class TestIImpl1 implements TestI {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: cdr
|
||||
* Date: Aug 14, 2006
|
||||
* Time: 3:36:28 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class TestIImpl3 implements TestI {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4" relativePaths="true" type="JAVA_MODULE">
|
||||
<component name="ModuleRootManager" />
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntryProperties />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: cdr
|
||||
* Date: Aug 14, 2006
|
||||
* Time: 3:35:03 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public interface TestI {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: cdr
|
||||
* Date: Aug 14, 2006
|
||||
* Time: 3:36:36 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class TestIImpl1 implements TestI {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4" relativePaths="true" type="JAVA_MODULE">
|
||||
<component name="ModuleRootManager" />
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntryProperties />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
class A {
|
||||
void methodOfClassFromLib1() {
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
class A {
|
||||
void methodOfClassFromLib2() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.intellij.navigation;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.CodeInsightTestCase;
|
||||
import com.intellij.codeInsight.navigation.ClassImplementationsSearch;
|
||||
import com.intellij.codeInsight.navigation.MethodImplementationsSearch;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.impl.ModuleManagerImpl;
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.CommonProcessors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author cdr
|
||||
*/
|
||||
public class GotoImplementationTest extends CodeInsightTestCase {
|
||||
|
||||
private static Collection<PsiClass> getClassImplementations(final PsiClass psiClass) {
|
||||
CommonProcessors.CollectProcessor<PsiClass> processor = new CommonProcessors.CollectProcessor<PsiClass>();
|
||||
ClassImplementationsSearch.processImplementations(psiClass, processor);
|
||||
|
||||
return processor.getResults();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUpProject() throws Exception {
|
||||
final String root = JavaTestUtil.getJavaTestDataPath() + "/codeInsight/navigation/alexProject";
|
||||
VirtualFile vfsRoot = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(root));
|
||||
|
||||
VirtualFile projectFile = vfsRoot.findChild("test.ipr");
|
||||
myProject = ProjectManagerEx.getInstanceEx().loadProject(projectFile.getPath());
|
||||
|
||||
simulateProjectOpen();
|
||||
ProjectManagerEx.getInstanceEx().setCurrentTestProject(myProject);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
((ModuleManagerImpl)ModuleManager.getInstance(myProject)).projectClosed();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
|
||||
ModuleManager moduleManager = ModuleManager.getInstance(getProject());
|
||||
Module[] modules = moduleManager.getModules();
|
||||
assertEquals(3, modules.length);
|
||||
|
||||
Module module1 = moduleManager.findModuleByName("test1");
|
||||
Module module2 = moduleManager.findModuleByName("test2");
|
||||
Module module3 = moduleManager.findModuleByName("test3");
|
||||
PsiClass test1 = myJavaFacade.findClass("com.test.TestI", GlobalSearchScope.moduleScope(module1));
|
||||
PsiClass test2 = myJavaFacade.findClass("com.test.TestI", GlobalSearchScope.moduleScope(module2));
|
||||
PsiClass test3 = myJavaFacade.findClass("com.test.TestI", GlobalSearchScope.moduleScope(module3));
|
||||
HashSet<PsiClass> expectedImpls1 = new HashSet<PsiClass>(Arrays.asList(
|
||||
myJavaFacade.findClass("com.test.TestIImpl1", GlobalSearchScope.moduleScope(module1)),
|
||||
myJavaFacade.findClass("com.test.TestIImpl2", GlobalSearchScope.moduleScope(module1))
|
||||
));
|
||||
assertEquals(expectedImpls1, new HashSet<PsiClass>(getClassImplementations(test1)));
|
||||
|
||||
PsiMethod psiMethod = test1.findMethodsByName("test", false)[0];
|
||||
Set<PsiMethod> expectedMethodImpl1 = new HashSet<PsiMethod>(Arrays.asList(
|
||||
myJavaFacade.findClass("com.test.TestIImpl1", GlobalSearchScope.moduleScope(module1)).findMethodsByName("test",false)[0],
|
||||
myJavaFacade.findClass("com.test.TestIImpl2", GlobalSearchScope.moduleScope(module1)).findMethodsByName("test",false)[0]
|
||||
));
|
||||
assertEquals(expectedMethodImpl1, new HashSet<PsiMethod>(Arrays.asList(MethodImplementationsSearch.getMethodImplementations(psiMethod))));
|
||||
|
||||
HashSet<PsiClass> expectedImpls2 = new HashSet<PsiClass>(Arrays.asList(
|
||||
myJavaFacade.findClass("com.test.TestIImpl1", GlobalSearchScope.moduleScope(module2)),
|
||||
myJavaFacade.findClass("com.test.TestIImpl3", GlobalSearchScope.moduleScope(module2))
|
||||
));
|
||||
assertEquals(expectedImpls2, new HashSet<PsiClass>(getClassImplementations(test2)));
|
||||
|
||||
HashSet<PsiClass> expectedImpls3 = new HashSet<PsiClass>(Arrays.asList(
|
||||
myJavaFacade.findClass("com.test.TestIImpl1", GlobalSearchScope.moduleScope(module3))
|
||||
));
|
||||
assertEquals(expectedImpls3, new HashSet<PsiClass>(getClassImplementations(test3)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dsl
|
||||
*/
|
||||
public class LibraryOrderTest extends PsiTestCase {
|
||||
|
||||
public void test1() {
|
||||
setupPaths();
|
||||
checkClassFromLib("test.A", "1");
|
||||
|
||||
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
|
||||
final OrderEntry[] order = rootModel.getOrderEntries();
|
||||
final int length = order.length;
|
||||
OrderEntry lib2 = order[length - 1];
|
||||
OrderEntry lib1 = order[length - 2];
|
||||
assertTrue(lib1 instanceof LibraryOrderEntry);
|
||||
assertEquals("lib1", ((LibraryOrderEntry) lib1).getLibraryName());
|
||||
assertTrue(lib2 instanceof LibraryOrderEntry);
|
||||
assertEquals("lib2", ((LibraryOrderEntry) lib2).getLibraryName());
|
||||
|
||||
order[length - 1] = lib1;
|
||||
order[length - 2] = lib2;
|
||||
rootModel.rearrangeOrderEntries(order);
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rootModel.commit();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
checkClassFromLib("test.A", "2");
|
||||
}
|
||||
|
||||
public void testNavigation() throws Exception {
|
||||
setupPaths();
|
||||
final JavaPsiFacade psiManager = getJavaFacade();
|
||||
final PsiClass classA = psiManager.findClass("test.A");
|
||||
final PsiElement navigationElement = classA.getNavigationElement();
|
||||
assertNotNull(navigationElement);
|
||||
assertTrue(navigationElement != classA);
|
||||
assertEquals("A.java", navigationElement.getContainingFile().getVirtualFile().getName());
|
||||
}
|
||||
|
||||
private void checkClassFromLib(String qualifiedName, String index) {
|
||||
final PsiClass classA = (PsiClass)JavaPsiFacade.getInstance(myProject).findClass(qualifiedName).getNavigationElement();
|
||||
assertNotNull(classA);
|
||||
final PsiMethod[] methodsA = classA.getMethods();
|
||||
assertEquals(1, methodsA.length);
|
||||
assertEquals("methodOfClassFromLib" + index, methodsA[0].getName());
|
||||
}
|
||||
|
||||
public void setupPaths() {
|
||||
final String basePath = JavaTestUtil.getJavaTestDataPath() + "/psi/libraryOrder/";
|
||||
|
||||
final VirtualFile lib1SrcFile = refreshAndFindFile(basePath + "lib1/src");
|
||||
final VirtualFile lib1classes = refreshAndFindFile(basePath + "lib1/classes");
|
||||
final VirtualFile lib2SrcFile = refreshAndFindFile(basePath + "lib2/src");
|
||||
final VirtualFile lib2classes = refreshAndFindFile(basePath + "lib2/classes");
|
||||
|
||||
assertTrue(lib1SrcFile != null);
|
||||
assertTrue(lib2SrcFile != null);
|
||||
|
||||
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
|
||||
final LibraryTable libraryTable = rootModel.getModuleLibraryTable();
|
||||
|
||||
addLibraryWithSourcePath("lib1", libraryTable, lib1SrcFile, lib1classes);
|
||||
addLibraryWithSourcePath("lib2", libraryTable, lib2SrcFile, lib2classes);
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rootModel.commit();
|
||||
}
|
||||
});
|
||||
final List<VirtualFile> list = Arrays.asList(OrderEnumerator.orderEntries(myModule).getClassesRoots());
|
||||
assertTrue(list.contains(lib1classes));
|
||||
assertTrue(list.contains(lib2classes));
|
||||
}
|
||||
|
||||
private VirtualFile refreshAndFindFile(String path) {
|
||||
final File ioLib1Src = new File(path);
|
||||
final VirtualFile lib1SrcFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ioLib1Src);
|
||||
return lib1SrcFile;
|
||||
}
|
||||
|
||||
private void addLibraryWithSourcePath(String name, final LibraryTable libraryTable, final VirtualFile libSource,
|
||||
VirtualFile libClasses) {
|
||||
final Library lib = libraryTable.createLibrary(name);
|
||||
final Library.ModifiableModel libModel = lib.getModifiableModel();
|
||||
libModel.addRoot(libClasses, OrderRootType.CLASSES);
|
||||
libModel.addRoot(libSource, OrderRootType.SOURCES);
|
||||
libModel.commit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.ide.impl.ProjectUtil;
|
||||
import com.intellij.mock.MockDocument;
|
||||
import com.intellij.mock.MockPsiFile;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.impl.DocumentImpl;
|
||||
import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.impl.DebugUtil;
|
||||
import com.intellij.psi.impl.PsiDocumentManagerImpl;
|
||||
import com.intellij.psi.impl.TextBlock;
|
||||
import com.intellij.psi.impl.source.PsiFileImpl;
|
||||
import com.intellij.testFramework.LeakHunter;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.Reference;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class PsiDocumentManagerImplTest extends PlatformTestCase {
|
||||
private PsiDocumentManagerImpl getPsiDocumentManager() {
|
||||
return (PsiDocumentManagerImpl)PsiDocumentManager.getInstance(getProject());
|
||||
}
|
||||
|
||||
public void testGetCachedPsiFile_NoFile() throws Exception {
|
||||
final PsiFile file = getPsiDocumentManager().getCachedPsiFile(new MockDocument());
|
||||
assertNull(file);
|
||||
}
|
||||
|
||||
public void testGetPsiFile_NotRegisteredDocument() throws Exception {
|
||||
final PsiFile file = getPsiDocumentManager().getPsiFile(new MockDocument());
|
||||
assertNull(file);
|
||||
}
|
||||
|
||||
public void testGetDocument_FirstGet() throws Exception {
|
||||
VirtualFile vFile = createFile();
|
||||
final PsiFile file = new MockPsiFile(vFile, getPsiManager());
|
||||
|
||||
final Document document = getPsiDocumentManager().getDocument(file);
|
||||
assertNotNull(document);
|
||||
assertSame(document, FileDocumentManager.getInstance().getDocument(vFile));
|
||||
}
|
||||
|
||||
private static LightVirtualFile createFile() {
|
||||
return new LightVirtualFile("foo.java");
|
||||
}
|
||||
|
||||
public void testDocumentGced() throws Exception {
|
||||
VirtualFile vFile = createFile();
|
||||
PsiDocumentManagerImpl documentManager = getPsiDocumentManager();
|
||||
long id = System.identityHashCode(documentManager.getDocument(getPsiManager().findFile(vFile)));
|
||||
|
||||
documentManager.commitAllDocuments();
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
assertEmpty(documentManager.getUncommittedDocuments());
|
||||
|
||||
LeakHunter.checkLeak(documentManager, DocumentImpl.class);
|
||||
LeakHunter.checkLeak(documentManager, PsiFileImpl.class, new Processor<PsiFileImpl>() {
|
||||
@Override
|
||||
public boolean process(PsiFileImpl psiFile) {
|
||||
return psiFile.getViewProvider().getVirtualFile().getFileSystem() instanceof LocalFileSystem;
|
||||
}
|
||||
});
|
||||
//Class.forName("com.intellij.util.ProfilingUtil").getDeclaredMethod("forceCaptureMemorySnapshot").invoke(null);
|
||||
|
||||
Reference<Document> reference = vFile.getUserData(FileDocumentManagerImpl.DOCUMENT_KEY);
|
||||
assertNotNull(reference);
|
||||
for (int i=0;i<1000;i++) {
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
if (reference.get() == null) break;
|
||||
System.gc();
|
||||
}
|
||||
assertNull(documentManager.getCachedDocument(getPsiManager().findFile(vFile)));
|
||||
|
||||
Document newDoc = documentManager.getDocument(getPsiManager().findFile(vFile));
|
||||
assertTrue(id != System.identityHashCode(newDoc));
|
||||
}
|
||||
|
||||
public void testGetUncommittedDocuments_noDocuments() throws Exception {
|
||||
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
}
|
||||
|
||||
public void testGetUncommittedDocuments_documentChanged_DontProcessEvents() throws Exception {
|
||||
PsiFile file = getPsiManager().findFile(createFile());
|
||||
|
||||
final Document document = getPsiDocumentManager().getDocument(file);
|
||||
|
||||
final TextBlock block = TextBlock.get(file);
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
block.performAtomically(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
}
|
||||
|
||||
public void testGetUncommittedDocuments_documentNotRegistered() throws Exception {
|
||||
final Document document = new MockDocument();
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
}
|
||||
|
||||
public void testCommitDocument_RemovesFromUncommittedList() throws Exception {
|
||||
PsiFile file = getPsiManager().findFile(createFile());
|
||||
|
||||
final Document document = getPsiDocumentManager().getDocument(file);
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
getPsiDocumentManager().commitDocument(document);
|
||||
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
}
|
||||
|
||||
public void testCommitAllDocument_RemovesFromUncommittedList() throws Exception {
|
||||
PsiFile file = getPsiManager().findFile(createFile());
|
||||
|
||||
final Document document = getPsiDocumentManager().getDocument(file);
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
getPsiDocumentManager().commitAllDocuments();
|
||||
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
}
|
||||
|
||||
public void testDocumentFromAlienProjectDoesNotEndsUpInMyUncommittedList() throws Exception {
|
||||
PsiFile file = getPsiManager().findFile(createFile());
|
||||
|
||||
final Document document = getPsiDocumentManager().getDocument(file);
|
||||
|
||||
File temp = createTempDirectory();
|
||||
final Project alienProject = createProject(new File(temp, "alien.ipr"), DebugUtil.currentStackTrace());
|
||||
boolean succ2 = ProjectManagerEx.getInstanceEx().openProject(alienProject);
|
||||
assertTrue(succ2);
|
||||
|
||||
|
||||
try {
|
||||
PsiManager alienManager = PsiManager.getInstance(alienProject);
|
||||
final String alienText = "alien";
|
||||
|
||||
LightVirtualFile alienVirt = new LightVirtualFile("foo.java", alienText);
|
||||
final PsiFile alienFile = alienManager.findFile(alienVirt);
|
||||
final PsiDocumentManagerImpl alienDocManager = (PsiDocumentManagerImpl)PsiDocumentManager.getInstance(alienProject);
|
||||
final Document alienDocument = alienDocManager.getDocument(alienFile);
|
||||
//alienDocument.putUserData(CACHED_VIEW_PROVIDER, new MockFileViewProvider(alienFile));
|
||||
assertEquals(0, alienDocManager.getUncommittedDocuments().length);
|
||||
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
getPsiDocumentManager()
|
||||
.documentChanged(new DocumentEventImpl(alienDocument, 0, "", "", alienDocument.getModificationStamp(), false));
|
||||
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
assertEquals(0, alienDocManager.getUncommittedDocuments().length);
|
||||
|
||||
alienDocManager.documentChanged(new DocumentEventImpl(alienDocument, 0, "", "", alienDocument.getModificationStamp(), false));
|
||||
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
assertEquals(1, alienDocManager.getUncommittedDocuments().length);
|
||||
|
||||
getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false));
|
||||
assertEquals(1, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
assertEquals(1, alienDocManager.getUncommittedDocuments().length);
|
||||
|
||||
alienDocManager.documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false));
|
||||
assertEquals(1, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
assertEquals(1, alienDocManager.getUncommittedDocuments().length);
|
||||
}
|
||||
});
|
||||
}
|
||||
finally {
|
||||
ProjectUtil.closeAndDispose(alienProject);
|
||||
}
|
||||
}
|
||||
|
||||
public void testCommitInBackground() {
|
||||
PsiFile file = getPsiManager().findFile(createFile());
|
||||
assertTrue(file.isPhysical());
|
||||
final Document document = getPsiDocumentManager().getDocument(file);
|
||||
|
||||
final Semaphore semaphore = new Semaphore();
|
||||
semaphore.down();
|
||||
getPsiDocumentManager().performWhenAllCommitted(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
assertTrue(getPsiDocumentManager().isCommitted(document));
|
||||
semaphore.up();
|
||||
}
|
||||
});
|
||||
waitAndPump(semaphore);
|
||||
assertTrue(getPsiDocumentManager().isCommitted(document));
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
document.insertString(0, "class X {}");
|
||||
}
|
||||
});
|
||||
|
||||
semaphore.down();
|
||||
getPsiDocumentManager().performWhenAllCommitted(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
assertTrue(getPsiDocumentManager().isCommitted(document));
|
||||
semaphore.up();
|
||||
}
|
||||
});
|
||||
waitAndPump(semaphore);
|
||||
assertTrue(getPsiDocumentManager().isCommitted(document));
|
||||
|
||||
final AtomicInteger count = new AtomicInteger();
|
||||
final Runnable action = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
count.incrementAndGet();
|
||||
}
|
||||
};
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
document.insertString(0, "/**/");
|
||||
boolean executed = getPsiDocumentManager().cancelAndRunWhenAllCommitted("xxx", action);
|
||||
assertFalse(executed);
|
||||
executed = getPsiDocumentManager().cancelAndRunWhenAllCommitted("xxx", action);
|
||||
assertFalse(executed);
|
||||
assertEquals(0, count.get());
|
||||
}
|
||||
});
|
||||
|
||||
while (!getPsiDocumentManager().isCommitted(document)) {
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
}
|
||||
assertTrue(getPsiDocumentManager().isCommitted(document));
|
||||
assertEquals(1, count.get());
|
||||
|
||||
count.set(0);
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
document.insertString(0, "/**/");
|
||||
boolean executed = getPsiDocumentManager().performWhenAllCommitted(action);
|
||||
assertFalse(executed);
|
||||
executed = getPsiDocumentManager().performWhenAllCommitted(action);
|
||||
assertFalse(executed);
|
||||
assertEquals(0, count.get());
|
||||
}
|
||||
});
|
||||
|
||||
while (!getPsiDocumentManager().isCommitted(document)) {
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
}
|
||||
assertTrue(getPsiDocumentManager().isCommitted(document));
|
||||
assertEquals(2, count.get());
|
||||
}
|
||||
|
||||
private static void waitAndPump(Semaphore semaphore) {
|
||||
while (!semaphore.waitFor(10)) {
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isRunInWriteAction() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.editor.SelectionModel;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.util.PsiModificationTracker;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class PsiModificationTrackerTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
public void testAnnotationNotChanged() throws Exception {
|
||||
doReplaceTest("@SuppressWarnings(\"zz\")\n" +
|
||||
"public class Foo { <selection></selection>}",
|
||||
"hi");
|
||||
}
|
||||
|
||||
public void testAnnotationNameChanged() throws Exception {
|
||||
doReplaceTest("@Suppr<selection>ess</selection>Warnings(\"zz\")\n" +
|
||||
"public class Foo { }",
|
||||
"hi");
|
||||
}
|
||||
|
||||
public void testAnnotationParameterChanged() throws Exception {
|
||||
doReplaceTest("@SuppressWarnings(\"<selection>zz</selection>\")\n" +
|
||||
"public class Foo { }",
|
||||
"hi");
|
||||
}
|
||||
|
||||
public void testAnnotationRemoved() throws Exception {
|
||||
doReplaceTest("<selection>@SuppressWarnings(\"zz\")</selection>\n" +
|
||||
"public class Foo { }",
|
||||
"");
|
||||
}
|
||||
|
||||
public void testAnnotationWithClassRemoved() throws Exception {
|
||||
doReplaceTest("<selection>@SuppressWarnings(\"zz\")\n" +
|
||||
"public </selection> class Foo { }",
|
||||
"");
|
||||
}
|
||||
|
||||
public void testRemoveAnnotatedMethod() throws Exception {
|
||||
doReplaceTest("public class Foo {\n" +
|
||||
" <selection> " +
|
||||
" @SuppressWarnings(\"\")\n" +
|
||||
" public void method() {}\n" +
|
||||
"</selection>" +
|
||||
"}",
|
||||
"");
|
||||
}
|
||||
|
||||
public void testRenameAnnotatedMethod() throws Exception {
|
||||
doReplaceTest("public class Foo {\n" +
|
||||
" @SuppressWarnings(\"\")\n" +
|
||||
" public void me<selection>th</selection>od() {}\n" +
|
||||
"}",
|
||||
"zzz");
|
||||
}
|
||||
|
||||
public void testRenameAnnotatedClass() throws Exception {
|
||||
doReplaceTest(" @SuppressWarnings(\"\")\n" +
|
||||
"public class F<selection>o</selection>o {\n" +
|
||||
" public void method() {}\n" +
|
||||
"}",
|
||||
"zzz");
|
||||
}
|
||||
|
||||
public void testRemoveAll() throws Exception {
|
||||
doReplaceTest("<selection>@SuppressWarnings(\"zz\")\n" +
|
||||
"public class Foo { }</selection>",
|
||||
"");
|
||||
}
|
||||
|
||||
public void testRemoveFile() throws Exception {
|
||||
doTest("<selection>@SuppressWarnings(\"zz\")\n" +
|
||||
"public class Foo { }</selection>",
|
||||
new Processor<PsiFile>() {
|
||||
@Override
|
||||
public boolean process(PsiFile psiFile) {
|
||||
try {
|
||||
final VirtualFile vFile = psiFile.getVirtualFile();
|
||||
assert vFile != null : psiFile;
|
||||
vFile.delete(this);
|
||||
}
|
||||
catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void doReplaceTest(@NonNls String text, @NonNls final String with) {
|
||||
doTest(text, new Processor<PsiFile>() {
|
||||
@Override
|
||||
public boolean process(PsiFile psiFile) {
|
||||
replaceSelection(with);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void doTest(@NonNls String text, Processor<PsiFile> run) {
|
||||
PsiFile file = myFixture.configureByText(JavaFileType.INSTANCE, text);
|
||||
PsiModificationTracker modificationTracker = PsiManager.getInstance(getProject()).getModificationTracker();
|
||||
long count = modificationTracker.getModificationCount();
|
||||
run.process(file);
|
||||
assertFalse(modificationTracker.getModificationCount() == count);
|
||||
}
|
||||
|
||||
private void replaceSelection(final String with) {
|
||||
new WriteCommandAction.Simple(getProject()) {
|
||||
@Override
|
||||
protected void run() throws Throwable {
|
||||
SelectionModel sel = myFixture.getEditor().getSelectionModel();
|
||||
myFixture.getEditor().getDocument().replaceString(sel.getSelectionStart(), sel.getSelectionEnd(), with);
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public void testJavaStructureModificationChangesAfterPackageDelete() {
|
||||
PsiFile file = myFixture.addFileToProject("/x/y/Z.java", "text");
|
||||
PsiModificationTracker modificationTracker = PsiManager.getInstance(getProject()).getModificationTracker();
|
||||
long count = modificationTracker.getJavaStructureModificationCount();
|
||||
|
||||
file.getContainingDirectory().delete();
|
||||
|
||||
assertEquals(count + 1, modificationTracker.getJavaStructureModificationCount());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,360 @@
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.CodeInsightTestCase;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.event.DocumentListener;
|
||||
import com.intellij.openapi.editor.event.EditorEventMulticaster;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.impl.source.PsiFileImpl;
|
||||
import com.intellij.psi.impl.source.tree.FileElement;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.stubs.StubTree;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.FileContentUtil;
|
||||
import gnu.trove.THashSet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
@PlatformTestCase.WrapInCommand
|
||||
public class SmartPsiElementPointersTest extends CodeInsightTestCase {
|
||||
private VirtualFile myRoot;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/codeEditor/smartPsiElementPointers";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
myRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
public void testChangeInDocument() {
|
||||
PsiClass aClass = myJavaFacade.findClass("AClass", GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
|
||||
SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
|
||||
|
||||
int offset = aClass.getTextOffset();
|
||||
document.insertString(offset, "/**/");
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
PsiElement element = pointer.getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiClass);
|
||||
assertTrue(element.isValid());
|
||||
}
|
||||
|
||||
// This test is unfair. If pointer would be asked for getElement() between commits it'll never restore again anyway.
|
||||
//
|
||||
public void testChangeInDocumentTwice() {
|
||||
PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
|
||||
SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
|
||||
|
||||
int offset = aClass.getTextOffset();
|
||||
document.insertString(offset, "/*");
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
document.insertString(offset + 2, "*/");
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
PsiElement element = pointer.getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiClass);
|
||||
assertTrue(element.isValid());
|
||||
}
|
||||
|
||||
public void testGetElementWhenDocumentModified() {
|
||||
PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
|
||||
SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
|
||||
|
||||
int offset = aClass.getTextOffset();
|
||||
document.insertString(offset, "/**/");
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
document.insertString(offset, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
|
||||
PsiElement element = pointer.getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiClass);
|
||||
assertTrue(element.isValid());
|
||||
}
|
||||
|
||||
public void testKeepBeltWhenDocumentModified() {
|
||||
PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
|
||||
SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
|
||||
|
||||
int offset = aClass.getTextOffset();
|
||||
document.insertString(offset, "/******/");
|
||||
|
||||
pointer.getElement();
|
||||
|
||||
document.insertString(offset, "/**/");
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
PsiElement element = pointer.getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiClass);
|
||||
assertTrue(element.isValid());
|
||||
}
|
||||
|
||||
public void testChangeInPsi() {
|
||||
PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
|
||||
SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
|
||||
|
||||
int offset = aClass.getTextOffset();
|
||||
document.insertString(offset, "/**/");
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
PsiElement element = pointer.getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiClass);
|
||||
assertTrue(element.isValid());
|
||||
}
|
||||
|
||||
public void testPsiChangesWithLazyPointers() throws Exception {
|
||||
PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
|
||||
final SmartPsiElementPointer<PsiIdentifier> pointer = SmartPointerManager.getInstance(myProject).createLazyPointer(aClass.getNameIdentifier());
|
||||
final PsiComment javadoc =
|
||||
JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory().createCommentFromText("/** javadoc */", aClass);
|
||||
aClass.getParent().addBefore(javadoc, aClass);
|
||||
|
||||
final PsiIdentifier elt = pointer.getElement();
|
||||
assertNotNull(elt);
|
||||
assertSame(elt, aClass.getNameIdentifier());
|
||||
}
|
||||
|
||||
public void testTypePointer() {
|
||||
PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
|
||||
final PsiTypeElement typeElement = myJavaFacade.findClass("Test",GlobalSearchScope.allScope(getProject())).getFields()[0].getTypeElement();
|
||||
|
||||
SmartPsiElementPointer typePointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(typeElement);
|
||||
SmartPsiElementPointer classPointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
|
||||
Document aClassDocument = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
|
||||
Document testDocument = PsiDocumentManager.getInstance(myProject).getDocument(typeElement.getContainingFile());
|
||||
|
||||
aClassDocument.insertString(aClass.getTextOffset(), "/**/");
|
||||
testDocument.insertString(typeElement.getTextOffset(), "/**/");
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
PsiElement element = typePointer.getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiTypeElement);
|
||||
assertTrue(element.isValid());
|
||||
assertEquals(classPointer.getElement(), PsiUtil.resolveClassInType(((PsiTypeElement)element).getType()));
|
||||
}
|
||||
|
||||
public void testCreatePointerInBeforeDocumentChange() {
|
||||
final PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(aClass.getContainingFile());
|
||||
|
||||
final SmartPsiElementPointer[] pointer = new SmartPsiElementPointer[1];
|
||||
int offset = aClass.getTextOffset();
|
||||
DocumentListener listener = new DocumentListener() {
|
||||
@Override
|
||||
public void beforeDocumentChange(DocumentEvent event) {
|
||||
pointer[0] = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void documentChanged(DocumentEvent event) {
|
||||
}
|
||||
};
|
||||
EditorEventMulticaster multicaster = EditorFactory.getInstance().getEventMulticaster();
|
||||
multicaster.addDocumentListener(listener);
|
||||
try {
|
||||
document.insertString(offset, "/******/");
|
||||
}
|
||||
finally {
|
||||
multicaster.removeDocumentListener(listener);
|
||||
}
|
||||
|
||||
pointer[0].getElement();
|
||||
|
||||
document.insertString(0, "/**/");
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
PsiElement element = pointer[0].getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiClass);
|
||||
assertTrue(element.isValid());
|
||||
}
|
||||
|
||||
public void testCreatePointerWhenNoPsiFile() {
|
||||
myPsiManager.startBatchFilesProcessingMode(); // to use weak refs
|
||||
|
||||
try {
|
||||
final PsiClass aClass = myJavaFacade.findClass("AClass",GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
|
||||
VirtualFile vFile = myRoot.findChild("AClass.java");
|
||||
assertNotNull(vFile);
|
||||
PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(myProject);
|
||||
Document document = FileDocumentManager.getInstance().getDocument(vFile);
|
||||
|
||||
final SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
|
||||
System.gc();
|
||||
/*
|
||||
PsiFile psiFile = myPsiManager.getFileManager().getCachedPsiFile(vFile);
|
||||
assertNull(psiFile);
|
||||
*/
|
||||
|
||||
document.insertString(0, "class Foo{}\n");
|
||||
|
||||
PsiElement element = pointer.getElement();
|
||||
assertEquals(aClass, element);
|
||||
|
||||
document.insertString(0, "/**/");
|
||||
psiDocumentManager.commitAllDocuments();
|
||||
|
||||
if (aClass.isValid()) {
|
||||
aClass.getChildren();
|
||||
}
|
||||
|
||||
element = pointer.getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiClass);
|
||||
assertTrue(element.isValid());
|
||||
}
|
||||
finally {
|
||||
myPsiManager.finishBatchFilesProcessingMode(); // to use weak refs
|
||||
}
|
||||
}
|
||||
|
||||
public void testReplaceFile() throws IOException {
|
||||
VirtualFile vfile = myRoot.createChildData(this, "X.java");
|
||||
VfsUtil.saveText(vfile, "public class X { public int X; }");
|
||||
|
||||
PsiClass aClass = myJavaFacade.findClass("X", GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
assertTrue(aClass.isValid());
|
||||
|
||||
SmartPsiElementPointer classp = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
SmartPsiElementPointer filep = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass.getContainingFile());
|
||||
|
||||
FileContentUtil.reparseFiles(myProject, Collections.<VirtualFile>singleton(vfile), true);
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
assertFalse(aClass.isValid());
|
||||
|
||||
PsiElement element = classp.getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiClass);
|
||||
assertTrue(element.isValid());
|
||||
assertEquals(vfile, element.getContainingFile().getVirtualFile());
|
||||
|
||||
element = filep.getElement();
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof PsiFile);
|
||||
assertTrue(element.isValid());
|
||||
assertEquals(vfile, element.getContainingFile().getVirtualFile());
|
||||
}
|
||||
|
||||
public void testCreatePointerDoesNotLoadPsiTree() throws IOException {
|
||||
VirtualFile vfile = myRoot.createChildData(this, "X.java");
|
||||
VfsUtil.saveText(vfile, "public class X { public int X; }");
|
||||
|
||||
PsiClass aClass = myJavaFacade.findClass("X", GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(aClass);
|
||||
assertTrue(aClass.isValid());
|
||||
|
||||
PsiFileImpl file = (PsiFileImpl)aClass.getContainingFile();
|
||||
|
||||
assertTreeLoaded(file, false);
|
||||
|
||||
SmartPsiElementPointer p = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(aClass);
|
||||
assertNotNull(p);
|
||||
|
||||
assertTreeLoaded(file, false);
|
||||
|
||||
assertInstanceOf(p.getElement(), PsiClass.class);
|
||||
|
||||
assertTreeLoaded(file, false);
|
||||
|
||||
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
|
||||
Document document = documentManager.getDocument(file);
|
||||
document.insertString(0, "/** asdasd */");
|
||||
documentManager.commitAllDocuments();
|
||||
|
||||
// loaded tree
|
||||
assertTreeLoaded(file, true);
|
||||
|
||||
assertInstanceOf(p.getElement(), PsiClass.class);
|
||||
|
||||
assertTreeLoaded(file, true);
|
||||
}
|
||||
|
||||
private static void assertTreeLoaded(PsiFileImpl file, boolean loaded) {
|
||||
FileElement treeElement = file.getTreeElement();
|
||||
assertEquals(loaded, treeElement != null);
|
||||
StubTree stubTree = file.getStubTree();
|
||||
assertEquals(loaded, stubTree == null);
|
||||
}
|
||||
|
||||
public void testPointerDisambiguationAfterDupLine() throws Exception {
|
||||
PsiJavaFile file = (PsiJavaFile)configureByText(StdFileTypes.JAVA, "class XXX{ void foo() { \n" +
|
||||
" <caret>foo();\n" +
|
||||
"}}");
|
||||
PsiClass aClass = file.getClasses()[0];
|
||||
assertNotNull(aClass);
|
||||
|
||||
PsiReferenceExpression ref1 = PsiTreeUtil.getParentOfType(PsiUtilBase.getElementAtCaret(getEditor()), PsiReferenceExpression.class);
|
||||
SmartPsiElementPointer pointer1 = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(ref1);
|
||||
|
||||
ctrlD();
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
Set<PsiReferenceExpression> refs = new THashSet<PsiReferenceExpression>();
|
||||
int offset=0;
|
||||
while (true) {
|
||||
offset = getEditor().getDocument().getText().indexOf("foo();", offset+1);
|
||||
if (offset == -1) break;
|
||||
PsiReferenceExpression ref2 = PsiTreeUtil.getParentOfType(getFile().findElementAt(offset), PsiReferenceExpression.class);
|
||||
refs.add(ref2);
|
||||
}
|
||||
refs.remove(ref1);
|
||||
assertEquals(1, refs.size());
|
||||
PsiReferenceExpression ref2 = refs.iterator().next();
|
||||
assertNotSame(ref1, ref2);
|
||||
SmartPsiElementPointer pointer2 = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(ref2);
|
||||
assertNotSame(pointer1, pointer2);
|
||||
|
||||
PsiElement element1 = pointer1.getElement();
|
||||
PsiElement element2 = pointer2.getElement();
|
||||
|
||||
assertNotNull(element1);
|
||||
assertNotNull(element2);
|
||||
assertNotSame(element1, element2);
|
||||
|
||||
assertFalse(SmartPointerManager.getInstance(myProject).pointToTheSameElement(pointer1, pointer2));
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user