Package org.eclipse.wst.sse.core.internal.provisional

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel


    }
  }
 
  private void updateEncodingMemento() {
    boolean failed = false;
    IStructuredModel internalModel = getInternalModel();
    if (internalModel != null) {
      IStructuredDocument doc = internalModel.getStructuredDocument();
      EncodingMemento memento = doc.getEncodingMemento();
      IDocumentCharsetDetector detector = internalModel.getModelHandler().getEncodingDetector();
      if (memento != null && detector != null) {
        detector.set(doc);
        try {
          String newEncoding = detector.getEncoding();
          if (newEncoding != null) {
View Full Code Here


     * Squiggles strategy, even when the native problem underline was specified for annotations */
    return super.getSourceViewerDecorationSupport(viewer);
  }

  private void installCharacterPairing() {
    IStructuredModel model = getInternalModel();
    if (model != null) {
      IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(SSEUIPlugin.ID, "characterPairing"); //$NON-NLS-1$
      IContentTypeManager mgr = Platform.getContentTypeManager();
      IContentType type = mgr.getContentType(model.getContentTypeIdentifier());
      if (type != null) {
        for (int i = 0; i < elements.length; i++) {
          // Create the inserter
          IConfigurationElement element = elements[i];
          try {
View Full Code Here

  /**
   * Installs semantic highlighting on the editor
   */
  private void installSemanticHighlighting() {
    IStructuredModel model = getInternalModel();
    if (fSemanticManager == null && model != null) {
      fSemanticManager = new SemanticHighlightingManager();
      fSemanticManager.install(getSourceViewer(), getPreferenceStore(), getSourceViewerConfiguration(), model.getContentTypeIdentifier());
    }
  }
View Full Code Here

   */
  protected String getContentType(IDocument document) {
    String type = null;

    IModelManager mgr = StructuredModelManager.getModelManager();
    IStructuredModel model = null;
    try {
      model = mgr.getExistingModelForRead(document);
      if (model != null) {
        type = model.getContentTypeIdentifier();
      }
    }
    finally {
      if (model != null) {
        model.releaseFromRead();
      }
    }
    return type;
  }
View Full Code Here

        fIsReconciling= true;
    }
    fJobPresenter = fPresenter;
    fJobSemanticHighlightings = fSemanticHighlightings;
    fJobHighlightings = fHighlightings;
    IStructuredModel model = null;
    try {
      if (fJobPresenter == null || fJobSemanticHighlightings == null || fJobHighlightings == null || fDocument == null)
        return;

      fJobPresenter.setCanceled(false);
   
      startReconcilingPositions();
      IStructuredDocument document = (IStructuredDocument) fDocument;
      model = ModelManagerImpl.getInstance().getModelForRead(document);
      IStructuredDocumentRegion[] regions = document.getStructuredDocumentRegions(partition.getOffset(), partition.getLength());
      for (int i = 0; i < regions.length && fIsInstalled; i++) {
        if (document.containsReadOnly(regions[i].getStartOffset(), regions[i].getLength()))
          addPosition(new Position(regions[i].getStartOffset(), regions[i].getLength()), null, true);
        else {
          for (int j = 0; j < fJobSemanticHighlightings.length && fIsInstalled; j++) {
            if (fJobHighlightings[j].isEnabled()) {
              Position[] consumes = null;
              if (fJobSemanticHighlightings[j] instanceof ISemanticHighlightingExtension && model != null) {
                consumes = ((ISemanticHighlightingExtension) fJobSemanticHighlightings[j]).consumes(regions[i], model.getIndexedRegion(regions[i].getStartOffset()));
              }
              else {
                consumes = fJobSemanticHighlightings[j].consumes(regions[i]);
              }
              if (consumes != null) {
                for (int k = 0; k < consumes.length; k++)
                  addPosition(consumes[k], fJobHighlightings[j]);
              }
            }
          }
        }
      }

      if (fIsInstalled) {
        List oldPositions = fRemovedPositions;
        List newPositions = new ArrayList(fNOfRemovedPositions);
        for (int i = 0, n = oldPositions.size(); i < n && fIsInstalled; i++) {
          Object current = oldPositions.get(i);
          if (current != null)
            newPositions.add(current);
        }
        fRemovedPositions = newPositions;
       
        TextPresentation presentation = null;
        if (!fJobPresenter.isCanceled())
          presentation = fJobPresenter.createPresentation(fAddedPositions, fRemovedPositions);
        if (!fJobPresenter.isCanceled())
          updatePresentation(presentation, fAddedPositions, fRemovedPositions);
      }
      stopReconcilingPositions();
    }
    finally {
      fJobPresenter= null;
      fJobSemanticHighlightings= null;
      fJobHighlightings= null;
      if (model != null)
        model.releaseFromRead();
      synchronized (fReconcileLock) {
        fIsReconciling= false;
      }
    }
  }
View Full Code Here

    if (Debug.displayInfo)
      System.out.println("-----------------------ModelQueryAdapterFactoryForJSP.createAdapter" + target); //$NON-NLS-1$
    if (modelQueryAdapterImpl == null) {
      if (target instanceof IDOMNode) {
        IDOMNode xmlNode = (IDOMNode) target;
        IStructuredModel model = stateNotifier = xmlNode.getModel();
        if (model.getBaseLocation() != null) {
          stateNotifier.addModelStateListener(this);
        }

        org.eclipse.wst.sse.core.internal.util.URIResolver resolver = model.getResolver();
        if (Debug.displayInfo)
          System.out.println("----------------ModelQueryAdapterFactoryForJSP... baseLocation : " + resolver.getFileBaseLocation()); //$NON-NLS-1$

        /**
         * XMLCatalogIdResolver currently requires a filesystem
         * location string. Customarily this will be what is in the
         * deprecated SSE URIResolver and required by the Common URI
         * Resolver.
         */
        URIResolver idResolver = null;
        if (resolver != null) {
          idResolver = new XMLCatalogIdResolver(resolver.getFileBaseLocation(), resolver);
        }
        else {
          /*
           * 203649 - this block may be necessary due to ordering of
           * setting the resolver into the model
           */
          String baseLocation = null;
          String modelsBaseLocation = model.getBaseLocation();
          if (modelsBaseLocation != null) {
            File file = new Path(modelsBaseLocation).toFile();
            if (file.exists()) {
              baseLocation = file.getAbsolutePath();
            }
            else {
              IPath basePath = new Path(model.getBaseLocation());
              IResource derivedResource = null;
              if (basePath.segmentCount() > 1)
                derivedResource = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
              else
                derivedResource = ResourcesPlugin.getWorkspace().getRoot().getProject(basePath.segment(0));
View Full Code Here

     * @see org.eclipse.jface.text.ITextInputListener#inputDocumentChanged(org.eclipse.jface.text.IDocument, org.eclipse.jface.text.IDocument)
     */
    public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
      if(fContentTypeID == null) {
        if(newInput instanceof IStructuredDocument) {
          IStructuredModel model = null;
          try {
            model = StructuredModelManager.getModelManager().getModelForRead((IStructuredDocument)newInput);
            if(model != null) {
              fContentTypeID = model.getContentTypeIdentifier();
              if (fAutoActivation != null) {
                fAutoActivation.dispose();
              }
              fAutoActivation = CompletionProposalComputerRegistry.getDefault().getActivator(fContentTypeID, fPartitionTypeID);
            }
          } finally {
            if(model != null) {
              model.releaseFromRead();
            }
          }
        }
      }
    }
View Full Code Here

  protected void validateFile(IFile f, IReporter reporter) {
    if (DEBUG) {
      Logger.log(Logger.INFO, getClass().getName() + " validating: " + f); //$NON-NLS-1$
    }

    IStructuredModel sModel = null;
    try {
      sModel = StructuredModelManager.getModelManager().getModelForRead(f);
      if (sModel != null && !reporter.isCancelled()) {
        performValidation(f, reporter, sModel.getStructuredDocument());
      }
    }
    catch (Exception e) {
      Logger.logException(e);
    }
    finally {
      if (sModel != null)
        sModel.releaseFromRead();
    }
  }
View Full Code Here

     * Squiggles strategy, even when the native problem underline was specified for annotations */
    return super.getSourceViewerDecorationSupport(viewer);
  }

  private void installCharacterPairing() {
    IStructuredModel model = getInternalModel();
    if (model != null) {
      IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(SSEUIPlugin.ID, "characterPairing"); //$NON-NLS-1$
      IContentTypeManager mgr = Platform.getContentTypeManager();
      IContentType type = mgr.getContentType(model.getContentTypeIdentifier());
      if (type != null) {
        for (int i = 0; i < elements.length; i++) {
          // Create the inserter
          IConfigurationElement element = elements[i];
          try {
View Full Code Here

  /**
   * Installs semantic highlighting on the editor
   */
  private void installSemanticHighlighting() {
    IStructuredModel model = getInternalModel();
    if (fSemanticManager == null && model != null) {
      fSemanticManager = new SemanticHighlightingManager();
      fSemanticManager.install(getSourceViewer(), getPreferenceStore(), getSourceViewerConfiguration(), model.getContentTypeIdentifier());
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.