示例#1
0
  @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;
  }
示例#2
0
 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();
     }
   }
 }