Search in sources :

Example 86 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class ShardKeysPanel method buildKeyList.

private void buildKeyList(Composite parent) {
    Group keyListGroup = new Group(parent, SWT.NONE);
    keyListGroup.setText(Messages.shardKeyList);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 1;
    keyListGroup.setLayoutData(gridData);
    GridLayout layout = new GridLayout();
    keyListGroup.setLayout(layout);
    keyListToolBar = new ToolBar(keyListGroup, SWT.FLAT);
    insertKeyItem = new ToolItem(keyListToolBar, SWT.PUSH);
    insertKeyItem.setToolTipText(Messages.AddKey);
    insertKeyItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert.png"));
    insertKeyItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert_disabled.png"));
    insertKeyItem.setEnabled(true);
    deletekeyItem = new ToolItem(keyListToolBar, SWT.PUSH);
    deletekeyItem.setToolTipText(Messages.deleteKey);
    deletekeyItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete.png"));
    deletekeyItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete_disabled.png"));
    deletekeyItem.setEnabled(false);
    keyListColumnNameArrs = new String[] { Messages.tblKeyColumnName };
    int[] columnwidthArr = new int[] { 180 };
    keyListTableViewer = CommonUITool.createCommonTableViewer(keyListGroup, null, keyListColumnNameArrs, columnwidthArr, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 320));
    keyListTable = keyListTableViewer.getTable();
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 87 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class ShardKeysPanel method buildKeyInfo.

private void buildKeyInfo(Composite parent) {
    keyInfoGroup = new Group(parent, SWT.NONE);
    keyInfoGroup.setText(Messages.shardKeyInfo);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    keyInfoGroup.setLayoutData(gridData);
    GridLayout layout = new GridLayout();
    keyInfoGroup.setLayout(layout);
    keyInfoToolBar = new ToolBar(keyInfoGroup, SWT.FLAT);
    insertKeyInfoItem = new ToolItem(keyInfoToolBar, SWT.PUSH);
    insertKeyInfoItem.setToolTipText(Messages.addData);
    insertKeyInfoItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert.png"));
    insertKeyInfoItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert_disabled.png"));
    insertKeyInfoItem.setEnabled(false);
    deletekeyInfoItem = new ToolItem(keyInfoToolBar, SWT.PUSH);
    deletekeyInfoItem.setToolTipText(Messages.deleteData);
    deletekeyInfoItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete.png"));
    deletekeyInfoItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete_disabled.png"));
    deletekeyInfoItem.setEnabled(false);
    keyInfoColumnNameArrs = new String[] { Messages.tblMin, Messages.tblMax, Messages.tblShardId };
    int[] columnwidthArr = new int[] { 100, 100, 200 };
    keyInfoTableViewer = CommonUITool.createCommonTableViewer(keyInfoGroup, null, keyInfoColumnNameArrs, columnwidthArr, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 320));
    keyInfoTable = keyInfoTableViewer.getTable();
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 88 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class DBSpaceLabelProvider method createButtonComposite.

private void createButtonComposite(Composite parent) {
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    parent.setLayout(layout);
    infoLable = new Label(parent, SWT.None);
    infoLable.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.itemSetting);
    settingItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            boolean useOrNot = GeneralPreference.isUseHostDashboard();
            ShowDashboardDialog dialog = new ShowDashboardDialog(getSite().getShell(), ShowDashboardDialog.TYPE_HOST, useOrNot, -1);
            if (dialog.open() == IDialogConstants.OK_ID) {
                useOrNot = dialog.isUseAutoShow();
                GeneralPreference.setUseHostDashboard(useOrNot);
            }
        }
    });
    saveItem = new ToolItem(toolbar, SWT.PUSH);
    saveItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/file_save.png"));
    saveItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/file_save_disabled.png"));
    saveItem.setToolTipText(Messages.saveAutoStartipLabel);
    saveItem.setEnabled(false);
    saveItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            saveAutoParam(getNewAutoStartDB());
        }
    });
    exportItem = new ToolItem(toolbar, SWT.PUSH);
    exportItem.setImage(CubridManagerUIPlugin.getImage("icons/action/conf_export.png"));
    exportItem.setToolTipText(Messages.itemExport);
    exportItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            new ExportHostStatusDialog(Display.getCurrent().getActiveShell(), HostDashboardEditor.this).open();
        }
    });
    refreshItem = new ToolItem(toolbar, SWT.PUSH);
    refreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.setToolTipText(Messages.itemRefresh);
    refreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            loadAllData();
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ShowDashboardDialog(com.cubrid.common.ui.common.preference.ShowDashboardDialog) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 89 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class EditCMCubridBrokerConfPart method createToolBarComp.

