/** * Returns whether or not children exist for the Application Window's * toolbar control. * <p> * @return boolean true if children exist, false otherwise */ protected boolean toolBarChildrenExist() { Control toolControl = getToolBarControl(); if (toolControl instanceof ToolBar) { return ((ToolBar) toolControl).getItemCount() > 0; } return false; }
@Override public int getLength() { return getToolBar().getItemCount(); }
/** * Returns whether or not children exist for the Application Window's * toolbar control. * <p> * @return boolean true if children exist, false otherwise */ protected boolean toolBarChildrenExist() { Control toolControl = getToolBarControl(); if (toolControl instanceof ToolBar) { return ((ToolBar) toolControl).getItemCount() > 0; } return false; }
/** * Returns whether or not children exist for the Application Window's * toolbar control. * <p> * @return boolean true if children exist, false otherwise */ protected boolean toolBarChildrenExist() { Control toolControl = getToolBarControl(); if (toolControl instanceof ToolBar) { return ((ToolBar) toolControl).getItemCount() > 0; } return false; }
public int getLength() { return getToolBar().getItemCount(); }
public int getItemCount() { ToolBar toolBar = getControl(); if (toolBar == null || toolBar.isDisposed()) { return 0; } return toolBar.getItemCount(); }
@Override public int getItemCount() { ToolBar toolBar = getControl(); if (toolBar == null || toolBar.isDisposed()) { return 0; } return toolBar.getItemCount(); }
@Override public int getItemCount() { ToolBar toolBar = getControl(); if (toolBar == null || toolBar.isDisposed()) { return 0; } return toolBar.getItemCount(); }
@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; } };
@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(); } } } });
this( checkNull( parent ), checkStyle( style ), parent.getItemCount() );
super (parent, checkStyle (style)); this.parent = parent; parent.createItem (this, parent.getItemCount ());
/** * Returns the item at the given, zero-relative index in the * receiver. Throws an exception if the index is out of range. * * @param index the index of the item to return * @return the item at the given index * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public ToolItem getItem (int index) { checkWidget(); if (!(0 <= index && index < getItemCount())) error (SWT.ERROR_INVALID_RANGE); return getItems()[index]; }
/** * Returns the item at the given, zero-relative index in the * receiver. Throws an exception if the index is out of range. * * @param index the index of the item to return * @return the item at the given index * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public ToolItem getItem (int index) { checkWidget(); if (!(0 <= index && index < getItemCount())) error (SWT.ERROR_INVALID_RANGE); return getItems()[index]; }
/** * Returns the item at the given, zero-relative index in the * receiver. Throws an exception if the index is out of range. * * @param index the index of the item to return * @return the item at the given index * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public ToolItem getItem (int index) { checkWidget(); if (!(0 <= index && index < getItemCount())) error (SWT.ERROR_INVALID_RANGE); return getItems()[index]; }
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(); } } } } });
/** * This is a HACK ! Due to compatibility restrictions we have the case where * we <b>must</b> leave 'empty' toolbars in the trim. This code detects this * particular scenario and hides any TB's of this type... * * @param te * The proposed trim element * @return <code>true</code> iff this element represents an empty managed * TB. */ private boolean hideManagedTB(MTrimElement te) { if (!(te instanceof MToolBar) || !(te.getRenderer() instanceof ToolBarManagerRenderer)) return false; if (!(te.getWidget() instanceof Composite)) return false; Composite teComp = (Composite) te.getWidget(); Control[] kids = teComp.getChildren(); if (kids.length != 1 || !(kids[0] instanceof ToolBar)) return false; boolean barVisible = ((ToolBar) kids[0]).getItemCount() > 0; // HACK! The trim dragging code uses the visible attribute as well // this is a local 'lock' to prevent the layout from messing with it if (!te.getTags().contains("LockVisibility")) { //$NON-NLS-1$ te.setVisible(barVisible); } return !barVisible; }
/** * This is a HACK ! Due to compatibility restrictions we have the case where * we <b>must</b> leave 'empty' toolbars in the trim. This code detects this * particular scenario and hides any TB's of this type... * * @param te * The proposed trim element * @return <code>true</code> iff this element represents an empty managed * TB. */ private boolean hideManagedTB(MTrimElement te) { if (!(te instanceof MToolBar) || !(te.getRenderer() instanceof ToolBarManagerRenderer)) return false; if (!(te.getWidget() instanceof Composite)) return false; Composite teComp = (Composite) te.getWidget(); Control[] kids = teComp.getChildren(); if (kids.length != 1 || !(kids[0] instanceof ToolBar)) return false; boolean barVisible = ((ToolBar) kids[0]).getItemCount() > 0; // HACK! The trim dragging code uses the visible attribute as well // this is a local 'lock' to prevent the layout from messing with it if (!te.getTags().contains("LockVisibility")) { //$NON-NLS-1$ te.setVisible(barVisible); } return !barVisible; }
@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; }
itemInsertIndex = filterBar.getItemCount(); // so we insert after separator