protected void createRunnables(Composite compo) {
    if (!runnables.isEmpty()) {
      boolean first = true;
      for (final NotificationRunnable r : runnables) {
        if (!first) {
          toolkit.createLabel(compo, " ");
        }
        Hyperlink h =
            toolkit.createHyperlink(compo, r.getLabel() == null ? "run" : r.getLabel(), SWT.NONE);
        h.addHyperlinkListener(
            new HyperlinkAdapter() {

              @Override
              public void linkActivated(HyperlinkEvent e) {
                Display.getDefault()
                    .asyncExec(
                        new Runnable() {

                          public void run() {
                            PapyrusAsyncNotificationPopup.this.run(r);
                          }
                        });
              }
            });
        first = false;
      }
    }
  }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 private void unhook(Hyperlink link) {
   link.removeListener(SWT.MouseDown, listener);
   link.removeHyperlinkListener(listener);
   link.removeListener(SWT.MouseEnter, listener);
   link.removeListener(SWT.MouseExit, listener);
   if (lastActivated == link) lastActivated = null;
   if (lastEntered == link) lastEntered = null;
   links.remove(link);
 }
Exemplo n.º 4
0
 private void update(Hyperlink hyperlink, Object object) {
   String text = labelProvider != null ? labelProvider.getText(object) : object.toString();
   Image image = labelProvider != null ? labelProvider.getImage(object) : null;
   String tooltip = labelProvider != null ? labelProvider.getToolTipText(object) : text;
   hyperlink.setText(text);
   hyperlink.setToolTipText(tooltip);
   if (hyperlink instanceof ImageHyperlink) ((ImageHyperlink) hyperlink).setImage(image);
   reflow();
 }
Exemplo n.º 5
0
 /**
  * Sets the hyperlink underline mode.
  *
  * @param mode the new hyperlink underline mode
  * @see HyperlinkSettings
  */
 @Override
 public void setHyperlinkUnderlineMode(int mode) {
   super.setHyperlinkUnderlineMode(mode);
   if (links != null) {
     for (int i = 0; i < links.size(); i++) {
       Hyperlink label = links.get(i);
       label.setUnderlined(mode == UNDERLINE_ALWAYS);
     }
   }
 }
  public SMAEstimatedHoursHeader(
      Composite parent, int style, final AbstractWorkflowArtifact sma, final SMAEditor editor) {
    super(parent, style);
    this.awa = sma;
    setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    setLayout(ALayout.getZeroMarginLayout(2, false));
    editor.getToolkit().adapt(this);

    try {
      if (!sma.isCancelled() && !sma.isCompleted()) {
        Hyperlink link = editor.getToolkit().createHyperlink(this, LABEL, SWT.NONE);
        link.addHyperlinkListener(
            new IHyperlinkListener() {

              @Override
              public void linkEntered(HyperlinkEvent e) {
                // do nothing
              }

              @Override
              public void linkExited(HyperlinkEvent e) {
                // do nothing
              }

              @Override
              public void linkActivated(HyperlinkEvent e) {
                try {
                  if (editor.isDirty()) {
                    editor.doSave(null);
                  }
                  PromptChangeUtil.promptChangeAttribute(
                      sma, AtsAttributeTypes.EstimatedHours, true, false);
                } catch (Exception ex) {
                  OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
                }
              }
            });
      } else {
        Label origLabel = editor.getToolkit().createLabel(this, LABEL);
        origLabel.setLayoutData(new GridData());
      }

      valueLabel = editor.getToolkit().createLabel(this, "0.0");
      valueLabel.setToolTipText(getToolTip());
      valueLabel.setLayoutData(new GridData());
      updateLabel(sma);

    } catch (OseeCoreException ex) {
      Label errorLabel =
          editor.getToolkit().createLabel(this, "Error: " + ex.getLocalizedMessage());
      errorLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
      OseeLog.log(Activator.class, Level.SEVERE, ex);
    }
  }
