Ejemplo n.º 1
0
 public void setSelection(org.eclipse.jface.viewers.ISelection selection) {
   this.selection = selection;
   for (org.eclipse.jface.viewers.ISelectionChangedListener listener : selectionChangedListeners) {
     listener.selectionChanged(
         new org.eclipse.jface.viewers.SelectionChangedEvent(this, selection));
   }
 }
Ejemplo n.º 2
0
 private void fireSelectionChange(ISelectionProvider provider, ISelection selection) {
   SelectionChangedEvent evt = new SelectionChangedEvent(provider, selection);
   for (Iterator iter = fSelectionListeners.iterator(); iter.hasNext(); ) {
     ISelectionChangedListener listener = (ISelectionChangedListener) iter.next();
     listener.selectionChanged(evt);
   }
 }
 /** Notify listeners about changes */
 protected void notifyListeners() {
   SelectionChangedEvent event =
       new SelectionChangedEvent(dependencyViewer, dependencyViewer.getSelection());
   for (ISelectionChangedListener listener : listeners) {
     listener.selectionChanged(event);
   }
 }
 void notifyListeners(ISelection selection) {
   List list = new ArrayList(listeners);
   for (Iterator i = list.iterator(); i.hasNext(); ) {
     ISelectionChangedListener listener = (ISelectionChangedListener) i.next();
     listener.selectionChanged(new SelectionChangedEvent(this, selection));
   }
 }
Ejemplo n.º 5
0
 protected void fireSelectionChangedEvent() {
   SelectionChangedEvent e = new SelectionChangedEvent(this, getSelection());
   for (Object listener : selectionChangedListeners.getListeners()) {
     ISelectionChangedListener l = (ISelectionChangedListener) listener;
     l.selectionChanged(e);
   }
 }
Ejemplo n.º 6
0
 private void fireSelectionChanged() {
   SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection());
   Object[] lis = selectionListeners.getListeners();
   for (int i = 0; i < lis.length; i++) {
     ISelectionChangedListener li = (ISelectionChangedListener) lis[i];
     li.selectionChanged(evt);
   }
 }
Ejemplo n.º 7
0
  @Override
  public void setSelection(ISelection selection) {
    editorSelection = selection;

    for (ISelectionChangedListener listener : selectionChangedListeners) {
      listener.selectionChanged(new SelectionChangedEvent(this, selection));
    }
  }
  /**
   * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's
   * overall selection. Calling this result will notify the listeners.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public void setSelection(ISelection selection) {
    editorSelection = selection;

    for (ISelectionChangedListener listener : selectionChangedListeners) {
      listener.selectionChanged(new SelectionChangedEvent(this, selection));
    }
    setStatusLineManager(selection);
  }
Ejemplo n.º 9
0
  /**
   * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's
   * overall selection. Calling this result will notify the listeners.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public void setSelection(ISelection selection) {
    editorSelection = selection;

    for (Iterator listeners = selectionChangedListeners.iterator(); listeners.hasNext(); ) {
      ISelectionChangedListener listener = (ISelectionChangedListener) listeners.next();
      listener.selectionChanged(new SelectionChangedEvent(this, selection));
    }
    setStatusLineManager(selection);
  }
    /** fires a SelectionChangedEvent to all added SelectionChangedListeners */
    private void fireSelectionChanged() {

      Iterator iter = getSelectionListeners().iterator();

      while (iter.hasNext()) {
        ISelectionChangedListener listener = (ISelectionChangedListener) iter.next();
        listener.selectionChanged(new SelectionChangedEvent(this, getSelection()));
      }
    }
    @Override
    public void setSelection(ISelection selection) {
      this.selection = selection;

      for (Object l : listeners.getListeners()) {
        ((ISelectionChangedListener) l)
            .selectionChanged(new SelectionChangedEvent(this, selection));
      }
    }
  public DocumentListSelectionAdapter(
      SearchEditorSelectionProvider provider, DocumentList target, SearchEditor editor) {
    this.target = target;
    this.provider = provider;
    this.editor = editor;

    linkEditorToTarget();

    editorToTargetListener.selectionChanged(
        new SelectionChangedEvent(provider, provider.getSelection()));
  }
Ejemplo n.º 13
0
 public void selectionChanged(SelectionChangedEvent event) {
   Object[] sel = getSelection();
   if (sel != null && sel.length != 0) {
     if (sel[0] instanceof Tree<?>) {
       sel[0] = ((Tree<?>) sel[0]).contents;
     }
     if (sel[0] instanceof PersistentObject) {
       ElexisEventDispatcher.fireSelectionEvent((PersistentObject) sel[0]);
     }
   }
   if (selChangeListener != null) selChangeListener.selectionChanged(event);
 }
