Example #1
0
 /** @param cloudTreeViewer */
 private void createViewer() {
   viewer = new CloudViewer(this, SWT.FLAT | SWT.MULTI);
   viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
   viewer.setContentProvider(new CloudContentProvider());
   viewer.setLabelProvider(new CloudLabelProvider());
   CloudListener cloudListener = new CloudListener();
   viewer.getControl().addKeyListener(cloudListener);
   viewer.getControl().addMouseListener(cloudListener);
   viewer.getControl().setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
 }
Example #2
0
  public void refresh() {
    this.flat = input.isFlat();
    if (flat) {
      viewer.setInput(input.getRoot());
    }
    refreshBreadCrumb();
    viewer.refresh();

    if (viewer.getInput() == input.getRoot())
      viewer.setSelection(new StructuredSelection(new Object[] {input.getRoot()}), true);

    //		if (viewer.getCloud().getItems().length > 0) {
    //			viewer.setSelection(new StructuredSelection(viewer.getCloud().getItems()[0].getData()),
    // true);
    //		}
  }
Example #3
0
 public void setInput(TagsTree input) {
   if (this.input == input) {
     return;
   }
   this.flat = input.isFlat();
   this.input = input;
   viewer.setInput(input.getRoot());
   refresh();
 }
Example #4
0
 private void refreshBreadCrumb() {
   String linkText = "";
   TagTreeItem current = (TagTreeItem) viewer.getInput();
   int parentNum = 0;
   while (current != null) {
     String text = current.getName();
     int dot = text.lastIndexOf('.');
     if (dot > 0 && dot < text.length() - 1) {
       text = text.substring(dot + 1);
     }
     linkText = "<a href=\"" + parentNum + "\">" + text + "</a>" + linkText;
     if (current.getParent() != null && current.getParent() != input.getRoot()) {
       linkText = "." + linkText;
     } else {
       linkText = " " + linkText;
     }
     current = current.getParent();
     parentNum++;
   }
   formText.setText("<form><p>" + linkText + "</p></form>", true, false);
 }
Example #5
0
 public ISelection getSelection() {
   return viewer.getSelection();
 }