public ShowKonsolidatorAction(IWorkbenchWindow window, String label) {
   this.window = window;
   setText(label);
   setId(ID);
   // setActionDefinitionId(ID);
   setImageDescriptor(ImageCache.getInstance().getImageDescriptor(ImageCache.KONSOLIDATOR));
   window.getSelectionService().addSelectionListener(this);
   setToolTipText(Messages.ShowKonsolidatorAction_1);
   setRightID(ActionRightIDs.KONSOLIDATOR);
   if (Activator.getDefault().isStandalone()
       && !Activator.getDefault().getInternalServer().isRunning()) {
     IInternalServerStartListener listener =
         new IInternalServerStartListener() {
           @Override
           public void statusChanged(InternalServerEvent e) {
             if (e.isStarted()) {
               setEnabled(checkRights());
             }
           }
         };
     Activator.getDefault().getInternalServer().addInternalServerStatusListener(listener);
   } else {
     setEnabled(checkRights());
   }
 }
 public ImportPersonFromLdap(IWorkbenchWindow window, String label) {
   this.window = window;
   setText(label);
   setId(ID);
   setImageDescriptor(ImageCache.getInstance().getImageDescriptor(ImageCache.PERSON));
   setToolTipText(Messages.getString("ImportPersonFromLdap.1")); // $NON-NLS-1$
   setRightID(ActionRightIDs.IMPORTLDAP);
   if (Activator.getDefault().isStandalone()
       && !Activator.getDefault().getInternalServer().isRunning()) {
     IInternalServerStartListener listener =
         new IInternalServerStartListener() {
           @Override
           public void statusChanged(InternalServerEvent e) {
             if (e.isStarted()) {
               setEnabled(checkRights());
             }
           }
         };
     Activator.getDefault().getInternalServer().addInternalServerStatusListener(listener);
   } else {
     setEnabled(checkRights());
   }
 }
Пример #3
0
  private void makeActions() {

    addTemplateAction =
        new RightsEnabledAction(ActionRightIDs.REPORTDEPOSITADD) {
          @Override
          public void doRun() {
            AddReportToDepositDialog dlg =
                new AddReportToDepositDialog(Display.getDefault().getActiveShell());
            dlg.open();
            updateView();
          }
        };
    addTemplateAction.setText(Messages.ReportDepositView_5);
    addTemplateAction.setToolTipText(Messages.ReportDepositView_7);
    addTemplateAction.setImageDescriptor(
        ImageCache.getInstance().getImageDescriptor(ImageCache.NOTE_NEW));
    addTemplateAction.setEnabled(true);

    deleteTemplateAction =
        new RightsEnabledAction(ActionRightIDs.REPORTDEPOSITDELETE) {

          @Override
          public void doRun() {
            int count = ((IStructuredSelection) viewer.getSelection()).size();
            boolean confirm =
                MessageDialog.openConfirm(
                    viewer.getControl().getShell(),
                    Messages.ReportDepositView_15,
                    NLS.bind(Messages.ReportDepositView_16, count));
            if (!confirm) {
              return;
            }
            deleteAttachments();
            updateView();
          }
        };

    deleteTemplateAction.setText(Messages.ReportDepositView_13);
    deleteTemplateAction.setToolTipText(Messages.ReportDepositView_14);
    deleteTemplateAction.setImageDescriptor(
        ImageCache.getInstance().getImageDescriptor(ImageCache.DELETE));
    deleteTemplateAction.setEnabled(false);

    editTemplateAction =
        new RightsEnabledAction(ActionRightIDs.REPORTDEPOSITEDIT) {

          @Override
          public void doRun() {
            int count = ((IStructuredSelection) viewer.getSelection()).size();
            if (count == 1) {
              AddReportToDepositDialog dlg =
                  new AddReportToDepositDialog(
                      Display.getDefault().getActiveShell(),
                      (ReportTemplateMetaData)
                          ((IStructuredSelection) viewer.getSelection()).getFirstElement());
              dlg.open();
              updateView();
            } else {
              MessageDialog.openWarning(
                  Display.getDefault().getActiveShell(),
                  Messages.ReportDepositView_20,
                  Messages.ReportDepositView_21);
              return;
            }
          }
        };

    editTemplateAction.setText(Messages.ReportDepositView_17);
    editTemplateAction.setToolTipText(Messages.ReportDepositView_18);
    editTemplateAction.setImageDescriptor(
        ImageCache.getInstance().getImageDescriptor(ImageCache.EDIT));
    editTemplateAction.setEnabled(false);

    refreshAction =
        new RightsEnabledAction() {

          @Override
          public void doRun() {
            JobScheduler.scheduleInitJob(loadDataJob);
          }
        };

    refreshAction.setText(Messages.ReportDepositView_19);
    refreshAction.setToolTipText(Messages.ReportDepositView_19);
    refreshAction.setImageDescriptor(
        ImageCache.getInstance().getImageDescriptor(ImageCache.RELOAD));
    refreshAction.setEnabled(true);

    doubleclickAction =
        new RightsEnabledAction() {

          @Override
          public void doRun() {
            editTemplateAction.run();
          }
        };
  }