コード例 #1
0
 public static Action createMenuAction(IResources resources, IApplicationModel anathemaModel) {
   SmartAction action = new RepositoryViewAction(anathemaModel, resources);
   action.setName(
       resources.getString("AnathemaCore.Tools.RepositoryView.ActionTitle")
           + "\u2026"); //$NON-NLS-1$ //$NON-NLS-2$
   return action;
 }
コード例 #2
0
 private void performCancel() {
   if (cancelable) {
     setCanceled(true);
     cancelAction.setEnabled(false);
   }
   yield();
 }
コード例 #3
0
  @Override
  public void initPresentation() {
    final SmartAction action =
        new SmartAction(
            resources.getString("AnathemaCore.Tools.RepositoryView.DeleteName"),
            new FileUi().getRemoveFileIcon()) {

          @Override
          protected void execute(final Component parentComponent) {
            String message = resources.getString("AnathemaCore.Tools.RepositoryView.DeleteMessage");
            String okButton = resources.getString("AnathemaCore.Tools.RepositoryView.DeleteOk");
            ConfigurableVetor vetor = new ConfigurableVetor(parentComponent, message, okButton);
            vetor.requestPermissionFor(
                new Command() {
                  @Override
                  public void execute() {
                    try {
                      int itemCount = repositoryModel.getPrintNameFilesInSelection().length;
                      repositoryModel.deleteSelection();
                      messaging.addMessage(
                          "AnathemaCore.Tools.RepositoryView.DeleteDoneMessage", itemCount);
                    } catch (RepositoryException e) {
                      MessageDialogFactory.showMessageDialog(
                          parentComponent,
                          new Message(
                              resources.getString(
                                  "AnathemaCore.Tools.RepositoryView.RepositoryError"),
                              e));
                      Logger.getLogger(getClass()).error(e);
                    }
                  }
                });
          }
        };
    action.setToolTipText(resources.getString("AnathemaCore.Tools.RepositoryView.DeleteToolTip"));
    treeView.addActionButton(action);
    repositoryModel.addTreeSelectionChangeListener(
        new ChangeListener() {
          @Override
          public void changeOccurred() {
            action.setEnabled(repositoryModel.canSelectionBeDeleted());
          }
        });
    action.setEnabled(false);
  }
コード例 #4
0
 public void setCancelable(boolean cancelable) {
   this.cancelable = cancelable;
   cancelAction.setEnabled(cancelable);
 }