/**
	 * create tool barcomp
	 * @param parent
	 */
public void createToolBarComp(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    comp.setLayoutData(gd);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = -1;
    comp.setLayout(layout);
    ToolBar toolbar = new ToolBar(comp, SWT.LEFT_TO_RIGHT | SWT.FLAT);
    toolbar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
    saveCubridBrokerConfItem = new ToolItem(toolbar, SWT.PUSH);
    saveCubridBrokerConfItem.setImage(CubridManagerUIPlugin.getImage("icons/queryeditor/file_save.png"));
    saveCubridBrokerConfItem.setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.msgTipSaveAction);
    saveCubridBrokerConfItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            //check whether contains duplicate property name
            String errMsg = editorComp.validate();
            if (errMsg != null) {
                CommonUITool.openErrorBox(errMsg);
                return;
            }
            doSave();
        }
    });
    // Show/hide of the history pane
    saveAsCubridBrokerConfItem = new ToolItem(toolbar, SWT.PUSH);
    saveAsCubridBrokerConfItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/file_saveas.png"));
    saveAsCubridBrokerConfItem.setToolTipText(Messages.cubridBrokerConfEditorSaveAsItemLabel);
    saveAsCubridBrokerConfItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            //check whether contains duplicate property name
            String errMsg = editorComp.validate();
            if (errMsg != null) {
                CommonUITool.openErrorBox(errMsg);
                return;
            }
            ExportConfigDialog dialog = new ExportConfigDialog(getSite().getShell(), ConfigType.CUBRID_BROKER, true);
            if (defaultExportFilePath != null && !"".equals(defaultExportFilePath)) {
                dialog.setDefaultFilePath(defaultExportFilePath);
            }
            if (defaultExportFileName != null && !"".equals(defaultExportFileName)) {
                dialog.setDefaultFileName(defaultExportFileName);
            }
            if (defaultExportFileExtName != null && !"".equals(defaultExportFileExtName)) {
                dialog.setDefaultFileExtName(defaultExportFileExtName);
            }
            if (defaultExportFileCharset != null && !"".equals(defaultExportFileCharset)) {
                dialog.setOutputFileCharset(defaultExportFileCharset);
            }
            if (dialog.open() == Dialog.OK) {
                defaultExportFilePath = dialog.getDefaultFilePath();
                defaultExportFileName = dialog.getDefaultFileName();
                defaultExportFileExtName = dialog.getDefaultFileExtName();
                String fileFullName = dialog.getOutputFileFullName();
                defaultExportFileCharset = dialog.getOutputFileCharset();
                BrokerConfig cubridBrokerConfig = editorComp.getBrokerConfig();
                errMsg = editorComp.validate();
                if (errMsg != null) {
                    CommonUITool.openErrorBox(errMsg);
                    return;
                }
                String contents = brokerConfPersistUtil.readBrokerConfig(cubridBrokerConfig);
                try {
                    brokerConfPersistUtil.writeBrokerConfig(new File(fileFullName), defaultExportFileCharset, contents);
                    CommonUITool.openInformationBox(Messages.titleSuccess, Messages.cubridBrokerConfEditorSaveSucessMsg);
                    setDirty(false);
                } catch (Exception e) {
                    CommonUITool.openErrorBox(e.getMessage());
                }
            }
        }
    });
    new ToolItem(toolbar, SWT.SEPARATOR);
    ToolItem importItem = new ToolItem(toolbar, SWT.PUSH);
    importItem.setImage(CubridManagerUIPlugin.getImage("icons/queryeditor/file_open.png"));
    importItem.setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.msgTipOpenAction);
    importItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            ImportConfigDialog dialog = new ImportConfigDialog(getSite().getShell(), ConfigType.CUBRID_BROKER, true);
            if (defaultImportFileName != null && !"".equals(defaultImportFileName)) {
                dialog.setDefaultFileName(defaultImportFileName);
            }
            if (defaultImportFileCharset != null && !"".equals(defaultImportFileCharset)) {
                dialog.setDefaultCharset(defaultImportFileCharset);
            }
            if (dialog.open() == Dialog.OK) {
                defaultImportFileName = dialog.getDefaultFileName();
                defaultImportFileCharset = dialog.getDefaultCharset();
                List<String> contents = dialog.getImportFileContent();
                StringBuilder contentBuilder = new StringBuilder();
                for (String content : contents) {
                    contentBuilder.append(content).append(StringUtil.NEWLINE);
                }
                BrokerConfig cubridBrokerConfig = brokerConfPersistUtil.parseStringLineToBrokerConfig(contentBuilder.toString());
                firstView = false;
                editorComp.setBrokerConfig(cubridBrokerConfig);
                editorComp.createBrokerConfTableData();
            }
        }
    });
    new ToolItem(toolbar, SWT.SEPARATOR);
    addPropItem = new ToolItem(toolbar, SWT.PUSH);
    addPropItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert.png"));
    addPropItem.setToolTipText(Messages.cubridBrokerConfEditorAddPropItemLabel);
    addPropItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            editorComp.addPropData();
        }
    });
    deletePropItem = new ToolItem(toolbar, SWT.PUSH);
    deletePropItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete.png"));
    deletePropItem.setToolTipText(Messages.cubridBrokerConfEditorDeletePropItemLabel);
    deletePropItem.addSelectionListener(new SelectionAdapter() {

        @SuppressWarnings("all")
        public void widgetSelected(SelectionEvent event) {
            editorComp.deletePropData();
        }
    });
}
Also used : ExportConfigDialog(com.cubrid.cubridmanager.ui.host.dialog.ExportConfigDialog) BrokerConfig(com.cubrid.common.ui.spi.model.BrokerConfig) Composite(org.eclipse.swt.widgets.Composite) BrokerConfigEditComposite(com.cubrid.common.ui.common.control.BrokerConfigEditComposite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) PartInitException(org.eclipse.ui.PartInitException) GridLayout(org.eclipse.swt.layout.GridLayout) ImportConfigDialog(com.cubrid.cubridmanager.ui.host.dialog.ImportConfigDialog) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(java.util.List) File(java.io.File) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 90 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class ViewDashboardEditorPart method createPartControl.

