Examples of CompoundCommand


Examples of org.eclipse.gef.commands.CompoundCommand

    redo();
  }
 
  @Override
  public void redo(){
    CompoundCommand compoundCommand = new CompoundCommand(COMMAND_ID);
    MusicDiagram activeDiagram = MusicPlugin.getDefault().getActiveDiagram();
    SectionForm child = new SectionForm();
    CreateCommand createCmd = new CreateCommand();
    createCmd.setParent(activeDiagram);
    createCmd.setChild(child);
    compoundCommand.add(createCmd);
    DeleteCommand cleanupCommand = new DeleteCommand();
    cleanupCommand.setParent(activeDiagram);
    cleanupCommand.setChild(child);
    compoundCommand.add(cleanupCommand);
    compoundCommand.execute();   
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

      return false;
    return true;
  }

  public Command createCloneCommand(BasicElement child, MusicContainerForm parent) {
    CompoundCommand compoundCmd = new CompoundCommand(ACTION_ID);
    CreateCommand createCmd = new CreateCommand();
    createCmd.setParent(parent);
    try {
      createCmd.setChild(child.getClass().newInstance());
      createCmd.setMeiNode((MeiNode) child.getMeiNode().clone());
    } catch (InstantiationException e) {
      LogService.error(e.getMessage(), e);
    } catch (IllegalAccessException e) {
      LogService.error(e.getMessage(), e);
    }
    compoundCmd.add(createCmd);
    LogService.info(MusicMessages.CloneFormAction_4 + compoundCmd.size());
    return compoundCmd;
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

    return true;
  }

  @SuppressWarnings("unchecked")
  public Command createManageSourcesCommand() {
    CompoundCommand compoundCmd = new CompoundCommand(ACTION_ID);
    ManageSourcesCommand manageSourcesCmd = new ManageSourcesCommand();
    manageSourcesCmd.setMusicDiagram(MusicPlugin.getDefault().getActiveDiagram());
    manageSourcesCmd.setPostList((List<SourceBindingWrapper>) Display.getCurrent().getData(StringConstants.MUSIC_DIAGRAM_DIRTY));
    manageSourcesCmd.setPreList(MusicPlugin.getDefault().getActiveDiagram().getSourceList());
    compoundCmd.add(manageSourcesCmd);
    return compoundCmd;
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

@Override
@SuppressWarnings("rawtypes")
protected Command getAddCommand(Request generic) {
  ChangeBoundsRequest request = (ChangeBoundsRequest)generic;
  List editParts = request.getEditParts();
  CompoundCommand command = new CompoundCommand();
  command.setDebugLabel("Add in ConstrainedLayoutEditPolicy");//$NON-NLS-1$
  GraphicalEditPart childPart;
  Rectangle r;
  Object constraint;

  for (int i = 0; i < editParts.size(); i++) {
    childPart = (GraphicalEditPart)editParts.get(i);
    r = childPart.getFigure().getBounds().getCopy();
    //convert r to absolute from childpart figure
    childPart.getFigure().translateToAbsolute(r);
    r = request.getTransformedRectangle(r);
    //convert this figure to relative
    getLayoutContainer().translateToRelative(r);
    getLayoutContainer().translateFromParent(r);
    r.translate(getLayoutOrigin().getNegated());
    constraint = getConstraintFor(r);
    command.add(createAddCommand(generic, childPart,
      translateToModelConstraint(constraint)));
  }
  return command.unwrap();
}
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

      return false;
    return true;
  }

  public Command createAllRelabelCommands() {
    CompoundCommand compoundCmd = new CompoundCommand(ACTION_ID);
    for (int iterator = 0; iterator < getSelectedObjects().size(); iterator++) {
      Object selectedObject = getSelectedObjects().get(iterator);
      if (selectedObject instanceof MusicTreeEditPart
          && ((MusicTreeEditPart) selectedObject).getModel() instanceof MeasureForm)
        compoundCmd
            .add(createRelabelCommand((MusicTreeEditPart) selectedObject, iterator));
    }
    compoundCmd.add(new RefreshScreenCommand());
    LogService.info(MusicMessages.RelabelMeasuresAction_1 + compoundCmd.size() + MusicMessages.RelabelMeasuresAction_2);
    return compoundCmd;
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

  protected boolean calculateEnabled() {
    return true;
  }

  public Command createMassInsertCommand() {
    this.compoundCmd = new CompoundCommand(getCompoundCommandName());
    massInsertStaffdefs();
    compoundCmd.add(new RefreshScreenCommand());
    return compoundCmd;
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

}

@Override
@SuppressWarnings("rawtypes")
protected Command getAddCommand(ChangeBoundsRequest request){
  CompoundCommand command = new CompoundCommand();
  command.setDebugLabel("Add in MusicTreeContainerEditPolicy");//$NON-NLS-1$
  List editparts = request.getEditParts();
  int index = findIndexOfTreeItemAt(request.getLocation());
 
  for(int i = 0; i < editparts.size(); i++){
    EditPart child = (EditPart)editparts.get(i);
    if(isAncestor(child,getHost()))
      command.add(UnexecutableCommand.INSTANCE);
    else {
      BasicElement childModel = (BasicElement)child.getModel();
      command.add(createCreateCommand(
            childModel,
            new Rectangle(new org.eclipse.draw2d.geometry.Point(),
              childModel.getSize()),
            index, "Reparent " + childModel.getClass().getSimpleName()));//$NON-NLS-1$
    }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

}

@Override
@SuppressWarnings("rawtypes")
protected Command getMoveChildrenCommand(ChangeBoundsRequest request){
  CompoundCommand command = new CompoundCommand();
  List editparts = request.getEditParts();
  List children = getHost().getChildren();
  int newIndex = findIndexOfTreeItemAt(request.getLocation());
   
  for(int i = 0; i < editparts.size(); i++){
    EditPart child = (EditPart)editparts.get(i);
    int tempIndex = newIndex;
    int oldIndex = children.indexOf(child);
    if(oldIndex == tempIndex || oldIndex + 1 == tempIndex){
      command.add(UnexecutableCommand.INSTANCE);
      return command;
    } else if(oldIndex <= tempIndex){
      tempIndex--;
    }
    command.add(new ReorderPartCommand(
          (BasicElement)child.getModel(),
          (MusicContainerForm)getHost().getModel(),
          tempIndex));
  }
  return command;
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

  protected boolean calculateEnabled() {
    return true;
  }

  public Command createMassInsertCommand() {
    this.compoundCmd = new CompoundCommand(getCompoundCommandName());
    massInsertMeasures();
    compoundCmd.add(new RefreshScreenCommand());
    return compoundCmd;
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

  @Override
  @SuppressWarnings("rawtypes")
  public Command getOrphanChildrenCommand(GroupRequest request) {
    List parts = request.getEditParts();
    CompoundCommand result = new CompoundCommand(
        MusicMessages.MusicContainerEditPolicy_OrphanCommandLabelText);
    for (int i = 0; i < parts.size(); i++) {
      OrphanChildCommand orphan = new OrphanChildCommand();
      orphan.setChild((BasicElement) ((EditPart) parts.get(i)).getModel());
      orphan.setParent((MusicContainerForm) getHost().getModel());
      orphan.setLabel(MusicMessages.MusicElementEditPolicy_OrphanCommandLabelText);
      result.add(orphan);
    }
    return result.unwrap();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.