org.eclipse.ui.forms.widgets.Hyperlink.addHyperlinkListener()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(12.1k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中org.eclipse.ui.forms.widgets.Hyperlink.addHyperlinkListener()方法的一些代码示例,展示了Hyperlink.addHyperlinkListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hyperlink.addHyperlinkListener()方法的具体详情如下:
包路径:org.eclipse.ui.forms.widgets.Hyperlink
类名称:Hyperlink
方法名:addHyperlinkListener

Hyperlink.addHyperlinkListener介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private void createListenersHyperlinkBody() {
  // Listen to hyperlink clicks
  fHyperlinkBody.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    public void linkActivated(HyperlinkEvent e) {
      handleHyperlinkBodyLinkActivated();
    }
  });
  // Listen to mouse hovers
  PDETextHover.addHoverListenerToControl(fInfoControlHover, fHyperlinkBody, this);
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

/**
 * Attaches the listener for the entry.
 *
 * @param listener
 */
public void setFormEntryListener(IFormEntryListener listener) {
  if (fLabel != null && fLabel instanceof Hyperlink) {
    if (this.fListener != null)
      ((Hyperlink) fLabel).removeHyperlinkListener(this.fListener);
    if (listener != null)
      ((Hyperlink) fLabel).addHyperlinkListener(listener);
  }
  this.fListener = listener;
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * Creates {@link Hyperlink} that when clicked sets the last specified time to the timeframe
 * control.
 *
 * @param parent
 *            Parent composite.
 * @param toolkit
 *            {@link FormToolkit}
 * @param text
 *            Text on the {@link Hyperlink}.
 * @param time
 *            Wanted time frame to set on click.
 * @return Created {@link Hyperlink}.
 */
private Hyperlink createTimeHyperlink(Composite parent, FormToolkit toolkit, String text, final long time) {
  Hyperlink hyperlink = toolkit.createHyperlink(parent, text, SWT.NONE);
  hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    public void linkActivated(HyperlinkEvent e) {
      Date toDate = new Date();
      Date fromDate = new Date(toDate.getTime() - time);
      toDateTime.setSelection(toDate);
      fromDateTime.setSelection(fromDate);
      getPreferencePanel().update();
    }
  });
  return hyperlink;
}

代码示例来源:origin: org.eclipse/org.eclipse.help.ui

private void createAdvancedLink(Composite parent, FormToolkit toolkit) {
  advancedLink = toolkit.createHyperlink(parent, Messages.FederatedSearchPart_advanced, SWT.NULL);
  advancedLink.addHyperlinkListener(new HyperlinkAdapter() {
    public void linkActivated(HyperlinkEvent e) {
      doAdvanced();
    }
  });
  TableWrapData td = new TableWrapData();
  td.colspan = 2;
  advancedLink.setLayoutData(td);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

private void hook(Hyperlink link) {
  link.addListener(SWT.MouseDown, listener);
  link.addHyperlinkListener(listener);
  link.addListener(SWT.Dispose, listener);
  link.addListener(SWT.MouseEnter, listener);
  link.addListener(SWT.MouseExit, listener);
  links.add(link);
}

代码示例来源:origin: org.eclipse.mylyn.builds/ui

@Override
protected Control createContent(Composite parent, FormToolkit toolkit) {
  Composite composite = toolkit.createComposite(parent);
  composite.setLayout(new GridLayout(2, false));
  hyperlink = toolkit.createHyperlink(composite, "Show Output in Console", SWT.NONE);
  hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    public void linkActivated(HyperlinkEvent event) {
      buildOutputAction.run();
    }
  });
  hyperlink.setEnabled(buildOutputAction.isEnabled());
  return composite;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

private void hook(Hyperlink link) {
  link.addListener(SWT.MouseDown, listener);
  link.addHyperlinkListener(listener);
  link.addListener(SWT.Dispose, listener);
  link.addListener(SWT.MouseEnter, listener);
  link.addListener(SWT.MouseExit, listener);
  links.add(link);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro

private Hyperlink createStaticPage(Composite parent) {
  Form mainForm = toolkit.createForm(parent);
  Composite body = mainForm.getBody();
  GridLayout gl = new GridLayout();
  body.setLayout(gl);
  String label = Messages.StaticHTML_welcome;
  Hyperlink link = toolkit.createHyperlink(body, label, SWT.WRAP);
  link.setFont(PageStyleManager.getHeaderFont());
  GridData gd = new GridData(GridData.GRAB_HORIZONTAL
      | GridData.GRAB_VERTICAL);
  gd.horizontalAlignment = GridData.CENTER;
  gd.verticalAlignment = GridData.CENTER;
  link.setLayoutData(gd);
  link.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    public void linkActivated(HyperlinkEvent e) {
      Hyperlink link = (Hyperlink) e.getSource();
      Util.openBrowser((String) link.getHref());
      return;
    }
  });
  return link;
}

