private void addFavorite() { TreeItem treeItem; String fullContainer; ContainerKeyInfo cinfo = new ContainerKeyInfo(); if (itemsSelected[0] instanceof TreeItem) { treeItem = (TreeItem) itemsSelected[0]; fullContainer = text.getText(); } else { treeItem = getTreeItemByTableItem((TableItem) itemsSelected[0]); NodeType type = (NodeType) itemsSelected[0].getData(NODE_TYPE); if (type == NodeType.CONTAINER || type == NodeType.DATABASE) fullContainer = text.getText() + itemsSelected[0].getText() + ":"; else fullContainer = text.getText() + itemsSelected[0].getText(); } parseContainer(treeItem, cinfo); AddFavoriteDialog dialog = new AddFavoriteDialog(shell, iconImage, fullContainer); String name = (String) dialog.open(); if (name != null) service3.add(cinfo.getId(), name, fullContainer); removeFavoriteMenuItem(); addFavoriteMenuItem(); }
private void exportOne(ContainerKeyInfo cinfo, String file, Item item) { ContainerKey containerKey = cinfo.getContainer(); if (item instanceof TableItem) { NodeType type = (NodeType) item.getData(NODE_TYPE); if (type != NodeType.CONTAINER && type != NodeType.DATABASE) { String con = containerKey == null ? "" : containerKey .getContainerKey(); containerKey = new ContainerKey(con + item.getText()); } } ExportService service = new ExportService(file, cinfo.getId(), cinfo.getDb(), containerKey); try { service.export(); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } }
private void deleteKey(Item item) { ContainerKeyInfo cinfo = new ContainerKeyInfo(); TreeItem[] items = tree.getSelection(); parseContainer(items[0], cinfo); String key = cinfo.getContainerStr(); key += item.getText(); service2.deleteKey(cinfo.getId(), cinfo.getDb(), key); item.dispose(); }
private void copy() { pBuffer = new PasteBuffer(); for (Item item : itemsSelected) { TreeItem treeItem; ContainerKeyInfo cinfo = new ContainerKeyInfo(); if (item instanceof TreeItem) { treeItem = (TreeItem) item; } else { treeItem = getTreeItemByTableItem((TableItem) item); } parseContainer(treeItem, cinfo); if (item instanceof TreeItem) pBuffer.copy(cinfo); else { NodeType type = (NodeType) item.getData(NODE_TYPE); if (type == NodeType.CONTAINER || type == NodeType.DATABASE) pBuffer.copy(cinfo); else { cinfo.setContainer(cinfo.getContainer(), item.getText()); pBuffer.copy(cinfo); } } } }
private void cut() { pBuffer = new PasteBuffer(); for (Item item : itemsSelected) { TreeItem treeItem; ContainerKeyInfo cinfo = new ContainerKeyInfo(); if (item instanceof TreeItem) { treeItem = (TreeItem) item; } else { treeItem = getTreeItemByTableItem((TableItem) item); } parseContainer(treeItem, cinfo); if (item instanceof TreeItem) pBuffer.cut(cinfo, treeItem); else { NodeType type = (NodeType) item.getData(NODE_TYPE); if (type == NodeType.CONTAINER || type == NodeType.DATABASE) pBuffer.cut(cinfo, treeItem); else { cinfo.setContainer(cinfo.getContainer(), item.getText()); pBuffer.cut(cinfo, treeItem); } } } }
private void renameKey() { ContainerKeyInfo cinfo = new ContainerKeyInfo(); TreeItem[] items = tree.getSelection(); parseContainer(items[0], cinfo); String key = cinfo.getContainerStr(); key += itemsSelected[0].getText(); RenameKeysDialog dialog = new RenameKeysDialog(shell, iconImage, cinfo.getServerName(), cinfo.getDb(), key); RenameInfo rinfo = (RenameInfo) dialog.open(); if (rinfo != null) { boolean result = service2.renameKey(cinfo.getId(), cinfo.getDb(), key, rinfo.getNewContainer(), rinfo.isOverwritten()); dbContainerTreeItemSelected(items[0], false); if (!rinfo.isOverwritten() && !result) { String failString = i18nFile.getText(I18nFile.RENAMEKEYFAIL); MessageDialog.openError(shell, i18nFile.getText(I18nFile.RENAMEKEYRESULT), failString); } } }
@Override public View getView(int position, View convertView, ViewGroup parent) { ......//initialize text view for this position Item item = getItem(position); textView.setText(item.getText()); ....... }
@Override String doGetStringValue(Object source) { return ((Item) source).getText(); }
@Override String getNameText () { return getText (); }
@Override String getNameText () { return getText (); }
@Override String getNameText () { return getText (); }
@Override String getNameText() { return getText(); }
LinearLayout parentLayout = (LinearLayout)findViewById(R.id.parent_layout); for (Item item: items) { View view = getLayoutInflater(null).inflate(R.layout.your_button_layout, parentLayout, false); TextView text= (TextView) view.findViewById(R.id.text); ImageView background= (ImageView) view.findViewById(R.id.image); text.setText(item.getText()); background.setBackground(item.getBackground()); parentLayout.addView(view); }
String getText (int columnIndex, boolean checkData) { if (checkData && !parent.checkData (this, true)) SWT.error (SWT.ERROR_WIDGET_DISPOSED); int validColumnCount = Math.max (1, parent.columns.length); if (!(0 <= columnIndex && columnIndex < validColumnCount)) return ""; //$NON-NLS-1$ if (columnIndex == 0) return super.getText (); /* super is intentional here */ if (texts [columnIndex] == null) return ""; //$NON-NLS-1$ return texts [columnIndex]; } /**
@Override public String getText () { checkWidget(); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); return super.getText (); }
public static void preserve( Item item ) { preserveProperty( item, PROP_TEXT, item.getText() ); preserveProperty( item, PROP_IMAGE, item.getImage() ); }
/** * {@inheritDoc} */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { // Get the input definition out of the context IEvaluationContext context = (IEvaluationContext) event.getApplicationContext(); Item column = (Item) context.getVariable(COLUMN_PARAM); Boolean visible = (Boolean) context.getVariable(VISIBLE_PARAM); Class<?> inputControllerClass = (Class<?>) context.getVariable(CONTROLLER_CLASS_PARAM); showHideColumn(column, column.getText(), visible.booleanValue(), inputControllerClass); return null; }
public static void writeText( final Item item, final boolean escapeMnemonics ) throws IOException { String text = item.getText(); if( WidgetLCAUtil.hasChanged( item, Props.TEXT, text ) ) { JSWriter writer = JSWriter.getWriterFor( item ); text = WidgetLCAUtil.escapeText( text, escapeMnemonics ); writer.set( JSConst.QX_FIELD_LABEL, text ); } }
public static void preserve( final Item item ) { IWidgetAdapter adapter = WidgetUtil.getAdapter( item ); adapter.preserve( Props.TEXT, item.getText() ); adapter.preserve( Props.IMAGE, item.getImage() ); }
private void refresh(Item[] items) { for (int i= 0; i < items.length; i++) { Item item= items[i]; item.setData(COLORED_LABEL_KEY, null); String text= item.getText(); item.setText(""); //$NON-NLS-1$ item.setText(text); if (item instanceof TreeItem) { refresh(((TreeItem) item).getItems()); } } }