Search in sources :

Example 11 with RenameSupport

use of org.eclipse.jdt.ui.refactoring.RenameSupport in project xtext-xtend by eclipse.

the class XImportSectionUpdateOnRenameTest method renameJavaElement.

public void renameJavaElement(final IType javaElement, final String newName) throws Exception {
    this.syncUtil.totalSync(false);
    final RenameSupport renameSupport = RenameSupport.create(javaElement, newName, RenameSupport.UPDATE_REFERENCES);
    renameSupport.perform(this.workbench.getActiveWorkbenchWindow().getShell(), this.workbench.getActiveWorkbenchWindow());
    this.syncUtil.totalSync(false);
    Assert.assertTrue(this.compositeRefactoringProcessorAccess.isDisposed());
}
Also used : RenameSupport(org.eclipse.jdt.ui.refactoring.RenameSupport)

Example 12 with RenameSupport

use of org.eclipse.jdt.ui.refactoring.RenameSupport in project xtext-xtend by eclipse.

the class XImportSectionUpdateOnRenameTest method renameJavaElement.

public void renameJavaElement(final IField javaElement, final String newName) throws Exception {
    this.syncUtil.totalSync(false);
    final RenameSupport renameSupport = RenameSupport.create(javaElement, newName, RenameSupport.UPDATE_REFERENCES);
    renameSupport.perform(this.workbench.getActiveWorkbenchWindow().getShell(), this.workbench.getActiveWorkbenchWindow());
    this.syncUtil.totalSync(false);
    Assert.assertTrue(this.compositeRefactoringProcessorAccess.isDisposed());
}
Also used : RenameSupport(org.eclipse.jdt.ui.refactoring.RenameSupport)

Example 13 with RenameSupport

use of org.eclipse.jdt.ui.refactoring.RenameSupport in project xtext-xtend by eclipse.

the class JavaRefactoringIntegrationTest method renameJavaElement.

protected void renameJavaElement(IType javaElement, String newName) throws CoreException, InterruptedException, InvocationTargetException {
    syncUtil.totalSync(false);
    RenameSupport renameSupport = RenameSupport.create(javaElement, newName, RenameSupport.UPDATE_REFERENCES);
    renameSupport.perform(workbench.getActiveWorkbenchWindow().getShell(), workbench.getActiveWorkbenchWindow());
    syncUtil.totalSync(false);
    assertTrue(compositeRefactoringProcessorAccess.isDisposed());
}
Also used : RenameSupport(org.eclipse.jdt.ui.refactoring.RenameSupport)

Example 14 with RenameSupport

use of org.eclipse.jdt.ui.refactoring.RenameSupport in project webtools.sourceediting by eclipse.

the class JSPRenameElementActionDelegate method run.

public void run(IAction action) {
    IJavaElement element = getSelectedElement();
    if (element != null) {
        RenameSupport renameSupport = null;
        try {
            switch(element.getElementType()) {
                case IJavaElement.TYPE:
                    renameSupport = RenameSupport.create((IType) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
                    break;
                case IJavaElement.METHOD:
                    renameSupport = RenameSupport.create((IMethod) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
                    break;
                case IJavaElement.PACKAGE_FRAGMENT:
                    renameSupport = RenameSupport.create((IPackageFragment) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
                    break;
            }
            if (renameSupport != null) {
                renameSupport.openDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
                PlatformStatusLineUtil.clearStatusLine();
            }
        } catch (CoreException e) {
            Logger.logException(e);
        }
    } else {
        // $NON-NLS-1$
        PlatformStatusLineUtil.displayErrorMessage(JSPUIMessages.JSPRenameElementAction_0);
        PlatformStatusLineUtil.addOneTimeClearListener();
    }
}
Also used : IJavaElement(org.eclipse.jdt.core.IJavaElement) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) CoreException(org.eclipse.core.runtime.CoreException) IMethod(org.eclipse.jdt.core.IMethod) RenameSupport(org.eclipse.jdt.ui.refactoring.RenameSupport) IType(org.eclipse.jdt.core.IType)

Example 15 with RenameSupport

use of org.eclipse.jdt.ui.refactoring.RenameSupport in project webtools.sourceediting by eclipse.

the class RenameElementHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    fEditor = HandlerUtil.getActiveEditor(event);
    IJavaElement element = getSelectedElement();
    if (element != null) {
        RenameSupport renameSupport = null;
        try {
            switch(element.getElementType()) {
                case IJavaElement.TYPE:
                    renameSupport = RenameSupport.create((IType) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
                    break;
                case IJavaElement.METHOD:
                    renameSupport = RenameSupport.create((IMethod) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
                    break;
                case IJavaElement.PACKAGE_FRAGMENT:
                    renameSupport = RenameSupport.create((IPackageFragment) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
                    break;
                case IJavaElement.FIELD:
                    renameSupport = RenameSupport.create((IField) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
                    break;
            }
            if (renameSupport != null) {
                renameSupport.openDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
                PlatformStatusLineUtil.clearStatusLine();
            }
        } catch (CoreException e) {
            Logger.logException(e);
        }
    } else {
        // $NON-NLS-1$
        PlatformStatusLineUtil.displayErrorMessage(JSPUIMessages.JSPRenameElementAction_0);
        PlatformStatusLineUtil.addOneTimeClearListener();
    }
    return null;
}
Also used : IJavaElement(org.eclipse.jdt.core.IJavaElement) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) CoreException(org.eclipse.core.runtime.CoreException) IMethod(org.eclipse.jdt.core.IMethod) IField(org.eclipse.jdt.core.IField) RenameSupport(org.eclipse.jdt.ui.refactoring.RenameSupport) IType(org.eclipse.jdt.core.IType)

Aggregations

RenameSupport (org.eclipse.jdt.ui.refactoring.RenameSupport)17 IPackageFragment (org.eclipse.jdt.core.IPackageFragment)3 CoreException (org.eclipse.core.runtime.CoreException)2 IJavaElement (org.eclipse.jdt.core.IJavaElement)2 IMethod (org.eclipse.jdt.core.IMethod)2 IType (org.eclipse.jdt.core.IType)2 ArrayList (java.util.ArrayList)1 LinkedModeModel (org.eclipse.che.ide.ext.java.shared.dto.LinkedModeModel)1 ChangeInfo (org.eclipse.che.ide.ext.java.shared.dto.refactoring.ChangeInfo)1 RefactoringResult (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringResult)1 RenameRefactoringSession (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RenameRefactoringSession)1 RenameLinkedModeRefactoringSession (org.eclipse.che.plugin.java.server.refactoring.session.RenameLinkedModeRefactoringSession)1 RenameSession (org.eclipse.che.plugin.java.server.refactoring.session.RenameSession)1 IField (org.eclipse.jdt.core.IField)1 Change (org.eclipse.ltk.core.refactoring.Change)1 CompositeChange (org.eclipse.ltk.core.refactoring.CompositeChange)1 PerformChangeOperation (org.eclipse.ltk.core.refactoring.PerformChangeOperation)1 RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)1 RenameRefactoring (org.eclipse.ltk.core.refactoring.participants.RenameRefactoring)1 IRenameSupport (org.eclipse.xtext.ui.refactoring.ui.IRenameSupport)1