/* * @return <code>true</code> if compare result is OK to show, <code>false</code> otherwise */ public boolean compareResultOK(CompareEditorInput input, IRunnableContext context) { final Shell shell = getShell(); try { // run operation in separate thread and make it cancelable if (context == null) context = PlatformUI.getWorkbench().getProgressService(); context.run(true, true, input); String message = input.getMessage(); if (message != null) { MessageDialog.openError( shell, Utilities.getString("CompareUIPlugin.compareFailed"), message); // $NON-NLS-1$ return false; } if (input.getCompareResult() == null) { MessageDialog.openInformation( shell, Utilities.getString("CompareUIPlugin.dialogTitle"), Utilities.getString("CompareUIPlugin.noDifferences")); // $NON-NLS-2$ //$NON-NLS-1$ return false; } return true; } catch (InterruptedException x) { // canceled by user } catch (InvocationTargetException x) { MessageDialog.openError( shell, Utilities.getString("CompareUIPlugin.compareFailed"), x.getTargetException().getMessage()); // $NON-NLS-1$ } return false; }
public IStatus prepareInput(CompareEditorInput input, IProgressMonitor monitor) { try { input.run(monitor); String message = input.getMessage(); if (message != null) { return new Status(IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, message, null); } if (input.getCompareResult() == null) { return new Status( IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, NO_DIFFERENCE, Utilities.getString("CompareUIPlugin.noDifferences"), null); //$NON-NLS-1$ } return Status.OK_STATUS; } catch (InterruptedException e) { throw new OperationCanceledException(); } catch (InvocationTargetException e) { return new Status( IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, Utilities.getString("CompareUIPlugin.compareFailed"), e.getTargetException()); // $NON-NLS-1$ } }
@Override public void setTitle(String title) { if (operation == BonitaGroovyRefactoringAction.REFACTOR_OPERATION) { super.setTitle(Messages.bind(Messages.refactorTitle, elementName)); } else { super.setTitle(Messages.bind(Messages.removeTitle, elementName)); } }
/** * Performs the comparison described by the given input and opens a compare editor on the result. * * @param input the input on which to open the compare editor * @param page the workbench page on which to create a new compare editor * @param editor if not null the input is opened in this editor * @param activate if <code>true</code> the editor will be activated * @see IWorkbenchPage#openEditor(org.eclipse.ui.IEditorInput, String, boolean) * @see CompareEditorInput */ public void openCompareEditor( final CompareEditorInput input, final IWorkbenchPage page, final IReusableEditor editor, final boolean activate) { CompareConfiguration configuration = input.getCompareConfiguration(); if (configuration != null) { IPreferenceStore ps = configuration.getPreferenceStore(); if (ps != null) configuration.setProperty( CompareConfiguration.USE_OUTLINE_VIEW, Boolean.valueOf(ps.getBoolean(ComparePreferencePage.USE_OUTLINE_VIEW))); } if (input.canRunAsJob()) { openEditorInBackground(input, page, editor, activate); } else { if (compareResultOK(input, null)) { internalOpenEditor(input, page, editor, activate); } } }
@Override public void saveChanges(IProgressMonitor monitor) throws CoreException { super.saveChanges(monitor); for (int i = 0; i < oldExpressions.size(); i++) { if (!oldExpressions.get(i).getContent().equals(newExpressions.get(i).getContent())) { cc.append( SetCommand.create( domain, oldExpressions.get(i), ExpressionPackage.Literals.EXPRESSION__CONTENT, newExpressions.get(i).getContent())); if (ExpressionConstants.CONDITION_TYPE.equals(oldExpressions.get(i).getType())) { cc.append( SetCommand.create( domain, oldExpressions.get(i), ExpressionPackage.Literals.EXPRESSION__NAME, newExpressions.get(i).getContent())); } } } status = true; }
@Override protected void handleDispose() { super.handleDispose(); // we do NOT dispose the images, as these are shared }
@Override protected void contentsCreated() { super.contentsCreated(); // select the first conflict getNavigator().selectChange(true); }
@Override public void setStatusMessage(String message) { super.setStatusMessage(message); }