Search in sources :

Example 51 with DirectoryDialog

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

the class GeneralInfoPage method createLogVolumeGroup.

/**
	 * Create log volume information group
	 *
	 * @param parent the parent composite
	 */
private void createLogVolumeGroup(Composite parent) {
    Group logVolumeGroup = new Group(parent, SWT.NONE);
    logVolumeGroup.setText(Messages.grpLogVolInfo);
    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    logVolumeGroup.setLayout(layout);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    logVolumeGroup.setLayoutData(gridData);
    if (CompatibleUtil.isSupportLogPageSize(server.getServerInfo())) {
        Label logPageSizeLabel = new Label(logVolumeGroup, SWT.LEFT | SWT.WRAP);
        logPageSizeLabel.setText(Messages.lblLogPageSize);
        gridData = new GridData();
        gridData.widthHint = 150;
        logPageSizeLabel.setLayoutData(gridData);
        logPageSizeCombo = new Combo(logVolumeGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 3;
        logPageSizeCombo.setLayoutData(gridData);
        logPageSizeCombo.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                valid();
            }
        });
    }
    Label logSizeLabel = new Label(logVolumeGroup, SWT.LEFT | SWT.WRAP);
    logSizeLabel.setText(Messages.lblVolSize);
    gridData = new GridData();
    gridData.widthHint = 150;
    logSizeLabel.setLayoutData(gridData);
    logVolumeSizeText = new Text(logVolumeGroup, SWT.BORDER);
    logVolumeSizeText.setTextLimit(20);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    logVolumeSizeText.setLayoutData(gridData);
    logVolumeSizeText.addFocusListener(new FocusListener() {

        public void focusGained(FocusEvent event) {
            logVolumeSizeText.addModifyListener(GeneralInfoPage.this);
        }

        public void focusLost(FocusEvent event) {
            logVolumeSizeText.removeModifyListener(GeneralInfoPage.this);
        }
    });
    Label logVolumePathLabel = new Label(logVolumeGroup, SWT.LEFT | SWT.WRAP);
    logVolumePathLabel.setText(Messages.lblLogVolPath);
    gridData = new GridData();
    gridData.widthHint = 150;
    logVolumePathLabel.setLayoutData(gridData);
    logVolumePathText = new Text(logVolumeGroup, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    logVolumePathText.setLayoutData(gridData);
    Button selectDirectoryButton = new Button(logVolumeGroup, SWT.NONE);
    selectDirectoryButton.setText(Messages.btnBrowse);
    selectDirectoryButton.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
    selectDirectoryButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            DirectoryDialog dlg = new DirectoryDialog(getShell());
            if (databasePath != null && databasePath.trim().length() > 0) {
                dlg.setFilterPath(databasePath);
            }
            dlg.setText(Messages.msgSelectDir);
            dlg.setMessage(Messages.msgSelectDir);
            String dir = dlg.open();
            if (dir != null) {
                logVolumePathText.setText(dir);
            }
        }
    });
    ServerInfo serverInfo = server.getServerInfo();
    if (serverInfo != null && !serverInfo.isLocalServer()) {
        selectDirectoryButton.setEnabled(false);
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 52 with DirectoryDialog

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

the class ChartSettingDlg method createHistoryPathItem.

/**
	 * Create history path item.This item can be controlled to show or hide by
	 * setting the field of isSetHistoryPath, whose default value is true.
	 */
public void createHistoryPathItem() {
    CTabItem historyItem = new CTabItem(folder, SWT.NONE);
    historyItem.setText(Messages.tabItemHitoryTtl);
    Composite tabComp = new Composite(folder, SWT.NONE);
    tabComp.setLayout(new GridLayout());
    tabComp.setLayoutData(new GridData(GridData.FILL_BOTH));
    historyItem.setControl(tabComp);
    Group group = new Group(tabComp, SWT.NONE);
    group.setText(Messages.msgHistoryPathGrp);
    group.setLayout(new GridLayout(3, false));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    final Label pathLabel = new Label(group, SWT.RESIZE);
    final GridData gdPathLabel = new GridData(SWT.CENTER, SWT.CENTER, false, false);
    pathLabel.setLayoutData(gdPathLabel);
    pathLabel.setText(Messages.msgHistoryPathLbl);
    historyPathTxt = new Text(group, SWT.BORDER);
    final GridData gdPathText = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gdPathText.widthHint = 240;
    historyPathTxt.setLayoutData(gdPathText);
    if (null != historyPath) {
        historyPathTxt.setText(historyPath);
    }
    historyPathTxt.setEditable(false);
    Button selectTargetDirectoryButton = new Button(group, SWT.NONE);
    selectTargetDirectoryButton.setText(Messages.btnBrowse);
    selectTargetDirectoryButton.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
    selectTargetDirectoryButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            DirectoryDialog dlg = new DirectoryDialog(folder.getShell());
            String historyDir = historyPathTxt.getText();
            if (historyDir != null && historyDir.trim().length() > 0) {
                dlg.setFilterPath(historyDir);
            }
            dlg.setText(Messages.msgSelectDir);
            dlg.setMessage(Messages.msgSelectDir);
            String dir = dlg.open();
            if (dir != null) {
                String newPath = dir + File.separator + historyFileName;
                historyPathTxt.setText(newPath);
            }
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) CTabItem(org.eclipse.swt.custom.CTabItem) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 53 with DirectoryDialog

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

the class ExportHostStatusDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.exportDashboardDialogTitle);
    setTitle(Messages.exportDashboardDialogTitle);
    setMessage(Messages.exportDashboardDialogMessage);
    Composite comp = new Composite(parent, SWT.BORDER);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    comp.setLayout(new GridLayout(1, false));
    Composite charsetComp = new Composite(comp, SWT.NONE);
    charsetComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    charsetComp.setLayout(new GridLayout(2, false));
    new Label(charsetComp, SWT.NONE).setText(com.cubrid.common.ui.cubrid.table.Messages.lblFileCharset);
    fileCharsetCombo = new Combo(charsetComp, SWT.NONE);
    {
        GridData gridData = new GridData(GridData.BEGINNING);
        fileCharsetCombo.setLayoutData(gridData);
        fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
        fileCharsetCombo.select(0);
    }
    Composite excelNameComp = new Composite(comp, SWT.NONE);
    excelNameComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    excelNameComp.setLayout(new GridLayout(2, false));
    new Label(excelNameComp, SWT.NONE).setText(Messages.exportDashboardDialogLblFileName);
    saveExcelName = new Text(excelNameComp, SWT.BORDER);
    GridData saveExcelNameGd = new GridData();
    saveExcelNameGd.widthHint = 150;
    saveExcelName.setLayoutData(saveExcelNameGd);
    saveExcelName.setText(editor.getServerInfo().getServerName());
    Composite exlComp = new Composite(comp, SWT.NONE);
    exlComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    exlComp.setLayout(new GridLayout(3, false));
    new Label(exlComp, SWT.NONE).setText(com.cubrid.common.ui.common.Messages.runSQLDialogExcelPathLabel);
    saveExcelPath = new Text(exlComp, SWT.BORDER);
    saveExcelPath.setLayoutData(new GridData(GridData.FILL_BOTH));
    saveExcelPath.setEditable(false);
    saveExcelBtn = new Button(exlComp, SWT.NONE);
    saveExcelBtn.setText(com.cubrid.common.ui.common.Messages.brokerLogTopMergeOpenBtn);
    saveExcelBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            DirectoryDialog dialog = new DirectoryDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
            dialog.setFilterPath(saveExcelPath.getText());
            String dir = dialog.open();
            if (dir != null) {
                if (!dir.endsWith(File.separator)) {
                    dir += File.separator;
                }
                saveExcelPath.setText(dir);
            }
        }
    });
    return parent;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 54 with DirectoryDialog

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

