use of com.intellij.refactoring.move.moveMembers.MoveMembersProcessor in project intellij-community by JetBrains.
the class MoveMembersTest method performAction.
private void performAction(String sourceClassName, String targetClassName, int[] memberIndices, final String visibility) throws Exception {
PsiClass sourceClass = myJavaFacade.findClass(sourceClassName, ProjectScope.getProjectScope(myProject));
assertNotNull("Class " + sourceClassName + " not found", sourceClass);
PsiClass targetClass = myJavaFacade.findClass(targetClassName, ProjectScope.getProjectScope(myProject));
assertNotNull("Class " + targetClassName + " not found", targetClass);
PsiElement[] children = sourceClass.getChildren();
ArrayList<PsiMember> members = new ArrayList<>();
for (PsiElement child : children) {
if (child instanceof PsiMember) {
members.add(((PsiMember) child));
}
}
LinkedHashSet<PsiMember> memberSet = new LinkedHashSet<>();
for (int index : memberIndices) {
PsiMember member = members.get(index);
assertTrue(member.hasModifierProperty(PsiModifier.STATIC));
memberSet.add(member);
}
MockMoveMembersOptions options = new MockMoveMembersOptions(targetClass.getQualifiedName(), memberSet);
options.setMemberVisibility(visibility);
new MoveMembersProcessor(myProject, null, options).run();
FileDocumentManager.getInstance().saveAllDocuments();
}
use of com.intellij.refactoring.move.moveMembers.MoveMembersProcessor in project intellij-community by JetBrains.
the class ConfigurationRefactoringsTest method moveMembers.
private void moveMembers(final PsiClass otherTest, final HashSet<PsiMember> members) {
MockMoveMembersOptions options = new MockMoveMembersOptions(otherTest.getQualifiedName(), members);
new MoveMembersProcessor(myProject, null, options).run();
}
Aggregations