Package org.eclipse.ui.forms.widgets

Examples of org.eclipse.ui.forms.widgets.Hyperlink


  private Hyperlink createHeadHyperLink(Composite composite,
      String labelText) {
    createLabel(composite, labelText);

    Hyperlink hyperlink = new Hyperlink(composite, SWT.NONE);
    hyperlink.setLayoutData(GridDataFactory.fillDefaults().create());
    return hyperlink;
  }
View Full Code Here


    for (int i = 0; i < commit.getParentCount(); i++) {
      final RevCommit parentCommit = commit.getParent(i);
      toolkit.createLabel(parents, getParentCommitLabel(i))
          .setForeground(
              toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
      final Hyperlink link = toolkit
          .createHyperlink(parents,
              parentCommit.abbreviate(PARENT_LENGTH).name(),
              SWT.NONE);
      link.addHyperlinkListener(new HyperlinkAdapter() {
        public void linkActivated(HyperlinkEvent e) {
          try {
            CommitEditor.open(new RepositoryCommit(getCommit()
                .getRepository(), parentCommit));
            if ((e.getStateMask() & SWT.MOD1) != 0)
View Full Code Here

     * @param body
     * @param link
     */
    private Control createImageHyperlink(Composite parent, IntroLink link) {
        Control control;
        Hyperlink linkControl;
        boolean showLinkDescription = styleManager.getShowLinkDescription();
        Image linkImage = styleManager.getImage(link, "link-icon", //$NON-NLS-1$
            ImageUtil.DEFAULT_LINK);

        if (showLinkDescription && link.getText() != null) {
            Composite container = toolkit.createComposite(parent);
            TableWrapLayout layout = new TableWrapLayout();
            layout.leftMargin = layout.rightMargin = 0;
            layout.topMargin = layout.bottomMargin = 0;
            layout.verticalSpacing = 0;
            layout.numColumns = 2;
            container.setLayout(layout);

            //Label ilabel = toolkit.createLabel(container, null);
            ImageHyperlink ilabel = toolkit.createImageHyperlink(container, SWT.NULL);
            ilabel.setImage(linkImage);
            ilabel.setHoverImage(styleManager.getImage(link, "hover-icon", //$NON-NLS-1$
                null));
            ilabel.setHref(link.getUrl());
            ilabel.addHyperlinkListener(hyperlinkAdapter);
            TableWrapData td = new TableWrapData();
            td.valign = TableWrapData.TOP;
            td.rowspan = 2;
            ilabel.setLayoutData(td);

            linkControl = toolkit.createHyperlink(container, null, SWT.WRAP);
            td = new TableWrapData(TableWrapData.LEFT, TableWrapData.BOTTOM);
            td.grabVertical = true;
            linkControl.setLayoutData(td);
            // Util.highlight(linkControl, SWT.COLOR_RED);
            // Util.highlight(container, SWT.COLOR_DARK_YELLOW);

            Control desc = createText(container, link.getIntroText());
            td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
            td.grabHorizontal = true;
            td.grabVertical = true;
            desc.setLayoutData(td);
            control = container;
        } else {
            ImageHyperlink imageLink = toolkit.createImageHyperlink(parent,
                SWT.WRAP | SWT.CENTER);
            imageLink.setImage(linkImage);
            imageLink.setHoverImage(styleManager.getImage(link, "hover-icon", //$NON-NLS-1$
                null));
            TableWrapData td = new TableWrapData();
            td.grabHorizontal = true;
            imageLink.setLayoutData(td);
            linkControl = imageLink;
            control = linkControl;
        }
        linkControl.setText(link.getLabel());
        linkControl.setFont(PageStyleManager.getBannerFont());
        colorControl(linkControl, link);
        linkControl.setHref(link.getUrl());
        linkControl.addHyperlinkListener(hyperlinkAdapter);
        // Util.highlight(linkControl, SWT.COLOR_DARK_YELLOW);
        return control;
    }
View Full Code Here

        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() {

            public void linkActivated(HyperlinkEvent e) {
                Hyperlink link = (Hyperlink) e.getSource();
                Util.openBrowser((String) link.getHref());
                return;
            }
        });

        return link;
View Full Code Here

          unhook((Hyperlink) e.widget);
          break;
      }
    }
    private void onMouseEnter(Event e) {
      Hyperlink link = (Hyperlink) e.widget;
      previousBackground = link.getBackground();
      previousForeground = link.getForeground();
      if (isActiveBackgroundSet)
        link.setBackground(getActiveBackground());
      if (isActiveForegroundSet)
        link.setForeground(getActiveForeground());
      if (getHyperlinkUnderlineMode() == UNDERLINE_HOVER)
        link.setUnderlined(true);
      link.setCursor(getHyperlinkCursor());     
    }
View Full Code Here

      if (getHyperlinkUnderlineMode() == UNDERLINE_HOVER)
        link.setUnderlined(true);
      link.setCursor(getHyperlinkCursor());     
    }
    private void onMouseExit(Event e) {
      Hyperlink link = (Hyperlink) e.widget;
      if (isActiveBackgroundSet)
        link.setBackground(previousBackground);
      if (isActiveForegroundSet)
        link.setForeground(previousForeground);
      if (getHyperlinkUnderlineMode() == UNDERLINE_HOVER)
        link.setUnderlined(false);
    }
View Full Code Here

    }
    public void linkActivated(HyperlinkEvent e) {
    }

    public void linkEntered(HyperlinkEvent e) {
      Hyperlink link = (Hyperlink) e.widget;
      if (lastEntered != null) {
        linkExited(lastEntered);
      }
      lastEntered = link;
    }
View Full Code Here

    private void ensureControlExists() {
      if (needHyperlink()) {
        if (messageLabel != null)
          messageLabel.setVisible(false);
        if (messageHyperlink == null) {
          messageHyperlink = new Hyperlink(FormHeading.this, SWT.NULL);
          messageHyperlink.setUnderlined(true);
          messageHyperlink.setText(message);
          messageHyperlink.setHref(messages);
          Object[] llist = listeners.getListeners();
          for (int i = 0; i < llist.length; i++)
View Full Code Here

   
    Control[] controls = AttributeEditorUtils.createLinkText(
        toolkit, composite, element,
        ClickPlugin.getString("editor.clickXML.pages.path"),
        ClickPlugin.ATTR_PATH);
    final Hyperlink linkPath = (Hyperlink)controls[0];
    final Text textPath = (Text)controls[1];
    textPath.addModifyListener(new ModifyListener(){
      public void modifyText(ModifyEvent e){
        if(textPath.getText().equals("")){
          element.removeAttribute(ClickPlugin.ATTR_PATH);
        } else {
          element.setAttribute(ClickPlugin.ATTR_PATH, textPath.getText());
        }
      }
    });
   
    IFile file = (IFile)ClickUtils.getResource(element.getStructuredDocument());
    IJavaProject project = JavaCore.create(file.getProject());
   
    final Text textClass = AttributeEditorUtils.createClassText(
        project, toolkit, composite, element,
        ClickPlugin.getString("editor.clickXML.pages.class"),
        ClickPlugin.ATTR_CLASSNAME,
        ClickPlugin.CLICK_PAGE_CLASS, textPath);
    textClass.addModifyListener(new ModifyListener(){
      public void modifyText(ModifyEvent e){
        if(textClass.getText().equals("")){
          element.removeAttribute(ClickPlugin.ATTR_CLASSNAME);
        } else {
          element.setAttribute(ClickPlugin.ATTR_CLASSNAME, textClass.getText());
        }
      }
    });
   
    linkPath.addHyperlinkListener(new HyperlinkAdapter(){
      public void linkActivated(HyperlinkEvent e){
        IFile file = (IFile)ClickUtils.getResource(element.getStructuredDocument());
        IProject project = file.getProject();
        String root = ClickUtils.getWebAppRootFolder(project);
        try {
View Full Code Here

public class AttributeEditorUtils {

  public static Control[] createLinkText(FormToolkit toolkit, Composite parent,
      final IDOMElement element, String label, final String attrName){

    Hyperlink link = toolkit.createHyperlink(parent, label, SWT.NULL);

    Composite composite = FieldAssistUtils.createNullDecoratedPanel(parent, true);
    final Text text = toolkit.createText(composite, "", SWT.BORDER);

    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
View Full Code Here

TOP

Related Classes of org.eclipse.ui.forms.widgets.Hyperlink

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.