use of org.eclipse.swt.widgets.Table in project cubrid-manager by CUBRID.
the class FavoriteQueryNavigatorView method addFavoriteByFileLink.
private void addFavoriteByFileLink(String basepath, String filename, String memo, String charset) {
FavoriteQueryPersistUtil.getInstance().addFavorite(basepath, filename, memo, charset, false);
reloadFavoriteQuery();
Table table = tv.getTable();
table.deselectAll();
if (table.getItemCount() > 0) {
table.select(table.getItemCount() - 1);
}
}
use of org.eclipse.swt.widgets.Table in project cubrid-manager by CUBRID.
the class CubridIndexNavigatorView method createPartControl.
public void createPartControl(Composite parent) {
tableIndexTableViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
Table columnsTable = tableIndexTableViewer.getTable();
columnsTable.setLinesVisible(true);
columnsTable.setHeaderVisible(true);
final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
pkColumn.setAlignment(SWT.LEFT);
pkColumn.setWidth(40);
pkColumn.setText(Messages.lblIndexType);
final TableColumn indexNameColumn = new TableColumn(columnsTable, SWT.NONE);
indexNameColumn.setAlignment(SWT.LEFT);
indexNameColumn.setWidth(80);
indexNameColumn.setText(Messages.tblColumnIndexName);
final TableColumn onColumn = new TableColumn(columnsTable, SWT.NONE);
onColumn.setAlignment(SWT.LEFT);
onColumn.setWidth(90);
onColumn.setText(Messages.tblColumnOnColumns);
tableIndexTableViewer.setContentProvider(new CubridIndexNavigatorContentProvider());
tableIndexTableViewer.setLabelProvider(new CubridIndexNavigatorLabelProvider());
}
use of org.eclipse.swt.widgets.Table in project cubrid-manager by CUBRID.
the class CubridColumnNavigatorView method createPartControl.
public void createPartControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
{
GridLayout gl = new GridLayout(1, false);
comp.setLayout(gl);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
comp.setLayoutData(gd);
}
lblSchemaName = new Label(comp, SWT.NONE);
lblSchemaName.setText(com.cubrid.common.ui.common.Messages.lblQuickViewColInfo);
{
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
lblSchemaName.setLayoutData(gd);
}
tableColTableViewer = new TableViewer(comp, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
{
GridData gd = new GridData(GridData.FILL_BOTH);
tableColTableViewer.getTable().setLayoutData(gd);
tableColTableViewer.getTable().setToolTipText(com.cubrid.common.ui.common.Messages.miniSchemaCopyColumnTooltip);
final MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
final Menu contextMenu = menuManager.createContextMenu(tableColTableViewer.getTable());
tableColTableViewer.getTable().setMenu(contextMenu);
final Menu copyMenu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
tableColTableViewer.getTable().setMenu(copyMenu);
tableColTableViewer.getTable().addKeyListener(new org.eclipse.swt.events.KeyAdapter() {
public void keyPressed(org.eclipse.swt.events.KeyEvent event) {
if ((event.stateMask & SWT.CTRL) != 0 && (event.stateMask & SWT.SHIFT) == 0 && event.keyCode == 'c') {
copyColumnListToClipboard(",");
}
}
});
final MenuItem copyMenuItem = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyColumnWithComma);
copyMenuItem.setAccelerator(SWT.CTRL + 'C');
copyMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copyColumnListToClipboard(",");
}
});
final MenuItem copyMenuItem2 = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem2.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyColumnWithNewline);
copyMenuItem2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copyColumnListToClipboard(StringUtil.NEWLINE);
}
});
new MenuItem(copyMenu, SWT.SEPARATOR);
final MenuItem copyMenuItem3 = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem3.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopySelectQuery);
copyMenuItem3.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copySelectSQLToClipboard();
}
});
final MenuItem copyMenuItem4 = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem4.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyInsertQuery);
copyMenuItem4.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copyInsertSQLToClipboard();
}
});
final MenuItem copyMenuItem5 = new MenuItem(copyMenu, SWT.PUSH);
copyMenuItem5.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyUpdateQuery);
copyMenuItem5.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
copyUpdateSQLToClipboard();
}
});
}
Table columnsTable = tableColTableViewer.getTable();
columnsTable.setLinesVisible(true);
columnsTable.setHeaderVisible(true);
final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
pkColumn.setAlignment(SWT.CENTER);
pkColumn.setWidth(30);
pkColumn.setText(Messages.tblColumnPK);
final TableColumn nameColumn = new TableColumn(columnsTable, SWT.NONE);
nameColumn.setWidth(90);
nameColumn.setText(Messages.tblColumnName);
final TableColumn dataTypeColumn = new TableColumn(columnsTable, SWT.NONE);
dataTypeColumn.setWidth(120);
dataTypeColumn.setText(Messages.tblColumnDataType);
final TableColumn defaultColumn = new TableColumn(columnsTable, SWT.NONE);
defaultColumn.setWidth(98);
defaultColumn.setText(Messages.tblColumnDefault);
final TableColumn autoIncrTableColumn = new TableColumn(columnsTable, SWT.NONE);
autoIncrTableColumn.setAlignment(SWT.CENTER);
autoIncrTableColumn.setWidth(100);
autoIncrTableColumn.setText(Messages.tblColumnAutoIncr);
final TableColumn notNullColumn = new TableColumn(columnsTable, SWT.NONE);
notNullColumn.setWidth(70);
notNullColumn.setText(Messages.tblColumnNotNull);
notNullColumn.setAlignment(SWT.CENTER);
final TableColumn uniqueColumn = new TableColumn(columnsTable, SWT.NONE);
uniqueColumn.setWidth(70);
uniqueColumn.setText(Messages.tblColumnUnique);
uniqueColumn.setAlignment(SWT.CENTER);
final TableColumn sharedColumn = new TableColumn(columnsTable, SWT.NONE);
sharedColumn.setWidth(60);
sharedColumn.setResizable(false);
sharedColumn.setText(Messages.tblColumnShared);
sharedColumn.setAlignment(SWT.CENTER);
final TableColumn inheritColumn = new TableColumn(columnsTable, SWT.NONE);
inheritColumn.setAlignment(SWT.CENTER);
inheritColumn.setWidth(90);
inheritColumn.setResizable(false);
inheritColumn.setText(Messages.tblColumnInherit);
final TableColumn classColumn = new TableColumn(columnsTable, SWT.NONE);
classColumn.setWidth(90);
classColumn.setResizable(false);
classColumn.setText(Messages.tblColumnClass);
classColumn.setAlignment(SWT.CENTER);
}
use of org.eclipse.swt.widgets.Table in project LAMSADE-tools by LAntoine.
the class Tester method main.
public static void main(String[] args) throws SQLException {
System.setProperty("SWT_GTK3", "0");
Display display = new Display();
Shell shell = new Shell(display);
// shell.setSize(300, 300);
shell.setText("Conference List");
GridLayout gridLayout = new GridLayout();
shell.setLayout(gridLayout);
shell.setLocation(400, 200);
shell.layout(true, true);
final Point newSize = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
shell.setSize(new Point(888, 661));
/*
* Initialize Group conferencesInfos which will include : -The Grid data
* which will display conferences
*
* -The fields that will allow the user to add a new conference in the
* database
*/
Group grpUserDetails = new Group(shell, SWT.NONE);
GridData gd_grpUserDetails = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_grpUserDetails.widthHint = 848;
gd_grpUserDetails.heightHint = 155;
grpUserDetails.setLayoutData(gd_grpUserDetails);
grpUserDetails.setText("User Details");
Label lblFirstname = new Label(grpUserDetails, SWT.NONE);
lblFirstname.setBounds(10, 26, 70, 15);
lblFirstname.setText("First Name");
Label lblNewLabel_1 = new Label(grpUserDetails, SWT.NONE);
lblNewLabel_1.setBounds(10, 53, 55, 15);
lblNewLabel_1.setText("Last Name");
txt_firstname = new Text(grpUserDetails, SWT.BORDER);
txt_firstname.setBounds(86, 23, 98, 21);
txt_lastname = new Text(grpUserDetails, SWT.BORDER);
txt_lastname.setBounds(86, 50, 98, 21);
/*
* Handle the User Info's Search Throws exception if firstname or
* lastname is wrong
*/
Button btn_searchInfo = new Button(grpUserDetails, SWT.NONE);
btn_searchInfo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
try {
UserDetails user = GetInfosFromYearbook.getUserDetails(txt_lastname.getText(), txt_firstname.getText());
txt_function.setText(user.getFunction());
txt_number.setText(user.getNumber());
txt_email.setText(user.getEmail());
txt_group.setText(user.getGroup());
txt_fax.setText(user.getFax());
txt_office.setText(user.getOffice());
txt_city_ud.setText(user.getCity());
txt_country_ud.setText(user.getCountry());
} catch (@SuppressWarnings("unused") Exception e) {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setText("Error");
mb.setMessage("Please verify firstname and lastname");
mb.open();
}
}
});
btn_searchInfo.setBounds(10, 87, 114, 25);
btn_searchInfo.setText("Search My Infos");
Label lbl_function = new Label(grpUserDetails, SWT.NONE);
lbl_function.setBounds(224, 26, 55, 15);
lbl_function.setText("Function");
Label lbl_number = new Label(grpUserDetails, SWT.NONE);
lbl_number.setBounds(224, 56, 55, 15);
lbl_number.setText("Phone");
Label lbl_email = new Label(grpUserDetails, SWT.NONE);
lbl_email.setBounds(224, 92, 55, 15);
lbl_email.setText("E-mail");
Label lbl_group = new Label(grpUserDetails, SWT.NONE);
lbl_group.setBounds(224, 124, 55, 15);
lbl_group.setText("Group");
txt_function = new Text(grpUserDetails, SWT.BORDER);
txt_function.setBounds(285, 20, 219, 21);
txt_number = new Text(grpUserDetails, SWT.BORDER);
txt_number.setBounds(285, 53, 219, 21);
txt_email = new Text(grpUserDetails, SWT.BORDER);
txt_email.setBounds(285, 87, 219, 21);
txt_group = new Text(grpUserDetails, SWT.BORDER);
txt_group.setBounds(285, 121, 219, 21);
Label lbl_fax = new Label(grpUserDetails, SWT.NONE);
lbl_fax.setText("Fax");
lbl_fax.setBounds(535, 26, 55, 15);
Label lbl_office = new Label(grpUserDetails, SWT.NONE);
lbl_office.setText("Office");
lbl_office.setBounds(535, 59, 55, 15);
Label lbl_city = new Label(grpUserDetails, SWT.NONE);
lbl_city.setText("City");
lbl_city.setBounds(535, 92, 55, 15);
Label lbl_country = new Label(grpUserDetails, SWT.NONE);
lbl_country.setText("Country");
lbl_country.setBounds(535, 124, 55, 15);
txt_fax = new Text(grpUserDetails, SWT.BORDER);
txt_fax.setBounds(596, 23, 219, 21);
txt_office = new Text(grpUserDetails, SWT.BORDER);
txt_office.setBounds(596, 56, 219, 21);
txt_city_ud = new Text(grpUserDetails, SWT.BORDER);
txt_city_ud.setBounds(596, 89, 219, 21);
txt_country_ud = new Text(grpUserDetails, SWT.BORDER);
txt_country_ud.setBounds(596, 121, 219, 21);
Group grp_conferencesInfos = new Group(shell, SWT.NONE);
GridData gd_conferencesInfos = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_conferencesInfos.heightHint = 237;
gd_conferencesInfos.widthHint = 854;
grp_conferencesInfos.setLayoutData(gd_conferencesInfos);
grp_conferencesInfos.setText("Conferences");
Table table = new Table(grp_conferencesInfos, SWT.V_SCROLL);
table.setBounds(165, 16, 502, 134);
table.setHeaderVisible(true);
fillConferenceTable(table);
Button btn_addNewConf = new Button(grp_conferencesInfos, SWT.NONE);
btn_addNewConf.setBounds(165, 156, 149, 25);
btn_addNewConf.setText("Create conference");
Label lblTitle = new Label(grp_conferencesInfos, SWT.NONE);
lblTitle.setAlignment(SWT.RIGHT);
lblTitle.setBounds(25, 16, 50, 15);
lblTitle.setText("Title");
Text txt_title = new Text(grp_conferencesInfos, SWT.BORDER);
txt_title.setBounds(81, 15, 78, 21);
Label lblUrl = new Label(grp_conferencesInfos, SWT.NONE);
lblUrl.setAlignment(SWT.RIGHT);
lblUrl.setText("URL");
lblUrl.setBounds(25, 45, 50, 15);
Text txt_url = new Text(grp_conferencesInfos, SWT.BORDER);
txt_url.setBounds(81, 42, 78, 21);
Label lblStartDate = new Label(grp_conferencesInfos, SWT.NONE);
lblStartDate.setAlignment(SWT.RIGHT);
lblStartDate.setText("Start Date");
lblStartDate.setBounds(10, 72, 65, 15);
Text txt_startDate = new Text(grp_conferencesInfos, SWT.BORDER);
txt_startDate.setBounds(81, 69, 78, 21);
Label lblEndDate = new Label(grp_conferencesInfos, SWT.NONE);
lblEndDate.setAlignment(SWT.RIGHT);
lblEndDate.setText("End Date");
lblEndDate.setBounds(10, 99, 65, 15);
Text txt_endDate = new Text(grp_conferencesInfos, SWT.BORDER);
txt_endDate.setBounds(81, 96, 78, 21);
Label lblFee = new Label(grp_conferencesInfos, SWT.NONE);
lblFee.setText("Fee");
lblFee.setBounds(42, 126, 33, 15);
Text txt_fee = new Text(grp_conferencesInfos, SWT.BORDER);
txt_fee.setBounds(81, 123, 78, 21);
// add news fields
/*
* Label lblCity= new Label(grp_conferencesInfos, SWT.NONE);
* lblCity.setAlignment(SWT.RIGHT); lblCity.setBounds(25, 38, 50, 15);
* lblCity.setText("City"); Text txt_city = new
* Text(grp_conferencesInfos, SWT.BORDER); txt_city.setBounds(81, 35,
* 78, 21);
*/
Label lblCity = new Label(grp_conferencesInfos, SWT.NONE);
lblCity.setAlignment(SWT.RIGHT);
lblCity.setBounds(25, 153, 50, 15);
lblCity.setText("City");
Text txt_city = new Text(grp_conferencesInfos, SWT.BORDER);
txt_city.setBounds(81, 150, 78, 21);
Label lbladdress = new Label(grp_conferencesInfos, SWT.NONE);
lbladdress.setAlignment(SWT.RIGHT);
lbladdress.setBounds(25, 180, 50, 15);
lbladdress.setText("Address");
Text txt_address = new Text(grp_conferencesInfos, SWT.BORDER);
txt_address.setBounds(81, 177, 78, 21);
// Create new Conference object, assign it values from
// selection, then pass it function to export to desktop
// public Conference(int id, String title, String url, LocalDate
// start_date, LocalDate end_date, double entry_fee)
Button btnExportEvent = new Button(grp_conferencesInfos, SWT.NONE);
btnExportEvent.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/M/yyyy");
TableItem[] ti = table.getSelection();
if (ti.length == 0) {
// Put somewhere that an event should be selected
} else {
Conference conf = new Conference(ti[0].getText(0), ti[0].getText(1), LocalDate.parse(ti[0].getText(2), formatter), LocalDate.parse(ti[0].getText(3), formatter), Double.parseDouble(ti[0].getText(4)), ti[0].getText(5), ti[0].getText(6));
try {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFilterNames(new String[] { "Calendar Files", "All Files (*.*)" });
// Windows
dialog.setFilterExtensions(new String[] { "*.ics", "*.*" });
switch(Util.getOS()) {
case WINDOWS:
dialog.setFilterPath("c:\\");
break;
case LINUX:
dialog.setFilterPath("/");
break;
case MAC:
dialog.setFilterPath("/");
break;
case SOLARIS:
dialog.setFilterPath("/");
break;
default:
dialog.setFilterPath("/");
}
dialog.setFileName("conference.ics");
conf.generateCalendarFile(dialog.open());
} catch (IOException | ValidationException | ParserException e2) {
e2.printStackTrace();
}
}
}
});
btnExportEvent.setBounds(320, 154, 104, 28);
btnExportEvent.setText("Export Event");
/*
* Behavior of a click on the add new conference button
*/
btn_addNewConf.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
System.out.println("Appui sur le bouton");
if (!txt_title.getText().isEmpty() && !txt_url.getText().isEmpty() && !txt_startDate.getText().isEmpty() && !txt_startDate.getText().isEmpty() && !txt_endDate.getText().isEmpty() && !txt_fee.getText().isEmpty()) {
try {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
LocalDate startDate = LocalDate.parse(txt_startDate.getText(), formatter);
LocalDate endDate = LocalDate.parse(txt_endDate.getText(), formatter);
Conference conf = new Conference(txt_title.getText(), txt_url.getText(), startDate, endDate, Double.parseDouble(txt_fee.getText()), txt_city.getText(), txt_address.getText());
ConferenceDatabase.insertInDatabase(conf);
/*
* Reload the conference table
*/
table.removeAll();
fillConferenceTable(table);
} catch (DateTimeParseException e1) {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setText("Date format error");
mb.setMessage("Please fill the dates in the following format : dd/MM/YYYY");
mb.open();
} catch (SQLException e2) {
throw new IllegalStateException(e2);
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setText("Information missing");
mb.setMessage("Please fill in the information regarding the conference");
mb.open();
}
}
});
/*
* This group will help the user to see his itinerary into the browser
*/
Group grp_map = new Group(shell, SWT.NONE);
grp_map.setText("Visualize your travel");
GridData gd_map = new GridData(SWT.LEFT, SWT.CENTER, false, true, 1, 1);
gd_map.heightHint = 85;
gd_map.widthHint = 860;
grp_map.setLayoutData(gd_map);
Text departure = new Text(grp_map, SWT.BORDER);
departure.setLocation(101, 22);
departure.setSize(196, 21);
Text arrival = new Text(grp_map, SWT.BORDER);
arrival.setLocation(101, 51);
arrival.setSize(196, 21);
Button btnItinerary = new Button(grp_map, SWT.NONE);
btnItinerary.setText("Validate");
btnItinerary.setBounds(303, 49, 68, 25);
Label lblDeparture = new Label(grp_map, SWT.NONE);
lblDeparture.setAlignment(SWT.RIGHT);
lblDeparture.setBounds(10, 25, 73, 15);
lblDeparture.setText("Departure");
Label lblArrival = new Label(grp_map, SWT.NONE);
lblArrival.setAlignment(SWT.RIGHT);
lblArrival.setBounds(10, 54, 73, 15);
lblArrival.setText("Arrival");
/*
* Behavior of the btnItinerary : Takes the addresses entered in
* departure and arrival Texts and call the ItineraryMap class to open
* the itinerary into the browser
*/
btnItinerary.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
System.out.println("Appui sur le bouton");
if (!departure.getText().isEmpty() && !arrival.getText().isEmpty()) {
try {
AddressInfos dep = new AddressInfos(departure.getText());
AddressInfos arr = new AddressInfos(arrival.getText());
// ItineraryMap itinerary = new
// ItineraryMap(dep.getLongitude(),
// dep.getLatitude(),arr.getLongitude(),
// arr.getLatitude());
GoogleItineraryMap itinerary = new GoogleItineraryMap(departure.getText(), arrival.getText());
String url = itinerary.setMapUrl();
System.out.println(url);
itinerary.openMapUrl(url);
} catch (IllegalArgumentException e) {
LOGGER.error("Error : ", e);
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setText("Infromation missing");
mb.setMessage("Please fill in the departure and arrival fields");
mb.open();
}
}
});
arrival.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
System.out.println("nouvelle valeur = " + ((Text) e.widget).getText());
}
});
departure.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
System.out.println("nouvelle valeur = " + ((Text) e.widget).getText());
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
use of org.eclipse.swt.widgets.Table in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method createVolumnComposite.
/**
* create volumn information composite
*
* @param bar ExpandBar
* @param bar index
*
*/
public void createVolumnComposite(ExpandBar bar, int index) {
ExpandItem volumnItem = new ExpandItem(bar, SWT.NONE, index);
volumnItem.setText(Messages.exportDashboardVolumnTableTitle);
Composite volumnComposite = new Composite(bar, SWT.NONE);
volumnComposite.setLayout(new FillLayout());
volumnInfoTableViewer = new TableViewer(volumnComposite, SWT.BORDER | SWT.FULL_SELECTION);
volumnInfoTableViewer.getTable().setHeaderVisible(true);
volumnInfoTableViewer.getTable().setLinesVisible(true);
final TableViewerColumn columnVolumn = new TableViewerColumn(volumnInfoTableViewer, SWT.CENTER);
columnVolumn.getColumn().setWidth(140);
columnVolumn.getColumn().setText(Messages.volumnTableVolumnNameColumnLabel);
columnVolumn.getColumn().setToolTipText(Messages.volumnTableVolumnNameColumnLabel);
final TableViewerColumn columnType = new TableViewerColumn(volumnInfoTableViewer, SWT.CENTER);
columnType.getColumn().setWidth(90);
columnType.getColumn().setText(Messages.volumnTableVolumnTypeColumnLabel);
columnType.getColumn().setToolTipText(Messages.volumnTableVolumnTypeColumnLabel);
final TableViewerColumn columnFreeSize = new TableViewerColumn(volumnInfoTableViewer, SWT.RIGHT);
columnFreeSize.getColumn().setWidth(90);
columnFreeSize.getColumn().setText(Messages.volumnTableFreesizeColumnLabel);
columnFreeSize.getColumn().setToolTipText(Messages.volumnTableFreesizeColumnLabel);
final TableViewerColumn columnTotalSize = new TableViewerColumn(volumnInfoTableViewer, SWT.RIGHT);
columnTotalSize.getColumn().setWidth(90);
columnTotalSize.getColumn().setText(Messages.volumnTableTotalsizeColumnLabel);
columnTotalSize.getColumn().setToolTipText(Messages.volumnTableTotalsizeColumnLabel);
final TableViewerColumn lastModifyDate = new TableViewerColumn(volumnInfoTableViewer, SWT.CENTER);
lastModifyDate.getColumn().setWidth(90);
lastModifyDate.getColumn().setText(Messages.volumnTableLastModifyTimeColumnLabel);
lastModifyDate.getColumn().setToolTipText(Messages.volumnTableLastModifyTimeColumnLabel);
final TableViewerColumn columnLocation = new TableViewerColumn(volumnInfoTableViewer, SWT.LEFT);
columnLocation.getColumn().setWidth(300);
columnLocation.getColumn().setText(Messages.tblColumnVolPath);
columnLocation.getColumn().setToolTipText(Messages.tblColumnVolPath);
volumnInfoTableViewer.setContentProvider(new TableContentProvider());
volumnInfoTableViewer.setLabelProvider(new TableLabelProvider());
Table table = volumnInfoTableViewer.getTable();
table.setLinesVisible(true);
table.setHeaderVisible(true);
volumnInfoTableViewer.setInput(volumnInfoListData);
volumnItem.setControl(volumnComposite);
volumnItem.setHeight(130);
volumnItem.setExpanded(true);
Menu menu = new Menu(this.getSite().getShell(), SWT.POP_UP);
final MenuItem itemAddVolumn = new MenuItem(menu, SWT.PUSH);
itemAddVolumn.setText(com.cubrid.cubridmanager.ui.spi.Messages.setAddVolumeActionName);
itemAddVolumn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DefaultSchemaNode node = null;
for (ICubridNode cubridNode : database.getChildren()) {
if (cubridNode.getType().equals(CubridNodeType.DBSPACE_FOLDER)) {
node = (DefaultSchemaNode) cubridNode;
}
}
if (node == null) {
return;
}
// Gets the status of adding volume
GetAddVolumeStatusInfo getAddVolumeStatusInfo = new GetAddVolumeStatusInfo();
final CommonQueryTask<GetAddVolumeStatusInfo> statusTask = new CommonQueryTask<GetAddVolumeStatusInfo>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), getAddVolumeStatusInfo);
statusTask.setDbName(database.getLabel());
TaskExecutor taskExecutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.cubrid.dbspace.Messages.getVolumeInfoTaskName);
taskExecutor.addTask(statusTask);
CommonQueryTask<DbSpaceInfoList> spaceInfoTask = null;
DatabaseInfo databaseInfo = database.getDatabaseInfo();
DbSpaceInfoList dbSpaceInfoList = databaseInfo.getDbSpaceInfoList();
int pageSize = 0;
if (null == dbSpaceInfoList) {
dbSpaceInfoList = new DbSpaceInfoList();
spaceInfoTask = new CommonQueryTask<DbSpaceInfoList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), dbSpaceInfoList);
spaceInfoTask.setDbName(database.getLabel());
taskExecutor.addTask(spaceInfoTask);
}
new ExecTaskWithProgress(taskExecutor).busyCursorWhile();
if (spaceInfoTask == null) {
pageSize = dbSpaceInfoList.getPagesize();
} else {
final DbSpaceInfoList model = ((CommonQueryTask<DbSpaceInfoList>) spaceInfoTask).getResultModel();
pageSize = model.getPagesize();
}
getAddVolumeStatusInfo = statusTask.getResultModel();
//open add volumn dialog
AddVolumeDialog addVolumeDialog = new AddVolumeDialog(getSite().getShell());
addVolumeDialog.setGetAddVolumeStatusInfo(getAddVolumeStatusInfo);
addVolumeDialog.initPara(node);
addVolumeDialog.setTreeViewer(CubridNavigatorView.getNavigatorView("com.cubrid.cubridmanager.host.navigator").getViewer());
addVolumeDialog.setPageSize(pageSize);
int returnCode = addVolumeDialog.open();
//if add volumn refresh table
if (returnCode == IDialogConstants.OK_ID) {
volumnInfoListData.clear();
loadVolumnsInfo();
volumnInfoTableViewer.refresh();
}
}
});
volumnInfoTableViewer.getTable().setMenu(menu);
tableViewOnBarIndexMap.put(volumnInfoTableViewer, index);
}
Aggregations