private void treeDblClick( Event event ) { StyledTextComp wScript = getStyledTextComp(); Point point = new Point( event.x, event.y ); TreeItem item = wTree.getItem( point ); // Qualification where the Click comes from if ( item != null && item.getParentItem() != null ) { if ( item.getParentItem().equals( wTreeClassesItem ) ) { setActiveCtab( item.getText() ); } else if ( !item.getData().equals( "Snippit" ) ) { int iStart = wScript.getCaretOffset(); int selCount = wScript.getSelectionCount(); // this selection // will be replaced // by wScript.insert iStart = iStart - selCount; // when a selection is already there // we need to subtract the position if ( iStart < 0 ) { iStart = 0; // just safety } String strInsert = (String) item.getData(); wScript.insert( strInsert ); wScript.setSelection( iStart, iStart + strInsert.length() ); } } }
@Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.ARROW_DOWN || e.keyCode == SWT.ARROW_UP) { typeTree.getControl().setFocus(); Tree tree = (Tree) typeTree.getControl(); if (tree.getItemCount() > 0) { tree.setSelection(tree.getItem(0)); } } }
private void treeDblClick( Event event ) { StyledTextComp wScript = getStyledTextComp(); Point point = new Point( event.x, event.y ); TreeItem item = wTree.getItem( point ); // Qualifikation where the Click comes from if ( item != null && item.getParentItem() != null ) { if ( item.getParentItem().equals( wTreeScriptsItem ) ) { setActiveCtab( item.getText() ); } else if ( !item.getData().equals( "Function" ) ) { int iStart = wScript.getCaretOffset(); int selCount = wScript.getSelectionCount(); // this selection will be replaced by wScript.insert iStart = iStart - selCount; // when a selection is already there we need to subtract the position if ( iStart < 0 ) { iStart = 0; // just safety } String strInsert = (String) item.getData(); if ( strInsert.equals( "jsFunction" ) ) { strInsert = item.getText(); } wScript.insert( strInsert ); wScript.setSelection( iStart, iStart + strInsert.length() ); } } /* * if (item != null && item.getParentItem()!=null && !item.getData().equals("Function")) { int iStart = * wScript.getCaretOffset(); String strInsert =(String)item.getData(); if(strInsert.equals("jsFunction")) strInsert * = (String)item.getText(); wScript.insert(strInsert); wScript.setSelection(iStart,iStart+strInsert.length()); } */ }
private void treeDblClick( Event event ) { StyledTextComp wScript = getStyledTextComp(); Point point = new Point( event.x, event.y ); TreeItem item = wTree.getItem( point ); // Qualifikation where the Click comes from if ( item != null && item.getParentItem() != null ) { if ( item.getParentItem().equals( wTreeScriptsItem ) ) { setActiveCtab( item.getText() ); } else if ( !item.getData().equals( "Function" ) ) { int iStart = wScript.getCaretOffset(); int selCount = wScript.getSelectionCount(); // this selection will be replaced by wScript.insert iStart = iStart - selCount; // when a selection is already there we need to subtract the position if ( iStart < 0 ) { iStart = 0; // just safety } String strInsert = (String) item.getData(); if ( strInsert.equals( "jsFunction" ) ) { strInsert = item.getText(); } wScript.insert( strInsert ); wScript.setSelection( iStart, iStart + strInsert.length() ); } } /* * if (item != null && item.getParentItem()!=null && !item.getData().equals("Function")) { int iStart = * wScript.getCaretOffset(); String strInsert =(String)item.getData(); if(strInsert.equals("jsFunction")) strInsert * = (String)item.getText(); wScript.insert(strInsert); wScript.setSelection(iStart,iStart+strInsert.length()); } */ }
@Override public void mouseDown(MouseEvent arg0) { if (arg0.button == 3) { Point point = new Point(arg0.x, arg0.y); TreeItem selectedItem = tree.getItem(point); selectTreeItem(); if (selectedItem == rootRedisServers || selectedItem == null) { tree.setMenu(menu_null); } else { NodeType type = (NodeType) selectedItem .getData(NODE_TYPE); if (type == NodeType.ROOT) { tree.setMenu(menu_null); } else if (type == NodeType.SERVER) { updateMenuServer(false, menuTreeServer); tree.setMenu(menuTreeServer); } else if (type == NodeType.DATABASE || type == NodeType.CONTAINER) { updateMenuDBContainer(type, menuTreeDBContainer); tree.setMenu(menuTreeDBContainer); } } } } });
public void handleEvent( Event event ) { try { Point point = new Point( event.x, event.y ); TreeItem item = wTree.getItem( point ); if ( item != null ) { TargetStepAttribute target = treeItemTargetMap.get( item );
public void mouseDown(MouseEvent event) { // only activate if there is a cell editor Point pt = new Point(event.x, event.y); TreeItem item = tree.getItem(pt); if (item != null) { handleSelect(item); } } });
public void mouseDoubleClick(MouseEvent e) { if (e.button != 1) return; Point click = new Point(e.x, e.y); TreeItem item = wSamplesTree.getItem(click); if (item != null) { openSample(item); } }
@Override public void mouseDown(MouseEvent event) { // only activate if there is a cell editor Point pt = new Point(event.x, event.y); TreeItem item = tree.getItem(pt); if (item != null) { handleSelect(item); } } });
protected Item getChild(Widget widget, int index) { if (widget instanceof TreeItem) { return ((TreeItem) widget).getItem(index); } if (widget instanceof Tree) { return ((Tree) widget).getItem(index); } return null; }
@Override public void mouseUp(MouseEvent e) { if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN) System.out.println("BreadcrumbItemDropDown.showMenu()$treeViewer>mouseUp"); //$NON-NLS-1$ if (e.button != 1) return; if ((OpenStrategy.getOpenMethod() & OpenStrategy.SINGLE_CLICK) != 0) return; Item item= tree.getItem(new Point(e.x, e.y)); if (item == null) return; openElement(item.getData()); }
private File getTargetFile(DropTargetEvent event) { // Determine the target File for the drop TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y))); File targetFile = null; if (item != null) { // We are over a particular item in the tree, use the item's file targetFile = (File) item.getData(TREEITEMDATA_FILE); } return targetFile; } });
public void mouseUp(MouseEvent e) { if (tree.getSelectionCount() < 1) return; if (e.button != 1) return; if (tree.equals(e.getSource())) { Object o= tree.getItem(new Point(e.x, e.y)); TreeItem selection= tree.getSelection()[0]; if (selection.equals(o)) gotoSelectedElement(); } } });
protected Object getToolTipItem(Point point) { TreeItem item = ((Tree) getTreeViewer().getControl()).getItem(point); if (item != null) { return item.getData(); } return null; } };
void setRowColumn(int row, int column, boolean notify) { TreeItem item = row == -1 ? null : tree.getItem(row); TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column); setRowColumn(item, col, notify); }
void setRowColumn(int row, int column, boolean notify) { TreeItem item = row == -1 ? null : tree.getItem(row); TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column); setRowColumn(item, col, notify); }
void setRowColumn(int row, int column, boolean notify) { TreeItem item = row == -1 ? null : tree.getItem(row); TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column); setRowColumn(item, col, notify); }
protected void doNavigate(String text) { checkTree(); if (rootItems == null) return; int index = searchPattern(text); if (index != -1 && index != currentIndex) { indexTree.setSelection(new TreeItem[] { indexTree.getItem(index) }); currentIndex = index; } }
protected Object getToolTipItem(Point point) { TreeItem item = ((Tree) getTreeViewer().getControl()).getItem(point); if (item != null) { return item.getData(); } return null; } };
protected Item getItemAt(Point p) { TreeItem[] selection = tree.getSelection(); if( selection.length == 1 ) { int columnCount = tree.getColumnCount(); for( int i = 0; i < columnCount; i++ ) { if( selection[0].getBounds(i).contains(p) ) { return selection[0]; } } } return getTree().getItem(p); }