Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ViewerSorter


        bookmarksProvider = new BookmarksContentProvider();
        bookmarksTree.setContentProvider(bookmarksProvider);
        getSite().getWorkbenchWindow().getPartService().addPartListener(bookmarksProvider);
        labelProvider = new BookmarksLabelProvider();
        bookmarksTree.setLabelProvider(labelProvider);
        bookmarksTree.setSorter(new ViewerSorter());
        bookmarksTree.setInput(bookmarksProvider);
        bookmarksTree.setAutoExpandLevel(2);
        bookmarksTree.addDoubleClickListener(new BookmarkAction());
        bookmarksTree.addDoubleClickListener(new IDoubleClickListener(){
View Full Code Here


                }
            }

        });

        tableViewer.setSorter(new ViewerSorter(){
            @Override
            public int compare( Viewer viewer, Object e1, Object e2 ) {
                TableDescriptor d1 = (TableDescriptor) e1;
                TableDescriptor d2 = (TableDescriptor) e2;
                return d1.name.compareTo(d2.name);
View Full Code Here

        addDoubleCickListener();
        setGlobalActions();
    }

    private void setTreeSorter() {
        treeViewer.setSorter(new ViewerSorter(){
            ViewerLayerSorter layerSorter = new ViewerLayerSorter();
            /**
             * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer,
             *      java.lang.Object, java.lang.Object)
             */
 
View Full Code Here

            public void selectionChanged( SelectionChangedEvent event ) {
                setDetails();
            }
        });
       
        viewer.setSorter(new ViewerSorter(){
             @Override
            public void sort( Viewer viewer, Object[] elements ) {
                Arrays.sort(elements, new Comparator<Object>(){

                    public int compare( Object o1, Object o2 ) {
View Full Code Here

        enableableControls.add(categorySelectorLabel);

        final ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY);
        //Default sorter for elements in ComboViewer.
        //Elements will be displayed in alphabetical order
        combo.setSorter(new ViewerSorter());
        data = new GridData(GridData.FILL_HORIZONTAL);
        combo.getControl().setLayoutData(data);
        enableableControls.add(combo.getControl());

        final Map namesToDescriptors = new HashMap();
View Full Code Here

      if (viewer instanceof TableViewer){
        TableViewer tableViewer= (TableViewer) viewer;
        if (tableViewer.getTable().isDisposed()) {
          return;
        }
        tableViewer.setSorter(new ViewerSorter() {
          public int compare(Viewer iviewer, Object e1, Object e2) {
            if (e1 == null) {
              return -1;
            } else if (e2 == null) {
              return 1;
View Full Code Here

    fLocationsViewer = new TreeViewer(comp);
    gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 6;
    fLocationsViewer.getControl().setLayoutData(gd);
    fLocationsContentProvider = new ManLocationsContentProvider();
    fLocationsViewer.setSorter(new ViewerSorter());
    fLocationsViewer.setContentProvider(fLocationsContentProvider);
    fLocationsViewer.setLabelProvider(getLabelProvider());
    fLocationsViewer.setInput(this);
    fLocationsViewer.addSelectionChangedListener(this);
View Full Code Here

    public void createPartControl(Composite parent) {
        viewer = multiColumnViewer(parent);

        viewer.setContentProvider(new MarkerContentProvider());
        viewer.setLabelProvider(new MarkerLabelProvider());
        viewer.setSorter(new ViewerSorter());
        viewer.setInput(ResourcesPlugin.getWorkspace());

        viewer.addSelectionChangedListener(this);
    }
View Full Code Here

        data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
        data.widthHint = ( int ) ( SIZING_SELECTION_WIDGET_WIDTH * 0.4 );
        availableObjectClassesViewer.getTable().setLayoutData( data );
        availableObjectClassesViewer.setContentProvider( new ArrayContentProvider() );
        availableObjectClassesViewer.setLabelProvider( labelProvider );
        availableObjectClassesViewer.setSorter( new ViewerSorter() );
        availableObjectClassesViewer.addFilter( new InstantSearchFilter( availableObjectClassesInstantSearch ) );
        availableObjectClassesViewer.setInput( availableObjectClasses );
        availableObjectClassesViewer.addDoubleClickListener( new IDoubleClickListener()
        {
            public void doubleClick( DoubleClickEvent event )
            {
                add( event.getSelection() );
            }
        } );
        availableObjectClassesViewer.getTable().addKeyListener( new KeyAdapter()
        {
            public void keyPressed( KeyEvent e )
            {
                if ( e.keyCode == SWT.ARROW_UP )
                {
                    if ( availableObjectClassesViewer.getTable().getSelectionIndex() <= 0 )
                    {
                        availableObjectClassesInstantSearch.setFocus();
                    }
                }
            }
        } );

        Composite buttonComposite = new Composite( composite, SWT.NONE );
        gl = new GridLayout( 1, true );
        buttonComposite.setLayout( gl );
        data = new GridData( GridData.FILL_BOTH );
        data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
        // data.widthHint = (int)(SIZING_SELECTION_WIDGET_WIDTH * 0.2);
        data.horizontalAlignment = SWT.CENTER;
        buttonComposite.setLayoutData( data );
        Label label0 = new Label( buttonComposite, SWT.NONE );
        data = new GridData();
        data.grabExcessHorizontalSpace = true;
        data.grabExcessVerticalSpace = true;
        label0.setLayoutData( data );
        addButton = BaseWidgetUtils.createButton( buttonComposite, "&Add", 1 );
        removeButton = BaseWidgetUtils.createButton( buttonComposite, "&Remove", 1 );
        Label label3 = new Label( buttonComposite, SWT.NONE );
        data = new GridData();
        data.grabExcessHorizontalSpace = true;
        data.grabExcessVerticalSpace = true;
        label3.setLayoutData( data );

        addButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                add( availableObjectClassesViewer.getSelection() );
            }
        } );

        removeButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                remove( selectedObjectClassesViewer.getSelection() );
            }
        } );

        selectedObjectClassesViewer = new TableViewer( composite );
        data = new GridData( GridData.FILL_BOTH );
        data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
        data.widthHint = ( int ) ( SIZING_SELECTION_WIDGET_WIDTH * 0.4 );
        selectedObjectClassesViewer.getTable().setLayoutData( data );
        selectedObjectClassesViewer.setContentProvider( new ArrayContentProvider() );
        selectedObjectClassesViewer.setLabelProvider( labelProvider );
        selectedObjectClassesViewer.setSorter( new ViewerSorter() );
        selectedObjectClassesViewer.setInput( selectedObjectClasses );
        selectedObjectClassesViewer.addDoubleClickListener( new IDoubleClickListener()
        {
            public void doubleClick( DoubleClickEvent event )
            {
View Full Code Here

    treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        selectedClass = (ToolComponent) ((TreeSelection)event.getSelection()).getFirstElement();
      }
    });
    treeViewer.setSorter(new ViewerSorter());
    Tree resultsTree = treeViewer.getTree();
    resultsTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    treeViewer.setContentProvider(new ITreeContentProvider() {
     
      @Override
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.