Exemplo n.º 7
0
 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);
 }
  public Composite createControl(final Composite parent) {
    // Form form=tk.createForm(parent);
    // form.setLayoutData(SWTHelper.getFillGridData(1,true,1,false));
    // Composite ret=form.getBody();
    Composite ret = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    ret.setLayout(layout);
    ret.setBackground(parent.getBackground());

    ImageHyperlink hClr = tk.createImageHyperlink(ret, SWT.NONE); // $NON-NLS-1$
    hClr.setImage(Images.IMG_CLEAR.getImage());
    hClr.addHyperlinkListener(
        new HyperlinkAdapter() {

          @Override
          public void linkActivated(final HyperlinkEvent e) {
            clearValues();
          }
        });
    hClr.setBackground(parent.getBackground());

    Composite inner = new Composite(ret, SWT.NONE);
    GridLayout lRet = new GridLayout(fields.length, true);
    inner.setLayout(lRet);
    inner.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));

    for (String l : fields) {
      Hyperlink hl = tk.createHyperlink(inner, l, SWT.NONE);
      hl.addHyperlinkListener(
          new HyperlinkAdapter() {

            @Override
            public void linkActivated(final HyperlinkEvent e) {
              Hyperlink h = (Hyperlink) e.getSource();
              fireSortEvent(h.getText());
            }
          });
      hl.setBackground(parent.getBackground());
    }

    createSelectors(fields.length);
    for (int i = 0; i < selectors.length; i++) {
      selectors[i] = new ElexisText(tk.createText(inner, "", SWT.BORDER)); // $NON-NLS-1$
      selectors[i].addModifyListener(ml);
      selectors[i].addSelectionListener(sl);
      selectors[i].setToolTipText(
          Messages.getString("DefaultControlFieldProvider.enterFilter")); // $NON-NLS-1$
      selectors[i].setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
      SWTHelper.setSelectOnFocus((Text) selectors[i].getWidget());
    }

    return ret;
  }
Exemplo n.º 9
0
 /**
  * Sets the group foreground and also sets the background of all the currently managed links.
  *
  * @param fg the new foreground
  */
 @Override
 public void setForeground(Color fg) {
   super.setForeground(fg);
   isForegroundSet = true;
   if (links != null) {
     for (int i = 0; i < links.size(); i++) {
       Hyperlink label = links.get(i);
       label.setForeground(fg);
     }
   }
 }
Exemplo n.º 10
0
  private void createHeaderArea(Composite parent, FormToolkit toolkit, int span) {
    RevCommit commit = getCommit().getRevCommit();
    Composite top = toolkit.createComposite(parent);
    GridDataFactory.fillDefaults().grab(true, false).span(span, 1).applyTo(top);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(top);

    Composite userArea = toolkit.createComposite(top);
    GridLayoutFactory.fillDefaults().spacing(2, 2).numColumns(1).applyTo(userArea);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(userArea);

    PersonIdent author = commit.getAuthorIdent();
    if (author != null) createUserArea(userArea, toolkit, author, true);

    PersonIdent committer = commit.getCommitterIdent();
    if (committer != null && !committer.equals(author))
      createUserArea(userArea, toolkit, committer, false);

    int count = commit.getParentCount();
    if (count > 0) {
      Composite parents = toolkit.createComposite(top);
      GridLayoutFactory.fillDefaults().spacing(2, 2).numColumns(2).applyTo(parents);
      GridDataFactory.fillDefaults().grab(false, false).applyTo(parents);

      for (int i = 0; i < count; i++) {
        final RevCommit parentCommit = commit.getParent(i);
        toolkit
            .createLabel(parents, UIText.CommitEditorPage_LabelParent)
            .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) getEditor().close(false);
                } catch (PartInitException e1) {
                  Activator.logError("Error opening commit editor", e1); // $NON-NLS-1$
                }
              }
            });
      }
    }

    createTagsArea(userArea, toolkit, 2);
  }
