Package org.eclipse.jst.pagedesigner.itemcreation

Examples of org.eclipse.jst.pagedesigner.itemcreation.ItemCreationRequest


  /**
   * @see org.eclipse.gef.dnd.AbstractTransferDropTargetListener#createTargetRequest()
   */
  protected Request createTargetRequest() {
    ItemCreationRequest request = new ItemCreationRequest();
    /*TODO: nothing is done with this var.  Does the method have a side-effect? TagToolPaletteEntry tagItem =*/TemplateTransfer.getInstance().getTemplate();
    return request;
  }
View Full Code Here


    // We should never see request that is not of ItemCreationRequest type,
    // but there is an error case that Eclipse send out other types
    // requests.
    // Add this test to avoid potential error.
    if (getCreateRequest() instanceof ItemCreationRequest) {
      ItemCreationRequest request = (ItemCreationRequest) getCreateRequest();
            Object transferObj = TemplateTransfer.getInstance().getObject();
           
            if (transferObj instanceof IDropSourceData)
            {
                request.setTagCreationProvider((IDropSourceData) transferObj);
                request.setLocation(getDropLocation());
            }
            else
            {
                PDPlugin.getLogger(this.getClass()).error("Unexpected transfer object on palette drag:"+transferObj, new Throwable("Artificial throwable for stack tracing")); //$NON-NLS-1$ //$NON-NLS-2$
            }
View Full Code Here

    private boolean customizeAndCheckExecute(final Command command)
    {
        if (command instanceof CreateItemCommand)
        {
            final ItemCreationRequest request = (ItemCreationRequest) getCreateRequest();
            final CreateItemCommand createCommand = (CreateItemCommand) command;
            final IStatus status  =
                new DropCustomizationController(createCommand, request.getTagCreationProvider(), createCommand.getDocument(), createCommand.getPosition())
                    .performCustomization();
           
            return status.getSeverity() == IStatus.OK;
        }
        // don't block a drop if the command is not customizable
View Full Code Here

   * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#getCommand(org.eclipse.gef.Request)
   */
  @Override
  public Command getCommand(Request request) {
    if (request instanceof ItemCreationRequest) {
      ItemCreationRequest r = (ItemCreationRequest) request;
      DesignPosition position = findPosition((ItemCreationRequest)request);
     
      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$
          getViewer(getHost()).getModel(), domposition, r.getTagCreationProvider());
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jst.pagedesigner.itemcreation.ItemCreationRequest

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.