代码示例来源:origin: org.eclipse/org.eclipse.help.ui

private void createScopeSet(Section section, FormToolkit toolkit) {
  scopeSetLink = toolkit.createHyperlink(section, null, SWT.NULL);
  scopeSetLink.addHyperlinkListener(new HyperlinkAdapter() {
    public void linkActivated(HyperlinkEvent e) {
      doChangeScopeSet();
    }
  });
  scopeSetLink.setToolTipText(Messages.FederatedSearchPart_changeScopeSet);
  section.setTextClient(scopeSetLink);
  ScopeSet active = scopeSetManager.getActiveSet();
  setActiveScopeSet(active);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

public void addMessageHyperlinkListener(IHyperlinkListener listener) {
  if (listeners == null)
    listeners = new ListenerList<>();
  listeners.add(listener);
  ensureControlExists();
  if (messageHyperlink != null)
    messageHyperlink.addHyperlinkListener(listener);
  if (listeners.size() == 1)
    updateForeground();
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

protected Control createInfoTextArea(Composite parent)
{
 Composite infoComposite = new Composite(parent, SWT.NONE);
 GridLayout gridLayout = new GridLayout(2, false);
 gridLayout.marginHeight = 0;
 gridLayout.marginWidth = 0;
 infoComposite.setLayout(gridLayout);
 GridData gd = new GridData(GridData.FILL_BOTH);
 infoComposite.setLayoutData(gd);
 nsInfoLabel = new Label(infoComposite, SWT.LEFT);
 nsInfoLabel.setText(infoText);
 Font font = nsInfoLabel.getFont();
 FontData[] fontDatas = font.getFontData();
 for (int i = 0; i < fontDatas.length; i++)
 {
  fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
 }
 infoFont = new Font(nsInfoLabel.getDisplay(), fontDatas);
 nsInfoLabel.setFont(infoFont);
 gd = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
 nsInfoLabel.setLayoutData(gd);
 nsInfoLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
 link = new Hyperlink(infoComposite, SWT.RIGHT);
 link.setText(Messages._UI_ACTION_OPEN_IN_NEW_EDITOR);
 link.setFont(infoFont);
 link.addHyperlinkListener(linkListener);
 return infoComposite;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

public void addMessageHyperlinkListener(IHyperlinkListener listener) {
  if (listeners == null)
    listeners = new ListenerList<>();
  listeners.add(listener);
  ensureControlExists();
  if (messageHyperlink != null)
    messageHyperlink.addHyperlinkListener(listener);
  if (listeners.size() == 1)
    updateForeground();
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * Creates links for given commands on the parent composite.
 *
 * @param parent
 *            Parent composite.
 * @param toolkit
 *            {@link FormToolkit} to use.
 * @param commandMap
 *            IDs of the commands to display. Only active ones will be displayed.
 */
private void createLinks(Composite parent, FormToolkit toolkit, Map<String, String> commandMap) {
  for (Map.Entry<String, String> entry : commandMap.entrySet()) {
    Command command = commandService.getCommand(entry.getKey());
    if (command.isDefined() && (null != command.getHandler()) && command.getHandler().isEnabled()) {
      toolkit.createLabel(parent, "", SWT.NONE).setImage(arrow);
      Hyperlink link = toolkit.createHyperlink(parent, entry.getValue(), SWT.WRAP);
      link.addHyperlinkListener(new CommandHyperlinkListener(command));
      link.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    }
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

link.addHyperlinkListener(new HyperlinkAdapter() {
  public void linkActivated(HyperlinkEvent e) {
    showErrors();
link.addHyperlinkListener(new HyperlinkAdapter() {
  public void linkActivated(HyperlinkEvent e) {
    getPage().reset();

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
protected void createLabel(Composite parent, FormToolkit toolkit) {
  if (!part.isEditable()) {
    super.createLabel(parent, toolkit);
    return;
  }
  Hyperlink link = toolkit.createHyperlink(parent, getPropertyLabel(), SWT.NULL);
  link.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    public void linkActivated(HyperlinkEvent e) {
      if (!isReferenceModel()) {
        openReference();
      } else {
        Display.getCurrent().beep();
      }
    }
  });
  PDETextHover.addHoverListenerToControl(fIC, link, this);
}

代码示例来源:origin: org.eclipse.neoscada.hmi/org.eclipse.scada.ca.ui.editor.forms.common

public void createStandardLinkText ( final Composite parent, final String linkFactory, final String attributeName, final String label, final String textMessage, final ConfigurationEditorInput input, final Object valueType )
{
  this.toolkit.createLabel ( parent, label + ":" );
  final Text text = this.toolkit.createText ( parent, "" );
  text.setMessage ( textMessage );
  text.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, true, true ) );
  text.setToolTipText ( textMessage );
  final IObservableValue value = Observables.observeMapEntry ( input.getDataMap (), attributeName, valueType );
  this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), value );
  final Hyperlink link = this.toolkit.createHyperlink ( parent, "link", SWT.NONE );
  link.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, false, false ) );
  link.addHyperlinkListener ( new HyperlinkAdapter () {
    @Override
    public void linkActivated ( final HyperlinkEvent e )
    {
      EditorHelper.handleOpen ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getActivePage (), input.getConnectionUri (), linkFactory, text.getText () );
    }
  } );
}

代码示例来源:origin: de.dentrassi.eclipse.neoscada.hmi/org.eclipse.scada.ca.ui.editor.forms.common

public void createStandardLinkText ( final Composite parent, final String linkFactory, final String attributeName, final String label, final String textMessage, final ConfigurationEditorInput input, final Object valueType )
{
  this.toolkit.createLabel ( parent, label + ":" );
  final Text text = this.toolkit.createText ( parent, "" );
  text.setMessage ( textMessage );
  text.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, true, true ) );
  text.setToolTipText ( textMessage );
  final IObservableValue value = Observables.observeMapEntry ( input.getDataMap (), attributeName, valueType );
  this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), value );
  final Hyperlink link = this.toolkit.createHyperlink ( parent, "link", SWT.NONE );
  link.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, false, false ) );
  link.addHyperlinkListener ( new HyperlinkAdapter () {
    @Override
    public void linkActivated ( final HyperlinkEvent e )
    {
      EditorHelper.handleOpen ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getActivePage (), input.getConnectionUri (), linkFactory, text.getText () );
    }
  } );
}

