Search in sources :

Example 1 with JSChangeSignatureDialog

use of com.intellij.lang.javascript.refactoring.changeSignature.JSChangeSignatureDialog 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();
}
Also used : BaseRefactoringProcessor(com.intellij.refactoring.BaseRefactoringProcessor) JSChangeSignatureDialog(com.intellij.lang.javascript.refactoring.changeSignature.JSChangeSignatureDialog) JSMethodDescriptor(com.intellij.lang.javascript.refactoring.changeSignature.JSMethodDescriptor) JSParameterInfo(com.intellij.lang.javascript.refactoring.changeSignature.JSParameterInfo)

Aggregations

JSChangeSignatureDialog (com.intellij.lang.javascript.refactoring.changeSignature.JSChangeSignatureDialog)1 JSMethodDescriptor (com.intellij.lang.javascript.refactoring.changeSignature.JSMethodDescriptor)1 JSParameterInfo (com.intellij.lang.javascript.refactoring.changeSignature.JSParameterInfo)1 BaseRefactoringProcessor (com.intellij.refactoring.BaseRefactoringProcessor)1