Пример #1
0
  /** @return either Window.OK or Window.CANCEL */
  private int showPreferenceDialog() {
    FilteredPreferenceDialog dialog =
        WorkbenchPreferenceDialog.createDialogOn(window.getShell(), DebugPreferencePage.PAGE_ID);

    dialog.showOnly(new String[] {DebugPreferencePage.PAGE_ID});

    return dialog.open();
  }
  /**
   * Apply the data to the first page if there is any.
   *
   * @param data The data to be applied
   * @param displayedIds The ids to filter to.
   * @param dialog The dialog to apply to.
   */
  private static void applyOptions(
      Object data, String[] displayedIds, FilteredPreferenceDialog dialog) {
    if (data != null) {
      dialog.setPageData(data);
      IPreferencePage page = dialog.getCurrentPage();
      if (page instanceof PreferencePage) {
        ((PreferencePage) page).applyData(data);
      }
    }

    if (displayedIds != null) {
      dialog.showOnly(displayedIds);
    }
  }
 /**
  * Sets the current page to be the one corresponding to the given index in the page history.
  *
  * @param index the index into the page history
  */
 private void jumpToHistory(int index) {
   if (index >= 0 && index < history.size()) {
     historyIndex = index;
     dialog.setCurrentPageId(getHistoryEntry(index).getId());
   }
   updateHistoryControls();
 }
 /**
  * Registers the given action with the workbench command support.
  *
  * @param action the action to register.
  */
 private void registerKeybindings(IAction action) {
   final IHandler handler = new ActionHandler(action);
   final IHandlerService handlerService =
       (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
   final IHandlerActivation activation =
       handlerService.activateHandler(
           action.getActionDefinitionId(), handler, new ActiveShellExpression(dialog.getShell()));
   activations.add(activation);
 }