コード例 #1
0
 private synchronized MultiSelection<Object> getMixedSelection() {
   if (mixedSelection == null) {
     mixedSelection =
         MultiSelection.from(
             Object.class,
             new ObservableSet<Object>() {
               @Override
               protected ImmutableSet<Object> compute() {
                 if (tv != null) {
                   ISelection s = tv.getSelection();
                   if (s instanceof IStructuredSelection) {
                     Object[] elements = ((IStructuredSelection) s).toArray();
                     return ImmutableSet.copyOf(elements);
                   }
                 }
                 return ImmutableSet.of();
               }
             });
     debug("mixedSelection", mixedSelection.getElements());
   }
   if (tv != null) {
     addViewerSelectionListener();
   }
   return mixedSelection;
 }
コード例 #2
0
 @Override
 public synchronized MultiSelection<BootDashElement> getSelection() {
   if (selection == null) {
     selection = getMixedSelection().filter(BootDashElement.class);
     debug("selection", selection.getElements());
   }
   return selection;
 }
コード例 #3
0
 private void addViewerSelectionListener() {
   tv.setSelection(new StructuredSelection(Arrays.asList(mixedSelection.getValue().toArray())));
   tv.addSelectionChangedListener(
       new ISelectionChangedListener() {
         public void selectionChanged(SelectionChangedEvent event) {
           mixedSelection.getElements().refresh();
         }
       });
 }
コード例 #4
0
 public AbstractBootDashAction(MultiSelection<BootDashElement> selection, UserInteractions ui) {
   this.selection = selection;
   this.ui = ui;
   selection
       .getElements()
       .addListener(
           new ValueListener<Set<BootDashElement>>() {
             public void gotValue(
                 LiveExpression<Set<BootDashElement>> exp, Set<BootDashElement> selecteds) {
               updateEnablement();
             }
           });
 }
コード例 #5
0
 protected BootDashElement getSingleSelectedElement() {
   return selection.getSingle();
 }
コード例 #6
0
 protected Collection<BootDashElement> getSelectedElements() {
   return selection.getValue();
 }
コード例 #7
0
 public static <T> MultiSelection<T> union(MultiSelection<T> a, MultiSelection<T> b) {
   Assert.isLegal(a.getElementType().equals(b.getElementType()));
   return from(a.getElementType(), LiveSets.union(a.getElements(), b.getElements()));
 }