コード例 #1
0
ファイル: MoveUpAction.java プロジェクト: empeg/jemplode
 public void actionPerformed(ActionEvent _event) {
   ContainerSelection selection = myContext.getSelection();
   if (selection != null) {
     IContainer container = selection.getContainer();
     if (container instanceof IFIDPlaylistWrapper) {
       FIDPlaylist playlist = ((IFIDPlaylistWrapper) container).getPlaylist();
       int[] selectedIndexes = selection.getSelectedIndexes();
       int[] newIndexes = playlist.reposition(selectedIndexes, -1);
       // MODIFIED
       myContext.setSelection(this, new ContainerSelection(myContext, playlist, newIndexes));
     }
   }
 }
コード例 #2
0
ファイル: SearchPanel.java プロジェクト: empeg/jemplode
  public IPredicate getPredicate() {
    IPredicate predicate = null;
    if (myStandardSeach.isSelected()) {
      Enumeration optionsEnum = myOptions.elements();
      while (optionsEnum.hasMoreElements()) {
        TextOption option = (TextOption) optionsEnum.nextElement();
        if (option.isSelected()) {
          IPredicate optionPredicate = option.getPredicate();
          if (predicate == null) {
            predicate = optionPredicate;
          } else {
            predicate = new AndPredicate(predicate, optionPredicate);
          }
        }
      }
    } else if (myAdvancedSearch.isSelected()) {
      try {
        String searchString = myAdvancedTextField.getText();
        PredicateParser predParser = new PredicateParser();
        predicate = predParser.parse(searchString);
      } catch (ParseException e) {
        String error = e.getMessage();
        Debug.handleError(myContext.getFrame(), error, true);
      }
    }

    return predicate;
  }
コード例 #3
0
  private void selectionChanged(boolean _addedPath) {
    TreeSelectionModel selectionModel = myTree.getSelectionModel();
    IContainerTreeNode parentTreeNode;
    IContainerTreeNode selectedTreeNode;
    int childIndex;
    if (_addedPath) {
      TreePath selectionPath = selectionModel.getSelectionPath();
      if (selectionPath == null) {
        selectedTreeNode = null;
        parentTreeNode = null;
        childIndex = -1;
      } else {
        selectedTreeNode = (IContainerTreeNode) selectionPath.getLastPathComponent();
        parentTreeNode = (IContainerTreeNode) selectedTreeNode.getParent();
        if (parentTreeNode != null) {
          childIndex = parentTreeNode.getIndex(selectedTreeNode);
        } else {
          childIndex = -1;
        }
      }
    } else {
      selectedTreeNode = null;
      parentTreeNode = null;
      childIndex = -1;
    }

    myContext.setSelectedContainer(selectedTreeNode);
    if (parentTreeNode == null) {
      // MODIFIED
      myContext.setSelection(myTree, null);
    } else {
      if (parentTreeNode instanceof IFIDPlaylistWrapper) {
        FIDPlaylist playlist = ((IFIDPlaylistWrapper) parentTreeNode).getPlaylist();
        childIndex = ((FIDPlaylistTreeNode) selectedTreeNode).getPlaylistIndex();
        // MODIFIED
        myContext.setSelection(
            myTree, new ContainerSelection(myContext, playlist, new int[] {childIndex}));
      } else {
        // MODIFIED
        myContext.setSelection(
            myTree, new ContainerSelection(myContext, parentTreeNode, new int[] {childIndex}));
      }
    }
  }
コード例 #4
0
ファイル: UpgradeAction.java プロジェクト: empeg/jemplode
 public void actionPerformed(ActionEvent _event) {
   try {
     UpgraderDialog upgradeDialog;
     ISynchronizeClient synchronizeClient = myContext.getSynchronizeClient();
     if (synchronizeClient == null) {
       upgradeDialog = new UpgraderDialog(myContext.getFrame());
     } else {
       IProtocolClient protocolClient =
           synchronizeClient.getProtocolClient(new SilentProgressListener());
       try {
         IConnection conn = protocolClient.getConnection();
         upgradeDialog = new UpgraderDialog(myContext.getFrame(), conn);
       } finally {
         protocolClient.close();
       }
     }
     upgradeDialog.setVisible(true);
   } catch (Throwable t) {
     Debug.handleError(myContext.getFrame(), t, true);
   }
 }
コード例 #5
0
ファイル: SearchPanel.java プロジェクト: empeg/jemplode
  public synchronized void performSearch() throws ParseException {
    PlayerDatabase playerDatabase = myContext.getPlayerDatabase();
    IPredicate predicate = getPredicate();
    NodeFinder searcher = new NodeFinder(playerDatabase);
    FIDPlaylist searchPlaylist;
    if (predicate == null) {
      searchPlaylist = null;
    } else {
      searchPlaylist = searcher.findMatches(predicate.toString(), predicate, true);
    }
    showSearchResults(searchPlaylist);

    if (myLastSearchPlaylist != null && myLastSearchPlaylist.getReferenceCount() == 0) {
      myLastSearchPlaylist.delete();
    }

    myLastSearchPlaylist = searchPlaylist;
  }