org.eclipse.swt.widgets.Tree.addSelectionListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(258)

本文整理了Java中org.eclipse.swt.widgets.Tree.addSelectionListener()方法的一些代码示例,展示了Tree.addSelectionListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.addSelectionListener()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:addSelectionListener

Tree.addSelectionListener介绍

[英]Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in the SelectionListener interface.

When widgetSelected is called, the item field of the event object is valid. If the receiver has the SWT.CHECK style and the check selection changes, the event object detail field contains the value SWT.CHECK. widgetDefaultSelected is typically called when an item is double-clicked. The item field of the event object is valid for default selection, but the detail field is not used.
[中]将侦听器添加到侦听器集合中,当用户更改接收者的选择时,将通过向其发送SelectionListener界面中定义的消息之一来通知这些侦听器。
调用widgetSelected时,事件对象的项目字段有效。如果接收器具有SWT.CHECK样式,并且检查选择发生更改,则事件对象详细信息字段包含值SWT.CHECK。双击项目时通常会调用widgetDefaultSelected。事件对象的“项目”字段对于默认选择有效,但不使用“详细信息”字段。

代码示例

代码示例来源:origin: caoxinyu/RedisClient

private void initTree(SashForm sashForm) {
  tree = new Tree(sashForm, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
  tree.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {

代码示例来源:origin: pentaho/pentaho-kettle

public static final void addDoubleClick( final TreeItem treeItem, final DoubleClickInterface doubleClick ) {
 final String[] path1 = ConstUI.getTreeStrings( treeItem );
 final Tree tree = treeItem.getParent();
 if ( doubleClick != null ) {
  final SelectionAdapter selectionAdapter = new SelectionAdapter() {
   public void widgetDefaultSelected( SelectionEvent selectionEvent ) {
    TreeItem[] items = tree.getSelection();
    for ( int i = 0; i < items.length; i++ ) {
     String[] path2 = ConstUI.getTreeStrings( items[i] );
     if ( equalPaths( path1, path2 ) ) {
      doubleClick.action( treeItem );
     }
    }
   }
  };
  tree.addSelectionListener( selectionAdapter );
  // Clean up when we do a refresh too.
  treeItem.addDisposeListener( new DisposeListener() {
   public void widgetDisposed( DisposeEvent disposeEvent ) {
    tree.removeSelectionListener( selectionAdapter );
   }
  } );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

wTree.addSelectionListener( new SelectionAdapter() {
 public void widgetDefaultSelected( SelectionEvent arg0 ) {
  handleOK();

代码示例来源:origin: pentaho/pentaho-kettle

tree.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent event ) {
  if ( tree.getSelectionCount() == 1 ) {

代码示例来源:origin: pentaho/pentaho-kettle

private void createSelectionTree() {
 // //////////////////////////////////////////////////////////////////////////////////////////////////
 //
 // Now set up the transformation/job tree
 //
 selectionTree = new Tree( viewTreeComposite, SWT.SINGLE );
 selectionTreeManager = new TreeManager( selectionTree );
 selectionTreeManager.addRoot( STRING_TRANSFORMATIONS, Arrays.asList( new DBConnectionFolderProvider(), new
     StepsFolderProvider(), new HopsFolderProvider(), new PartitionsFolderProvider(), new SlavesFolderProvider(), new
     ClustersFolderProvider() ) );
 selectionTreeManager.addRoot( STRING_JOBS, Arrays.asList( new DBConnectionFolderProvider(), new
     JobEntriesFolderProvider(), new SlavesFolderProvider() ) );
 props.setLook( selectionTree );
 selectionTree.setLayout( new FillLayout() );
 addDefaultKeyListeners( selectionTree );
 selectionTree.addMenuDetectListener( e -> setMenu( selectionTree ) );
 selectionTree.addSelectionListener( new SelectionAdapter() {
  @Override
  public void widgetSelected( SelectionEvent e ) {
   showSelection();
  }
  @Override
  public void widgetDefaultSelected( SelectionEvent e ) {
   doubleClickedInTree( selectionTree );
  }
 } );
 // Set a listener on the tree
 addDragSourceToTree( selectionTree );
}

代码示例来源:origin: pentaho/pentaho-kettle

wTree.addSelectionListener( new SelectionAdapter() {
 private String getSelectedPath( SelectionEvent selectionEvent ) {
  TreeItem treeItem = (TreeItem) selectionEvent.item;

代码示例来源:origin: pentaho/pentaho-kettle

jobParentItem.setImage( GUIResource.getInstance().getImageJobGraph() );
wTree.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent event ) {
  enableButtons();

代码示例来源:origin: pentaho/pentaho-kettle

props.setLook( coreObjectsTree );
coreObjectsTree.addSelectionListener( new SelectionAdapter() {

代码示例来源:origin: pentaho/pentaho-kettle

wTree.addSelectionListener( lsDef );
wTree.addKeyListener( new KeyAdapter() {
 public void keyPressed( KeyEvent e ) {
wTree.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent e ) {
  if ( wTree.getSelection().length > 0 ) {

代码示例来源:origin: org.codehaus.openxma/xmartclient

public void addListeners(Object control, EventAdapter adapter) {
  if(control instanceof Tree) {
    ((Tree)control).addSelectionListener(adapter);
    ((Tree)control).addTreeListener(adapter);
  } else throw new IllegalArgumentException("unsupported control type: "+control.getClass().getName());
}

代码示例来源:origin: org.codehaus.openxma/xmartserver

protected Control createRootMenu(EventAdapter adapter, Composite menuCompositeW)  {
  menuW = new Tree(menuCompositeW,SWT.SINGLE);
  menuW.addSelectionListener(adapter);
  return menuW;
}

代码示例来源:origin: org.codehaus.openxma/xmartclient

protected Control createRootMenu(EventAdapter adapter, Composite menuCompositeW)  {
  menuW = new Tree(menuCompositeW,SWT.SINGLE);
  menuW.addSelectionListener(adapter);
  return menuW;
}

代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui

tree.setLayoutData(gd);
fillTree(project, tree);
tree.addSelectionListener(new SelectionAdapter(){
  public void widgetSelected(SelectionEvent e) {
    selection = getSelectionForItem(tree.getSelection()[0]);

代码示例来源:origin: cbeust/testng-eclipse

private void addListeners() {
 m_tree.addSelectionListener(new SelectionListener() {
  public void widgetSelected(SelectionEvent e) {
   activate();
  }
  public void widgetDefaultSelected(SelectionEvent e) {
   activate();
  }
 });
 m_tree.addDisposeListener(new DisposeListener() {
  public void widgetDisposed(DisposeEvent e) {
   disposeIcons();
  }
 });
 m_tree.addMouseListener(new MouseAdapter() {
  @Override
  public void mouseDoubleClick(MouseEvent e) {
   handleDoubleClick(e);
  }
 });
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

tree.addSelectionListener(new SelectionListener() {
  @Override
  public void widgetSelected(SelectionEvent e) {

代码示例来源:origin: org.eclipse.xtext/ui

@Override
protected Control createDialogArea(Composite parent) {
  treeViewer = createTreeViewer(parent, TREESTYLE);
  final Tree tree = treeViewer.getTree();
  tree.addKeyListener(new KeyAdapter() {
    @Override
    public void keyPressed(KeyEvent e) {
      if (e.character == 0x1B) { // ESC
        dispose();
      } else {
        if(e.keyCode == invokingKeystroke.getNaturalKey() && e.stateMask == invokingKeystroke.getModifierKeys()) {
          changeOutlineMode();
          e.doit = false;
        }
      }
    }
  });
  tree.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetDefaultSelected(SelectionEvent e) {
      gotoSelectedElement();
    }
  });
  installFilter();
  setInfoText();
  addDisposeListener(this);
  return treeViewer.getControl();
}

代码示例来源:origin: kiegroup/droolsjbpm-tools

tree.addSelectionListener(new SelectionAdapter() {
  @Override
  public void widgetSelected(SelectionEvent e) {

代码示例来源:origin: org.apache.directory.studio/ldapbrowser.common

viewer.getTree().addSelectionListener( viewerSelectionListener );
viewer.getTree().addMouseListener( viewerMouseListener );
EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );

代码示例来源:origin: org.eclipse/org.eclipse.datatools.enablement.oda.xml.ui

availableXmlTree = new Tree( treeGroup, SWT.MULTI
    | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
availableXmlTree.addSelectionListener( new SelectionAdapter( ) {

代码示例来源:origin: org.eclipse/org.eclipse.datatools.enablement.oda.xml.ui

availableXmlTree = new Tree( treeGroup, SWT.MULTI
    | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
availableXmlTree.addSelectionListener( new SelectionAdapter( ) {

相关文章

Tree类方法