@Override public boolean matches( Widget widget ) { if( widget instanceof ToolItem ) { ToolItem item = ( ToolItem )widget; ToolBar toolBar = item.getParent(); return toolBar.getItem( toolBar.getItemCount() - 1 ) == item; } return false; } };
public void getName(AccessibleEvent e) { if (e.childID != ACC.CHILDID_SELF) { ToolItem item = tb.getItem(e.childID); if (item != null) { String toolTip = item.getToolTipText(); if (toolTip != null) { e.result = toolTip; } } } } });
@Override public Control remove(ToolBar parent, Control control) { for(ToolItem item : parent.getItems()){ if(item.getControl() == control){ Thing parentThing = Designer.getThing(parent); Thing itemThing = Designer.getThing(item); parentThing.removeChild(itemThing); parentThing.save(); ItemInfo itemInfo = getItemIndex(parent, control); int index = itemInfo != null ? itemInfo.index : -1; item.dispose(); control.dispose(); ToolBarCreator.initToolBar(parent); if(index != -1){ if(index > 0 && parent.getItemCount() > index - 1){ return parent.getItem(index - 1).getControl(); }if(parent.getItemCount() > index){ return parent.getItem(index).getControl(); } } return parent; } } return null; }
@Override public void mouseDown(MouseEvent e) { ToolBar bar = (ToolBar) e.widget; downPos = new Point(e.x, e.y); ToolItem downItem = bar.getItem(downPos); // We're only interested if the button went down over a // perspective item if (downItem != null && downItem.getData() instanceof MPerspective) dragItem = downItem; }
@Override public void getName(AccessibleEvent e) { if (0 <= e.childID && e.childID < perspSwitcherToolbar.getItemCount()) { ToolItem item = perspSwitcherToolbar.getItem(e.childID); if (item != null) { e.result = item.getToolTipText(); } } } });
@Override public boolean matches( Widget widget ) { if( widget instanceof ToolItem ) { ToolItem item = ( ToolItem )widget; ToolBar toolBar = item.getParent(); return toolBar.getItem( 0 ) == item; } return false; } };
public void getName(AccessibleEvent e) { if (e.childID != ACC.CHILDID_SELF) { Accessible accessible = (Accessible) e .getSource(); ToolBar toolBar = (ToolBar) accessible .getControl(); if (0 <= e.childID && e.childID < toolBar.getItemCount()) { ToolItem item = toolBar.getItem(e.childID); if (item != null) { e.result = item.getToolTipText(); } } } } });
@Override public void getName(AccessibleEvent e) { if (e.childID != ACC.CHILDID_SELF) { ToolItem item = toolBar.getItem(e.childID); if (item != null) { String toolTip = item.getToolTipText(); if (toolTip != null) { e.result = toolTip; } } } } };
@Override public void getName(AccessibleEvent e) { if (e.childID != ACC.CHILDID_SELF) { ToolItem item = toolBar.getItem(e.childID); if (item != null) { String toolTip = item.getToolTipText(); if (toolTip != null) { e.result = toolTip; } } } } };
@Override public void getName(AccessibleEvent e) { if (e.childID != ACC.CHILDID_SELF) { ToolItem item = tb.getItem(e.childID); if (item != null) { String toolTip = item.getToolTipText(); if (toolTip != null) { e.result = toolTip; } } } } });
protected Widget getTipWidget(Event event) { Point widgetPosition = new Point(event.x, event.y); Widget widget = event.widget; if (widget instanceof ToolBar) { ToolBar w = (ToolBar) widget; return w.getItem(widgetPosition); } if (widget instanceof Table) { Table w = (Table) widget; return w.getItem(widgetPosition); } if (widget instanceof Tree) { Tree w = (Tree) widget; return w.getItem(widgetPosition); } return widget; }
@Override public Node item(int index) { return getElement(getToolBar().getItem(index)); }
public Node item(int index) { return getElement(getToolBar().getItem(index)); }
boolean isTabGroup () { ToolItem [] tabList = parent._getTabItemList (); if (tabList != null) { for (int i=0; i<tabList.length; i++) { if (tabList [i] == this) return true; } } if ((style & SWT.SEPARATOR) != 0) return true; int index = parent.indexOf (this); if (index == 0) return true; ToolItem previous = parent.getItem (index - 1); return (previous.getStyle () & SWT.SEPARATOR) != 0; }
boolean isTabGroup () { ToolItem [] tabList = parent._getTabItemList (); if (tabList != null) { for (int i=0; i<tabList.length; i++) { if (tabList [i] == this) return true; } } if ((style & SWT.SEPARATOR) != 0) return true; int index = parent.indexOf (this); if (index == 0) return true; ToolItem previous = parent.getItem (index - 1); return (previous.getStyle () & SWT.SEPARATOR) != 0; }
boolean isTabGroup () { ToolItem [] tabList = parent._getTabItemList (); if (tabList != null) { for (int i=0; i<tabList.length; i++) { if (tabList [i] == this) return true; } } if ((style & SWT.SEPARATOR) != 0) return true; int index = parent.indexOf (this); if (index == 0) return true; ToolItem previous = parent.getItem (index - 1); return (previous.getStyle () & SWT.SEPARATOR) != 0; }
boolean isTabGroup () { ToolItem [] tabList = parent._getTabItemList (); if (tabList != null) { for (int i=0; i<tabList.length; i++) { if (tabList [i] == this) return true; } } if ((style & SWT.SEPARATOR) != 0) return true; int index = parent.indexOf (this); if (index == 0) return true; ToolItem previous = parent.getItem (index - 1); return (previous.getStyle () & SWT.SEPARATOR) != 0; }
@Override public void mouseDown(MouseEvent e) { ToolItem ti= tb.getItem(new Point(e.x, e.y)); if (ti != null) { if (ti.getData() instanceof ActionContributionItem) { ActionContributionItem actionContributionItem= (ActionContributionItem) ti.getData(); IAction action= actionContributionItem.getAction(); if (action == fOpenConsoleAction) { Event event= new Event(); event.widget= ti; event.x= e.x; event.y= e.y; action.runWithEvent(event); } } } } });
@Override public void handleEvent( Event event ) { MenuItem item = ( MenuItem )event.widget; PageDescriptor pageDescriptor = ( PageDescriptor )item.getData(); ToolItem dropDown = pageSwitcher.getItem( 0 ); dropDown.setText( item.getText() ); dropDown.setData( pageDescriptor ); dropDown.setImage( item.getImage() ); if( !DATA_ACTIVATED.equals( event.data ) ) { ui.getPageOperator().openPage( pageDescriptor.getId() ); } } }
private void track(MouseEvent e) { // Create and track the feedback overlay if (dragShell == null) createFeedback(); // Move the drag shell Rectangle b = dragItem.getBounds(); Point p = new Point(e.x, e.y); p = dragShell.getDisplay().map(dragItem.getParent(), null, p); dragShell.setLocation(p.x - (b.width / 2), p.y - (b.height / 2)); // Set the cursor feedback ToolBar bar = (ToolBar) e.widget; ToolItem curItem = bar.getItem(new Point(e.x, e.y)); if (curItem != null && curItem.getData() instanceof MPerspective) { perspSwitcherToolbar.setCursor(perspSwitcherToolbar.getDisplay().getSystemCursor(SWT.CURSOR_HAND)); } else { perspSwitcherToolbar.setCursor(perspSwitcherToolbar.getDisplay().getSystemCursor(SWT.CURSOR_NO)); } }