代码示例来源:origin: org.eclipse.egit/ui

private void createHeadLink(final Repository repository, Composite composite) throws IOException {
  final ObjectId objectId = repository
      .resolve(repository.getFullBranch());
  if (objectId == null) {
    Text headLabel = createLabeledReadOnlyText(composite, UIText.GitProjectPropertyPage_LabelId);
    if (repository.getAllRefs().size() == 0)
      headLabel.setText(UIText.GitProjectPropertyPage_ValueEmptyRepository);
    else
      headLabel.setText(UIText.GitProjectPropertyPage_ValueUnbornBranch);
  } else {
    Hyperlink headLink = createHeadHyperLink(composite, UIText.GitProjectPropertyPage_LabelId);
    headLink.setText(objectId.name());
    headLink.setUnderlined(true);
    headLink.setFont(JFaceResources.getDialogFont());
    headLink.setForeground(JFaceColors.getHyperlinkText(headLink
        .getDisplay()));
    headLink.addHyperlinkListener(new HyperlinkAdapter() {
      @Override
      public void linkActivated(HyperlinkEvent e) {
        RepositoryCommit commit = getCommit(repository, objectId);
        if(commit != null)
          CommitEditor.openQuiet(commit);
      }
    });
  }
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private void createLink(Object object) {
  Image image = labelProvider != null ? labelProvider.getImage(object) : null;
  Hyperlink hyperlink;
  if (image != null) {
    hyperlink = getManagedForm().getToolkit().createImageHyperlink(linkContainer, SWT.NULL);
    ((ImageHyperlink) hyperlink).setImage(image);
  } else
    hyperlink = getManagedForm().getToolkit().createHyperlink(linkContainer, null, SWT.NULL);
  update(hyperlink, object);
  hyperlink.setData(object);
  hyperlink.addHyperlinkListener(linkHandler);
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public void hookListeners() {
  hookMinOccur(widgetSelectedAdapter(e -> {
    if (blockListeners())
      return;
    fElement.setMinOccurs(getMinOccur());
  }));
  hookMaxOccur(widgetSelectedAdapter(e -> {
    if (blockListeners())
      return;
    fElement.setMaxOccurs(getMaxOccur());
  }));
  fReferenceLink.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    public void linkActivated(HyperlinkEvent e) {
      if (blockListeners())
        return;
      fireMasterSelection(new StructuredSelection(fElement.getReferencedObject()));
    }
  });
}

相关文章