Search in sources :

Example 36 with RenameRefactoring

use of org.eclipse.ltk.core.refactoring.participants.RenameRefactoring in project mdw-designer by CenturyLinkCloud.

the class WorkflowProjectManager method renameRemoteProject.

public static void renameRemoteProject(WorkflowProject workflowProject, String newName) {
    if (!workflowProject.isRemote())
        throw new RuntimeException("Can only rename remote projects");
    try {
        deRegisterProject(workflowProject);
        IProject workflowSourceProject = workflowProject.getSourceProject();
        if (workflowSourceProject != null && workflowSourceProject.exists()) {
            RenameResourceProcessor renameProc = new RenameResourceProcessor(workflowSourceProject);
            renameProc.setNewResourceName(newName);
            RenameRefactoring refactoring = new RenameRefactoring(renameProc);
            refactoring.checkAllConditions(new NullProgressMonitor());
            Change change = refactoring.createChange(new NullProgressMonitor());
            change.perform(new NullProgressMonitor());
        }
        workflowProject.setSourceProjectName(newName);
        registerProject(workflowProject);
    } catch (CoreException ex) {
        // fail silently since older remote projects don't have physical
        // counterparts
        PluginMessages.log(ex);
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) RenameResourceProcessor(org.eclipse.ltk.internal.core.refactoring.resource.RenameResourceProcessor) CoreException(org.eclipse.core.runtime.CoreException) RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.RenameRefactoring) Change(org.eclipse.ltk.core.refactoring.Change) IProject(org.eclipse.core.resources.IProject)

Aggregations

RenameRefactoring (org.eclipse.ltk.core.refactoring.participants.RenameRefactoring)36 RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)13 IType (org.eclipse.jdt.core.IType)12 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)10 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)8 JavaRefactoringArguments (org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments)8 RenameJavaElementDescriptor (org.eclipse.jdt.core.refactoring.descriptors.RenameJavaElementDescriptor)5 RenameMethodProcessor (org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor)5 RenameTypeParameterProcessor (org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeParameterProcessor)5 RenameArguments (org.eclipse.ltk.core.refactoring.participants.RenameArguments)5 RefactoringWizard (org.eclipse.ltk.ui.refactoring.RefactoringWizard)5 RefactoringWizardOpenOperation (org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation)5 RenameRefactoringWizard (org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard)5 CoreException (org.eclipse.core.runtime.CoreException)4 IMethod (org.eclipse.jdt.core.IMethod)4 IPackageFragment (org.eclipse.jdt.core.IPackageFragment)4 RenameVirtualMethodProcessor (org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 IFile (org.eclipse.core.resources.IFile)3