Exemplo n.º 11
0
 /**
  * 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;
 }
  /*
   * (non-Javadoc)
   * @see org.eclipse.ice.viz.service.widgets.PlotComposite#updateInfoContent(org.eclipse.swt.widgets.Composite, java.lang.String)
   */
  @Override
  protected void updateInfoContent(Composite infoContent, String message) {

    // Set the link's visibility.
    link.setVisible(showLink);

    super.updateInfoContent(infoContent, message);
  }
 private void createImportSection(final Composite composite) {
   Hyperlink link = new Hyperlink(composite, SWT.None);
   link.addHyperlinkListener(
       new HyperlinkAdapter() {
         @Override
         public void linkActivated(HyperlinkEvent e) {
           ImportEnvironmentsWizard newWizard = new ImportEnvironmentsWizard();
           WizardDialog dialog =
               new WizardDialog(Display.getCurrent().getActiveShell(), newWizard);
           dialog.open();
         }
       });
   link.setText("Import an existing environment into the Servers view");
   link.setUnderlined(true);
   GridData layoutData = new GridData();
   layoutData.horizontalSpan = 2;
   link.setLayoutData(layoutData);
 }
Exemplo n.º 14
0
  public void setLeistungen(Konsultation b) {
    List<Verrechnet> lgl = Collections.emptyList();
    if (b != null) {
      lgl = b.getLeistungen();
    }
    tVerr.setRedraw(false);
    tVerr.removeAll();
    StringBuilder sdg = new StringBuilder();
    Money sum = new Money(0);
    for (Verrechnet lst : lgl) {
      sdg.setLength(0);
      int z = lst.getZahl();
      Money preis = lst.getNettoPreis().multiply(z);
      sum.addMoney(preis);
      sdg.append(z)
          .append(" ")
          .append(lst.getCode())
          .append(" ")
          .append(lst.getText()) // $NON-NLS-1$ //$NON-NLS-2$
          .append(" (")
          .append(preis.getAmountAsString())
          .append(")"); // $NON-NLS-1$ //$NON-NLS-2$
      TableItem ti = new TableItem(tVerr, SWT.WRAP);
      ti.setText(sdg.toString());
      ti.setData(lst);

      IVerrechenbar vr = lst.getVerrechenbar();
      if (vr instanceof Artikel) {
        Artikel a = (Artikel) vr;
        int abgabeEinheit = a.getAbgabeEinheit();
        if (abgabeEinheit > 0 && abgabeEinheit < a.getPackungsGroesse()) {
          ti.setImage(Images.IMG_BLOCKS_SMALL.getImage());
        }
      }

      // set table item color
      IVerrechenbar verrBar = lst.getVerrechenbar();
      if (verrBar != null) {
        Color color = UiDesk.getColorFromRGB(defaultRGB);
        String codeName = verrBar.getCodeSystemName();

        if (codeName != null) {
          String rgbColor =
              CoreHub.globalCfg.get(Preferences.LEISTUNGSCODES_COLOR + codeName, defaultRGB);
          color = UiDesk.getColorFromRGB(rgbColor);
        }
        ti.setBackground(color);
      }
    }
    tVerr.setRedraw(true);
    sdg.setLength(0);
    sdg.append(Messages.VerrechnungsDisplay_billed)
        .append(sum.getAmountAsString())
        .append(")"); // $NON-NLS-1$ //$NON-NLS-2$
    hVer.setText(sdg.toString());
  }
