/** * @param units * to clean up * @param cleanUps * clean ups to execute on units * * @throws JavaModelException * @throws InvocationTargetException */ protected void performRefactoring(ICompilationUnit[] units, ICleanUp[] cleanUps) throws JavaModelException, InvocationTargetException { RefactoringExecutionStarter.startCleanupRefactoring(units, cleanUps, getShell(), false, getActionName()); }
protected void performRefactoring(ICompilationUnit[] units, ICleanUp[] cleanUps) throws InvocationTargetException { RefactoringExecutionStarter.startCleanupRefactoring(units, cleanUps, false, getShell(), false, getActionName()); }
protected void performRefactoring(ICompilationUnit[] units, ICleanUp[] cleanUps) throws InvocationTargetException { RefactoringExecutionStarter.startCleanupRefactoring(units, cleanUps, false, getShell(), false, getActionName()); }
private void showUnexpectedError(CoreException e) { String message2= Messages.format(ActionMessages.CleanUpAction_UnexpectedErrorMessage, e.getStatus().getMessage()); IStatus status= new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.ERROR, message2, null); ErrorDialog.openError(getShell(), getActionName(), null, status); }
private void showUnexpectedError(CoreException e) { String message2= Messages.format(ActionMessages.CleanUpAction_UnexpectedErrorMessage, e.getStatus().getMessage()); IStatus status= new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.ERROR, message2, null); ErrorDialog.openError(getShell(), getActionName(), null, status); }
private void showUnexpectedError(CoreException e) { String message2= Messages.format(ActionMessages.CleanUpAction_UnexpectedErrorMessage, e.getStatus().getMessage()); IStatus status= new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.ERROR, message2, null); ErrorDialog.openError(getShell(), getActionName(), null, status); }
public void run(IStructuredSelection selection) { ICompilationUnit[] cus= getCompilationUnits(selection); if (cus.length == 0) { MessageDialog.openInformation(getShell(), getActionName(), ActionMessages.CleanUpAction_EmptySelection_description); } else if (cus.length == 1) { run(cus[0]); } else { runOnMultiple(cus); } }
@Override public void run(IStructuredSelection selection) { ICompilationUnit[] cus= getCompilationUnits(selection); if (cus.length == 0) { MessageDialog.openInformation(getShell(), getActionName(), ActionMessages.CleanUpAction_EmptySelection_description); } else if (cus.length == 1) { run(cus[0]); } else { runOnMultiple(cus); } }
@Override public void run(IStructuredSelection selection) { ICompilationUnit[] cus= getCompilationUnits(selection); if (cus.length == 0) { MessageDialog.openInformation(getShell(), getActionName(), ActionMessages.CleanUpAction_EmptySelection_description); } else if (cus.length == 1) { run(cus[0]); } else { runOnMultiple(cus); } }
private void run(ICompilationUnit cu) { if (!ActionUtil.isEditable(fEditor, getShell(), cu)) return; ICleanUp[] cleanUps= getCleanUps(new ICompilationUnit[] { cu }); if (cleanUps == null) return; if (!ElementValidator.check(cu, getShell(), getActionName(), fEditor != null)) return; try { performRefactoring(new ICompilationUnit[] { cu }, cleanUps); } catch (InvocationTargetException e) { JavaPlugin.log(e); if (e.getCause() instanceof CoreException) showUnexpectedError((CoreException)e.getCause()); } }
private void run(ICompilationUnit cu) { if (!ActionUtil.isEditable(fEditor, getShell(), cu)) return; ICleanUp[] cleanUps= getCleanUps(new ICompilationUnit[] { cu }); if (cleanUps == null) return; if (!ElementValidator.check(cu, getShell(), getActionName(), fEditor != null)) return; try { performRefactoring(new ICompilationUnit[] { cu }, cleanUps); } catch (InvocationTargetException e) { JavaPlugin.log(e); if (e.getCause() instanceof CoreException) showUnexpectedError((CoreException)e.getCause()); } }
private void run(ICompilationUnit cu) { if (!ActionUtil.isEditable(fEditor, getShell(), cu)) return; ICleanUp[] cleanUps= createCleanUps(new ICompilationUnit[] { cu }); if (cleanUps == null) return; if (!ElementValidator.check(cu, getShell(), getActionName(), fEditor != null)) return; try { performRefactoring(new ICompilationUnit[] { cu }, cleanUps); } catch (InvocationTargetException e) { JavaPlugin.log(e); if (e.getCause() instanceof CoreException) showUnexpectedError((CoreException)e.getCause()); } catch (JavaModelException e) { showUnexpectedError(e); } }
private void runOnMultiple(final ICompilationUnit[] cus) { ICleanUp[] cleanUps= createCleanUps(cus); if (cleanUps == null) return; MultiStatus status= new MultiStatus(JavaUI.ID_PLUGIN, IStatus.OK, ActionMessages.CleanUpAction_MultiStateErrorTitle, null); for (int i= 0; i < cus.length; i++) { ICompilationUnit cu= cus[i]; if (!ActionUtil.isOnBuildPath(cu)) { String cuLocation= cu.getPath().makeRelative().toString(); String message= Messages.format(ActionMessages.CleanUpAction_CUNotOnBuildpathMessage, cuLocation); status.add(new Status(IStatus.INFO, JavaUI.ID_PLUGIN, IStatus.ERROR, message, null)); } } if (!status.isOK()) { ErrorDialog.openError(getShell(), getActionName(), null, status); return; } try { performRefactoring(cus, cleanUps); } catch (InvocationTargetException e) { JavaPlugin.log(e); if (e.getCause() instanceof CoreException) showUnexpectedError((CoreException)e.getCause()); } catch (JavaModelException e) { showUnexpectedError(e); } }
private void runOnMultiple(final ICompilationUnit[] cus) { ICleanUp[] cleanUps= getCleanUps(cus); if (cleanUps == null) return; MultiStatus status= new MultiStatus(JavaUI.ID_PLUGIN, IStatus.OK, ActionMessages.CleanUpAction_MultiStateErrorTitle, null); for (int i= 0; i < cus.length; i++) { ICompilationUnit cu= cus[i]; if (!ActionUtil.isOnBuildPath(cu)) { String cuLocation= BasicElementLabels.getPathLabel(cu.getPath(), false); String message= Messages.format(ActionMessages.CleanUpAction_CUNotOnBuildpathMessage, cuLocation); status.add(new Status(IStatus.INFO, JavaUI.ID_PLUGIN, IStatus.ERROR, message, null)); } } if (!status.isOK()) { ErrorDialog.openError(getShell(), getActionName(), null, status); return; } try { performRefactoring(cus, cleanUps); } catch (InvocationTargetException e) { JavaPlugin.log(e); if (e.getCause() instanceof CoreException) showUnexpectedError((CoreException)e.getCause()); } }
private void runOnMultiple(final ICompilationUnit[] cus) { ICleanUp[] cleanUps= getCleanUps(cus); if (cleanUps == null) return; MultiStatus status= new MultiStatus(JavaUI.ID_PLUGIN, IStatus.OK, ActionMessages.CleanUpAction_MultiStateErrorTitle, null); for (int i= 0; i < cus.length; i++) { ICompilationUnit cu= cus[i]; if (!ActionUtil.isOnBuildPath(cu)) { String cuLocation= BasicElementLabels.getPathLabel(cu.getPath(), false); String message= Messages.format(ActionMessages.CleanUpAction_CUNotOnBuildpathMessage, cuLocation); status.add(new Status(IStatus.INFO, JavaUI.ID_PLUGIN, IStatus.ERROR, message, null)); } } if (!status.isOK()) { ErrorDialog.openError(getShell(), getActionName(), null, status); return; } try { performRefactoring(cus, cleanUps); } catch (InvocationTargetException e) { JavaPlugin.log(e); if (e.getCause() instanceof CoreException) showUnexpectedError((CoreException)e.getCause()); } }