Esempio n. 1
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();
 }
  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());
  }
  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;
  }
Esempio n. 4
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();
  }
 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);
 }
  /*
   * (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;
  }
  @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));
            }
          }
        });
  }
 public void clear() {
   tVerr.removeAll();
   hVer.setText(Messages.VerrechnungsDisplay_billed + ")");
 }
Esempio n. 9
0
  void createSubSectionContents(
      final ChangeDetail changeDetail,
      final PatchSetDetail patchSetDetail,
      PatchSetPublishDetail publishDetail,
      Section subSection) {
    Composite composite = toolkit.createComposite(subSection);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);
    subSection.setClient(composite);

    Label authorLabel = new Label(composite, SWT.NONE);
    authorLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    authorLabel.setText("Author");

    Text authorText = new Text(composite, SWT.READ_ONLY);
    authorText.setText(GerritUtil.getUserLabel(patchSetDetail.getInfo().getAuthor()));

    Label committerLabel = new Label(composite, SWT.NONE);
    committerLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    committerLabel.setText("Committer");

    Text committerText = new Text(composite, SWT.READ_ONLY);
    committerText.setText(GerritUtil.getUserLabel(patchSetDetail.getInfo().getCommitter()));

    Label commitLabel = new Label(composite, SWT.NONE);
    commitLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    commitLabel.setText("Commit");

    Hyperlink commitLink = new Hyperlink(composite, SWT.READ_ONLY);
    commitLink.setText(patchSetDetail.getPatchSet().getRevision().get());
    commitLink.addHyperlinkListener(
        new HyperlinkAdapter() {
          @Override
          public void linkActivated(HyperlinkEvent event) {
            GerritToGitMapping mapping = getRepository(changeDetail);
            if (mapping != null) {
              final FetchPatchSetJob job =
                  new FetchPatchSetJob(
                      "Opening Commit Viewer",
                      mapping.getRepository(),
                      mapping.getRemote(),
                      patchSetDetail.getPatchSet());
              job.schedule();
              job.addJobChangeListener(
                  new JobChangeAdapter() {
                    @Override
                    public void done(IJobChangeEvent event) {
                      Display.getDefault()
                          .asyncExec(
                              new Runnable() {
                                @Override
                                public void run() {
                                  CommitEditor.openQuiet(job.getCommit());
                                }
                              });
                    }
                  });
            }
          }
        });

    Label refLabel = new Label(composite, SWT.NONE);
    refLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    refLabel.setText("Ref");

    Text refText = new Text(composite, SWT.READ_ONLY);
    refText.setText(patchSetDetail.getPatchSet().getRefName());

    final TableViewer viewer =
        new TableViewer(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.VIRTUAL);
    GridDataFactory.fillDefaults()
        .span(2, 1)
        .grab(true, true)
        .hint(500, SWT.DEFAULT)
        .applyTo(viewer.getControl());
    viewer.setContentProvider(
        new IStructuredContentProvider() {
          private EContentAdapter modelAdapter;

          public void dispose() {
            // ignore
          }

          public Object[] getElements(Object inputElement) {
            return getReviewItems(inputElement).toArray();
          }

          private List<IReviewItem> getReviewItems(Object inputElement) {
            if (inputElement instanceof IReviewItemSet) {
              return ((IReviewItemSet) inputElement).getItems();
            }
            return Collections.emptyList();
          }

          public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) {
            if (modelAdapter != null) {
              for (IReviewItem item : getReviewItems(oldInput)) {
                ((EObject) item).eAdapters().remove(modelAdapter);
              }
              addedDrafts = 0;
            }

            if (newInput instanceof IReviewItemSet) {
              // monitors any new topics that are added
              modelAdapter =
                  new EContentAdapter() {
                    @Override
                    public void notifyChanged(Notification notification) {
                      super.notifyChanged(notification);
                      if (notification.getFeatureID(IReviewItem.class)
                              == ReviewsPackage.REVIEW_ITEM__TOPICS
                          && notification.getEventType() == Notification.ADD) {
                        viewer.refresh();
                        addedDrafts++;
                      }
                    }
                  };
              for (Object item : getReviewItems(newInput)) {
                ((EObject) item).eAdapters().add(modelAdapter);
              }
            }
          }
        });
    viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new ReviewItemLabelProvider()));
    viewer.addOpenListener(
        new IOpenListener() {
          public void open(OpenEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            IFileItem item = (IFileItem) selection.getFirstElement();
            if (item != null) {
              doOpen((IReviewItemSet) viewer.getInput(), item);
            }
          }
        });

    IReviewItemSet itemSet =
        GerritUtil.createInput(changeDetail, new GerritPatchSetContent(patchSetDetail), cache);
    viewer.setInput(itemSet);

    Composite actionComposite =
        createActions(changeDetail, patchSetDetail, publishDetail, composite);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(actionComposite);

    subSectionExpanded(changeDetail, patchSetDetail, subSection, viewer);
    EditorUtil.addScrollListener(viewer.getTable());

    getTaskEditorPage().reflow();
  }