protected void refreshLangUI(){ tbtmNewItem.setText(RedisClient.i18nFile.getText(I18nFile.DATA)+(console.getTabFolder_2().indexOf(tbtmNewItem))); } }
@Override public void execute() { super.execute(); if(result.getType() != ResultType.Error){ tbtmNewItem = new CTabItem(console.getTabFolder_2(), SWT.NONE); tbtmNewItem.setText(RedisClient.i18nFile.getText(I18nFile.DATA)+(console.getTabFolder_2().indexOf(tbtmNewItem))); Composite composite = new Composite(console.getTabFolder_2(), SWT.NONE); tbtmNewItem.setControl(composite); composite.setLayout(new GridLayout(1, false)); initData(composite); console.getTabFolder_2().setSelection(tbtmNewItem); } } protected abstract void initData(Composite composite) ;
public static Boolean CtabExists(CTabFolder folder, CTabItem tab) { if (tab != null) { int intIndex = -1; intIndex = folder.indexOf(tab); if (intIndex == -1) { return false; } else { return true; } } else { return false; } }
/** * Removes a {@link CTabItem} for the sensor class. * * @param sensorClass * sensor class */ private void removeTabItem(Class<? extends ISensorConfig> sensorClass) { CTabItem tabItem = sensorToTabMap.remove(sensorClass); if (null != tabItem) { int index = tabFolder.indexOf(tabItem); tableViewers.remove(index); tabItem.dispose(); } if (CollectionUtils.isEmpty(tableViewers)) { createEmptyInputHint(); } }
@Override public void widgetSelected( SelectionEvent event ) { MenuItem menuItem = ( MenuItem )event.getSource(); int index = indexOf( ( CTabItem )menuItem.getData( id ) ); setSelection( index, true ); } } );
public void widgetSelected(SelectionEvent e) { MenuItem menuItem = (MenuItem)e.widget; int index = indexOf((CTabItem)menuItem.getData(id)); CTabFolder.this.setSelection(index, true); } });
@Override public void widgetSelected(SelectionEvent e) { MenuItem menuItem = (MenuItem)e.widget; int index = indexOf((CTabItem)menuItem.getData(id)); CTabFolder.this.setSelection(index, true); } });
@Override public void widgetSelected(SelectionEvent e) { MenuItem menuItem = (MenuItem)e.widget; int index = indexOf((CTabItem)menuItem.getData(id)); CTabFolder.this.setSelection(index, true); } });
@Override public void widgetSelected(SelectionEvent e) { MenuItem menuItem = (MenuItem)e.widget; int index = indexOf((CTabItem)menuItem.getData(id)); CTabFolder.this.setSelection(index, true); } });
@Override public void widgetSelected(SelectionEvent e) { MenuItem menuItem = (MenuItem)e.widget; int index = indexOf((CTabItem)menuItem.getData(id)); CTabFolder.this.setSelection(index, true); } });
@Override public void widgetSelected(SelectionEvent event) { int selectedIndex = fTabFolder.indexOf((CTabItem) event.item); if (!fInitializingTabs) { handleTabChange(selectedIndex); } Display display = fTabFolder.getDisplay(); display.addListener(SWT.PostEvent, new Listener() { @Override public void handleEvent(Event newEvent) { if (newEvent.detail == SWT.Selection) { // display.removeListener(SWT.PostEvent, this); if (fRefreshTabs) { refreshTabs(true); fTabFolder.setSelection(selectedIndex); refreshStatus(); } } } }); } });
/** * Set the selection to the tab at the specified item. * * @param item the tab item to be selected * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the item is null</li> * </ul> * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> */ public void setSelection(CTabItem item) { checkWidget(); if (item == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int index = indexOf(item); setSelection(index); } /**
/** * Set the selection to the tab at the specified item. * * @param item the tab item to be selected * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the item is null</li> * </ul> * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> */ public void setSelection(CTabItem item) { checkWidget(); if (item == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int index = indexOf(item); setSelection(index); } /**
/** * Set the selection to the tab at the specified item. * * @param item the tab item to be selected * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the item is null</li> * </ul> * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> */ public void setSelection(CTabItem item) { checkWidget(); if (item == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int index = indexOf(item); setSelection(index); } /**
/** * Set the selection to the tab at the specified item. * * @param item the tab item to be selected * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the item is null</li> * </ul> * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> */ public void setSelection(CTabItem item) { checkWidget(); if (item == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int index = indexOf(item); setSelection(index); } /**
/** * Returns the font that the receiver will use to paint textual information. * * @return the receiver's font * * @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> * * @since 1.0 */ public Font getFont() { checkWidget(); Font result = font; if( font == null ) { boolean isSelected = parent.indexOf( this ) == parent.getSelectionIndex(); result = parent.getItemFont( isSelected ); } return result; }
/** * Set the selection to the tab at the specified item. * * @param item the tab item to be selected * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the item is null</li> * </ul> * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> */ public void setSelection(CTabItem item) { checkWidget(); if (item == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int index = indexOf(item); setSelection(index); } /**
@Override public void renderInitialization( CTabItem item ) throws IOException { CTabFolder parent = item.getParent(); RemoteObject remoteObject = createRemoteObject( item, TYPE ); remoteObject.set( "parent", getId( parent ) ); remoteObject.set( "index", parent.indexOf( item ) ); remoteObject.set( "style", createJsonArray( getStyles( item, ALLOWED_STYLES ) ) ); }
private void setItemInfo() { if (curElement == null) return; Control ctrl = (Control) curElement.getWidget(); // KLUDGE!! Should delegate to curElement's renderer if (ctrl instanceof CTabFolder) { CTabFolder ctf = (CTabFolder) ctrl; Point localPos = display.map(null, ctf, cursorPos); curItem = ctf.getItem(localPos); if (curItem != null) { itemElement = (MUIElement) curItem.getData(AbstractPartRenderer.OWNING_ME); if (itemElement != null) { itemIndex = ctf.indexOf((CTabItem) curItem); itemRect = display.map(ctf, ctf.getShell(), ((CTabItem) curItem).getBounds()); } } } else if (ctrl instanceof ToolBar) { ToolBar tb = (ToolBar) ctrl; Point localPos = display.map(null, tb, cursorPos); ToolItem curItem = tb.getItem(localPos); if (curItem != null) { itemElement = (MUIElement) curItem.getData(AbstractPartRenderer.OWNING_ME); if (itemElement != null) { itemIndex = tb.indexOf(curItem); itemRect = display.map(tb, tb.getShell(), curItem.getBounds()); } } } }
private void setItemInfo() { if (curElement == null) { return; } Control ctrl = (Control) curElement.getWidget(); // KLUDGE!! Should delegate to curElement's renderer if (ctrl instanceof CTabFolder) { CTabFolder ctf = (CTabFolder) ctrl; Point localPos = display.map(null, ctf, cursorPos); curItem = ctf.getItem(localPos); if (curItem != null) { itemElement = (MUIElement) curItem.getData(AbstractPartRenderer.OWNING_ME); if (itemElement != null) { itemIndex = ctf.indexOf((CTabItem) curItem); itemRect = display.map(ctf, ctf.getShell(), ((CTabItem) curItem).getBounds()); } } } else if (ctrl instanceof ToolBar) { ToolBar tb = (ToolBar) ctrl; Point localPos = display.map(null, tb, cursorPos); ToolItem curItem = tb.getItem(localPos); if (curItem != null) { itemElement = (MUIElement) curItem.getData(AbstractPartRenderer.OWNING_ME); if (itemElement != null) { itemIndex = tb.indexOf(curItem); itemRect = display.map(tb, tb.getShell(), curItem.getBounds()); } } } }