Package org.eclipse.jst.pagedesigner.dom

Examples of org.eclipse.jst.pagedesigner.dom.IDOMPosition


    if (DOMUtil.isAncester(draggedNode, node)) {
      return UnexecutableCommand.INSTANCE;
    }

    // ok, we are about to move/copy into the specified position.
    IDOMPosition domposition = DOMPositionHelper.toDOMPosition(position);

    if (REQ_CLONE.equals(type)) {
      return new CloneNodeCommand((IHTMLGraphicalViewer) getHost()
          .getViewer(), domposition, draggedNode);
    }
View Full Code Here


    }

    @Override
    protected IDOMPosition doExecute()
    {
        final IDOMPosition domPosition = getDomPosition();
        final QName  containerQName = getContainerTag().asQName();
        boolean hasform = ValidatorSupport.checkContainer(domPosition, containerQName);
        IDOMPosition newPosition = domPosition;
        if (!hasform)
        {
            final IDOMModel model = ((IDOMNode) domPosition.getContainerNode())
                .getModel();
           
View Full Code Here

     
      if (position == null) {
        return null;
      }

      IDOMPosition domposition = DOMPositionHelper.toDOMPosition(position);
      if (domposition == null) {
        return null;
      }

      // since the head tag is a widget, the offset will need
      // to be updated in the position so that new node is
      // appended to the list of children.
      Node node = domposition.getContainerNode();
      domposition = new DOMPosition(node, node.getChildNodes().getLength());

      return new CreateItemCommand(
          PDPlugin
              .getResourceString("ItemCreationEditPolicy.CommandLabel.CreateItem"),//$NON-NLS-1$
View Full Code Here

                        TagToolCreationAdapter.findProviderForContainer(uri, tagName, PaletteItemManager.createPaletteContext(fileForDocument));
                    final ITaglibDomainMetaDataModelContext modelContext =
                        TaglibDomainMetaDataQueryHelper
                            .createMetaDataModelContext(fileForDocument.getProject(), child.getTagIdentifier().getUri());
//                        .createMetaDataModelContext(project, child.getTagIdentifier().getUri());
                    IDOMPosition domPosition = new DOMPosition(_element, childCount++);
                    CreationData creationData = new CreationData(creationProvider,_model, domPosition, modelContext, child);

                    ElementCustomizationCommand command = new UserCustomizedElementCustomizationCommand(_model, childNode, creationData);
                    command.execute();
                }
View Full Code Here

   * @param position
   * @return the paragraph
   */
  public Paragraph getParagraph(IDOMPosition position) {
    List tempResult = new ArrayList();
    IDOMPosition p1, p2;
    Node r1 = getParagraphNodes(position, tempResult, true);
    if (EditModelQuery.isChild(r1, position.getContainerNode())) {
      p1 = new DOMPosition(r1, r1.getChildNodes().getLength());
    } else {
      p1 = new DOMRefPosition(r1, false);
View Full Code Here

  public static Text splitDomText(EditPart part, DesignRange range) {
    if (part instanceof TextEditPart) {
      Text textNode = (Text) part.getModel();

      DOMRange domRange = DOMRangeHelper.toDOMRange(range);
      IDOMPosition start = domRange.getStartPosition();
      IDOMPosition end = domRange.getEndPosition();
      int domTempStartOffset = computeOffset(start, textNode);
      int domTempEndOffset = computeOffset(end, textNode);

      int domStartOffset = Math.min(domTempStartOffset, domTempEndOffset);
      int domEndOffset = Math.max(domTempStartOffset, domTempEndOffset);
View Full Code Here

    public final Element createTag(final CreationData creationData)
    {
        final ITagCreationAdvisor  advisor = selectCreationAdvisor(creationData);
       
        // adjust the creation position to accommodate required containers
        final IDOMPosition position =
            advisor.checkAndApplyNecessaryContainers(creationData.getModel(), creationData.getDomPosition());
       
        if (position == null) return null;//throw exception?

        creationData.setAdjustedPosition(position);
View Full Code Here

          .getFirstElement();
      if (element instanceof ElementEditPart) {
        updateRangeSelection(new DesignRefPosition((EditPart) element,
            false), new DesignRefPosition((EditPart) element, true));
      } else if (element instanceof Node) {
        IDOMPosition start = new DOMRefPosition((Node) element, false);
        IDOMPosition end = new DOMRefPosition((Node) element, true);
        updateRangeSelection(DOMPositionHelper.toDesignPosition(start),
            DOMPositionHelper.toDesignPosition(end));
      }
    }
  }
View Full Code Here

    ISelection selection = getViewer().getSelection();
    if (selection != null) {
      if (getViewer().isInRangeMode()) {
        DesignRange range = (DesignRange) selection;
        if (range.isValid()) {
          IDOMPosition domPos = DOMPositionHelper.toDOMPosition(range
              .getStartPosition());
          IDOMPosition domEnd = DOMPositionHelper.toDOMPosition(range
              .getEndPosition());
          if (EditValidateUtil.validPosition(domPos)
              && EditValidateUtil.validPosition(domEnd)) {
            position = EditModelQuery
                .getIndexedRegionLocation(domPos);
View Full Code Here

  protected ISelection toDesignRange(DOMRange range) {
    try {
      if (range == null) {
        return null;
      }
      IDOMPosition startPos = range.getStartPosition();
      DesignPosition start = DOMPositionHelper.toDesignPosition(startPos);
      if (range.isEmpty()) {
        return new DesignRange(start, start);
      }
            IDOMPosition endPos = range.getEndPosition();
            return new DesignRange(start, DOMPositionHelper
                .toDesignPosition(endPos));
    } catch (Exception e) {
      // "Selection error"
      _log.error("Error.RangeModeCommand.SetSelection"); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.eclipse.jst.pagedesigner.dom.IDOMPosition

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.