Search in sources :

Example 1 with RefactoringExecutionHelper

use of org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper in project che by eclipse.

the class RenameSupport method perform.

//	/**
//	 * Opens the refactoring dialog for this rename support.
//	 *
//	 * @param parent a shell used as a parent for the refactoring dialog.
//	 * @throws CoreException if an unexpected exception occurs while opening the
//	 * dialog.
//	 *
//	 * @see #openDialog(Shell, boolean)
//	 */
//	public void openDialog(Shell parent) throws CoreException {
//		openDialog(parent, false);
//	}
//
//	/**
//	 * Opens the refactoring dialog for this rename support.
//	 *
//	 * <p>
//	 * This method has to be called from within the UI thread.
//	 * </p>
//	 *
//	 * @param parent a shell used as a parent for the refactoring, preview, or error dialog
//	 * @param showPreviewOnly if <code>true</code>, the dialog skips all user input pages and
//	 * directly shows the preview or error page. Otherwise, shows all pages.
//	 * @return <code>true</code> if the refactoring has been executed successfully,
//	 * <code>false</code> if it has been canceled or if an error has happened during
//	 * initial conditions checking.
//	 *
//	 * @throws CoreException if an error occurred while executing the
//	 * operation.
//	 *
//	 * @see #openDialog(Shell)
//	 * @since 3.3
//	 */
//	public boolean openDialog(Shell parent, boolean showPreviewOnly) throws CoreException {
//		ensureChecked();
//		if (fPreCheckStatus.hasFatalError()) {
//			showInformation(parent, fPreCheckStatus);
//			return false;
//		}
//
//		UserInterfaceStarter starter;
//		if (!showPreviewOnly) {
//			starter = RenameUserInterfaceManager.getDefault().getStarter(fRefactoring);
//		} else {
//			starter = new RenameUserInterfaceStarter();
//			RenameRefactoringWizard wizard = new RenameRefactoringWizard(fRefactoring, fRefactoring.getName(), null, null, null) {
//				@Override
//				protected void addUserInputPages() {
//					// nothing to add
//				}
//			};
//			wizard.setForcePreviewReview(showPreviewOnly);
//			starter.initialize(wizard);
//		}
//		return starter.activate(fRefactoring, parent, getJavaRenameProcessor().getSaveMode());
//	}
//
/**
	 * Executes the rename refactoring without showing a dialog to gather
	 * additional user input (for example the new name of the <tt>IJavaElement</tt>).
	 * Only an error dialog is shown (if necessary) to present the result
	 * of the refactoring's full precondition checking.
	 * <p>
	 * The method has to be called from within the UI thread.
	 * </p>
	 *
	 *
	 * @throws InterruptedException if the operation has been canceled by the
	 * user.
	 * @throws InvocationTargetException if an error occurred while executing the
	 * operation.
	 */
public RefactoringStatus perform() throws InterruptedException, InvocationTargetException {
    try {
        ensureChecked();
        if (fPreCheckStatus.hasFatalError()) {
            return fPreCheckStatus;
        }
        RefactoringExecutionHelper helper = new RefactoringExecutionHelper(fRefactoring, RefactoringCore.getConditionCheckingFailedSeverity(), getJavaRenameProcessor().getSaveMode());
        RefactoringStatus status = helper.perform(true, true);
        fPerformChangeOperation = helper.getfPerformChangeOperation();
        return status;
    } catch (CoreException e) {
        throw new InvocationTargetException(e);
    }
}
Also used : RefactoringExecutionHelper(org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper) CoreException(org.eclipse.core.runtime.CoreException) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 CoreException (org.eclipse.core.runtime.CoreException)1 RefactoringExecutionHelper (org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper)1 RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)1