Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ISelectionChangedListener


                });

            }
        };
       
        _selectionChangedListener = new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {               
                if (!_table.getSelection().isEmpty()) {
                   
                    ISelection selection = _table.getSelection();
                    if (selection instanceof StructuredSelection) {
View Full Code Here


        }
        viewer.setLabelProvider(new WorkingSetLabelProvider());

        viewer.setContentProvider(new ArrayContentProvider());
        viewer.setInput(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets());
        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                // handleSelectionChanged();
            }
        });
View Full Code Here

    int style = SWT.BORDER | (false ? SWT.MULTI : SWT.SINGLE);

    TreeViewer tableViewer = new TreeViewer(new Tree(parent, style));
    tableViewer.setContentProvider(new WorkbenchContentProvider());
    tableViewer.setLabelProvider(WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        updateOKStatus();
      }
    });
View Full Code Here

    int style = SWT.BORDER | SWT.SINGLE;

    TreeViewer tableViewer = new TreeViewer(new Tree(parent, style));
    tableViewer.setContentProvider(new WorkbenchContentProvider());
    tableViewer.setLabelProvider(WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        updateOKStatus();
      }
    });
View Full Code Here

    });

    fFolderViewer.setLabelProvider(new BookMarkLabelProvider());
    fFolderViewer.setInput(new Object());

    fFolderViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        if (!selection.isEmpty())
          onFolderSelected((IFolder) selection.getFirstElement());
      }
View Full Code Here

      public void widgetSelected(SelectionEvent e) {
        onDelete();
      }
    });

    fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        editButton.setEnabled(!event.getSelection().isEmpty());
        deleteButton.setEnabled(!event.getSelection().isEmpty());
      }
    });
View Full Code Here

    });

    fFolderViewer.setLabelProvider(new BookMarkLabelProvider(false));
    fFolderViewer.setInput(new Object());

    fFolderViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        if (!selection.isEmpty())
          onFolderSelected((IFolder) selection.getFirstElement());
      }
View Full Code Here

    /* Hook into Statusline */
    fViewer.addSelectionChangedListener(new StatusLineUpdater(fEditorSite.getActionBars().getStatusLineManager()));

    /* Track Selections in the Viewer */
    fSelectionChangeListener = new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        onSelectionChanged(event);
      }
    };
    fViewer.addPostSelectionChangedListener(fSelectionChangeListener);
View Full Code Here

        NewsColumn column = (NewsColumn) element;
        return column.getName();
      }
    });

    fNewsColumnViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        updateMoveEnablement();
        updateRemoveEnablement();
      }
    });

    /* Right: Buttons to manage Columns */
    Composite buttonContainer = new Composite(this, SWT.None);
    buttonContainer.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
    buttonContainer.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    /* Add */
    final Menu menu = new Menu(getShell(), SWT.POP_UP);
    menu.addMenuListener(new MenuListener() {
      public void menuShown(MenuEvent e) {
        MenuItem[] items = menu.getItems();
        for (MenuItem item : items) {
          item.dispose();
        }

        NewsColumn[] newsColumns = NewsColumn.values();
        for (final NewsColumn column : newsColumns) {
          if (column.isSelectable() && !fModel.contains(column)) {
            MenuItem item = new MenuItem(menu, SWT.PUSH);
            item.setText(column.getName());
            item.addSelectionListener(new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                fModel.addColumn(column);
                fNewsColumnViewer.add(column);
                updateRemoveEnablement();
                fNewsColumnViewer.setSelection(new StructuredSelection(column));
              }
            });
          }
        }
      }

      public void menuHidden(MenuEvent e) {}
    });

    final Button addButton = new Button(buttonContainer, SWT.DOWN);
    setButtonLayoutData(addButton);
    addButton.setText(Messages.NewsColumnSelectionControl_ADD);
    addButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        Rectangle rect = addButton.getBounds();
        Point pt = new Point(rect.x, rect.y + rect.height);
        pt = addButton.toDisplay(pt);
        menu.setLocation(pt.x, pt.y);
        menu.setVisible(true);
      }
    });

    addButton.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        menu.dispose();
      }
    });

    /* Remove */
    fRemoveButton = new Button(buttonContainer, SWT.PUSH);
    setButtonLayoutData(fRemoveButton);
    fRemoveButton.setText(Messages.NewsColumnSelectionControl_REMOVE);
    fRemoveButton.setEnabled(false);
    fRemoveButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        onDelete();
      }
    });

    /* Move Up */
    fMoveUpButton = new Button(buttonContainer, SWT.PUSH);
    setButtonLayoutData(fMoveUpButton);
    fMoveUpButton.setText(Messages.NewsColumnSelectionControl_MOVE_UP);
    fMoveUpButton.setEnabled(false);
    fMoveUpButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        onMove(true);
      }
    });

    /* Move Down */
    fMoveDownButton = new Button(buttonContainer, SWT.PUSH);
    setButtonLayoutData(fMoveDownButton);
    fMoveDownButton.setText(Messages.NewsColumnSelectionControl_MOVE_DOWN);
    fMoveDownButton.setEnabled(false);
    fMoveDownButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        onMove(false);
      }
    });

    /* Bottom: Sort Column */
    Composite sortByContainer = new Composite(this, SWT.None);
    sortByContainer.setLayout(LayoutUtils.createGridLayout(3, 0, 0));
    sortByContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));

    Label sortByLabel = new Label(sortByContainer, SWT.NONE);
    sortByLabel.setText(Messages.NewsColumnSelectionControl_SORT_BY);

    fSortByViewer = new ComboViewer(sortByContainer, SWT.READ_ONLY | SWT.BORDER);
    fSortByViewer.getCombo().setVisibleItemCount(20);
    fSortByViewer.setContentProvider(new ArrayContentProvider());
    fSortByViewer.setLabelProvider(new LabelProvider() {
      @Override
      public String getText(Object element) {
        NewsColumn column = (NewsColumn) element;
        return column.getName();
      }
    });
    fSortByViewer.addFilter(new ViewerFilter() {
      @Override
      public boolean select(Viewer viewer, Object parentElement, Object element) {
        if (element == NewsColumn.RELEVANCE)
          return false;

        return true;
      }
    });

    fSortByViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        NewsColumn column = (NewsColumn) selection.getFirstElement();
        fModel.setSortColumn(column);
      }
    });

    fSortAscendingViewer = new ComboViewer(sortByContainer, SWT.READ_ONLY | SWT.BORDER);
    fSortAscendingViewer.getCombo().setVisibleItemCount(2);
    fSortAscendingViewer.setContentProvider(new ArrayContentProvider());
    fSortAscendingViewer.setLabelProvider(new LabelProvider() {
      @Override
      public String getText(Object element) {
        return (((Order) element)).getName();
      }
    });

    fSortAscendingViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        Order order = (Order) selection.getFirstElement();
        fModel.setAscending(order == Order.ASCENDING ? true : false);
      }
View Full Code Here

    /* Hook into Statusline */
    fViewer.addSelectionChangedListener(new StatusLineUpdater(fEditorSite.getActionBars().getStatusLineManager()));

    /* Track Selections in the Viewer */
    fSelectionChangeListener = new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        onSelectionChanged(event);
      }
    };
    fViewer.addSelectionChangedListener(fSelectionChangeListener);
View Full Code Here

TOP

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

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.