use of com.intellij.lang.javascript.refactoring.memberPushDown.JSPushDownProcessor in project intellij-plugins by JetBrains.
the class FlexPushDownTest method performAction.
private void performAction(String from, int docCommentPolicy, boolean makeAbstract, final String[] toPushDown) {
final JSClass sourceClass = (JSClass) JSDialectSpecificHandlersFactory.forLanguage(JavaScriptSupportLoader.ECMA_SCRIPT_L4).getClassResolver().findClassByQName(from, GlobalSearchScope.projectScope(getProject()));
assertNotNull("source class not found: " + from, sourceClass);
assertTrue(sourceClass.getQualifiedName() + " has no inheritors", !JSInheritanceUtil.findDirectSubClasses(sourceClass, false).isEmpty());
final List<JSMemberInfo> memberInfos = FlexPullUpTest.getMemberInfos(toPushDown, sourceClass, makeAbstract);
JSMemberInfo[] infosArray = JSMemberInfo.getSelected(memberInfos, sourceClass, Conditions.alwaysTrue());
new JSPushDownProcessor(myProject, infosArray, sourceClass, docCommentPolicy) {
@Override
@NotNull
protected UsageInfo[] findUsages() {
// ensure stable order
final UsageInfo[] usages = super.findUsages();
Arrays.sort(usages, (o1, o2) -> ((JSClass) o1.getElement()).getQualifiedName().compareTo(((JSClass) o2.getElement()).getQualifiedName()));
return usages;
}
}.run();
myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
FileDocumentManager.getInstance().saveAllDocuments();
}
Aggregations