/** Generate a new AST for this operation and applies it to the given cu */ protected void generateNewCompilationUnitAST(CompilationUnit cu) throws DartModelException { DartCore.notYetImplemented(); // cuAST = parse(cu); // // AST ast = cuAST.getAST(); // ASTRewrite rewriter = ASTRewrite.create(ast); // ASTNode child = generateElementAST(rewriter, cu); // if (child != null) { // ASTNode parent = ((DartElementImpl) getParentElement()).findNode(cuAST); // if (parent == null) // parent = cuAST; // insertASTNode(rewriter, parent, child); // TextEdit edits = rewriter.rewriteAST(); // applyTextEdit(cu, edits); // } worked(1); }
/** * Unregister the reconcile delta for the given working copy. * * @param workingCopy the working copy whose delta is to be removed */ protected void removeReconcileDelta(CompilationUnit workingCopy) { DartCore.notYetImplemented(); // DartModelManager.getInstance().getDeltaProcessor().reconcileDeltas.remove(workingCopy); }
/** * Run this operation and register any deltas created. * * @throws CoreException if the operation fails */ @Override public void run(IProgressMonitor monitor) throws CoreException { DartCore.notYetImplemented(); DartModelManager manager = DartModelManager.getInstance(); IDeltaProcessor deltaProcessor = manager.getDeltaProcessor(); int previousDeltaCount = deltaProcessor.getDartModelDeltas().size(); try { progressMonitor = monitor; pushOperation(this); try { if (canModifyRoots()) { // // computes the root infos before executing the operation // // noop if already initialized // DartModelManager.getInstance().getDeltaState().initializeRoots(false); } executeOperation(); } finally { if (isTopLevelOperation()) { runPostActions(); } } } finally { try { // re-acquire delta processor as it can have been reset during // executeOperation() deltaProcessor = manager.getDeltaProcessor(); // update DartModel using deltas that were recorded during this // operation for (int i = previousDeltaCount, size = deltaProcessor.getDartModelDeltas().size(); i < size; i++) { deltaProcessor.updateDartModel(deltaProcessor.getDartModelDeltas().get(i)); } // // close the parents of the created elements and reset their // // project's cache (in case we are in an IWorkspaceRunnable and the // // clients wants to use the created element's parent) // // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=83646 // for (int i = 0, length = resultElements.length; i < length; i++) // { // DartElement element = resultElements[i]; // Openable openable = (Openable) element.getOpenable(); // if (!(openable instanceof CompilationUnit) || !((CompilationUnit) // openable).isWorkingCopy()) { // a working copy must remain a child of // its parent even after a move // ((DartElementImpl) openable.getParent()).close(); // } // switch (element.getElementType()) { // case DartElement.PACKAGE_FRAGMENT_ROOT: // case DartElement.PACKAGE_FRAGMENT: // deltaProcessor.projectCachesToReset.add(element.getDartProject()); // break; // } // } deltaProcessor.resetProjectCaches(); // fire only iff: // - the operation is a top level operation // - the operation did produce some delta(s) // - but the operation has not modified any resource if (isTopLevelOperation()) { if ((deltaProcessor.getDartModelDeltas().size() > previousDeltaCount || !deltaProcessor.getReconcileDeltas().isEmpty()) && !hasModifiedResource()) { deltaProcessor.fire(null, DeltaProcessor.DEFAULT_CHANGE_EVENT); } // else deltas are fired while processing the resource delta } } finally { popOperation(); } } }
/** * Create a new node with the given type. * * @param nodeType the type of the node to be created * @return the node that was created */ public DartNode createInstance(int nodeType) { DartCore.notYetImplemented(); return null; }