use of com.intellij.lang.javascript.refactoring.changeSignature.JSMethodDescriptor in project intellij-plugins by JetBrains.
the class ActionScriptCompletionInTextFieldTest method testChangeSignatureReturnType.
@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testChangeSignatureReturnType() throws Exception {
configureByFiles(null, BASE_PATH + getTestName(false) + "_2.js2");
JSFunction function = createFakeFunction();
JSExpressionCodeFragment fragment = JSChangeSignatureDialog.createReturnTypeCodeFragment(new JSMethodDescriptor(function, false).getReturnType(), function, JavaScriptSupportLoader.ECMA_SCRIPT_L4);
String[] included = new String[] { "Z111", "Z222", "int", "String", "uint", "Number", "EventDispatcher", "void", "*" };
String[] excluded = ArrayUtil.mergeArrays(DEFALUT_VALUES, "public", "function", "while");
checkTextFieldCompletion(fragment, included, excluded, "Z111", BASE_PATH + getTestName(false) + ".txt");
}
use of com.intellij.lang.javascript.refactoring.changeSignature.JSMethodDescriptor in project intellij-plugins by JetBrains.
the class JSChangeSignatureDetector method performChange.
@Override
public void performChange(JSChangeInfo changeInfo, Editor editor, @NotNull final String oldText) {
final JSChangeInfo jsChangeInfo = changeInfo;
JSMethodDescriptor descriptor = new JSMethodDescriptor(jsChangeInfo.getMethod(), false) {
@Override
public String getName() {
return jsChangeInfo.getNewName();
}
@Override
public List<JSParameterInfo> getParameters() {
return Arrays.asList(jsChangeInfo.getNewParameters());
}
@Override
public int getParametersCount() {
return getParameters().size();
}
@Override
public String getVisibility() {
return jsChangeInfo.getNewVisibility().name();
}
@Override
public JSFunction getMethod() {
return jsChangeInfo.getMethod();
}
};
JSChangeSignatureDialog d = new JSChangeSignatureDialog(descriptor, changeInfo.getMethod()) {
@Override
protected void invokeRefactoring(BaseRefactoringProcessor processor) {
revertChanges(jsChangeInfo.getMethod(), oldText);
super.invokeRefactoring(processor);
}
};
d.showAndGet();
}
Aggregations