Exemplo n.º 15
0
  /**
   * Create the link to the element
   *
   * @see
   *     org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
   * @param parent the parent composite
   * @return the hyperlink control
   */
  @Override
  protected Control createCustomArea(Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    Hyperlink hyperLink = toolkit.createHyperlink(parent, label, SWT.UNDERLINE_LINK);
    hyperLink.setBackground(parent.getBackground());
    hyperLink.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
    if (allowNavigation) {
      hyperLink.addHyperlinkListener(
          new HyperlinkAdapter() {

            @Override
            public void linkActivated(HyperlinkEvent e) {
              navigateToElement();
              okPressed();
            }
          });
    }
    return hyperLink;
  }
  /*
   * (non-Javadoc)
   * @see org.eclipse.ice.viz.service.widgets.PlotComposite#createInfoContent(org.eclipse.swt.widgets.Composite, int)
   */
  @Override
  protected Composite createInfoContent(Composite parent, int style) {
    // Get the info Composite and its child with the message label.
    final Composite infoComposite = super.createInfoContent(parent, style);
    final Composite msgComposite = (Composite) infoComposite.getChildren()[1];

    // Get a Display and Shell used to create the hyperlink.
    final Display display = infoComposite.getDisplay();
    final Shell shell = infoComposite.getShell();

    // Set the text to display in the hyperlink.
    final String linkText = "Click here to update the connection " + "preferences.";

    // Create a link to the preference page.
    link = new Hyperlink(msgComposite, SWT.NONE);
    link.setText(linkText);
    link.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    link.setUnderlined(true);
    link.setForeground(display.getSystemColor(SWT.COLOR_LINK_FOREGROUND));
    // Add the listener to redirect the user to the preferences.
    link.addHyperlinkListener(
        new IHyperlinkListener() {
          @Override
          public void linkActivated(HyperlinkEvent e) {
            // Open up the viz service connection preferences.
            PreferencesUtil.createPreferenceDialogOn(
                    shell, getConnectionPreferencePageID(), null, null)
                .open();
          }

          @Override
          public void linkEntered(HyperlinkEvent e) {
            // Nothing to do yet.
          }

          @Override
          public void linkExited(HyperlinkEvent e) {
            // Nothing to do yet.
          }
        });

    return infoComposite;
  }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.pde.internal.ui.neweditor.plugin.ExtensionElementEditor#createContents(org.eclipse.swt.widgets.Composite,
   *      org.eclipse.ui.forms.widgets.FormToolkit, int)
   */
  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() {
          public void linkActivated(HyperlinkEvent e) {
            if (!isReferenceModel()) {
              openReference();
            } else {
              Display.getCurrent().beep();
            }
          }
        });
    PDETextHover.addHoverListenerToControl(fIC, link, this);
  }
Exemplo n.º 18
0
 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());
 }
  private Composite getErrorComposite(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setBackground(getListBackgroundColor());
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.grabExcessVerticalSpace = true;
    composite.setLayoutData(data);

    Hyperlink link = new Hyperlink(composite, SWT.WRAP);
    link.setText(TeamUIMessages.ChangesSection_8);
    link.addHyperlinkListener(
        new HyperlinkAdapter() {
          public void linkActivated(HyperlinkEvent e) {
            showErrors();
          }
        });
    link.setBackground(getListBackgroundColor());
    link.setUnderlined(true);

    link = new Hyperlink(composite, SWT.WRAP);
    link.setText(TeamUIMessages.ChangesSection_9);
    link.addHyperlinkListener(
        new HyperlinkAdapter() {
          public void linkActivated(HyperlinkEvent e) {
            getPage().reset();
          }
        });
    link.setBackground(getListBackgroundColor());
    link.setUnderlined(true);

    createDescriptionLabel(
        composite,
        NLS.bind(
            TeamUIMessages.ChangesSection_10,
            new String[] {
              Utils.shortenText(
                  SynchronizeView.MAX_NAME_LENGTH, getConfiguration().getParticipant().getName())
            }));

    return composite;
  }
Exemplo n.º 20
0
  private void populateJBossServerCombo() {
    serverMap.clear();

    IServer[] servers = DqpPlugin.getInstance().getServersProvider().getServers();
    for (IServer server : servers) {
      if (TeiidServerAdapterUtil.isJBossServer(server)) {
        serverMap.add(server);
      }
    }

    String[] items = serverMap.keySet().toArray(new String[0]);
    jbossServerCombo.setItems(items);

    if (items.length == 0) {
      newServerOrOpenServerViewHyperlink.setText(NEW_SERVER_LABEL);
    } else {
      newServerOrOpenServerViewHyperlink.setText(EDIT_SERVER_LABEL);
      jbossServerCombo.setText(items[0]);
    }

    // even if nothing in combo, still want the viewer to refresh
    handleServerComboSelection();
  }
