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

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


   *            the file to get the model for
   * @return the file's XMLModel or null
   */
  protected IDOMModel getModelForResource(IFile file) {
    IStructuredModel model = null;
    IModelManager manager = StructuredModelManager.getModelManager();

    try {
      model = manager.getModelForRead(file);
      // TODO.. HTML validator tries again to get a model a 2nd way
    }
    catch (Exception e) {
      Logger.log(Logger.ERROR_DEBUG, file.getFullPath().toString(), e);
    }
View Full Code Here


    SSEUIPlugin.getDefault().savePluginPreferences();
    return true;
  }

  protected void setupPicker(StyledTextColorPicker picker) {
    IModelManager mmanager = StructuredModelManager.getModelManager();
    picker.setParser(mmanager.createStructuredDocumentFor(ContentTypeIdForXML.ContentTypeID_XML).getParser());

    Dictionary descriptions = new Hashtable();
    initDescriptions(descriptions);

    Dictionary contextStyleMap = new Hashtable();
View Full Code Here

    // copied from ContentAssistUtils.getNodeAt()
    if (viewer == null)
      return null;

    IndexedRegion node = null;
    IModelManager mm = StructuredModelManager.getModelManager();
    IStructuredModel model = null;
    if (mm != null)
      model = mm.getExistingModelForRead(viewer.getDocument());
    try {
      if (model != null) {
        int lastOffset = documentOffset;
        node = model.getIndexedRegion(documentOffset);
        while (node == null && lastOffset >= 0) {
View Full Code Here

    // return temp;
    // }
    InputStream stream = null;
    try {
      String id = "" + System.currentTimeMillis() + ".html"; //$NON-NLS-1$ //$NON-NLS-2$
      IModelManager manager = StructuredModelManager.getModelManager();
      stream = new ByteArrayInputStream(getGeneratedHTML().getBytes());
      IDOMModel model = (IDOMModel) manager.getModelForRead(id, stream,
          null);
      Element root = model.getDocument().getDocumentElement();
      Element resultEle = (Element) DOMUtil.cloneNodeDeepIgnoreError(
          getDestDocument(), root);
      model.releaseFromRead();
View Full Code Here

  private IDOMModel readModel(InputStream input) throws IOException, UnsupportedEncodingException {
    if (input == null)
      return null;
    // create temporary model
    String id = input.toString() + ".html"; //$NON-NLS-1$
    IModelManager manager = StructuredModelManager.getModelManager();
    IStructuredModel model = manager.getModelForEdit(id, input, null);
    if (!(model instanceof IDOMModel)) {
      if (model != null)
        model.releaseFromEdit();
      return null;
    }
View Full Code Here

  /**
   */
  private IDOMModel readModel(IFile file) throws IOException, CoreException {
    if (file == null)
      return null;
    IModelManager manager = StructuredModelManager.getModelManager();
    IStructuredModel model = manager.getModelForEdit(file);
    if (!(model instanceof IDOMModel)) {
      if (model != null)
        model.releaseFromEdit();
      return null;
    }
View Full Code Here

        // Create a new model for Content Assist to operate on. This
        // will simulate
        // a full Document and then adjust the offset numbers in the
        // list of results.
        IStructuredModel internalModel = null;
        IModelManager mmanager = StructuredModelManager.getModelManager();
        internalModel = mmanager.createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSP);
        IDOMNode xmlNode = null;
        IDOMModel xmlOuterModel = null;
        if (contentAssistRequest.getNode() instanceof IDOMNode) {
          xmlNode = (IDOMNode) contentAssistRequest.getNode();
          xmlOuterModel = xmlNode.getModel();
View Full Code Here

  /**
   */
  private IStructuredModel getModelForEdit(IFile file) throws IOException {
    if (file == null)
      return null;
    IModelManager manager = getModelManager();

    // create a fake InputStream
    IStructuredModel model = null;
    try {
      model = manager.getModelForEdit(file);
    }
    catch (UnsupportedCharsetException ex) {
      try {
        model = manager.getModelForEdit(file, EncodingRule.FORCE_DEFAULT);
      }
      catch (IOException ioe) {
      }
      catch (CoreException ce) {
      }
View Full Code Here

  /**
   */
  private IStructuredModel getModelForRead(IFile file) throws IOException {
    if (file == null)
      return null;
    IModelManager manager = getModelManager();

    // create a fake InputStream
    IStructuredModel model = null;
    try {
      model = manager.getModelForRead(file);
    }
    catch (UnsupportedCharsetException ex) {
      try {
        model = manager.getModelForRead(file, EncodingRule.FORCE_DEFAULT);
      }
      catch (IOException ioe) {
      }
      catch (CoreException ce) {
      }
View Full Code Here

  }

  public IStructuredModel getNewModelForEdit(IFile iFile) {
    if (iFile == null)
      return null;
    IModelManager manager = getModelManager();
    if (manager == null)
      return null;

    IStructuredModel model = null;
    try {
      model = manager.getNewModelForEdit(iFile, false);
    }
    catch (IOException ex) {
    }
    catch (ResourceInUse riu) {
    }
View Full Code Here

TOP

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

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.