public void createControl(Composite parent) {
    SecondMoveMethodPageComposite pageContent = new SecondMoveMethodPageComposite(parent, config);

    setControl(pageContent);
    IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    helpSystem.setHelp(pageContent, "org.rubypeople.rdt.refactoring.refactoring_move_method");
  }
  protected boolean resolvePage(String contextId, boolean endpoint) {
    String contextName = contextId;
    IContext context = HelpSystem.getContext(contextName);
    if (context == null) {
      if (endpoint) {
        contextName = "org.fusesource.ide.camel.editor.endpoint";
      } else {
        contextName = "org.fusesource.ide.camel.editor.allEIPs";
        context = HelpSystem.getContext("");
      }
      context = HelpSystem.getContext(contextName);

      // Activator.getLogger().debug("Context ID " + contextId +
      // " is bad using default.");
    }
    if (context == null) {
      Activator.getLogger().warning("Could not find context: " + contextName);
      return false;
    }
    IHelpResource[] relatedTopics = context.getRelatedTopics();
    if (relatedTopics != null && relatedTopics.length > 0) {
      IHelpResource resource = relatedTopics[0];
      if (resource != null) {
        String helpUrl = resource.getHref();
        IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
        URL url = helpSystem.resolve(helpUrl, true);
        return browser.setUrl(url.toExternalForm());
      }
    }
    Activator.getLogger().warning("Could not find resource in context: " + contextName);
    return false;
  }
 @Override
 protected void createGraphicalViewer(Composite parent) {
   super.createGraphicalViewer(parent);
   IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
   helpSystem.setHelp(
       getGraphicalViewer().getControl(), HelpContextIds.SC_EDITOR_GRAPHICAL_VIEWER);
 }
  /**
   * Creates the SWT controls for this workbench part.
   *
   * @param parent the parent control
   */
  public void createSection(Composite parent) {
    super.createSection(parent);
    FormToolkit toolkit = getFormToolkit(parent.getDisplay());

    Section section =
        toolkit.createSection(
            parent,
            ExpandableComposite.TWISTIE
                | ExpandableComposite.EXPANDED
                | ExpandableComposite.TITLE_BAR
                | Section.DESCRIPTION
                | ExpandableComposite.FOCUS_TITLE);
    section.setText(Messages.configurationEditorPortsSection);
    section.setDescription(Messages.configurationEditorPortsDescription);
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));

    // ports
    Composite composite = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 8;
    layout.marginWidth = 8;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL));
    IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
    whs.setHelp(composite, ContextIds.CONFIGURATION_EDITOR_PORTS);
    toolkit.paintBordersFor(composite);
    section.setClient(composite);

    ports = toolkit.createTable(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
    ports.setHeaderVisible(true);
    ports.setLinesVisible(true);
    whs.setHelp(ports, ContextIds.CONFIGURATION_EDITOR_PORTS_LIST);

    TableLayout tableLayout = new TableLayout();

    TableColumn col = new TableColumn(ports, SWT.NONE);
    col.setText(Messages.configurationEditorPortNameColumn);
    ColumnWeightData colData = new ColumnWeightData(15, 150, true);
    tableLayout.addColumnData(colData);

    col = new TableColumn(ports, SWT.NONE);
    col.setText(Messages.configurationEditorPortValueColumn);
    colData = new ColumnWeightData(8, 80, true);
    tableLayout.addColumnData(colData);

    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    data.widthHint = 230;
    data.heightHint = 100;
    ports.setLayoutData(data);
    ports.setLayout(tableLayout);

    viewer = new TableViewer(ports);
    viewer.setColumnProperties(new String[] {"name", "port"});

    initialize();
  }
Exemple #5
0
  public final Object execute(final ExecutionEvent event) {
    final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    final String href = event.getParameter(PARAM_ID_HREF);

    if (href == null) {
      helpSystem.displayHelp();
    } else {
      helpSystem.displayHelpResource(href);
    }

    return null;
  }
