Example #1
0
  /** This operation sets the input of the resourceTreeViewer. */
  private void setTreeContent() {

    // If currently playing, stop.
    if (playAction.isInPlayState()) {
      playAction.stop();
    }
    // If there are no files, but there are images, set to the images tab.
    // Otherwise, default to the files tab.
    if (textList.isEmpty() && !imageList.isEmpty()) {
      resourceTreeViewer.setInput(imageList);
      tabFolder.setSelection(1);
      playable = true;

      // Select the first available image resource.
      resourceTreeViewer.setSelection(new StructuredSelection(imageList.get(0)), true);
    } else {
      resourceTreeViewer.setInput(textList);
      tabFolder.setSelection(0);
      playable = false;

      // Select the first available text resource.
      if (!textList.isEmpty()) {
        resourceTreeViewer.setSelection(new StructuredSelection(textList.get(0)), true);
      }
    }

    return;
  }
Example #2
0
  /**
   * This operation sets the input of the resourceTreeViewer when a tab selection change occurs.
   *
   * @param tabIndex The currently selected tab.
   */
  private void setTreeContent(int tabIndex) {

    // If currently playing, stop.
    if (playAction.isInPlayState()) {
      playAction.stop();
    }
    if (tabIndex == 1) {
      resourceTreeViewer.setInput(imageList);
      if (!imageList.isEmpty()) {
        playable = true;
      }
    } else {
      resourceTreeViewer.setInput(textList);
      playable = false;
    }
    return;
  }