the class TableUtil method getSavedDir.

/**
	 * Get saved file
	 * 
	 * @param shell Shell
	 * @param filterPath String
	 * @return File
	 */
public static File getSavedDir(Shell shell, String title, String message, String filterPath) {
    DirectoryDialog dialog = new DirectoryDialog(shell, SWT.SAVE | SWT.APPLICATION_MODAL);
    if (title != null) {
        dialog.setText(title);
    }
    if (message != null) {
        dialog.setMessage(message);
    }
    String filepath = filterPath;
    if (StringUtil.isEmpty(filepath)) {
        filepath = CommonUIPlugin.getSettingValue(EXPORT_FILE_PATH_KEY);
    }
    if (filepath != null) {
        dialog.setFilterPath(filepath);
    }
    String filePath = dialog.open();
    if (filePath == null) {
        return null;
    }
    File file = new File(filePath);
    CommonUIPlugin.putSettingValue(TableUtil.EXPORT_FILE_PATH_KEY, file.getAbsolutePath());
    return file;
}
Also used : File(java.io.File) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 55 with DirectoryDialog

use of org.eclipse.swt.widgets.DirectoryDialog in project azure-tools-for-java by Microsoft.

the class AzureExportDockerSshKeysDialog method createDialogArea.

/**
	 * Create contents of the dialog.
	 * @param parent
	 */
