public void run(IProgressMonitor pm) throws InvocationTargetException { try { RefactoringCore.getUndoManager().performUndo(query, pm); } catch (CoreException e) { throw new InvocationTargetException(e); } } };
public void run(IProgressMonitor pm) throws InvocationTargetException { try { RefactoringCore.getUndoManager().performRedo(query, pm); } catch (CoreException e) { throw new InvocationTargetException(e); } } };
public void dispose() { if (fUndoManagerListener != null) RefactoringCore.getUndoManager().removeListener(fUndoManagerListener); fWorkbenchWindow= null; fAction= null; fUndoManagerListener= null; }
protected void hookListener(IAction action) { if (isHooked()) return; fAction= action; fUndoManagerListener= createUndoManagerListener(); RefactoringCore.getUndoManager().addListener(fUndoManagerListener); }
private String getActionText() { return shortenText(Messages.format( RefactoringUIMessages.UndoRefactoringAction_extendedLabel, RefactoringCore.getUndoManager().peekUndoName()), fPatternLength); } }
private String getActionText() { return shortenText(Messages.format( RefactoringUIMessages.RedoRefactoringAction_extendedLabel, RefactoringCore.getUndoManager().peekRedoName()), fPatternLength); } }
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (monitor == null) { monitor= new NullProgressMonitor(); } monitor.beginTask(NewWizardMessages.ClasspathFixSelectionDialog_process_fix_description, 4); try { ClasspathFixProposal fix= dialog.getSelectedClasspathFix(); Change change= fix.createChange(new SubProgressMonitor(monitor, 1)); PerformChangeOperation op= new PerformChangeOperation(change); op.setUndoManager(RefactoringCore.getUndoManager(), change.getName()); op.run(new SubProgressMonitor(monitor, 1)); } catch (OperationCanceledException e) { throw new InterruptedException(); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } });
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (monitor == null) { monitor= new NullProgressMonitor(); } monitor.beginTask(NewWizardMessages.ClasspathFixSelectionDialog_process_fix_description, 4); try { ClasspathFixProposal fix= dialog.getSelectedClasspathFix(); Change change= fix.createChange(new SubProgressMonitor(monitor, 1)); PerformChangeOperation op= new PerformChangeOperation(change); op.setUndoManager(RefactoringCore.getUndoManager(), change.getName()); op.run(new SubProgressMonitor(monitor, 1)); } catch (OperationCanceledException e) { throw new InterruptedException(); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } });
public void selectionChanged(IAction action, ISelection s) { if (!isHooked()) { hookListener(action); fPatternLength= RefactoringUIMessages.UndoRefactoringAction_extendedLabel.length(); IUndoManager undoManager = RefactoringCore.getUndoManager(); if (undoManager.anythingToUndo()) { if (undoManager.peekUndoName() != null) action.setText(getActionText()); action.setEnabled(true); } else { action.setEnabled(false); } } }
public void selectionChanged(IAction action, ISelection s) { if (!isHooked()) { hookListener(action); fPatternLength= RefactoringUIMessages.RedoRefactoringAction_extendedLabel.length(); IUndoManager undoManager = RefactoringCore.getUndoManager(); if (undoManager.anythingToRedo()) { if (undoManager.peekRedoName() != null) action.setText(getActionText()); action.setEnabled(true); } else { action.setEnabled(false); } } }
public void run(IProgressMonitor pm) throws CoreException { try { pm.beginTask("", 11); pm.subTask(""); final RefactoringStatus status = refactoring.checkAllConditions(new SubProgressMonitor(pm, 4, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); if (status.getSeverity() >= RefactoringStatus.WARNING) { final boolean[] canceled = { false }; shell.getDisplay().syncExec(new Runnable() { public void run() { canceled[0] = showStatusDialog(status); } }); if (canceled[0]) { throw new OperationCanceledException(); } } Change change = refactoring.createChange(new SubProgressMonitor(pm, 2, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); change.initializeValidationData(new SubProgressMonitor(pm, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); performChangeOperation = new PerformChangeOperation(change); performChangeOperation.setUndoManager(RefactoringCore.getUndoManager(), refactoring.getName()); performChangeOperation.setSchedulingRule(ResourcesPlugin.getWorkspace().getRoot()); } finally { pm.done(); } }
public void run(IAction action) { Shell parent= fWorkbenchWindow.getShell(); IRunnableWithProgress op= createOperation(parent); try { PlatformUI.getWorkbench().getProgressService().runInUI( new ProgressMonitorDialog(fWorkbenchWindow.getShell()), op, ResourcesPlugin.getWorkspace().getRoot()); } catch (InvocationTargetException e) { RefactoringCore.getUndoManager().flush(); ExceptionHandler.handle(e, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), RefactoringUIMessages.UndoManagerAction_internal_error_title, RefactoringUIMessages.UndoManagerAction_internal_error_message); } catch (InterruptedException e) { // Operation isn't cancelable. } catch (OperationCanceledException e) { // the waiting dialog got canceled. } } }
Assert.isNotNull(operation); Assert.isNotNull(refactoring); operation.setUndoManager(RefactoringCore.getUndoManager(), refactoring.getName()); final IWizardContainer wizard= getContainer(); final Shell shell= wizard.getShell();
/** * {@inheritDoc} */ public void run(IProgressMonitor monitor) throws CoreException { if (monitor == null) monitor= new NullProgressMonitor(); monitor.beginTask("", 10); //$NON-NLS-1$ final CreateChangeOperation create= new CreateChangeOperation(new CheckConditionsOperation(fRefactoring, fStyle), RefactoringStatus.FATAL); create.run(new SubProgressMonitor(monitor, 6)); fPreconditionStatus= create.getConditionCheckingStatus(); if (fPreconditionStatus.hasFatalError()) { monitor.done(); return; } final Change change= create.getChange(); if (change != null) { final PerformChangeOperation perform= new PerformChangeOperation(change); perform.setUndoManager(RefactoringCore.getUndoManager(), fRefactoring.getName()); perform.run(new SubProgressMonitor(monitor, 2)); fValidationStatus= perform.getValidationStatus(); fUndo= perform.getUndoChange(); } } }
@Override public void run(IProgressMonitor monitor) throws CoreException { try { if (monitor == null) monitor= new NullProgressMonitor(); monitor.beginTask("", 10); //$NON-NLS-1$ final CreateChangeOperation create= new CreateChangeOperation(new CheckConditionsOperation(fRefactoring, fStyle), RefactoringStatus.FATAL); create.run(new SubProgressMonitor(monitor, 6)); fPreconditionStatus= create.getConditionCheckingStatus(); if (fPreconditionStatus.hasFatalError()) { monitor.done(); return; } final Change change= create.getChange(); if (change != null) { final PerformChangeOperation perform= new PerformChangeOperation(change); perform.setUndoManager(RefactoringCore.getUndoManager(), fRefactoring.getName()); perform.run(new SubProgressMonitor(monitor, 2)); fValidationStatus= perform.getValidationStatus(); fUndo= perform.getUndoChange(); } } finally { if (fRefactoringContext != null) fRefactoringContext.dispose(); } } }
@Override public void run(IProgressMonitor monitor) throws CoreException { try { if (monitor == null) monitor= new NullProgressMonitor(); monitor.beginTask("", 10); //$NON-NLS-1$ final CreateChangeOperation create= new CreateChangeOperation(new CheckConditionsOperation(fRefactoring, fStyle), RefactoringStatus.FATAL); create.run(new SubProgressMonitor(monitor, 6)); fPreconditionStatus= create.getConditionCheckingStatus(); if (fPreconditionStatus.hasFatalError()) { monitor.done(); return; } final Change change= create.getChange(); if (change != null) { final PerformChangeOperation perform= new PerformChangeOperation(change); perform.setUndoManager(RefactoringCore.getUndoManager(), fRefactoring.getName()); perform.run(new SubProgressMonitor(monitor, 2)); fValidationStatus= perform.getValidationStatus(); fUndo= perform.getUndoChange(); } } finally { if (fRefactoringContext != null) fRefactoringContext.dispose(); } } }
fPerformChangeOperation.setUndoManager(RefactoringCore.getUndoManager(), fRefactoring.getName()); if (fRefactoring instanceof IScheduledRefactoring) fPerformChangeOperation.setSchedulingRule(((IScheduledRefactoring)fRefactoring).getSchedulingRule());
fPerformChangeOperation.setUndoManager(RefactoringCore.getUndoManager(), fRefactoring.getName()); if (fRefactoring instanceof IScheduledRefactoring) fPerformChangeOperation.setSchedulingRule(((IScheduledRefactoring)fRefactoring).getSchedulingRule());
fPerformChangeOperation.setUndoManager(RefactoringCore.getUndoManager(), fRefactoring.getName()); if (fRefactoring instanceof IScheduledRefactoring) fPerformChangeOperation.setSchedulingRule(((IScheduledRefactoring)fRefactoring).getSchedulingRule());
op.setUndoManager(RefactoringCore.getUndoManager(), fRefactoring.getName()); Shell parent= getContainer().getShell(); try{