Package org.eclipse.wst.xml.core.internal.provisional.document

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument


      try {
        IFile file = ClickUtils.getClickConfigFile(project);
        IModelManager manager = StructuredModelManager.getModelManager();
        model = manager.getModelForEdit(file);
       
        IDOMDocument doc = ((IDOMModel)model).getDocument();
       
        Element root  = doc.getDocumentElement();
        Element pages = null;
        NodeList list = doc.getElementsByTagName(ClickPlugin.TAG_PAGES);
       
        if(list.getLength()==0){
          pages = doc.createElement(ClickPlugin.TAG_PAGES);
          boolean inserted = false;
          NodeList children = root.getChildNodes();
          for(int i=0;i<children.getLength();i++){
            Node node = children.item(i);
            if(node instanceof Element){
              root.insertBefore(pages, node);
              inserted = true;
              break;
            }
          }
          if(!inserted){
            root.appendChild(pages);
          }
        } else {
          pages = (Element)list.item(0);
        }
       
        NodeList children = pages.getChildNodes();
        boolean found = false;
       
        String newClazz = className;
        String pagesPackage = pages.getAttribute(ClickPlugin.ATTR_PACKAGE);
        if(packageName.length()!=0){
          if(pagesPackage==null || !packageName.equals(pagesPackage)){
            newClazz = packageName + "." + className;
          }
        }
       
        for(int i=0;i<children.getLength();i++){
          Node node = children.item(i);
          if(node instanceof Element && ((Element)node).getNodeName().equals(ClickPlugin.TAG_PAGE)){
            Element page = (Element)node;
            String path  = page.getAttribute(ClickPlugin.ATTR_PATH);
            String clazz = page.getAttribute(ClickPlugin.ATTR_CLASSNAME);
            if(newPath.equals(path) && newClazz.equals(clazz)){
              found = true;
              break;
            }
          }
        }
        if(!found){
          Element page = doc.createElement(ClickPlugin.TAG_PAGE);
          page.setAttribute(ClickPlugin.ATTR_PATH, newPath);
          page.setAttribute(ClickPlugin.ATTR_CLASSNAME, newClazz);
          pages.appendChild(page);
        }
        model.save();
View Full Code Here


                        // add factory to factory registry
                        factoryRegistry.addFactory(newFactory);

                        // add factory to propogating adapter
                        final IDOMModel domModel = (IDOMModel) sModel;
                        final IDOMDocument document = domModel.getDocument();
                        final PropagatingAdapter propagatingAdapter = (PropagatingAdapter) ((INodeNotifier) document)
                                .getAdapterFor(PropagatingAdapter.class);
                        if (propagatingAdapter != null) {
                            propagatingAdapter
                                    .addAdaptOnCreateFactory(newFactory);
View Full Code Here

        interceptor = (IDOMElement) iNode;
        break;
      }
    }

    IDOMDocument document = (IDOMDocument) sourceElement.getOwnerDocument();
    IDOMModel model = document.getModel();
    if (model != null) {
      model.beginRecording(this);
      if (interceptor == null) {
        interceptor = (IDOMElement) document.createElement(IntegrationSchemaConstants.ELEM_INTERCEPTORS);
        interceptor.setPrefix(ConfigCoreUtils
            .getPrefixForNamespaceUri(document, IntegrationSchemaConstants.URI));
        sourceElement.appendChild(interceptor);
        processor.insertDefaultAttributes(interceptor);
        formatter.formatNode(interceptor);
        formatter.formatNode(sourceElement);
      }

      IDOMElement wiretap = (IDOMElement) document.createElement(IntegrationSchemaConstants.ELEM_WIRE_TAP);
      wiretap.setPrefix(ConfigCoreUtils.getPrefixForNamespaceUri(document, IntegrationSchemaConstants.URI));
      interceptor.appendChild(wiretap);
      processor.insertDefaultAttributes(wiretap);
      formatter.formatNode(wiretap);
      formatter.formatNode(interceptor);
View Full Code Here

        namespaceUri = getDiagram().getNamespaceUri();
      }
      else {
        namespaceUri = uri;
      }
      IDOMDocument document = getDiagram().getDomDocument();
      input = (IDOMElement) document.createElement(getInputName());
      input.setPrefix(ConfigCoreUtils.getPrefixForNamespaceUri(document, namespaceUri));
      internalSetName();
    }
  }
View Full Code Here

    extendedAddChild(child, index);
    fireStructureChange(CHILDREN, child);
  }

  protected void extendedAddChild(Activity child, int index) {
    IDOMDocument document = (IDOMDocument) getInput().getOwnerDocument();
    IDOMElement childElem = child.getInput();
    if (childElem == null) {
      childElem = (IDOMElement) document.createElement(child.getInputName());
      childElem.setPrefix(ConfigCoreUtils.getPrefixForNamespaceUri(document, getDiagram().getNamespaceUri()));
    }

    IDOMModel model = document.getModel();
    if (model != null) {
      model.beginRecording(this);
      getInput().appendChild(childElem);
      getDiagram().getXmlProcessor().insertDefaultAttributes(childElem);
      formatter.formatNode(childElem);
View Full Code Here

      model.endRecording(this);
    }
  }

  protected void extendedRemoveChild(Activity child) {
    IDOMDocument document = (IDOMDocument) getInput().getOwnerDocument();
    IDOMElement childElem = child.getInput();
    if (childElem != null) {
      IDOMModel model = document.getModel();
      Node parent = childElem.getParentNode();
      if (model != null && parent != null) {
        model.beginRecording(this);
        parent.removeChild(childElem);
        formatter.formatNode(parent);
View Full Code Here

        manager.add(new Separator());
        manager.add(new DeleteNodeAction(textView, node));
      }
    }
    else {
      IDOMDocument doc = getConfigEditor().getDomDocument();
      if (doc != null) {
        createEmptyDocumentActions(manager, doc);
      }
    }
  }
View Full Code Here

  }

  @Override
  public void refresh() {
    if (newBeanButton != null) {
      IDOMDocument document = getConfigEditor().getDomDocument();
      if (document == null || document.getDocumentElement() == null) {
        newBeanButton.setEnabled(false);
      }
      else {
        newBeanButton.setEnabled(true);
      }
View Full Code Here

    return false;
  }

  @Override
  public void execute() {
    IDOMDocument document = (IDOMDocument) sourceElement.getOwnerDocument();
    IDOMModel model = document.getModel();
    if (model != null) {
      model.beginRecording(this);
      IDOMElement mapping = (IDOMElement) document.createElement(IntegrationSchemaConstants.ELEM_MAPPING);
      mapping.setPrefix(ConfigCoreUtils.getPrefixForNamespaceUri(document, IntegrationSchemaConstants.URI));
      sourceElement.appendChild(mapping);
      processor.insertDefaultAttributes(mapping);
      formatter.formatNode(mapping);
      formatter.formatNode(sourceElement);
View Full Code Here

    return false;
  }

  @Override
  public void execute() {
    IDOMDocument document = (IDOMDocument) sourceElement.getOwnerDocument();
    IDOMModel model = document.getModel();
    if (model != null) {
      model.beginRecording(this);
      IDOMElement recipient = (IDOMElement) document.createElement(IntegrationSchemaConstants.ELEM_RECIPIENT);
      recipient.setPrefix(ConfigCoreUtils.getPrefixForNamespaceUri(document, IntegrationSchemaConstants.URI));
      sourceElement.appendChild(recipient);
      processor.insertDefaultAttributes(recipient);
      formatter.formatNode(recipient);
      formatter.formatNode(sourceElement);
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument

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.