コード例 #1
0
  @Override
  public void onContextInitialize(final IWorkbenchApplicationContext context) {
    this.context = context;

    final ActionFactory actionFactory = new ActionFactory();
    final IAction addFolderAction = actionFactory.createAddFolderAction(context);

    // create menus
    context.getPopupMenu().addAction(addFolderAction);

    final List<IComponentNode> componentList3 = new LinkedList<IComponentNode>();
    componentList3.add(new ImportantComponentTreeNodeDemo1("IMPORTANT1", "Important"));
    final FolderNodeDemo folderNode2 = new FolderNodeDemo("MISC", "Misc", componentList3);
    context.add(folderNode2);
  }
コード例 #2
0
 @Override
 public void onClose(final IVetoable vetoable) {
   final QuestionResult result =
       Toolkit.getQuestionPane()
           .askYesNoQuestion("Would you really like to quit the application?");
   if (result != QuestionResult.YES) {
     vetoable.veto();
   } else {
     final ITrayItem trayItem = context.getWorkbenchContext().getTrayItem();
     if (trayItem != null) {
       trayItem.showWarning("Application closed", "You really have closed the application!");
     }
   }
 }