mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
selection tests
This commit is contained in:
+2
-1
@@ -43,6 +43,7 @@ import java.util.List;
|
||||
*/
|
||||
public class JavaAnonymousClassesNodeProvider implements FileStructureNodeProvider<JavaAnonymousClassTreeElement>, PropertyOwner {
|
||||
public static final String ID = "SHOW_ANONYMOUS";
|
||||
public static final String JAVA_ANONYMOUS_PROPERTY_NAME = "java.anonymous.provider";
|
||||
|
||||
@Override
|
||||
public Collection<JavaAnonymousClassTreeElement> provideNodes(TreeElement node) {
|
||||
@@ -87,6 +88,6 @@ public class JavaAnonymousClassesNodeProvider implements FileStructureNodeProvid
|
||||
@NotNull
|
||||
@Override
|
||||
public String getPropertyName() {
|
||||
return "java.anonymous.provider";
|
||||
return JAVA_ANONYMOUS_PROPERTY_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class Constructor {
|
||||
int num1;
|
||||
int num2;
|
||||
|
||||
Constructor() {<caret>}
|
||||
void foo() {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
-Constructor.java
|
||||
-Constructor
|
||||
[Constructor()]
|
||||
foo():void
|
||||
num1:int
|
||||
num2:int
|
||||
@@ -0,0 +1,7 @@
|
||||
class Field {
|
||||
int num1;
|
||||
int <caret>num2;
|
||||
|
||||
Field() {}
|
||||
void foo() {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
-Field.java
|
||||
-Field
|
||||
Field()
|
||||
foo():void
|
||||
num1:int
|
||||
[num2:int]
|
||||
@@ -0,0 +1,7 @@
|
||||
class InsideClass {
|
||||
int num1;
|
||||
int num2;
|
||||
<caret>
|
||||
InsideClass() {}
|
||||
void foo() {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
-InsideClass.java
|
||||
-[InsideClass]
|
||||
InsideClass()
|
||||
foo():void
|
||||
num1:int
|
||||
num2:int
|
||||
@@ -0,0 +1,7 @@
|
||||
class Method {
|
||||
int num1;
|
||||
int num2;
|
||||
|
||||
Method() {}
|
||||
void foo() {<caret>}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
-Method.java
|
||||
-Method
|
||||
Method()
|
||||
[foo():void]
|
||||
num1:int
|
||||
num2:int
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.ide.fileStructure;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class JavaFileStructureSelectionTest extends JavaFileStructureTestCase {
|
||||
@Override
|
||||
protected String getTestDataFolderName() {
|
||||
return "selection";
|
||||
}
|
||||
|
||||
public void testField() throws Exception {checkTree();}
|
||||
public void testMethod() throws Exception {checkTree();}
|
||||
public void testConstructor() throws Exception {checkTree();}
|
||||
public void testInsideClass() throws Exception {checkTree();}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.ide.fileStructure;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.ide.structureView.impl.java.JavaAnonymousClassesNodeProvider;
|
||||
import com.intellij.ide.util.FileStructurePopup;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.testFramework.FileStructureTestBase;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public abstract class JavaFileStructureTestCase extends FileStructureTestBase {
|
||||
private boolean myShowAnonymousByDefault;
|
||||
|
||||
protected abstract String getTestDataFolderName();
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myShowAnonymousByDefault = PropertiesComponent.getInstance().getBoolean(getAnonymousPropertyName(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFileExtension() {
|
||||
return "java";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
PropertiesComponent.getInstance().setValue(getAnonymousPropertyName(), Boolean.toString(myShowAnonymousByDefault));
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private static String getAnonymousPropertyName() {
|
||||
return FileStructurePopup.getPropertyName(JavaAnonymousClassesNodeProvider.JAVA_ANONYMOUS_PROPERTY_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + "/fileStructure/" + getTestDataFolderName();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user