public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    ToolBar toolBar = new ToolBar(parent, SWT.LEFT_TO_RIGHT | SWT.FLAT);
    toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
    refreshItem.setText(Messages.tablesDetailInfoPartRefreshBtn);
    refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            refresh();
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem addViewItem = new ToolItem(toolBar, SWT.NONE);
    addViewItem.setText(Messages.viewDetailInfoPartTableCreateViewBtn);
    addViewItem.setImage(CommonUIPlugin.getImage("icons/action/schema_view_add.png"));
    addViewItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addView();
        }
    });
    ToolItem editViewItem = new ToolItem(toolBar, SWT.NONE);
    editViewItem.setText(Messages.viewDetailInfoPartTableEditViewBtn);
    editViewItem.setImage(CommonUIPlugin.getImage("icons/action/schema_view_edit.png"));
    editViewItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            editView();
        }
    });
    ToolItem dropViewItem = new ToolItem(toolBar, SWT.NONE);
    dropViewItem.setText(Messages.viewDetailInfoPartTableDropViewBtn);
    dropViewItem.setImage(CommonUIPlugin.getImage("icons/action/schema_view_delete.png"));
    dropViewItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            dropView();
        }
    });
    createViewsDetailInfoTable(parent);
    createTabFolder(parent);
    this.setInputs();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

ToolItem (org.eclipse.swt.widgets.ToolItem)140 ToolBar (org.eclipse.swt.widgets.ToolBar)110 SelectionEvent (org.eclipse.swt.events.SelectionEvent)91 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)81 GridData (org.eclipse.swt.layout.GridData)73 Composite (org.eclipse.swt.widgets.Composite)64 GridLayout (org.eclipse.swt.layout.GridLayout)58 Image (org.eclipse.swt.graphics.Image)36 Label (org.eclipse.swt.widgets.Label)32 Point (org.eclipse.swt.graphics.Point)26 DisposeEvent (org.eclipse.swt.events.DisposeEvent)25 DisposeListener (org.eclipse.swt.events.DisposeListener)24 Cursor (org.eclipse.swt.graphics.Cursor)20 FillLayout (org.eclipse.swt.layout.FillLayout)18 SelectionListener (org.eclipse.swt.events.SelectionListener)17 TableViewer (org.eclipse.jface.viewers.TableViewer)16 Text (org.eclipse.swt.widgets.Text)16 Display (org.eclipse.swt.widgets.Display)15 ArrayList (java.util.ArrayList)14 List (java.util.List)14