Exemplo n.º 21
0
  protected void createSection(Section section, FormToolkit toolkit) {
    setTitle("Tools");

    Composite body = createTableWrapBody(1, toolkit);

    toolkit.createLabel(body, "Tools to help manage this project:");

    Hyperlink launch = toolkit.createHyperlink(body, "Resolve missing dependencies", SWT.NULL);
    launch.setHref("resolve");
    launch.addHyperlinkListener(this);

    Hyperlink debug = toolkit.createHyperlink(body, "Prune unused dependencies", SWT.NULL);
    debug.setHref("prune");
    debug.addHyperlinkListener(this);
  }
  @Override
  public void createControl(Composite parent) {
    GridData gd;

    Composite composite = new Composite(parent, SWT.NULL);
    setControl(composite);

    composite.setLayout(new GridLayout(1, false));

    new Label(composite, SWT.NONE).setText("Select Template:");

    tree = new Tree(composite, SWT.BORDER | SWT.FULL_SELECTION);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 100;
    tree.setLayoutData(gd);

    viewer = new TreeViewer(tree);
    contentProvider = new RepoTemplateContentProvider(false);
    viewer.setContentProvider(contentProvider);
    viewer.setLabelProvider(new RepoTemplateLabelProvider(loadedImages));
    viewer.addFilter(latestFilter);
    setTemplates(Collections.singletonList(emptyTemplate));

    btnLatestOnly = new Button(composite, SWT.CHECK);
    btnLatestOnly.setText("Show latest versions only");
    btnLatestOnly.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
    btnLatestOnly.setSelection(true);

    new Label(composite, SWT.NONE).setText("Description:");

    Composite cmpDescription = new Composite(composite, SWT.BORDER);
    cmpDescription.setBackground(tree.getBackground());

    txtDescription = new ScrolledFormText(cmpDescription, SWT.V_SCROLL | SWT.H_SCROLL, false);
    FormText formText = new FormText(txtDescription, SWT.NO_FOCUS);
    txtDescription.setFormText(formText);
    txtDescription.setBackground(tree.getBackground());
    formText.setBackground(tree.getBackground());
    formText.setForeground(tree.getForeground());
    formText.setFont("fixed", JFaceResources.getTextFont());
    formText.setFont("italic", JFaceResources.getFontRegistry().getItalic(""));

    GridData gd_cmpDescription = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd_cmpDescription.heightHint = 100;
    cmpDescription.setLayoutData(gd_cmpDescription);

    GridLayout layout_cmpDescription = new GridLayout(1, false);
    cmpDescription.setLayout(layout_cmpDescription);

    GridData gd_txtDescription = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_txtDescription.heightHint = 100;
    txtDescription.setLayoutData(gd_txtDescription);

    Hyperlink linkRetina = new Hyperlink(composite, SWT.NONE);
    linkRetina.setText("Why is this text blurred?");
    linkRetina.setUnderlined(true);
    linkRetina.setForeground(JFaceColors.getHyperlinkText(getShell().getDisplay()));
    linkRetina.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));

    viewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            Object element = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
            setTemplate(element instanceof Template ? (Template) element : null);
            getContainer().updateButtons();
          }
        });
    viewer.addOpenListener(
        new IOpenListener() {
          @Override
          public void open(OpenEvent event) {
            Object element = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
            setTemplate(element instanceof Template ? (Template) element : null);
            getContainer().updateButtons();
            IWizardPage nextPage = getNextPage();
            if (nextPage != null) getContainer().showPage(nextPage);
          }
        });
    btnLatestOnly.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            boolean latestOnly = btnLatestOnly.getSelection();
            if (latestOnly) viewer.addFilter(latestFilter);
            else viewer.removeFilter(latestFilter);
          }
        });
    linkRetina.addHyperlinkListener(
        new HyperlinkAdapter() {
          @Override
          public void linkActivated(HyperlinkEvent ev) {
            try {
              IWorkbenchBrowserSupport browser = PlatformUI.getWorkbench().getBrowserSupport();
              browser
                  .getExternalBrowser()
                  .openURL(
                      new URL(
                          "https://github.com/bndtools/bndtools/wiki/Blurry-Form-Text-on-High-Resolution-Displays"));
            } catch (Exception e) {
              log.log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Browser open error", e));
            }
          }
        });
  }
Exemplo n.º 23
0
 /**
  * Adds a hyperlink to the group to be jointly managed. Hyperlink will be managed until it is
  * disposed. Settings like colors, cursors and modes will affect all managed hyperlinks.
  *
  * @param link
  */
 public void add(Hyperlink link) {
   if (isBackgroundSet) link.setBackground(getBackground());
   if (isForegroundSet) link.setForeground(getForeground());
   if (getHyperlinkUnderlineMode() == UNDERLINE_ALWAYS) link.setUnderlined(true);
   hook(link);
 }