Exemple #6
0
 protected void createFormContent(final IManagedForm managedForm) {
   super.createFormContent(managedForm);
   ScrolledForm form = managedForm.getForm();
   FormToolkit toolkit = managedForm.getToolkit();
   form.setText(PDEUIMessages.OverviewPage_title);
   PDELabelProvider labelProvider = PDEPlugin.getDefault().getLabelProvider();
   ImageDescriptor description = PDEPluginImages.DESC_PRODUCT_DEFINITION;
   form.setImage(labelProvider.get(description));
   fillBody(managedForm, toolkit);
   IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
   String contextId = WARProductConstants.HELP_CONTEXT_OVERVIEW_PAGE;
   helpSystem.setHelp(form.getBody(), contextId);
 }
 /**
  * Opens the internal help in the Studio's internal browser.
  *
  * @param url
  * @return A boolean value indicating a successful operations or not.
  */
 public static boolean openHelpInBrowser(String url) {
   IWorkbench workbench = PlatformUI.getWorkbench();
   if (workbench != null) {
     IWorkbenchHelpSystem helpSystem = workbench.getHelpSystem();
     URL resolvedURL = helpSystem.resolve(url, true);
     if (resolvedURL != null) {
       return openInBroswer(
           resolvedURL,
           true,
           IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.STATUS);
     } else {
       IdeLog.logError(
           UIPlugin.getDefault(), "Unable to resolve the Help URL for " + url); // $NON-NLS-1$
       return false;
     }
   }
   return false;
 }
  /**
   * Creates preference page controls on demand.
   *
   * @param parentComposite the parent for the preference page
   */
  protected Control createContents(Composite superparent) {

    IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();

    Composite parent = new Composite(superparent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    parent.setLayout(layout);
    parent.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    parent.setToolTipText(WstWSUIPluginMessages.TOOLTIP_PWSI_PAGE);
    helpSystem.setHelp(parent, INFOPOP_PWSI_PAGE);

    GridLayout gl = new GridLayout();
    gl.numColumns = 1;
    gl.marginHeight = 0;
    gl.marginWidth = 0;

    wsdlValidationLabel_ = new Text(parent, SWT.READ_ONLY);
    wsdlValidationLabel_.setText(WstWSUIPluginMessages.LABEL_WSDLVAL);
    wsdlValidationLabel_.setToolTipText(WstWSUIPluginMessages.TOOLTIP_PWSI_WSDLVAL_LABEL);
    helpSystem.setHelp(wsdlValidationLabel_, INFOPOP_PWSI_WSDLVAL_LABEL);

    validateNoWsdlButton_ = new Button(parent, SWT.RADIO);
    validateNoWsdlButton_.setText(WstWSUIPluginMessages.LABEL_WSDLVAL_NONE);
    validateNoWsdlButton_.addListener(SWT.Selection, this);
    validateNoWsdlButton_.setToolTipText(WstWSUIPluginMessages.TOOLTIP_PWSI_RADIO_WSDLVAL_NONE);
    helpSystem.setHelp(validateNoWsdlButton_, INFOPOP_PWSI_RADIO_WSDLVAL_NONE);

    validateRemoteWsdlButton_ = new Button(parent, SWT.RADIO);
    validateRemoteWsdlButton_.setText(WstWSUIPluginMessages.LABEL_WSDLVAL_REMOTE);
    validateRemoteWsdlButton_.addListener(SWT.Selection, this);
    validateRemoteWsdlButton_.setToolTipText(
        WstWSUIPluginMessages.TOOLTIP_PWSI_RADIO_WSDLVAL_REMOTE);
    helpSystem.setHelp(validateRemoteWsdlButton_, INFOPOP_PWSI_RADIO_WSDLVAL_REMOTE);

    validateAllWsdlButton_ = new Button(parent, SWT.RADIO);
    validateAllWsdlButton_.setText(WstWSUIPluginMessages.LABEL_WSDLVAL_ALL);
    validateAllWsdlButton_.addListener(SWT.Selection, this);
    validateAllWsdlButton_.setToolTipText(WstWSUIPluginMessages.TOOLTIP_PWSI_RADIO_WSDLVAL_ALL);
    helpSystem.setHelp(validateAllWsdlButton_, INFOPOP_PWSI_RADIO_WSDLVAL_ALL);

    initializeValues();
    org.eclipse.jface.dialogs.Dialog.applyDialogFont(superparent);
    return parent;
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls
   * (org.eclipse.swt.widgets.Composite,
   * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
   */
  @Override
  public void createControls(
      final Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {

    this.parent = parent;
    this.toolkit = new FormToolkit(parent.getDisplay());
    super.createControls(parent, aTabbedPropertySheetPage);

    if (form != null && !form.isDisposed()) {
      try {
        form.dispose();
      } catch (Exception e) {
        // ignore any expose exceptions
      }
    }
    form = null;

    if (parent.isDisposed()) return;

    parent.setLayout(new GridLayout());
    // parent.setLayout(new GridLayout(1, false));
    parent.setLayoutData(new GridData(GridData.FILL_BOTH));

    form = toolkit.createForm(parent);
    form.setLayoutData(new GridData(GridData.FILL_BOTH));
    form.setText(EditorMessages.propertiesDocumentationTitle);
    toolkit.decorateFormHeading(form);

    form.getBody().setLayout(new GridLayout(1, false));

    Composite sbody = form.getBody();

    ToolBar navBar = new ToolBar(sbody, SWT.NONE);
    toolkit.adapt(navBar);
    navBar.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING));
    final ToolItem back = new ToolItem(navBar, SWT.PUSH);
    back.setText("<");
    back.setEnabled(false);
    final ToolItem forward = new ToolItem(navBar, SWT.PUSH);
    forward.setText(">");
    forward.setEnabled(false);

    back.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            browser.back();
          }
        });
    forward.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            browser.forward();
          }
        });

    final LocationListener locationListener =
        new LocationListener() {
          public void changed(LocationEvent event) {
            Browser browser = (Browser) event.widget;
            back.setEnabled(browser.isBackEnabled());
            forward.setEnabled(browser.isForwardEnabled());
          }

          public void changing(LocationEvent event) {}
        };

    browser = new Browser(sbody, SWT.NONE);
    GridData data = new GridData(GridData.FILL_BOTH);
    browser.setLayoutData(data);
    IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    URL url = helpSystem.resolve("org.fusesource.ide.help/index.html", true);
    browser.setUrl(url.toExternalForm());
    browser.addLocationListener(locationListener);

    // section.pack();
    // form.pack();
    form.layout(true, true);
    parent.layout(true, true);

    // in case of timing issues, lets do another layout just in case...
    Display.getCurrent()
        .asyncExec(
            new Runnable() {
              @Override
              public void run() {
                if (form != null && !form.isDisposed()) {
                  form.layout(true, true);
                }
                if (parent != null && !parent.isDisposed()) {
                  parent.layout(true, true);
                }
              }
            });
  }