Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ViewerSorter


      dialog.setTitle("Type Selection");
      dialog.setMessage("Select the type from the tree:");
      dialog.setInput(planNames);
      dialog.setAllowMultiple(false);
      dialog.setEmptyListMessage("No types available");
      dialog.setSorter(new ViewerSorter());
      if (initialSelection != null)
        dialog.setInitialSelection(initialSelection);
      if (dialog.open() == ElementTreeSelectionDialog.OK){
        Object selectedObject = dialog.getFirstResult();
        if (selectedObject instanceof ToolType)
View Full Code Here


        Composite interfaceComposite = new Composite(tabFolder, SWT.NONE);
        tbtmInterfaces.setControl(interfaceComposite);
        interfaceComposite.setLayout(new GridLayout(2, false));
       
        listViewer = new ListViewer(interfaceComposite, SWT.BORDER | SWT.V_SCROLL);
        listViewer.setSorter(new ViewerSorter());
        List list = listViewer.getList();
        GridData gd_list = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
        gd_list.widthHint = 284;
        list.setLayoutData(gd_list);
        list.setSize(238, 111);
        listViewer.setContentProvider(new IStructuredContentProvider() {
          public Object[] getElements(Object inputElement) {
            return ((Set<?>)inputElement).toArray();
          }

          public void dispose() {
            System.out.println("Disposing ...");
          }

          public void inputChanged(
              Viewer viewer,
              Object oldInput,
              Object newInput) {
            System.out.println("Input changed: old=" + oldInput + ", new=" + newInput);
          }
        });
        listViewer.setLabelProvider(new LabelProvider());
        Composite buttonComposite = new Composite(interfaceComposite, SWT.NONE);
        //buttonComposite.setSize(51, 46);
        buttonComposite.setCapture(true);
        GridLayout gl_buttonComposite = new GridLayout(1, false);
        gl_buttonComposite.verticalSpacing = 0;
        gl_buttonComposite.marginWidth = 0;
        gl_buttonComposite.horizontalSpacing = 0;
        gl_buttonComposite.marginHeight = 0;
        buttonComposite.setLayout(gl_buttonComposite);
       
        addButton = new Button(buttonComposite, SWT.NONE);
        addButton.setBounds(0, 0, 94, 30);
        addButton.setText("Add");
       
        removeButton = new Button(buttonComposite, SWT.NONE);
        removeButton.setBounds(0, 0, 94, 30);
        removeButton.setText("Remove");
       
        tableViewer.setContentProvider(new ArrayContentProvider());
       
        Composite membersComposite = new Composite(parent, SWT.NONE);
        membersComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        membersComposite.setLayout(new GridLayout(1, false));
       
        treeViewer = new TreeViewer(membersComposite, SWT.BORDER);
        treeViewer.addDoubleClickListener(new IDoubleClickListener() {
          public void doubleClick(DoubleClickEvent event) {
            ITreeSelection selection = (ITreeSelection)event.getSelection();
            IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            IWorkbenchPage page = window.getActivePage();
            Object element = selection.getFirstElement();
            if (element instanceof IClassComponent){
              OpenClassComponentAction action = new OpenClassComponentAction(page, (IClassComponent)element);
              action.run();
              treeViewer.refresh(element);
            }
          }
        });
        treeViewer.setSorter(new ViewerSorter());
        treeViewer.setAutoExpandLevel(1);
        Tree membersTree = treeViewer.getTree();
        GridData gd_membersTree = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
        gd_membersTree.widthHint = 300;
        membersTree.setLayoutData(gd_membersTree);
View Full Code Here

        selectionChanged(new SelectionChangedEvent(listViewer,
            listViewer.getSelection()));
        advanceToNextPage();
      }
    });
    listViewer.setSorter(new ViewerSorter());
    listViewer.setInput(getElements());
    listViewer.addSelectionChangedListener(this);
    Dialog.applyDialogFont(container);
    setControl(container);
View Full Code Here

    fTableViewer = new TableViewer(table);
    fTableViewer.setLabelProvider(new TemplateLabelProvider());
    fTableViewer.setContentProvider(new TemplateContentProvider());

    fTableViewer.setSorter(new ViewerSorter() {
      public int compare(Viewer viewer, Object object1, Object object2) {
        if ((object1 instanceof Template) && (object2 instanceof Template)) {
          Template left = (Template) object1;
          Template right = (Template) object2;
          int result = left.getName().compareToIgnoreCase(right.getName());
View Full Code Here

              matchingAnnotations.add(element);
            }
          }
        }
      }
      annotationsTable.setSorter(new ViewerSorter());
      annotationsTable.setInput(matchingAnnotations);

      final Sash sash = new Sash(annotationsComposite, SWT.HORIZONTAL);

      final PropertySheetPage propertySheet = new PropertySheetPage();
View Full Code Here

      final TableViewer structuredSelectionTable = new TableViewer(structuredSashForm, SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);

      structuredSelectionTable.getTable().setHeaderVisible(true);
      structuredSelectionTable.getTable().setLinesVisible(true);
      structuredSelectionTable.setSorter(new ViewerSorter() {
        public int category(Object element) {
          if (element instanceof IndexedRegion)
            return ((IndexedRegion) element).getStartOffset();
          return super.category(element);
        }
View Full Code Here

    fTableViewer = new TableViewer(table);
    fTableViewer.setLabelProvider(new TemplateLabelProvider());
    fTableViewer.setContentProvider(new TemplateContentProvider());

    fTableViewer.setSorter(new ViewerSorter() {
      public int compare(Viewer viewer, Object object1, Object object2) {
        if ((object1 instanceof Template) && (object2 instanceof Template)) {
          Template left = (Template) object1;
          Template right = (Template) object2;
          int result = left.getName().compareToIgnoreCase(right.getName());
View Full Code Here

  }

  private void setTreeViewerProviders() {
    _treeViewer.setContentProvider(_contentProvider);
    _treeViewer.setLabelProvider(_labelProvider);
    _treeViewer.setSorter(new ViewerSorter());
    _treeViewer
        .addSelectionChangedListener(new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            _selection = getSelectedElement((IStructuredSelection) event
                .getSelection());
View Full Code Here

    fTableViewer = new TableViewer(table);
    fTableViewer.setLabelProvider(new TemplateLabelProvider());
    fTableViewer.setContentProvider(new TemplateContentProvider());

    fTableViewer.setSorter(new ViewerSorter() {
      public int compare(Viewer viewer, Object object1, Object object2) {
        if ((object1 instanceof Template) && (object2 instanceof Template)) {
          Template left = (Template) object1;
          Template right = (Template) object2;
          int result = left.getName().compareToIgnoreCase(right.getName());
View Full Code Here

  private void setSortColumn(
      TableColumn column, int colIndex, int direction) {

    ITableLabelProvider labelProvider =
        (ITableLabelProvider) elementKindViewer.getLabelProvider();
    ViewerSorter sorter = new AlphabeticSorter(
        new LabelProviderToString(labelProvider, colIndex));
    if (SWT.UP == direction) {
      sorter = new InverseSorter(sorter);
    }
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.