/** * Execute the operation - generate new source for the compilation unit and save the results. * * @throws DartModelException if the operation is unable to complete */ @Override protected void executeOperation() throws DartModelException { try { beginTask(getMainTaskName(), getMainAmountOfWork()); DartElementDeltaImpl delta = newDartElementDelta(); CompilationUnitImpl unit = (CompilationUnitImpl) getCompilationUnit(); generateNewCompilationUnitAST(unit); if (creationOccurred) { // a change has really occurred unit.save(null, false); boolean isWorkingCopy = unit.isWorkingCopy(); if (!isWorkingCopy) { setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); } worked(1); resultElements = generateResultHandles(); // if unit is working copy, then save will have already fired the delta if (!isWorkingCopy /* && !Util.isExcluded(unit) */ && unit.getParent().exists()) { for (int i = 0; i < resultElements.length; i++) { delta.added(resultElements[i]); } addDelta(delta); } // else unit is created outside classpath // non-java resource delta will be notified by delta processor } } finally { done(); } }