use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.
the class EditorToolBar method CreateSelectItem.
private void CreateSelectItem(Composite parent) {
ToolItem selectDbItem = new ToolItem(this, SWT.SEPARATOR);
Composite comp = createDropDownComp();
selectDbItem.setControl(comp);
selectDbItem.setWidth(SELECTDBLABEL_LENTH + SELECTDBBUTTON_LENTH);
new ToolItem(this, SWT.SEPARATOR | SWT.VERTICAL);
}
use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method createBackupPlanInfoTable.
public void createBackupPlanInfoTable(Composite parent) {
parent.setLayout(new GridLayout(1, false));
ToolBar toolBar = new ToolBar(parent, SWT.RIGHT);
toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
refreshItem.setText(com.cubrid.common.ui.cubrid.table.Messages.tablesDetailInfoPartRefreshBtn);
refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
refreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
refreshBackupPlan();
}
});
ToolItem createItem = new ToolItem(toolBar, SWT.PUSH);
createItem.setText(Messages.jobAutoInfoDetailPartCreateBackupBtn);
createItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
createItem.setEnabled(canAddOrEdit);
createItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addBackupPlan();
}
});
ToolItem editItem = new ToolItem(toolBar, SWT.PUSH);
editItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
editItem.setEnabled(canAddOrEdit);
editItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
editBackupPlan();
}
});
ToolItem deleteItem = new ToolItem(toolBar, SWT.PUSH);
deleteItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
deleteItem.setEnabled(canAddOrEdit);
deleteItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
deleteBackupPlan();
}
});
ToolItem openLogItem = new ToolItem(toolBar, SWT.PUSH);
openLogItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
openLogItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
openBackupPlanLog();
}
});
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
backupPlanInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
backupPlanInfoTable.getTable().setHeaderVisible(true);
backupPlanInfoTable.getTable().setLinesVisible(true);
backupPlanInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editBackupPlan();
}
});
final TableViewerColumn idColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
idColumn.getColumn().setWidth(80);
idColumn.getColumn().setText(Messages.backupPlanInfoTableIDColumn);
final TableViewerColumn levelColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
levelColumn.getColumn().setWidth(80);
levelColumn.getColumn().setText(Messages.backupPlanInfoTableLevelColumn);
final TableViewerColumn pathColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
pathColumn.getColumn().setWidth(200);
pathColumn.getColumn().setText(Messages.backupPlanInfoTablePathColumn);
final TableViewerColumn periodTypeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
periodTypeColumn.getColumn().setWidth(100);
periodTypeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTypeColumn);
final TableViewerColumn backupDetailColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
backupDetailColumn.getColumn().setWidth(150);
backupDetailColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodDetailColumn);
final TableViewerColumn backupTimeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
backupTimeColumn.getColumn().setWidth(90);
backupTimeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTimeColumn);
if (isSupportPeriodicAutoJob) {
final TableViewerColumn backupIntervalColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
backupIntervalColumn.getColumn().setWidth(100);
backupIntervalColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodIntervalColumn);
}
final TableViewerColumn onOffLineColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
onOffLineColumn.getColumn().setWidth(100);
onOffLineColumn.getColumn().setText(Messages.backupPlanInfoTableOnlineOfflineColumn);
backupPlanInfoTable.setContentProvider(new BackupPlanTableViewerContentProvider());
backupPlanInfoTable.setLabelProvider(new BackupPlanTableViewerLabelProvider());
backupPlanInfoTable.getTable().addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(backupPlanInfoTable.getTable());
}
});
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(backupPlanInfoTable.getTable());
backupPlanInfoTable.getTable().setMenu(contextMenu);
Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
final MenuItem createMenuItem = new MenuItem(menu, SWT.PUSH);
createMenuItem.setText(Messages.jobAutoInfoDetailPartCreateBackupBtn);
createMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
createMenuItem.setEnabled(canAddOrEdit);
createMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
addBackupPlan();
}
});
final MenuItem editMenuItem = new MenuItem(menu, SWT.PUSH);
editMenuItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
editMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
editMenuItem.setEnabled(canAddOrEdit);
editMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editBackupPlan();
}
});
final MenuItem dropMenuItem = new MenuItem(menu, SWT.PUSH);
dropMenuItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
dropMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
dropMenuItem.setEnabled(canAddOrEdit);
dropMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
deleteBackupPlan();
}
});
final MenuItem openLogMenuItem = new MenuItem(menu, SWT.PUSH);
openLogMenuItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
openLogMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
openBackupPlanLog();
}
});
backupPlanInfoTable.getTable().setMenu(menu);
}
use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method createButtonComposite.
/**
* create button composite
*
* @param parent
*/
public void createButtonComposite(Composite parent) {
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
parent.setLayout(layout);
Composite composite = new Composite(parent, SWT.None);
layout.marginHeight = 0;
composite.setLayout(new GridLayout(3, false));
composite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
infoLable = new Label(composite, SWT.None);
infoLable.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
infoLable.setText(getPartName());
new Label(composite, SWT.None).setText(" ");
errMsgLable = new Label(composite, SWT.None);
errMsgLable.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
ToolBar toolbar = new ToolBar(parent, SWT.RIGHT_TO_LEFT | SWT.WRAP | SWT.FLAT);
toolbar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
settingItem = new ToolItem(toolbar, SWT.PUSH);
settingItem.setImage(CommonUIPlugin.getImage("/icons/action/settings.png"));
settingItem.setToolTipText(Messages.databaseDashboardSettingTooltip);
settingItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
boolean useOrNot = GeneralPreference.isUseDatabaseDashboard();
ShowDashboardDialog dialog = new ShowDashboardDialog(getSite().getShell(), ShowDashboardDialog.TYPE_DB, useOrNot, autoRefreshTime);
if (dialog.open() == IDialogConstants.OK_ID) {
autoRefreshTime = dialog.getAutoRefreshSecond();
useOrNot = dialog.isUseAutoShow();
GeneralPreference.setUseDatabaseDashboard(useOrNot);
}
}
});
exportItem = new ToolItem(toolbar, SWT.PUSH);
exportItem.setImage(CubridManagerUIPlugin.getImage("icons/action/conf_export.png"));
exportItem.setToolTipText(Messages.databaseDashboardSettingTooltip);
exportItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
List<Table> exportTableList = new ArrayList<Table>();
if (CompatibleUtil.isSupportGetCPUAndMemoryInfo(database.getDatabaseInfo())) {
exportTableList.add(dbInfoTableViewer.getTable());
}
exportTableList.add(volumnInfoTableViewer.getTable());
exportTableList.add(brokerInfoTableViewer.getTable());
exportTableList.add(lockAndTransactionTable);
String[] excelSheetNames = { Messages.exportDashboardDBTableTitle, Messages.exportDashboardVolumnTableTitle, Messages.exportDashboardBrokerTableTitle, Messages.exportDashboardLockTableTitle };
new ExportDashboardDialog(Display.getCurrent().getActiveShell(), exportTableList, database.getDatabaseInfo().getDbName(), excelSheetNames).open();
}
});
new ToolItem(toolbar, SWT.SEPARATOR | SWT.VERTICAL);
autoRefreshItem = new ToolItem(toolbar, SWT.PUSH);
autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh_disabled.png"));
autoRefreshItem.setToolTipText(Messages.databaseDashboardStartAutoRefreshTooltip);
autoRefreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (autoRefreshData) {
autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh_disabled.png"));
autoRefreshItem.setToolTipText(Messages.databaseDashboardStartAutoRefreshTooltip);
stopAutoRefreshData();
} else {
autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh.png"));
autoRefreshItem.setToolTipText(Messages.databaseDashboardStopAutoRefreshTooltip);
startAutoRefreshData();
}
autoRefreshData = !autoRefreshData;
}
});
}
use of org.eclipse.swt.widgets.ToolItem in project tdi-studio-se by Talend.
the class TalendPaletteViewer method creatToolControl.
/**
* FIXME ggu
*
* Because the method createControl is final in super calss ScrollingGraphicalViewer,
*
* Then, use the reflection function to move to class TalendPaletteViewerProvider.
*/
// @Override
// public Control createControl(Composite parent) {
// FigureCanvas canvas = new TalendFigureCanvas(parent, getLightweightSystem(), this);
// setControl(canvas);
// installRootFigure(); // change the parent method to "protected".
// return canvas;
// }
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.ui.parts.ScrollingGraphicalViewer#creatToolControl(org.eclipse.swt.widgets.Composite)
*/
public Control creatToolControl(Composite parent) {
Composite container = new Composite(parent, SWT.BORDER);
// GridLayout layout = new GridLayout(3, false);
GridLayout layout = new GridLayout(2, false);
layout.marginLeft = 0;
layout.marginRight = 0;
layout.marginTop = 0;
layout.marginBottom = 0;
layout.marginHeight = 0;
layout.marginWidth = 0;
container.setLayout(layout);
final Text text = new Text(container, SWT.NONE);
GridData textGridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
textGridData.horizontalIndent = 0;
textGridData.verticalIndent = 0;
text.setLayoutData(textGridData);
filters.add(text);
initFilterTextControl(text);
ToolBar toolbar = new ToolBar(container, SWT.NONE);
Color searchButtonForgroundColor = cssStyleSetting.getSearchButtonBackgroundColor();
if (searchButtonForgroundColor != null) {
toolbar.setBackground(searchButtonForgroundColor);
}
GridLayout toolbarLayout = new GridLayout();
toolbarLayout.marginLeft = 0;
toolbarLayout.marginRight = 0;
toolbarLayout.marginTop = 0;
toolbarLayout.marginBottom = 0;
toolbarLayout.marginHeight = 0;
toolbarLayout.marginWidth = 0;
toolbar.setLayout(toolbarLayout);
Image findImage = cssStyleSetting.getSearchButtonImage();
if (findImage == null) {
findImage = ImageProvider.getImage(EImage.FIND_ICON);
}
ToolItem findItem = new ToolItem(toolbar, SWT.NONE);
findItem.setImage(findImage);
findItem.setToolTipText("Search");
findItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
startFiltering(text);
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
// });
return container;
}
use of org.eclipse.swt.widgets.ToolItem in project tdi-studio-se by Talend.
the class OutputDataMapTableView method createFiltersDropDown.
private void createFiltersDropDown() {
// itemDropDown = new ToolItem(toolBarActions, SWT.PUSH);
itemDropDown = new ToolItem(toolBarActions, SWT.ARROW);
//$NON-NLS-1$
itemDropDown.setToolTipText(Messages.getString("DataMapTableView.buttonTooltip.addFilterRow"));
itemDropDown.setImage(ImageProviderMapper.getImage(ImageInfo.ADD_FILTER_ICON));
menu = new Menu(this);
itemDropDown.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Rectangle bounds = itemDropDown.getBounds();
Point point = toolBarActions.toDisplay(bounds.x, bounds.y + bounds.height);
menu.setLocation(point);
menu.setVisible(true);
}
});
MenuItem addWhereClauses = new MenuItem(menu, SWT.PUSH);
//$NON-NLS-1$
addWhereClauses.setText(Messages.getString("DataMapTableView.buttonTooltip.menu.addWhereClauses"));
addWhereClauses.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onFiltersToolItemsSelected(e, extendedTableViewerForFilters.getTableViewerCreator(), FilterTableEntry.WHERE_FILTER);
}
});
MenuItem addOtherClauses = new MenuItem(menu, SWT.PUSH);
//$NON-NLS-1$
addOtherClauses.setText(Messages.getString("DataMapTableView.buttonTooltip.menu.addOtherClauses"));
addOtherClauses.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onFiltersToolItemsSelected(e, entendedTableViewerForOtherClauses.getTableViewerCreator(), FilterTableEntry.OTHER_FILTER);
}
});
}
Aggregations