@Override
 protected boolean showPage(IPreferenceNode node) {
   final boolean success = super.showPage(node);
   if (success) {
     history.addHistoryEntry(new PreferenceHistoryEntry(node.getId(), node.getLabelText(), null));
   }
   return success;
 }
  /**
   * Check to see if the node or any of its children have an id in the ids.
   *
   * @param node WorkbenchPreferenceNode
   * @return boolean <code>true</code> if node or oe of its children has an id in the ids.
   */
  private boolean checkNodeAndChildren(IPreferenceNode node) {
    if (ids.contains(node.getId())) {
      return true;
    }

    IPreferenceNode[] subNodes = node.getSubNodes();
    for (int i = 0; i < subNodes.length; i++) {
      if (checkNodeAndChildren(subNodes[i])) {
        return true;
      }
    }
    return false;
  }
 public ImageDescriptor getImageDescriptor() {
   Image image = preferenceNode.getLabelImage();
   if (image != null) {
     ImageDescriptor descriptor = ImageDescriptor.createFromImage(image);
     return descriptor;
   }
   return null;
 }
 public void execute() {
   IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   if (window != null) {
     WorkbenchPreferenceDialog dialog =
         WorkbenchPreferenceDialog.createDialogOn(window.getShell(), preferenceNode.getId());
     dialog.open();
   }
 }
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   final PreferenceElement other = (PreferenceElement) obj;
   if (preferenceNode == null) {
     if (other.preferenceNode != null) return false;
   } else if (!preferenceNode.equals(other.preferenceNode)) return false;
   return true;
 }
  /**
   * Create Network group
   *
   * @param parent parent composite
   */
  @SuppressWarnings("unchecked")
  private void createNetworkGroup(Composite parent) {

    // Makes the network preferences dialog manager
    PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();

    IPreferenceNode networkNode = null;

    for (IPreferenceNode node :
        (List<IPreferenceNode>) manager.getElements(PreferenceManager.PRE_ORDER)) {
      if (node.getId().equals(PROXY_PREFERENCE_PAGE_ID)) {
        networkNode = node;
        break;
      }
    }
    prefMan = new PreferenceManager();
    if (networkNode != null) {
      prefMan.addToRoot(networkNode);
    }

    Link downloadText = new Link(parent, SWT.WRAP);
    downloadText.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            // Do nothing
          }

          public void widgetSelected(SelectionEvent e) {
            openNetworkPreferencesPage();
          }
        });

    String linkText =
        Messages.bind(Messages.NetworkLinkText, Messages.NetworkLinkText, Messages.NetworkLinkLink);

    downloadText.setText(linkText);
    downloadText.update();
    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    downloadText.setLayoutData(gridData);
  }
  @Override
  protected void createPage(IPreferenceNode node) {

    super.createPage(node);
    if (this.pageData == null) {
      return;
    }
    // Apply the data if it has been set.
    IPreferencePage page = node.getPage();
    if (page instanceof PreferencePage) {
      ((PreferencePage) page).applyData(this.pageData);
    }
  }
  private PreferenceManager createPreferenceManager() {
    final PreferenceManager pm = new PreferenceManager(PM_SEPARATOR);
    final PreferenceNodeElement[] elements = getElements();

    for (PreferenceNodeElement element : elements) {
      PreferenceNode node =
          new WorkbenchPreferenceNode(
              element.id, element.name, null, element.bundleID, element.className);
      final String category = element.category;
      if (category == null || category.length() == 0) {
        pm.addToRoot(node);
      } else {
        final IPreferenceNode categoryNode = pm.find(category);
        if (categoryNode == null) {
          pm.addToRoot(node);
        } else {
          categoryNode.add(node);
        }
      }
    }

    return pm;
  }
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((preferenceNode == null) ? 0 : preferenceNode.hashCode());
   return result;
 }
 public String getLabel() {
   if (prefix != null && prefix.length() > 0) {
     return preferenceNode.getLabelText() + separator + prefix;
   }
   return preferenceNode.getLabelText();
 }
 public String getId() {
   return preferenceNode.getId();
 }