Exemple #1
0
  protected void nextPicture(final int x) {
    if (this.editedItemDb != null && this.editedItem != null) {
      List<? extends IMediaPicture> dbEntries = this.editedItemDb.getMediaItems();
      int current = dbEntries.indexOf(this.editedItem);
      int res = -1;
      if (current >= 0) { // Did we find the current item?
        int i = current + x;
        while (i
            != current) { // Keep searching until we find a picture or we get back where we started.
          if (i > dbEntries.size() - 1) {
            i = 0;
          } else if (i < 0) {
            i = dbEntries.size() - 1;
          }
          if (dbEntries.get(i).isPicture()) {
            res = i;
            break;
          }
          i = i + x;
        }
      } else if (dbEntries.size() > 0) {
        res = 0;
      }

      if (res >= 0) {
        IMediaPicture entry = dbEntries.get(res);

        // Reveal current item in list?
        IEditorPart activeEditor =
            getViewSite().getWorkbenchWindow().getActivePage().getActiveEditor();
        if (activeEditor != null) {
          IEditorInput edInput = activeEditor.getEditorInput();
          if (edInput instanceof MediaItemListEditorInput) {
            MediaItemListEditorInput<?> miEdInput = (MediaItemListEditorInput<?>) edInput;
            if (miEdInput.getMediaList().getListId().equals(this.editedItemDb.getListId())) {
              if (activeEditor instanceof MediaItemListEditor<?, ?>) {
                MediaItemListEditor<?, ?> mediaListEditor =
                    (MediaItemListEditor<?, ?>) activeEditor;
                mediaListEditor.revealItem(entry, false);
              }
            }
          }
        }

        setInput(this.editedItemDb, entry);
      }
    }
  }
Exemple #2
0
 protected void revealItemInList() throws PartInitException, MorriganException {
   if (this.editedItemDb != null && this.editedItem != null) {
     if (this.editedItemDb.getType().equals(MediaListType.LOCALMMDB.toString())) {
       this.listenToSelectionListener = false;
       try {
         MediaItemDbEditorInput input =
             EditorFactory.getMmdbInputBySerial(this.editedItemDb.getSerial());
         getViewSite()
             .getWorkbenchWindow()
             .getActivePage()
             .openEditor(input, LocalMixedMediaDbEditor.ID);
       } finally {
         this.listenToSelectionListener = true;
       }
     }
     IEditorPart activeEditor =
         getViewSite().getWorkbenchWindow().getActivePage().getActiveEditor();
     if (activeEditor instanceof MediaItemListEditor<?, ?>) {
       MediaItemListEditor<?, ?> mediaListEditor = (MediaItemListEditor<?, ?>) activeEditor;
       mediaListEditor.revealItem(this.editedItem);
     }
   }
 }