Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ViewerSorter


  }
  /*
   * Returns the index where the item should be inserted.
  */
  protected int indexForElement(Object element) {
    ViewerSorter sorter = getSorter();
    if(sorter == null)
      return combo.getItemCount();
    int count = combo.getItemCount();
    int min = 0, max = count - 1;
    while (min <= max) {
      int mid = (min + max) / 2;
      Object data = comboMap.get(mid);
      int compare = sorter.compare(this, data, element);
      if (compare == 0) {
        // find first item > element
        while (compare == 0) {
          ++mid;
          if (mid >= count) {
            break;
          }
          data = comboMap.get(mid);
          compare = sorter.compare(this, data, element);
        }
        return mid;
      }
      if (compare < 0)
        min = mid + 1;
View Full Code Here


        removeButton.setEnabled(!sel.isEmpty());
      }
    });
    listViewer.setContentProvider(new ArrayContentProvider());
    listViewer.setLabelProvider(new LabelProvider());
    listViewer.setSorter(new ViewerSorter());
   
    Composite buttonArea = new Composite(root, SWT.NONE);
    buttonArea.setLayout(new GridLayout());
    GridData gridData = new GridData();
    gridData.verticalAlignment = SWT.BEGINNING;
View Full Code Here

    m_TreeViewer.setContentProvider(m_Editor.getHirarchyProvider());
    m_TreeViewer.setLabelProvider(m_Editor.getOutlineLabelProvider());
    m_TreeViewer.addSelectionChangedListener(this);
    m_TreeViewer.addDoubleClickListener(this);
    if (enableSort)
      m_TreeViewer.setSorter(new ViewerSorter());
    IDocument doc = m_Editor.getDocument();
    if (doc != null)
    {
      m_TreeViewer.setInput(doc);
      m_TreeViewer.collapseAll();
View Full Code Here

  }
 
  public void update() {
    if (m_TreeViewer != null) {
      if (enableSort)
        m_TreeViewer.setSorter(new ViewerSorter());
      else
        m_TreeViewer.setSorter(null);
      Control control = m_TreeViewer.getControl();
      IDocument doc = m_Editor.getDocument();
      if (control != null && !control.isDisposed() && doc != null) {
View Full Code Here

  private void initViewer(Composite parent) {
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    viewContentProvider = new ViewContentProvider(this);
    viewer.setContentProvider(viewContentProvider);
    viewer.setLabelProvider(new ViewLabelProvider());
    viewer.setSorter(new ViewerSorter());
    viewer.setInput(getViewSite());
    viewer.expandAll();
  }
View Full Code Here

  private void initViewer(Composite parent) {
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    viewContentProvider = new ViewContentProvider(this);
    viewer.setContentProvider(viewContentProvider);
    viewer.setLabelProvider(new ViewLabelProvider());
    viewer.setSorter(new ViewerSorter());
    viewer.setInput(getViewSite());
    viewer.expandAll();
  }
View Full Code Here

            zipFile= new ZipFile(path);
            ZipFileStructureProvider provider= new ZipFileStructureProvider(zipFile);
           
            ILabelProvider lp= new ZipDialogLabelProvider(provider);
            ZipDialogContentProvider cp= new ZipDialogContentProvider(provider);
            ViewerSorter sorter= new ViewerSorter();
                       
            ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), lp, cp);
            dialog.setAllowMultiple(false);
            dialog.setValidator(new ZipDialogValidator());
            dialog.setTitle(title);
View Full Code Here

    Label parentEntityLabel = new Label(subclassDialogArea, SWT.NONE);
    parentEntityLabel.setText(Messages.getString("SubclassEntityDialog.parentEntityLabel"));
    _parentEntityViewer = new ComboViewer(subclassDialogArea);
    _parentEntityViewer.setContentProvider(new EOEntityListContentProvider(false, false, false));
    _parentEntityViewer.setLabelProvider(new EOEntityLabelProvider());
    _parentEntityViewer.setSorter(new ViewerSorter());
    _parentEntityViewer.setInput(_sourceModel);
    _parentEntityViewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _parentEntityViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent _event) {
        SubclassEntityDialog.this._updateSubclassFromUI();
      }
    });
    if (_parentEntity != null) {
      _parentEntityViewer.setSelection(new StructuredSelection(_parentEntity));
    }

    Label inheritanceTypeLabel = new Label(subclassDialogArea, SWT.NONE);
    inheritanceTypeLabel.setText(Messages.getString("SubclassEntityDialog.inheritanceTypeLabel"));
    _inheritanceTypeViewer = new ComboViewer(subclassDialogArea);
    _inheritanceTypeViewer.setLabelProvider(new InheritanceTypeLabelProvider());
    _inheritanceTypeViewer.setContentProvider(new InheritanceTypeContentProvider());
    _inheritanceTypeViewer.setSorter(new ViewerSorter());
    _inheritanceTypeViewer.setInput(InheritanceType.INHERITANCE_TYPES);
    _inheritanceTypeViewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _inheritanceTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent _event) {
        SubclassEntityDialog.this._updateSubclassFromUI();
      }
    });

    _inheritanceTypeViewer.setSelection(new StructuredSelection(InheritanceType.SINGLE_TABLE));
    Label destinationModelLabel = new Label(subclassDialogArea, SWT.NONE);
    destinationModelLabel.setText(Messages.getString("SubclassEntityDialog.destinationModelLabel"));
    _destinationModelViewer = new ComboViewer(subclassDialogArea);
    _destinationModelViewer.setContentProvider(new EOModelListContentProvider());
    _destinationModelViewer.setLabelProvider(new EOModelLabelProvider());
    _destinationModelViewer.setSorter(new ViewerSorter());
    _destinationModelViewer.setInput(_destinationModel);
    _destinationModelViewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _destinationModelViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent _event) {
        SubclassEntityDialog.this._updateSubclassFromUI();
View Full Code Here

    GridData tableLayoutData = new GridData(GridData.FILL_BOTH);
    tableLayoutData.heightHint = 200;
    _frameworkTableViewer.getTable().setHeaderVisible(true);
    _frameworkTableViewer.getTable().setLayoutData(tableLayoutData);
    _frameworkTableViewer.setSorter(new ViewerSorter());
    // _frameworkTableViewer.addSelectionChangedListener(this);

    final CheckboxTableViewer finalFrameworkTableViewer = _frameworkTableViewer;
    _frameworkTableViewer.addCheckStateListener(new ICheckStateListener() {
      public void checkStateChanged(CheckStateChangedEvent event) {
View Full Code Here

    RelatedLabelProvider relatedLabelProvider = new RelatedLabelProvider();
    _viewer.setLabelProvider(relatedLabelProvider);
    relatedContentProvider.setLabelProvider(relatedLabelProvider);

    _viewer.setSorter(new ViewerSorter());

    TableColumnLayout relatedTableLayout = new TableColumnLayout();
    viewerContainer.setLayout(relatedTableLayout);

    TableColumn typeColumn = new TableColumn(_viewer.getTable(), SWT.LEFT);
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.ViewerSorter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.