Search in sources :

Example 81 with ToolBar

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

the class ShardConnectionPanel method build.

public void build(Composite parent) {
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    parent.setLayout(layout);
    Label connectionFileNameLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
    connectionFileNameLabel.setText(Messages.shardConnnectionFileName);
    gridData = new GridData();
    gridData.widthHint = 200;
    gridData.horizontalSpan = 2;
    connectionFileNameLabel.setLayoutData(gridData);
    connectionFileNameText = new Text(parent, SWT.BORDER);
    connectionFileNameText.setTextLimit(32);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    connectionFileNameText.setLayoutData(gridData);
    connectionFileNameText.setEnabled(false);
    topLeftToolBar = new ToolBar(parent, SWT.FLAT);
    insertRecordItem = new ToolItem(topLeftToolBar, SWT.PUSH);
    insertRecordItem.setToolTipText(Messages.addConnection);
    insertRecordItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert.png"));
    insertRecordItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert_disabled.png"));
    insertRecordItem.setEnabled(true);
    delRecordItem = new ToolItem(topLeftToolBar, SWT.PUSH);
    delRecordItem.setToolTipText(Messages.deleteConnection);
    delRecordItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete.png"));
    delRecordItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete_disabled.png"));
    delRecordItem.setEnabled(false);
    columnNameArrs = new String[] { Messages.tblShardId, Messages.tblDBName, Messages.tblConInfo };
    int[] columnwidthArr = new int[] { 100, 180, 300 };
    connectionTableViewer = CommonUITool.createCommonTableViewer(parent, null, columnNameArrs, columnwidthArr, CommonUITool.createGridData(GridData.FILL_BOTH, 4, 1, -1, 320));
    connectionTable = connectionTableViewer.getTable();
    load();
    initial();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) ToolBar(org.eclipse.swt.widgets.ToolBar) Text(org.eclipse.swt.widgets.Text) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 82 with ToolBar

use of org.eclipse.swt.widgets.ToolBar 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 83 with ToolBar

use of org.eclipse.swt.widgets.ToolBar 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 84 with ToolBar

use of org.eclipse.swt.widgets.ToolBar 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 85 with ToolBar

use of org.eclipse.swt.widgets.ToolBar 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)

Aggregations

ToolBar (org.eclipse.swt.widgets.ToolBar)127 ToolItem (org.eclipse.swt.widgets.ToolItem)110 SelectionEvent (org.eclipse.swt.events.SelectionEvent)82 GridData (org.eclipse.swt.layout.GridData)81 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)74 GridLayout (org.eclipse.swt.layout.GridLayout)68 Composite (org.eclipse.swt.widgets.Composite)67 Image (org.eclipse.swt.graphics.Image)35 Label (org.eclipse.swt.widgets.Label)34 DisposeEvent (org.eclipse.swt.events.DisposeEvent)27 DisposeListener (org.eclipse.swt.events.DisposeListener)26 Point (org.eclipse.swt.graphics.Point)24 Cursor (org.eclipse.swt.graphics.Cursor)22 TableViewer (org.eclipse.jface.viewers.TableViewer)18 FillLayout (org.eclipse.swt.layout.FillLayout)18 Button (org.eclipse.swt.widgets.Button)17 Text (org.eclipse.swt.widgets.Text)17 ArrayList (java.util.ArrayList)14 SashForm (org.eclipse.swt.custom.SashForm)14 Combo (org.eclipse.swt.widgets.Combo)14