@Override protected IStatus run(IProgressMonitor monitor) { if (monitor.isCanceled() || paused) return Status.CANCEL_STATUS; long start = System.currentTimeMillis(); if (log.isDebugEnabled()) { log.debug("Preparing reconciliation."); // $NON-NLS-1$ } final IXtextDocument document = XtextDocumentUtil.get(textViewer); if (document != null) { final ReplaceRegion replaceRegionToBeProcessed = getAndResetReplaceRegion(); if (replaceRegionToBeProcessed != null) { if (strategy instanceof IReconcilingStrategyExtension) { ((IReconcilingStrategyExtension) strategy).setProgressMonitor(monitor); } strategy.reconcile(replaceRegionToBeProcessed); } } if (log.isDebugEnabled()) log.debug( "Reconciliation finished. Time required: " + (System.currentTimeMillis() - start)); // $NON-NLS-1$ return Status.OK_STATUS; }
public void run() { Resource resource = content.eResource(); if (resource == null) { return; } IFile file = getFile(resource.getURI()); if (file == null) { return; } document = XtextDocumentUtil.get(file); }
public void performNecessaryUpdates(Processor processor) { final IXtextDocument document = XtextDocumentUtil.get(textViewer); if (document != null && !paused) { final ReplaceRegion replaceRegionToBeProcessed = getAndResetReplaceRegion(); if (replaceRegionToBeProcessed != null) { processor.process(new XtextReconcilerUnitOfWork(replaceRegionToBeProcessed, document)); } } if (sessionStarted && !paused) { pause(); } }
protected void handleInputDocumentChanged(IDocument oldInput, IDocument newInput) { if (shouldInstallCompletionListener) { ContentAssistantFacade facade = ((ISourceViewerExtension4) textViewer).getContentAssistantFacade(); if (facade != null) { facade.addCompletionListener(documentListener); } shouldInstallCompletionListener = false; } if (oldInput instanceof IXtextDocument) { ((IXtextDocument) oldInput).removeXtextDocumentContentObserver(documentListener); } if (newInput instanceof IXtextDocument) { ((IXtextDocument) newInput).addXtextDocumentContentObserver(documentListener); final IXtextDocument document = XtextDocumentUtil.get(textViewer); strategy.setDocument(document); if (!initalProcessDone && strategy instanceof IReconcilingStrategyExtension) { initalProcessDone = true; IReconcilingStrategyExtension reconcilingStrategyExtension = (IReconcilingStrategyExtension) strategy; reconcilingStrategyExtension.initialReconcile(); } } }