Exemplo n.º 24
0
 protected void doLinkActivated(Hyperlink link) {
   Object object = link.getData();
   getPage().getEditor().setActivePage(morePageId, object);
 }
Exemplo n.º 25
0
 private void doEnter(Hyperlink link) {
   String statusText =
       labelProvider != null ? labelProvider.getStatusText(link.getData()) : link.getText();
   getPage().getEditorSite().getActionBars().getStatusLineManager().setMessage(statusText);
 }
Exemplo n.º 26
0
 public void clear() {
   tVerr.removeAll();
   hVer.setText(Messages.VerrechnungsDisplay_billed + ")");
 }
Exemplo n.º 27
0
 private void disposeLink(Object obj) {
   Hyperlink link = find(obj);
   if (link != null) link.dispose();
 }
Exemplo n.º 28
0
 private void linkExited(Hyperlink link) {
   link.setCursor(null);
   if (lastEntered == link) lastEntered = null;
 }
Exemplo n.º 29
0
 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);
 }
Exemplo n.º 30
0
  /** This is a callback that will allow us to create the viewer and initialize it. */
  @Override
  public void createPartControl(Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());

    Composite frame = toolkit.createComposite(parent, SWT.BORDER);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(frame);

    Composite comboDescFrame = toolkit.createComposite(frame, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(comboDescFrame);
    GridLayoutFactory.fillDefaults()
        .margins(5, 20)
        .spacing(SWT.DEFAULT, 25)
        .applyTo(comboDescFrame);

    Composite comboFrame = toolkit.createComposite(comboDescFrame, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(comboFrame);
    GridLayoutFactory.fillDefaults().applyTo(comboFrame);

    Composite labelFrame = toolkit.createComposite(comboFrame, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(labelFrame);
    GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(labelFrame);

    Label jbLabel =
        WidgetFactory.createLabel(
            labelFrame, UTIL.getString("TeiidServerOverviewSection.jbLabel")); // $NON-NLS-1$
    jbLabel.setForeground(labelFrame.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));
    GridDataFactory.swtDefaults().grab(false, false).applyTo(jbLabel);

    newServerOrOpenServerViewHyperlink =
        toolkit.createHyperlink(labelFrame, EDIT_SERVER_LABEL, SWT.NONE);
    GridDataFactory.swtDefaults().applyTo(newServerOrOpenServerViewHyperlink);
    newServerOrOpenServerViewHyperlink.addHyperlinkListener(
        new HyperlinkAdapter() {

          @Override
          public void linkActivated(HyperlinkEvent e) {
            if (serverMap.isEmpty()) {
              // There are no servers so open the server wizard
              NewServerAction action =
                  new NewServerAction(getViewSite().getShell(), getServerManager());
              action.run();
            } else {
              // open the servers view
              IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
              try {
                window
                    .getActivePage()
                    .showView("org.eclipse.wst.server.ui.ServersView"); // $NON-NLS-1$
              } catch (PartInitException ex) {
                UTIL.log(ex);
              }
            }
          }
        });

    jbossServerCombo = new Combo(comboFrame, SWT.READ_ONLY | SWT.DROP_DOWN);
    toolkit.adapt(jbossServerCombo);
    GridDataFactory.swtDefaults().minSize(250, 30).grab(true, false).applyTo(jbossServerCombo);
    jbossServerCombo.addSelectionListener(
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            handleServerComboSelection();
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            handleServerComboSelection();
          }
        });

    Text descriptionText =
        toolkit.createText(
            comboDescFrame,
            UTIL.getString("TeiidServerOverviewSection.description"), // $NON-NLS-1$
            SWT.MULTI | SWT.WRAP);
    descriptionText.setForeground(comboDescFrame.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));
    GridDataFactory.fillDefaults()
        .grab(false, true)
        .hint(100, SWT.DEFAULT)
        .applyTo(descriptionText);

    super.createPartControl(frame);

    viewer = getCommonViewer();
    GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl());

    viewer.setSorter(new NameSorter());

    DqpPlugin.getInstance().getServersProvider().addServerLifecycleListener(serversListener);

    // Populate the jboss server combo box which
    // should also populate the viewer as well
    populateJBossServerCombo();

    viewer.expandToLevel(3);
  }