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

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


    }

    private IStructuredModel createModel(String contentTypeID)
    {

        IModelManager manager = StructuredModelManager.getModelManager();
        return manager.createUnManagedStructuredModelFor(contentTypeID);

    }
View Full Code Here


      beansElement.appendChild(childNodeCopies.get(i));
    }
  }

  private Element getBeansXmlElement(IFile xmlConfigFile) throws CoreException {
    IModelManager modelManager = StructuredModelManager.getModelManager();
    try {
      model = modelManager.getModelForEdit(xmlConfigFile);
    }
    catch (CoreException e) {
      throw new CoreException(new Status(Status.ERROR, ConfigUiPlugin.PLUGIN_ID,
          "Could not open model for editing"));
    }
View Full Code Here

    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

    this.domDocument = domDocument;
    this.namespaceUri = namespaceUri;

    try {
      IStructuredModel model = domDocument.getModel();
      IModelManager modelManager = model.getModelManager();
      copiedModel = (IDOMModel) modelManager.createNewInstance(model);
      IDOMDocument copiedDocument = copiedModel.getDocument();
      createInput(copiedDocument);
    }
    catch (IOException e) {
      StatusHandler.log(new Status(IStatus.ERROR, ConfigUiPlugin.PLUGIN_ID, Messages
View Full Code Here

   * Returns an instance of the model manager. You *must* call
   * {@link IStructuredModel#releaseFromEdit()} on the instance when you are
   * done with it.
   */
  public static IStructuredModel getModel(IMarker marker) throws CoreException {
    IModelManager modelManager = StructuredModelManager.getModelManager();

    try {
      return modelManager.getModelForEdit((IFile) marker.getResource());
    }
    catch (IOException e) {
      throw new CoreException(new Status(Status.ERROR, BestPracticesPluginConstants.PLUGIN_ID,
          "Could not create model for resource", e));
    }
View Full Code Here

    this(Messages.getString("ModifyBeanWizard.TITLE")); //$NON-NLS-1$
    this.beanFile = beanFile;
    this.existingBean = existingNode;
    this.fileBrowsingEnabled = false;

    IModelManager modelManager = StructuredModelManager.getModelManager();
    DOMModelImpl modelForRead = null;
    try {
      modelForRead = (DOMModelImpl) modelManager.getModelForRead(beanFile);
      originalDocument = modelForRead.getDocument();

      DOMModelImpl copiedModel = (DOMModelImpl) modelManager.createNewInstance(modelForRead);
      IDOMDocument copiedDocument = copiedModel.getDocument();

      newBean = (IDOMElement) copiedDocument.importNode(existingNode, true);
    }
    catch (IOException e) {
View Full Code Here

    DOMModelImpl model = null;
    try {
      IEditorPart editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
          beanFile);

      IModelManager modelManager = StructuredModelManager.getModelManager();
      model = (DOMModelImpl) modelManager.getModelForEdit(beanFile);
      IDOMDocument document = model.getDocument();

      model.beginRecording(this);

      Node nextSibling = null;
View Full Code Here

    return true;
  }

  public void setBeanFile(IFile beanFile) {
    this.beanFile = beanFile;
    IModelManager modelManager = StructuredModelManager.getModelManager();
    DOMModelImpl modelForRead = null;

    try {
      modelForRead = (DOMModelImpl) modelManager.getModelForRead(beanFile);
      originalDocument = modelForRead.getDocument();

      DOMModelImpl copiedModel = (DOMModelImpl) modelManager.createNewInstance(modelForRead);
      IDOMDocument copiedDocument = copiedModel.getDocument();

      newBean = (IDOMElement) copiedDocument.createElementNS(NamespaceUtils.DEFAULT_NAMESPACE_URI,
          BeansSchemaConstants.ELEM_BEAN);
    }
View Full Code Here

          if (resource instanceof IFile) {
            selectedFile = (IFile) resource;
            int startLine = bean.getElementStartLine() - 1;
            int endLine = bean.getElementEndLine();

            IModelManager modelManager = StructuredModelManager.getModelManager();
            DOMModelImpl modelForRead = null;
            try {
              modelForRead = (DOMModelImpl) modelManager.getModelForRead(selectedFile);
              IStructuredDocument document = modelForRead.getStructuredDocument();
              int startOffset = document.getLineOffset(startLine);
              int endOffset = document.getLineOffset(endLine);

              if (startOffset == endOffset) {
View Full Code Here

    return null;
  }

  private IndexedRegion getNode(IDocument document, int documentOffset) {
    IndexedRegion node = null;
    IModelManager mm = StructuredModelManager.getModelManager();
    IStructuredModel model = null;
    if (mm != null)
      model = mm.getExistingModelForRead(document);
    try {
      if (model != null) {
        int lastOffset = documentOffset;
        node = model.getIndexedRegion(documentOffset);
        while (node == null && lastOffset >= 0) {
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.