@Override
protected Control createDialogArea(Composite parent) {
    setTitle("Export SSH Keys");
    setMessage(pathToolTip);
    Composite area = (Composite) super.createDialogArea(parent);
    Composite mainContainer = new Composite(area, SWT.NONE);
    mainContainer.setLayout(new GridLayout(2, false));
    mainContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
    exportSshPathTextField = new Text(mainContainer, SWT.BORDER);
    exportSshPathTextField.setToolTipText(pathToolTip);
    exportSshPathTextField.setText(path);
    exportSshPathTextField.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent event) {
            path = (((Text) event.getSource()).getText());
            if (Files.isDirectory(Paths.get(path))) {
                errDispatcher.removeMessage("exportSshPathTextField", exportSshPathTextField);
                setErrorMessage(null);
            } else {
                errDispatcher.addMessage("exportSshPathTextField", pathToolTip, null, IMessageProvider.ERROR, exportSshPathTextField);
                setErrorMessage("Invalid directory path");
            }
        }
    });
    GridData gd_exportSshPathTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_exportSshPathTextField.verticalIndent = 5;
    gd_exportSshPathTextField.horizontalIndent = 5;
    exportSshPathTextField.setLayoutData(gd_exportSshPathTextField);
    Button exportSshPathBrowseButton = new Button(mainContainer, SWT.NONE);
    exportSshPathBrowseButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog directoryDialog = new DirectoryDialog(exportSshPathTextField.getShell());
            directoryDialog.setText("Select SSH Keys Directory");
            directoryDialog.setFilterPath(System.getProperty("user.home"));
            String pathSelected = directoryDialog.open();
            if (pathSelected == null) {
                return;
            }
            path = pathSelected;
            exportSshPathTextField.setText(path);
        }
    });
    GridData gd_exportSshPathBrowseButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_exportSshPathBrowseButton.verticalIndent = 5;
    exportSshPathBrowseButton.setLayoutData(gd_exportSshPathBrowseButton);
    exportSshPathBrowseButton.setText("Browse...");
    Label lblNote = new Label(mainContainer, SWT.NONE);
    GridData gd_lblNote = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblNote.verticalIndent = 5;
    gd_lblNote.horizontalIndent = 5;
    lblNote.setLayoutData(gd_lblNote);
    lblNote.setText("Note:");
    new Label(mainContainer, SWT.NONE);
    Label lblAnyExistingidrsa = new Label(mainContainer, SWT.NONE);
    GridData gd_lblAnyExistingidrsa = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_lblAnyExistingidrsa.horizontalIndent = 20;
    lblAnyExistingidrsa.setLayoutData(gd_lblAnyExistingidrsa);
    lblAnyExistingidrsa.setText("Any existing \"id_rsa\" and \"id_rsa.pub\" files in the selected directory");
    Label lblWillBeOverwritten = new Label(mainContainer, SWT.NONE);
    GridData gd_lblWillBeOverwritten = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblWillBeOverwritten.horizontalIndent = 20;
    lblWillBeOverwritten.setLayoutData(gd_lblWillBeOverwritten);
    lblWillBeOverwritten.setText("will be overwritten!");
    new Label(mainContainer, SWT.NONE);
    FormToolkit toolkit = new FormToolkit(mainContainer.getDisplay());
    toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
    managedForm = new ManagedForm(mainContainer);
    errMsgForm = managedForm.getForm();
    errMsgForm.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    errMsgForm.setBackground(mainContainer.getBackground());
    errDispatcher = managedForm.getMessageManager();
    //		return area;
    return super.createDialogArea(parent);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) ManagedForm(org.eclipse.ui.forms.ManagedForm) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Aggregations

DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)88 SelectionEvent (org.eclipse.swt.events.SelectionEvent)51 Button (org.eclipse.swt.widgets.Button)49 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)48 GridData (org.eclipse.swt.layout.GridData)48 GridLayout (org.eclipse.swt.layout.GridLayout)47 Text (org.eclipse.swt.widgets.Text)47 Composite (org.eclipse.swt.widgets.Composite)42 Label (org.eclipse.swt.widgets.Label)40 Group (org.eclipse.swt.widgets.Group)27 File (java.io.File)25 ModifyListener (org.eclipse.swt.events.ModifyListener)22 ModifyEvent (org.eclipse.swt.events.ModifyEvent)21 Combo (org.eclipse.swt.widgets.Combo)21 FileDialog (org.eclipse.swt.widgets.FileDialog)11 TableViewer (org.eclipse.jface.viewers.TableViewer)8 Table (org.eclipse.swt.widgets.Table)8 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)7 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)7