protected void processAction(TGActionContext context) {
   TGSong song = ((TGSong) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_SONG));
   TGTrack track = getSongManager(context).getLastTrack(song);
   if (track != null) {
     TablatureEditor.getInstance(getContext()).getTablature().getCaret().update(track.getNumber());
   }
 }
Esempio n. 2
0
  private void toggleDivisionType() {
    TGDuration duration =
        TablatureEditor.getInstance(this.findContext()).getTablature().getCaret().getDuration();
    TGDivisionType divisionType =
        (duration.getDivision().isEqual(TGDivisionType.NORMAL)
            ? TGDivisionType.TRIPLET
            : TGDivisionType.NORMAL);

    this.createDivisionTypeAction(this.createDivisionType(divisionType)).process();
  }
  protected void processAction(TGActionContext context) {
    try {
      Integer pasteMode = context.getAttribute(ATTRIBUTE_PASTE_MODE);
      Integer pasteCount = context.getAttribute(ATTRIBUTE_PASTE_COUNT);

      if (pasteMode > 0 && pasteCount > 0) {
        Transferable transferable =
            TablatureEditor.getInstance(getContext()).getClipBoard().getTransferable();
        if (transferable instanceof MeasureTransferable) {
          ((MeasureTransferable) transferable).setTransferType(pasteMode);
          ((MeasureTransferable) transferable).setPasteCount(pasteCount);

          transferable.insertTransfer();
        }
      }
    } catch (CannotInsertTransferException e) {
      throw new TGActionException(e);
    }
  }
 protected void processAction(TGActionContext context) {
   TGLayout layout = TablatureEditor.getInstance(getContext()).getTablature().getViewLayout();
   layout.setStyle((layout.getStyle() ^ TGLayout.DISPLAY_COMPACT));
 }
 protected void processAction(TGActionContext context) {
   TablatureEditor.getInstance(getContext())
       .getTablature()
       .getEditorKit()
       .setMouseMode(EditorKit.MOUSE_MODE_EDITION);
 }