Ejemplo n.º 1
0
 @Override
 protected void createFormContent(IManagedForm managedForm) {
   FormToolkit toolkit = managedForm.getToolkit();
   ScrolledForm form = UI.formHeader(managedForm, Messages.ContributionTree);
   Composite body = UI.formBody(form, toolkit);
   Composite composite = toolkit.createComposite(body);
   UI.gridLayout(composite, 2);
   FlowImpactSelection selector =
       FlowImpactSelection.on(result, Cache.getEntityCache())
           .withEventHandler(new SelectionHandler())
           .create(composite, toolkit);
   Composite treeContainer = toolkit.createComposite(body);
   UI.gridLayout(treeContainer, 1);
   UI.gridData(treeContainer, true, true);
   createTree(toolkit, treeContainer);
   form.reflow(true);
   for (TreeColumn column : tree.getTree().getColumns()) column.pack();
   selector.selectWithEvent(selection);
 }
Ejemplo n.º 2
0
 private void createTree(FormToolkit toolkit, Composite treeContainer) {
   tree = new TreeViewer(treeContainer, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
   tree.setAutoExpandLevel(2);
   tree.getTree().setLinesVisible(false);
   tree.getTree().setHeaderVisible(true);
   for (int i = 0; i < HEADERS.length; i++) {
     TreeColumn c = new TreeColumn(tree.getTree(), SWT.NULL);
     c.setText(HEADERS[i]);
   }
   tree.setColumnProperties(HEADERS);
   tree.setContentProvider(new ContributionContentProvider());
   tree.setLabelProvider(new ContributionLabelProvider());
   tree.setSorter(new ContributionSorter());
   UI.gridData(tree.getTree(), true, true);
   toolkit.adapt(tree.getTree(), false, false);
   //		toolkit.paintBordersFor(tree.getTree());
   createMenu();
 }