Ejemplo n.º 14
0
    void fireSelectionChanged() {
      if (fSelectionChangedListeners != null) {
        IStructuredSelection selection = getSelection();

        if (fLastSelection != null) {
          List<?> newSelection = selection.toList();
          List<?> oldSelection = fLastSelection.toList();
          int size = newSelection.size();
          if (size == oldSelection.size()) {
            for (int i = 0; i < size; i++) {
              Object newElement = newSelection.get(i);
              Object oldElement = oldSelection.get(i);
              if (newElement != oldElement
                  && newElement.equals(oldElement)
                  && newElement instanceof IJavaElement) {
                // send out a fake selection event to make the Properties view update getKey():
                SelectionChangedEvent event =
                    new SelectionChangedEvent(this, StructuredSelection.EMPTY);
                Object[] listeners = fSelectionChangedListeners.getListeners();
                for (Object listener : listeners) {
                  ((ISelectionChangedListener) listener).selectionChanged(event);
                }
                break;
              }
            }
          }
        }
        fLastSelection = selection;

        SelectionChangedEvent event = new SelectionChangedEvent(this, selection);

        Object[] listeners = fSelectionChangedListeners.getListeners();
        for (int i = 0; i < listeners.length; i++) {
          ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
          listener.selectionChanged(event);
        }
      }
    }
Ejemplo n.º 15
0
 public void setSelection(ISelection selection) {
   editorSelection = selection;
   for (ISelectionChangedListener listener : selectionChangedListeners) {
     listener.selectionChanged(new SelectionChangedEvent(getSelectionProvider(), selection));
   }
 }
 /** Fire current selection */
 private void fireSelectionChanged() {
   SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
   for (ISelectionChangedListener listener : fSelectionListeners) {
     listener.selectionChanged(event);
   }
 }
Ejemplo n.º 17
0
 public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
   m_selectionChangedListener.selectionChanged(
       new SelectionChangedEvent(SelectionServiceAdapter.this, selection));
 }
 protected void notifyListeners(SelectionChangedEvent event) {
   for (Iterator i = listenerList.iterator(); i.hasNext(); ) {
     ISelectionChangedListener listener = (ISelectionChangedListener) i.next();
     listener.selectionChanged(event);
   }
 }
Ejemplo n.º 19
0
  protected void updateSelection() {
    final boolean checkLabel;
    synchronized (this.selectionLock) {
      final long diff = (this.selectionUpdateScheduleStamp - System.nanoTime()) / 1000000L;
      if (diff > 5) {
        this.display.timerExec((int) diff, this.selectionUpdateRunnable);
        return;
      }
      checkLabel = this.selectionCheckLabel;
      this.selectionCheckLabel = false;
      this.selectionUpdateScheduled = false;
    }
    final RDataTableSelection selection;
    if (this.tableLayers == null) {
      selection = new RDataTableSelection(null, null, null, null);
    } else {
      final SelectionLayer selectionLayer = this.tableLayers.selectionLayer;
      final PositionCoordinate anchor = selectionLayer.getSelectionAnchor();
      PositionCoordinate lastSelected = selectionLayer.getLastSelectedCellPosition();
      if (lastSelected.equals(anchor)) {
        lastSelected = null;
      }

      final boolean anchorChanged;
      if ((anchorChanged = !anchor.equals(this.currentAnchor))) {
        this.currentAnchor = new PositionCoordinate(anchor);
      }
      final boolean lastSelectedChanged;
      if ((lastSelectedChanged =
          !((lastSelected != null)
              ? lastSelected.equals(this.currentLastSelectedCell)
              : null == this.currentLastSelectedCell))) {
        this.currentLastSelectedCell =
            (lastSelected != null) ? new PositionCoordinate(lastSelected) : null;
      }

      if (!checkLabel && !anchorChanged && !lastSelectedChanged) {
        return;
      }

      String anchorRowLabel = null;
      String anchorColumnLabel = null;
      if (this.currentAnchor.columnPosition >= 0 && this.currentAnchor.rowPosition >= 0) {
        if (anchorChanged || checkLabel) {
          anchorRowLabel = getRowLabel(this.currentAnchor.rowPosition);
          if (anchorRowLabel != null) {
            anchorColumnLabel = getColumnLabel(this.currentAnchor.columnPosition);
            if (anchorColumnLabel == null) {
              anchorRowLabel = null;
            }
          }
        } else if (this.selection != null) {
          anchorRowLabel = this.selection.getAnchorRowLabel();
          anchorColumnLabel = this.selection.getAnchorColumnLabel();
        }
      }

      if (anchorRowLabel == null) {
        return;
      }

      String lastSelectedRowLabel = null;
      String lastSelectedColumnLabel = null;
      if (this.currentLastSelectedCell != null
          && this.currentLastSelectedCell.columnPosition >= 0
          && this.currentLastSelectedCell.rowPosition >= 0) {
        if (lastSelectedChanged || checkLabel) {
          lastSelectedRowLabel = getRowLabel(this.currentLastSelectedCell.rowPosition);
          if (lastSelectedRowLabel != null) {
            lastSelectedColumnLabel = getColumnLabel(this.currentLastSelectedCell.columnPosition);
            if (lastSelectedColumnLabel == null) {
              lastSelectedRowLabel = null;
            }
          }
        } else if (this.selection != null) {
          lastSelectedRowLabel = this.selection.getLastSelectedCellRowLabel();
          lastSelectedColumnLabel = this.selection.getLastSelectedCellColumnLabel();
        }
      }
      selection =
          new RDataTableSelection(
              anchorRowLabel, anchorColumnLabel,
              lastSelectedRowLabel, lastSelectedColumnLabel);
    }

    if (selection.equals(this.selection)) {
      return;
    }
    this.selection = selection;
    final SelectionChangedEvent event = new SelectionChangedEvent(this, this.selection);

    for (final ISelectionChangedListener listener : this.selectionListeners.toArray()) {
      listener.selectionChanged(event);
    }
  }