List of usage examples for org.eclipse.jface.viewers IStructuredSelection isEmpty
public boolean isEmpty();
From source file:com.hangum.tadpole.mongodb.core.composite.result.MongodbResultComposite.java
License:Open Source License
/** * document del - tree//from w w w . j a v a 2s .c o m */ private void deleteDocumentTree() { IStructuredSelection iss = (IStructuredSelection) treeViewerMongo.getSelection(); if (iss.isEmpty()) { MessageDialog.openError(null, Messages.MongodbResultComposite_9, Messages.MongodbResultComposite_10); return; } else if (MessageDialog.openConfirm(null, Messages.MongodbResultComposite_9, Messages.MongodbResultComposite_12)) { MongodbTreeViewDTO dto = (MongodbTreeViewDTO) iss.getFirstElement(); if (logger.isDebugEnabled()) logger.info("[delete object id is]" + dto.getDbObject().toString()); //$NON-NLS-1$ try { MongoDBQuery.deleteDocument(userDB, collectionName, dto.getDbObject()); find(); } catch (Exception e) { logger.error(collectionName + " collection document remove object id is" + dto.getDbObject(), e); //$NON-NLS-1$ Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); //$NON-NLS-1$ ExceptionDetailsErrorDialog.openError(null, "Error", "Document remove", errStatus); //$NON-NLS-1$ //$NON-NLS-2$ } } }
From source file:com.hangum.tadpole.mongodb.core.composite.result.MongodbResultComposite.java
License:Open Source License
/** * document del - table//from w w w .j ava2s. co m */ private void deleteDocumentTable() { IStructuredSelection iss = (IStructuredSelection) resultTableViewer.getSelection(); if (iss.isEmpty()) { MessageDialog.openError(null, Messages.MongodbResultComposite_9, Messages.MongodbResultComposite_10); return; } else if (MessageDialog.openConfirm(null, Messages.MongodbResultComposite_9, Messages.MongodbResultComposite_12)) { HashMap<Integer, Object> rsResult = (HashMap<Integer, Object>) iss.getFirstElement(); Object dbObject = rsResult.get(MongoDBDefine.PRIMARY_ID_KEY); try { MongoDBQuery.deleteDocument(userDB, collectionName, (DBObject) dbObject); find(); } catch (Exception e) { logger.error(collectionName + " collection document remove object id is" + dbObject, e); //$NON-NLS-1$ Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); //$NON-NLS-1$ ExceptionDetailsErrorDialog.openError(null, "Error", "Document remove", errStatus); //$NON-NLS-1$ //$NON-NLS-2$ } } }
From source file:com.hangum.tadpole.mongodb.erd.core.actions.TableSelectionAction.java
License:Open Source License
@Override protected boolean calculateEnabled() { IStructuredSelection is = (IStructuredSelection) getViewer().getSelection(); if (!is.isEmpty()) { if (is.getFirstElement() instanceof TableEditPart) { TableEditPart tablePart = (TableEditPart) is.getFirstElement(); Table tableModel = (Table) tablePart.getModel(); PlatformUI.getPreferenceStore().setValue(PublicTadpoleDefine.SELECT_ERD_TABLE, tableModel.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }/*w ww.j a v a2s. co m*/ } return true; }
From source file:com.hangum.tadpole.monitoring.core.dialogs.schedule.AddScheduleDialog.java
License:Open Source License
/** * Create contents of the dialog.//w ww . j a v a 2 s . c o m * @param parent */ @Override protected Control createDialogArea(final Composite parent) { Composite container = (Composite) super.createDialogArea(parent); GridLayout gridLayout = (GridLayout) container.getLayout(); gridLayout.verticalSpacing = 5; gridLayout.horizontalSpacing = 5; gridLayout.marginHeight = 5; gridLayout.marginWidth = 5; Composite compositeHead = new Composite(container, SWT.BORDER); compositeHead.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); compositeHead.setLayout(new GridLayout(3, false)); Label lblTitle = new Label(compositeHead, SWT.NONE); lblTitle.setText(Messages.AddScheduleDialog_0); textTitle = new Text(compositeHead, SWT.BORDER); textTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(compositeHead, SWT.NONE); Label lblDescription = new Label(compositeHead, SWT.NONE); lblDescription.setText(Messages.AddScheduleDialog_1); textDescription = new Text(compositeHead, SWT.BORDER); textDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(compositeHead, SWT.NONE); Label lblCronExpression = new Label(compositeHead, SWT.NONE); lblCronExpression.setText("<a href='http://www.cronmaker.com/' target='_blank'>Cron Expression</a>"); //$NON-NLS-1$ lblCronExpression.setData(RWT.MARKUP_ENABLED, Boolean.TRUE); textCronExp = new Text(compositeHead, SWT.BORDER); textCronExp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Button btnViewSchedule = new Button(compositeHead, SWT.NONE); btnViewSchedule.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { showExp(); } }); btnViewSchedule.setText(Messages.AddScheduleDialog_3); new Label(compositeHead, SWT.NONE); textViewSchedule = new Text(compositeHead, SWT.BORDER | SWT.MULTI); GridData gd_textViewSchedule = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); gd_textViewSchedule.heightHint = 60; textViewSchedule.setLayoutData(gd_textViewSchedule); Composite compositeBody = new Composite(container, SWT.BORDER); compositeBody.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); compositeBody.setLayout(new GridLayout(1, false)); ToolBar toolBar = new ToolBar(compositeBody, SWT.FLAT | SWT.RIGHT); final ToolItem tltmAdd = new ToolItem(toolBar, SWT.NONE); tltmAdd.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AddSQLDialog dialog = new AddSQLDialog(parent.getShell(), listSchedule.size()); if (Dialog.OK == dialog.open()) { listSchedule.add(dialog.getDao()); tableViewer.refresh(); } } }); tltmAdd.setText(Messages.AddScheduleDialog_4); tltmModify = new ToolItem(toolBar, SWT.NONE); tltmModify.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection iss = (IStructuredSelection) tableViewer.getSelection(); if (!iss.isEmpty()) { ScheduleDAO dao = (ScheduleDAO) iss.getFirstElement(); AddSQLDialog dialog = new AddSQLDialog(null, dao); if (Dialog.OK == dialog.open()) { tableViewer.refresh(dialog.getDao()); } } } }); tltmModify.setEnabled(false); tltmModify.setText(Messages.AddScheduleDialog_5); tltmDelete = new ToolItem(toolBar, SWT.NONE); tltmDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection iss = (IStructuredSelection) tableViewer.getSelection(); if (!iss.isEmpty()) { if (!MessageDialog.openConfirm(null, Messages.AddScheduleDialog_20, Messages.AddScheduleDialog_7)) return; ScheduleDAO dao = (ScheduleDAO) iss.getFirstElement(); listSchedule.remove(dao); tableViewer.refresh(); } } }); tltmDelete.setEnabled(false); tltmDelete.setText(Messages.AddScheduleDialog_8); tableViewer = new TableViewer(compositeBody, SWT.BORDER | SWT.FULL_SELECTION); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { tltmModify.setEnabled(true); tltmDelete.setEnabled(true); } }); Table table = tableViewer.getTable(); table.setLinesVisible(true); table.setHeaderVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); tableViewerColumn.setEditingSupport(new SQLOrderEditingSupport(tableViewer)); TableColumn tblclmnSeq = tableViewerColumn.getColumn(); tblclmnSeq.setWidth(50); TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tblclmnTitle = tableViewerColumn_1.getColumn(); tblclmnTitle.setWidth(100); tblclmnTitle.setText(Messages.AddScheduleDialog_9); TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tblclmnSql = tableViewerColumn_2.getColumn(); tblclmnSql.setWidth(273); tblclmnSql.setText(Messages.AddScheduleDialog_10); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); tableViewer.setLabelProvider(new AddScheduleLableProvider()); tableViewer.setInput(listSchedule); initData(); return container; }
From source file:com.hangum.tadpole.monitoring.core.editors.schedule.ScheduleEditor.java
License:Open Source License
@Override public void createPartControl(Composite parent) { parent.setLayout(new GridLayout(1, false)); Composite compositeHead = new Composite(parent, SWT.NONE); compositeHead.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); compositeHead.setLayout(new GridLayout(1, false)); Label lblInfo = new Label(compositeHead, SWT.NONE); lblInfo.setText(Messages.ScheduleEditor_1); SashForm sashForm = new SashForm(parent, SWT.VERTICAL); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); sashForm.setOrientation(SWT.HORIZONTAL); Group compositeList = new Group(sashForm, SWT.NONE); compositeList.setLayout(new GridLayout(1, false)); compositeList.setText("Schedule List"); ToolBar toolBar = new ToolBar(compositeList, SWT.FLAT | SWT.RIGHT); ToolItem tltmRefresh = new ToolItem(toolBar, SWT.NONE); tltmRefresh.addSelectionListener(new SelectionAdapter() { @Override//from w w w. ja v a 2s . c om public void widgetSelected(SelectionEvent e) { refreshSchedule(); } }); tltmRefresh.setText(Messages.ScheduleEditor_2); tltmModify = new ToolItem(toolBar, SWT.NONE); tltmModify.setEnabled(false); tltmModify.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection iss = (IStructuredSelection) tableViewerList.getSelection(); if (!iss.isEmpty()) { try { ScheduleMainDAO dao = (ScheduleMainDAO) iss.getFirstElement(); UserDBDAO userDB = TadpoleSystem_UserDBQuery.getUserDBInstance(dao.getDb_seq()); AddScheduleDialog dialog = new AddScheduleDialog(null, userDB, dao); dialog.open(); } catch (Exception e1) { logger.error("modify schedule", e1); } } } }); tltmModify.setText(Messages.ScheduleEditor_tltmModify_text); tltmDelete = new ToolItem(toolBar, SWT.NONE); tltmDelete.setEnabled(false); tltmDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection iss = (IStructuredSelection) tableViewerList.getSelection(); if (!iss.isEmpty()) { ScheduleMainDAO dao = (ScheduleMainDAO) iss.getFirstElement(); if (!MessageDialog.openQuestion(null, Messages.ScheduleEditor_3, Messages.ScheduleEditor_4)) return; try { UserDBDAO userDB = TadpoleSystem_UserDBQuery.getUserDBInstance(dao.getDb_seq()); ScheduleManager.getInstance().deleteJob(userDB, dao); TadpoleSystem_Schedule.deleteSchedule(dao.getSeq()); refreshSchedule(); } catch (Exception e1) { logger.error("delete schedule", e1); //$NON-NLS-1$ } } } }); tltmDelete.setText(Messages.ScheduleEditor_6); tableViewerList = new TableViewer(compositeList, SWT.BORDER | SWT.FULL_SELECTION); tableViewerList.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection iss = (IStructuredSelection) event.getSelection(); if (!iss.isEmpty()) { tltmDelete.setEnabled(true); tltmModify.setEnabled(true); ScheduleMainDAO dao = (ScheduleMainDAO) iss.getFirstElement(); try { List<ScheduleResultDAO> listResult = TadpoleSystem_Schedule.getScheduleResult(dao.getSeq()); tvResult.setInput(listResult); } catch (Exception e) { logger.error("get schedule result", e); //$NON-NLS-1$ } } } }); Table tableList = tableViewerList.getTable(); tableList.setLinesVisible(true); tableList.setHeaderVisible(true); tableList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewerList, SWT.NONE); TableColumn tblclmnName = tableViewerColumn.getColumn(); tblclmnName.setWidth(100); tblclmnName.setText(Messages.ScheduleEditor_8); TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewerList, SWT.NONE); TableColumn tblclmnDescription = tableViewerColumn_2.getColumn(); tblclmnDescription.setWidth(100); tblclmnDescription.setText(Messages.ScheduleEditor_9); TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewerList, SWT.NONE); TableColumn tblclmnCreateDate = tableViewerColumn_1.getColumn(); tblclmnCreateDate.setWidth(200); tblclmnCreateDate.setText(Messages.ScheduleEditor_10); Group compositeResult = new Group(sashForm, SWT.NONE); compositeResult.setLayout(new GridLayout(1, false)); compositeResult.setText("Schedule Result"); tvResult = new TableViewer(compositeResult, SWT.BORDER | SWT.FULL_SELECTION); Table table = tvResult.getTable(); table.setLinesVisible(true); table.setHeaderVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tvResult, SWT.NONE); TableColumn tblclmnResult = tableViewerColumn_3.getColumn(); tblclmnResult.setWidth(52); tblclmnResult.setText(Messages.ScheduleEditor_11); TableViewerColumn tableViewerColumn_4 = new TableViewerColumn(tvResult, SWT.NONE); TableColumn tblclmnMessage = tableViewerColumn_4.getColumn(); tblclmnMessage.setWidth(240); tblclmnMessage.setText(Messages.ScheduleEditor_12); TableViewerColumn tableViewerColumn_5 = new TableViewerColumn(tvResult, SWT.NONE); TableColumn tblclmnDate = tableViewerColumn_5.getColumn(); tblclmnDate.setWidth(140); tblclmnDate.setText(Messages.ScheduleEditor_13); tableViewerList.setContentProvider(ArrayContentProvider.getInstance()); tableViewerList.setLabelProvider(new ScheduleLabelProvider()); tvResult.setContentProvider(ArrayContentProvider.getInstance()); tvResult.setLabelProvider(new ResultLabelProvider()); initUI(); sashForm.setWeights(new int[] { 4, 6 }); // google analytic AnalyticCaller.track(this.getClass().getName()); }
From source file:com.hangum.tadpole.notes.core.views.list.NoteListViewPart.java
License:Open Source License
@Override public void createPartControl(Composite parent) { setPartName(Messages.NoteListViewPart_0); GridLayout gl_parent = new GridLayout(1, false); gl_parent.verticalSpacing = 1;/*from w ww .j ava 2s. co m*/ gl_parent.horizontalSpacing = 1; gl_parent.marginHeight = 1; gl_parent.marginWidth = 1; parent.setLayout(gl_parent); Composite compositeToolbar = new Composite(parent, SWT.NONE); compositeToolbar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); GridLayout gl_compositeToolbar = new GridLayout(1, false); gl_compositeToolbar.horizontalSpacing = 1; gl_compositeToolbar.marginHeight = 1; gl_compositeToolbar.marginWidth = 1; compositeToolbar.setLayout(gl_compositeToolbar); ToolBar toolBar = new ToolBar(compositeToolbar, SWT.FLAT | SWT.RIGHT); toolBar.setBounds(0, 0, 88, 20); ToolItem tltmRefresh = new ToolItem(toolBar, SWT.NONE); tltmRefresh.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { initData(); } }); tltmRefresh.setToolTipText(Messages.NoteListViewPart_1); tltmRefresh.setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "resources/icons/refresh.png")); //$NON-NLS-1$ ToolItem tltmCreate = new ToolItem(toolBar, SWT.NONE); tltmCreate.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { NewNoteDialog dialog = new NewNoteDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); if (dialog.OK == dialog.open()) { initData(); } } }); tltmCreate.setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "resources/icons/notes_new.png")); //$NON-NLS-1$ tltmCreate.setToolTipText(Messages.NoteListViewPart_2); final ToolItem tltmDelete = new ToolItem(toolBar, SWT.NONE); tltmDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection iss = (IStructuredSelection) tableViewer.getSelection(); if (!iss.isEmpty()) { try { if (MessageDialog.openQuestion(null, Messages.NoteListViewPart_3, Messages.NoteListViewPart_4)) { NotesDAO noteDao = (NotesDAO) iss.getFirstElement(); TadpoleSystem_Notes.deleteNote(noteDao.getSeq()); initData(); } } catch (Exception ee) { logger.error("delete note", ee); //$NON-NLS-1$ } } } }); tltmDelete .setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "resources/icons/notes_delete.png")); //$NON-NLS-1$ tltmDelete.setToolTipText(Messages.NoteListViewPart_6); tltmDelete.setEnabled(false); Composite compositeBody = new Composite(parent, SWT.NONE); GridLayout gl_compositeBody = new GridLayout(5, false); gl_compositeBody.marginHeight = 1; gl_compositeBody.verticalSpacing = 1; gl_compositeBody.horizontalSpacing = 1; gl_compositeBody.marginWidth = 1; compositeBody.setLayout(gl_compositeBody); compositeBody.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Label lblFilter = new Label(compositeBody, SWT.NONE); lblFilter.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblFilter.setText(Messages.NoteListViewPart_7); comboTypes = new Combo(compositeBody, SWT.READ_ONLY); comboTypes.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { initData(); } }); GridData gd_combo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_combo.widthHint = 80; gd_combo.minimumWidth = 80; comboTypes.setLayoutData(gd_combo); comboTypes.add(Messages.NoteListViewPart_8); comboTypes.setData(Messages.NoteListViewPart_8, "Send"); //$NON-NLS-1$ comboTypes.add(Messages.NoteListViewPart_9); comboTypes.setData(Messages.NoteListViewPart_9, "Receive"); //$NON-NLS-1$ comboTypes.select(1); comboRead = new Combo(compositeBody, SWT.READ_ONLY); comboRead.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { initData(); } }); comboRead.add(Messages.NoteListViewPart_10); comboRead.setData(Messages.NoteListViewPart_10, "Read"); //$NON-NLS-1$ comboRead.add(Messages.NoteListViewPart_11); comboRead.setData(Messages.NoteListViewPart_11, "Not yet Read"); //$NON-NLS-1$ comboRead.select(0); new Label(compositeBody, SWT.NONE); textFilter = new Text(compositeBody, SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL); textFilter.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.Selection) { initData(); } } }); textFilter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Composite compositeDate = new Composite(compositeBody, SWT.NONE); compositeDate.setLayout(new GridLayout(5, false)); compositeDate.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 5, 1)); Label lblStart = new Label(compositeDate, SWT.NONE); lblStart.setText(Messages.NoteListViewPart_lblStart_text_1); dateTimeStart = new DateTime(compositeDate, SWT.BORDER); // ?? ? . Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis() - (7 * 24 * 60 * 60 * 1000)); dateTimeStart.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH)); Label label = new Label(compositeDate, SWT.NONE); label.setText(Messages.NoteListViewPart_label_text); dateTimeEnd = new DateTime(compositeDate, SWT.BORDER); Button buttonSearch = new Button(compositeDate, SWT.NONE); buttonSearch.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { initData(); } }); buttonSearch.setText(Messages.NoteListViewPart_button_text); tableViewer = new TableViewer(compositeBody, SWT.BORDER | SWT.FULL_SELECTION); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { tltmDelete.setEnabled(true); } }); tableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { IStructuredSelection iss = (IStructuredSelection) tableViewer.getSelection(); if (!iss.isEmpty()) { String selComboType = (String) comboTypes.getData(comboTypes.getText()); NOTE_TYPES noteType = selComboType.equals("Send") ? NOTE_TYPES.SEND : NOTE_TYPES.RECEIVE; //$NON-NLS-1$ ViewDialog dialog = new ViewDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), (NotesDAO) iss.getFirstElement(), noteType); if (Dialog.OK == dialog.open()) { initData(); } } } }); Table table = tableViewer.getTable(); table.setLinesVisible(true); table.setHeaderVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1)); createColumns(); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.setLabelProvider(new NoteListLabelProvider()); initData(); // google analytic AnalyticCaller.track(this.getClass().getName()); }
From source file:com.hangum.tadpole.rdb.core.actions.object.rdb.object.ObjectExplorerSelectionAction.java
License:Open Source License
@Override public void run(IStructuredSelection selection, UserDBDAO userDB, OBJECT_TYPE actionType) { if (selection.isEmpty()) return;/*from w ww .j a v a 2 s .co m*/ String strObjectName = ""; Object[] arryObj = selection.toArray(); // table dao if (arryObj[0] instanceof TableDAO) { for (int i = 0; i < arryObj.length; i++) { TableDAO tcDAO = (TableDAO) arryObj[i]; strObjectName += tcDAO.getFullName() + ", "; //$NON-NLS-1$ } // column dao } else { for (int i = 0; i < arryObj.length; i++) { TableColumnDAO tcDAO = (TableColumnDAO) arryObj[i]; strObjectName += tcDAO.getField() + ", "; //$NON-NLS-1$ } } strObjectName = StringUtils.removeEnd(strObjectName, ", "); //$NON-NLS-1$ FindEditorAndWriteQueryUtil.runAtPosition(strObjectName); }
From source file:com.hangum.tadpole.rdb.core.actions.object.rdb.object.ObjectExplorerSelectionToEditorAction.java
License:Open Source License
@Override public void run(IStructuredSelection selection, UserDBDAO userDB, OBJECT_TYPE actionType) { if (selection.isEmpty()) return;//from www.j a v a2 s . c o m String strObjectName = ""; Object[] arryObj = selection.toArray(); if (arryObj[0] instanceof StructObjectDAO) { for (int i = 0; i < arryObj.length; i++) { StructObjectDAO tcDAO = (StructObjectDAO) arryObj[i]; strObjectName += tcDAO.getFullName() + ", "; //$NON-NLS-1$ } } strObjectName = StringUtils.removeEnd(strObjectName, ", "); //$NON-NLS-1$ FindEditorAndWriteQueryUtil.runAtPosition(strObjectName); }
From source file:com.hangum.tadpole.rdb.core.actions.object.rdb.object.TableColumnDeleteAction.java
License:Open Source License
@Override public void run(IStructuredSelection selection, UserDBDAO userDB, OBJECT_TYPE actionType) { if (selection.isEmpty()) return;/* w ww. ja va2 s . c o m*/ if (!MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.get().Confirm, Messages.get().TableColumnDeleteAction_2)) return; try { TableColumnObjectQuery.deleteColumn(userDB, selection.toList()); } catch (Exception e) { logger.error("Table delete column", e); MessageDialog.openError(null, Messages.get().Error, Messages.get().TableColumnDeleteAction_3 + "\n" + e.getMessage()); } // ? ? . refreshTableColumn(); }
From source file:com.hangum.tadpole.rdb.core.actions.object.rdb.object.TableColumnSelectionAction.java
License:Open Source License
@Override public void run(IStructuredSelection selection, UserDBDAO userDB, DB_ACTION actionType) { if (selection.isEmpty()) return;//from ww w . jav a2 s.c o m String strColumnName = ""; Object[] arryObj = selection.toArray(); for (int i = 0; i < arryObj.length; i++) { Object obj = arryObj[arryObj.length - i - 1]; TableColumnDAO tcDAO = (TableColumnDAO) obj; strColumnName += tcDAO.getField() + ", "; //$NON-NLS-1$ } // String strColumnName = ""; // for(Object obj : selection.toArray()) { // TableColumnDAO tcDAO = (TableColumnDAO)obj; // strColumnName += tcDAO.getField() + ", "; //$NON-NLS-1$ // } strColumnName = StringUtils.removeEnd(strColumnName, ", "); //$NON-NLS-1$ FindEditorAndWriteQueryUtil.runAtPosition(strColumnName); }