public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { CompositeChange change = new CompositeChange(new String()); change.markAsSynthetic(); change.add(new ConnectionProfileRenameChange(mProfile, mArguments)); return change; }
@Override public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { CompositeChange change = new CompositeChange(""); //$NON-NLS-1$ change.markAsSynthetic(); SubMonitor subMonitor = SubMonitor.convert(pm, PDEUIMessages.OrganizeManifestJob_taskName, fProjectList.size()); for (Iterator<?> i = fProjectList.iterator(); i.hasNext() && !pm.isCanceled();) { CompositeChange projectChange = cleanProject((IProject) i.next(), subMonitor.split(1)); if (projectChange.getChildren().length > 0) change.add(projectChange); } return change; }
private void handleUndos(Change failedChange, List undos) { if (undos == null) { fUndoUntilException= null; return; } if (failedChange instanceof CompositeChange) { Change partUndoChange= ((CompositeChange)failedChange).getUndoUntilException(); if (partUndoChange != null) { undos.add(partUndoChange); } } if (undos.size() == 0) { fUndoUntilException= new NullChange(getName()); return; } Collections.reverse(undos); fUndoUntilException= createUndoChange((Change[]) undos.toArray(new Change[undos.size()])); }
/** * Merges the children of the given composite change into this * change. This means the changes are removed from the given * composite change and added to this change. * * @param change the change to merge */ public void merge(CompositeChange change) { Change[] others= change.getChildren(); for (int i= 0; i < others.length; i++) { Change other= others[i]; change.remove(other); add(other); } }
/** * Hook to create an undo change. The method should be overridden * by clients which provide their own composite change to create * a corresponding undo change. * * @param childUndos the child undo. The undo edits appear in the * list in the reverse order of their execution. So the first * change in the array is the undo change of the last change * that got executed. * * @return the undo change */ protected Change createUndoChange(Change[] childUndos) { return new CompositeChange(getName(), childUndos); }
@Override public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { if (fChanges == null) { return new NullChange(); } CompositeChange compositeChange = new CompositeChange(WizardMessages.JavadocTagRefactoring_1); for (Change change : fChanges) { compositeChange.add(change); } return compositeChange; }
CompositeChange compositeChange= new CompositeChange(this.getName()); for (Entry<String, ArrayList<MultiFixTarget>> entry : packageToTarget.entrySet()) { ArrayList<MultiFixTarget> list= entry.getValue(); CreatePackageInfoWithDefaultNullnessProposal createPackageInfoProposal= createFor(this.fProblemId, this.getName(), (IPackageFragment) multiFixTarget.getCompilationUnit().getParent()); compositeChange.add(createPackageInfoProposal.getChange()); operation.setUndoManager(RefactoringCore.getUndoManager(), compositeChange.getName()); operation.run(monitor);
public Change createChange(IProgressMonitor pm) throws JavaModelException { IPackageFragmentRoot[] roots= getPackageFragmentRoots(); pm.beginTask("", roots.length); //$NON-NLS-1$ CompositeChange composite= new DynamicValidationStateChange(RefactoringCoreMessages.ReorgPolicy_move_source_folder); composite.markAsSynthetic(); IJavaProject destination= getDestinationJavaProject(); Assert.isNotNull(destination); for (int i= 0; i < roots.length; i++) { composite.add(createChange(roots[i], destination)); pm.worked(1); } pm.done(); return composite; }
@Override public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { CompositeChange change = new CompositeChange(MessageFormat.format(PDEUIMessages.RenamePluginProcessor_changeTitle, fInfo.getCurrentValue(), fInfo.getNewValue())); SubMonitor subMonitor = SubMonitor.convert(pm, getTotalWork()); // update manifest with new Id CreateHeaderChangeOperation op = new CreateHeaderChangeOperation(fInfo.getBase(), Constants.BUNDLE_SYMBOLICNAME, fInfo.getCurrentValue(), fInfo.getNewValue()); op.run(subMonitor.split(1)); change.add(op.getChange()); if (fInfo.isRenameProject()) { change.add(createProjectChange(subMonitor.split( 1))); } if (fInfo.isUpdateReferences()) change.addAll(createReferenceChanges(subMonitor.split(2))); return change; }
@Override public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { SubMonitor localmonitor = SubMonitor.convert(pm, WizardMessages.JavadocConversionPage_scanning_projects_for_javadoc_tags, projects.size() * 100); CompositeChange change = new CompositeChange(WizardMessages.JavadocTagRefactoring_1); IProject project = null; CompositeChange pchange = null; pchange = new CompositeChange(project.getName()); IFile build = project.getFile("build.properties"); //$NON-NLS-1$ if (ApiQuickFixProcessor.needsBuildPropertiesChange(build)) { try { pchange.add(ApiQuickFixProcessor.createBuildPropertiesChange(build)); } catch (CoreException ce) { if (pchange.getChildren().length > 0) { change.add(pchange);
private boolean hasChanges(CompositeChange change) { final Change[] children= change.getChildren(); for (int index= 0; index < children.length; index++) { if (children[index] instanceof CompositeChange) { if (hasChanges((CompositeChange) children[index])) return true; } else return true; } return false; }
@Override protected Change createChange() throws CoreException { return new CompositeChange(changeName, new Change[] { change, importChange }); }
@Override public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException { if (fQualifiedNameSearchResult != null) { CompositeChange parent= (CompositeChange) fRenamePackageChange.getParent(); try { /* * Sneak text changes in before the package rename to ensure * modified files are still at original location (see * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154238) */ parent.remove(fRenamePackageChange); parent.add(fQualifiedNameSearchResult.getSingleChange(Changes.getModifiedFiles(participantChanges))); } finally { fQualifiedNameSearchResult= null; parent.add(fRenamePackageChange); fRenamePackageChange= null; } } return null; }
/** * Adds all changes in the given array to the list of children. * * @param changes the changes to add */ public void addAll(Change[] changes) { for (int i= 0; i < changes.length; i++) { add(changes[i]); } }
@Override public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { CompositeChange result = new CompositeChange(getName()); addChange(result, pm); if (isInterestingForExtensions()) { addChange(result, PDEProject.getPluginXml(fProject), pm); addChange(result, PDEProject.getFragmentXml(fProject), pm); } return (result.getChildren().length == 0) ? null : result; }
@Override public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { CompositeChange change = new CompositeChange(""); //$NON-NLS-1$ change.markAsSynthetic(); ExternalizeStringsOperation op = new ExternalizeStringsOperation(fChangeFiles, change); try { op.run(pm); } catch (InvocationTargetException e) { } catch (InterruptedException e) { } return change; }
name= descriptions[0]; CompositeChange allChanges= new CompositeChange(name); return; allChanges.initializeValidationData(new SubProgressMonitor(pm, 1)); op.setUndoManager(RefactoringCore.getUndoManager(), allChanges.getName()); try { op.run(new SubProgressMonitor(pm, 1));
public Change createCompositeChange(String name, IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, document2textEdits.keySet().size() + document2change.keySet().size()); if(document2change.isEmpty() && document2textEdits.isEmpty()) return null; CompositeChange compositeChange = new FixedCompositeChange(name); for (IRefactoringDocument document : document2textEdits.keySet()) { Iterable<TextEdit> textEdits = document2textEdits.get(document); MultiTextEdit multiTextEdit = new MultiTextEdit(); for (TextEdit textEdit : textEdits) { multiTextEdit.addChild(textEdit); } Change change = document.createChange(name, multiTextEdit); compositeChange.add(change); progress.worked(1); } for (IRefactoringDocument document : document2change.keySet()) { Iterable<Change> documentChanges = document2change.get(document); CompositeChange documentCompositeChange = new FixedCompositeChange(name); documentCompositeChange.addAll(Iterables.toArray(documentChanges, Change.class)); compositeChange.add(documentCompositeChange); progress.worked(1); } return compositeChange; }
private void getFlattendedChildren(List result, CompositeChangeNode parent, CompositeChange focus) { Change[] changes= focus.getChildren(); for (int i= 0; i < changes.length; i++) { Change change= changes[i]; if (fFilter == null || fFilter.select(change)) { if (change instanceof CompositeChange && ((CompositeChange) change).isSynthetic()) { getFlattendedChildren(result, parent, (CompositeChange) change); } else { result.add(createNode(parent, change)); } } } } }
private void handleUndos(Change failedChange, List<Change> undos) { if (undos == null) { fUndoUntilException= null; return; } if (failedChange instanceof CompositeChange) { Change partUndoChange= ((CompositeChange)failedChange).getUndoUntilException(); if (partUndoChange != null) { undos.add(partUndoChange); } } if (undos.size() == 0) { fUndoUntilException= null; return; } Collections.reverse(undos); fUndoUntilException= createUndoChange(undos.toArray(new Change[undos.size()])); }