use of org.eclipse.swt.widgets.DirectoryDialog in project tdi-studio-se by Talend.
the class ImportProjectAsWizardPage method handleLocationDirectoryButtonPressed.
private void handleLocationDirectoryButtonPressed() {
DirectoryDialog dialog = new DirectoryDialog(directoryPathField.getShell());
//$NON-NLS-1$
dialog.setMessage(Messages.getString("ImportProjectAsWizardPage.dialog.selectDirectory.desc"));
String dirName = directoryPathField.getText().trim();
if (dirName.length() == 0) {
dirName = previouslyBrowsedDirectory;
}
if (dirName.length() == 0) {
dialog.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
} else {
File path = new File(dirName);
if (path.exists()) {
dialog.setFilterPath(new Path(dirName).toOSString());
}
}
String selectedDirectory = dialog.open();
if (selectedDirectory != null) {
previouslyBrowsedDirectory = selectedDirectory;
directoryPathField.setText(previouslyBrowsedDirectory);
evaluateSpecifiedPath(selectedDirectory);
}
}
use of org.eclipse.swt.widgets.DirectoryDialog in project cubrid-manager by CUBRID.
the class BrokerLogTopMergeDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
getShell().setText(Messages.brokerLogTopMergeDialogTitle);
setTitle(Messages.brokerLogTopMergeDialogTitle);
setMessage(Messages.brokerLogTopMergeDialogMessages);
Composite comp = new Composite(parent, SWT.BORDER);
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
comp.setLayout(new GridLayout(3, false));
Label qLabel = new Label(comp, SWT.NONE);
qLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
qLabel.setText(Messages.brokerLogTopMergeQLabel);
qText = new Text(comp, SWT.BORDER | SWT.READ_ONLY);
GridData text1Gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
text1Gd.grabExcessHorizontalSpace = true;
qText.setLayoutData(text1Gd);
Button qButton = new Button(comp, SWT.NONE);
qButton.setText(Messages.brokerLogTopMergeOpenBtn);
qButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
final FileDialog fileDialog = new FileDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), SWT.SINGLE);
fileDialog.setFilterPath(qText.getText());
fileDialog.setFilterExtensions(new String[] { "*.q" });
fileDialog.setFilterNames(new String[] { "*.q" });
final String fileTmp = fileDialog.open();
if (fileTmp == null) {
return;
}
qText.setText(fileTmp);
validate();
}
});
Label resLabel = new Label(comp, SWT.NONE);
resLabel.setText(Messages.brokerLogTopMergeResLabel);
resLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
resText = new Text(comp, SWT.BORDER | SWT.READ_ONLY);
GridData resTextGd = new GridData(SWT.FILL, SWT.CENTER, true, false);
resTextGd.grabExcessHorizontalSpace = true;
resText.setLayoutData(resTextGd);
Button resButton = new Button(comp, SWT.NONE);
resButton.setText(Messages.brokerLogTopMergeOpenBtn);
resButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
final FileDialog fileDialog = new FileDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), SWT.SINGLE);
fileDialog.setFilterPath(resText.getText());
fileDialog.setFilterExtensions(new String[] { "*.res" });
fileDialog.setFilterNames(new String[] { "*.res" });
final String fileTmp = fileDialog.open();
if (fileTmp == null) {
return;
}
resText.setText(fileTmp);
validate();
}
});
Label exlPathLabel = new Label(comp, SWT.NONE);
exlPathLabel.setText(Messages.brokerLogTopMergeExcelPathLabel);
exlPathLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
exlPathText = new Text(comp, SWT.BORDER | SWT.READ_ONLY);
GridData exlTextGd = new GridData(SWT.FILL, SWT.CENTER, true, false);
exlTextGd.grabExcessHorizontalSpace = true;
exlPathText.setLayoutData(exlTextGd);
Button exlButton = new Button(comp, SWT.NONE);
exlButton.setText(Messages.brokerLogTopMergeOpenBtn);
exlButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
DirectoryDialog dialog = new DirectoryDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
dialog.setFilterPath(exlPathText.getText());
String dir = dialog.open();
if (dir != null) {
if (!dir.endsWith(File.separator)) {
dir += File.separator;
}
exlPathText.setText(dir);
excelFullPathText.setText(dir + exlNameText.getText() + ".xls");
}
validate();
}
});
new Label(comp, SWT.NONE).setText(Messages.brokerLogTopMergeExcelNameLabel);
exlNameText = new Text(comp, SWT.BORDER);
exlNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
exlNameText.setText("log_top_merge");
exlNameText.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent event) {
excelFullPathText.setText(exlPathText.getText() + exlNameText.getText() + ".xls");
validate();
}
});
new Label(comp, SWT.NONE);
new Label(comp, SWT.NONE).setText(Messages.brokerLogTopMergeExcelFullNameLabel);
excelFullPathText = new Text(comp, SWT.READ_ONLY | SWT.BORDER);
excelFullPathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
excelFullPathText.setText(exlPathText.getText() + exlNameText.getText() + ".xls");
new Label(comp, SWT.NONE);
new Label(comp, SWT.NONE).setText(com.cubrid.common.ui.cubrid.table.Messages.lblFileCharset);
Composite paramComp = new Composite(comp, SWT.NONE);
GridData paramCompGd = new GridData(GridData.FILL_HORIZONTAL);
paramCompGd.horizontalSpan = 2;
paramComp.setLayoutData(paramCompGd);
paramComp.setLayout(new GridLayout(3, false));
fileCharsetCombo = new Combo(paramComp, SWT.NONE);
{
GridData gridData = new GridData(GridData.BEGINNING);
fileCharsetCombo.setLayoutData(gridData);
fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
fileCharsetCombo.select(0);
}
new Label(paramComp, SWT.NONE).setText(Messages.brokerLogTopMergePartionLineLabel);
lineCountspinner = new Spinner(paramComp, SWT.BORDER | SWT.LEFT);
lineCountspinner.setValues(3000, 1000, 10000, 0, 1000, 1000);
lineCountspinner.setToolTipText(Messages.brokerLogTopMergePartionLineDescription);
return parent;
}
use of org.eclipse.swt.widgets.DirectoryDialog in project cubrid-manager by CUBRID.
the class ExportErrorDataDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
setTitle(Messages.titleExportErrorLog);
setMessage(Messages.msgExportErrorLog);
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 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(Messages.runSQLDialogExcelPathLabel);
saveErrExcelPath = new Text(exlComp, SWT.BORDER);
saveErrExcelPath.setLayoutData(new GridData(GridData.FILL_BOTH));
saveErrExcelPath.setEditable(false);
saveErrExcelBtn = new Button(exlComp, SWT.NONE);
saveErrExcelBtn.setText(Messages.brokerLogTopMergeOpenBtn);
saveErrExcelBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
DirectoryDialog dialog = new DirectoryDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
dialog.setFilterPath(saveErrExcelPath.getText());
String dir = dialog.open();
if (dir != null) {
if (!dir.endsWith(File.separator)) {
dir += File.separator;
}
saveErrExcelPath.setText(dir);
}
}
});
return parent;
}
use of org.eclipse.swt.widgets.DirectoryDialog in project cubrid-manager by CUBRID.
the class VolumeSizeValidator method createVolumeGroup.
/**
*
* Create volume group area
*
* @param parent the parent composite
*/
private void createVolumeGroup(Composite parent) {
Group volumeGroup = new Group(parent, SWT.NONE);
volumeGroup.setText(Messages.grpAddtionalVolInfo);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
volumeGroup.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
volumeGroup.setLayout(layout);
Label volumeNameLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
volumeNameLabel.setText(Messages.lblVolName);
volumeNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumeNameText = new Text(volumeGroup, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
volumeNameText.setLayoutData(gridData);
volumeNameText.setEditable(false);
Label volumePathLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
volumePathLabel.setText(Messages.lblVolPath);
volumePathLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumePathText = new Text(volumeGroup, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
volumePathText.setLayoutData(gridData);
Button selectDirectoryButton = new Button(volumeGroup, 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) {
volumePathText.setText(dir);
}
}
});
ServerInfo serverInfo = server.getServerInfo();
if (serverInfo != null && !serverInfo.isLocalServer()) {
selectDirectoryButton.setEnabled(false);
}
Label volumeTypeLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
volumeTypeLabel.setText(Messages.lblVolType);
volumeTypeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumeTypeCombo = new Combo(volumeGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
volumeTypeCombo.setLayoutData(gridData);
volumeTypeCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
changeVolumeName();
}
});
Label sizeOfPageLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
sizeOfPageLabel.setText(Messages.lblVolSize);
sizeOfPageLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumeSizeText = new Text(volumeGroup, SWT.BORDER);
volumeSizeText.setTextLimit(20);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
volumeSizeText.setLayoutData(gridData);
volumeSizeText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
volumeSizeText.addModifyListener(VolumeInfoPage.this);
}
public void focusLost(FocusEvent event) {
volumeSizeText.removeModifyListener(VolumeInfoPage.this);
}
});
}
use of org.eclipse.swt.widgets.DirectoryDialog in project cubrid-manager by CUBRID.
the class CopyDatabaseDialog method createDestinationDatabaseGroup.
/**
* Create Destination Database Group
*
* @param composite the parent composite
*/
private void createDestinationDatabaseGroup(Composite composite) {
final Group destinationDBGroup = new Group(composite, SWT.NONE);
destinationDBGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
destinationDBGroup.setText(Messages.grpDbDestName);
final GridLayout gridLayout = new GridLayout();
destinationDBGroup.setLayout(gridLayout);
final Composite destinationDBComposit = new Composite(destinationDBGroup, SWT.LEFT);
final GridData gdDestinationDBComposit = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
destinationDBComposit.setLayoutData(gdDestinationDBComposit);
final GridLayout glDestinationDBComposite = new GridLayout();
glDestinationDBComposite.numColumns = 3;
destinationDBComposit.setLayout(glDestinationDBComposite);
final Label destinationDBNameLabel = new Label(destinationDBComposit, SWT.LEFT);
destinationDBNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
destinationDBNameLabel.setText(Messages.lblDescDbName);
destinationDBNameText = new Text(destinationDBComposit, SWT.BORDER);
final GridData gdDestinationDBNameText = new GridData(SWT.FILL, SWT.CENTER, true, false);
destinationDBNameText.setLayoutData(gdDestinationDBNameText);
destinationDBNameText.addKeyListener(new EditListener());
new Label(destinationDBComposit, SWT.LEFT);
final Label destinationDBDirPathLabel = new Label(destinationDBComposit, SWT.LEFT);
destinationDBDirPathLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
destinationDBDirPathLabel.setText(Messages.lblDescDbPathName);
destinationDBDirPathText = new Text(destinationDBComposit, SWT.BORDER);
destinationDBDirPathText.setRedraw(true);
destinationDBDirPathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, isLocalServer ? 1 : 2, 1, -1, -1));
destinationDBDirPathText.addKeyListener(new EditListener() {
@Override
public void keyReleased(KeyEvent event) {
isDefaultChanged = true;
super.keyReleased(event);
}
});
if (isLocalServer) {
dbDirPathButton = new Button(destinationDBComposit, SWT.PUSH);
dbDirPathButton.setText(Messages.btnBrowseName);
dbDirPathButton.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
dbDirPathButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
String text = destinationDBDirPathText.getText();
if (text == null || text.trim().length() == 0) {
text = CubridManagerUIPlugin.getPluginDialogSettings().get(KEY_DATABASE_PATH + database.getId());
}
if (text != null) {
dialog.setFilterPath(text);
}
dialog.setText(Messages.msgSelectDir);
dialog.setMessage(Messages.msgSelectDir);
String newPath = dialog.open();
if (newPath != null) {
destinationDBDirPathText.setText(newPath);
isDefaultChanged = true;
CubridManagerUIPlugin.getPluginDialogSettings().put(KEY_DATABASE_PATH + database.getId(), newPath);
}
}
});
}
final Label volumnPath = new Label(destinationDBComposit, SWT.LEFT);
volumnPath.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumnPath.setText(Messages.lblVolumePathName);
volumePathText = new Text(destinationDBComposit, SWT.BORDER);
volumePathText.setRedraw(true);
volumePathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, isLocalServer ? 1 : 2, 1, -1, -1));
volumePathText.addKeyListener(new EditListener() {
@Override
public void keyReleased(KeyEvent event) {
isDefaultChanged = true;
super.keyReleased(event);
}
});
if (isLocalServer) {
dbExtPathButton = new Button(destinationDBComposit, SWT.PUSH);
dbExtPathButton.setText(Messages.btnBrowseName);
dbExtPathButton.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
dbExtPathButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
String text = volumePathText.getText();
if (text == null || text.trim().length() == 0) {
text = CubridManagerUIPlugin.getPluginDialogSettings().get(KEY_EXTENDED_VOLUME_PATH + database.getId());
}
if (text == null || text.trim().length() == 0) {
text = CubridManagerUIPlugin.getPluginDialogSettings().get(KEY_DATABASE_PATH + database.getId());
}
if (text != null) {
dialog.setFilterPath(text);
}
dialog.setText(Messages.msgSelectDir);
dialog.setMessage(Messages.msgSelectDir);
String newPath = dialog.open();
if (newPath != null) {
volumePathText.setText(newPath);
isDefaultChanged = true;
CubridManagerUIPlugin.getPluginDialogSettings().put(KEY_EXTENDED_VOLUME_PATH + database.getId(), newPath);
}
}
});
}
final Label destinationDBLogPathLabel = new Label(destinationDBComposit, SWT.LEFT);
destinationDBLogPathLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
destinationDBLogPathLabel.setText(Messages.lblDescLogPathName);
destinationDBLogPathText = new Text(destinationDBComposit, SWT.BORDER);
destinationDBLogPathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, isLocalServer ? 1 : 2, 1, -1, -1));
destinationDBLogPathText.addKeyListener(new EditListener() {
@Override
public void keyReleased(KeyEvent event) {
isDefaultChanged = true;
super.keyReleased(event);
}
});
if (isLocalServer) {
Button folders = new Button(destinationDBComposit, SWT.PUSH);
folders.setText(Messages.btnBrowseName);
folders.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
folders.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
String text = destinationDBLogPathText.getText();
if (text == null || text.trim().length() == 0) {
text = CubridManagerUIPlugin.getPluginDialogSettings().get(KEY_LOG_FILE_PATH + database.getId());
}
if (text == null || text.trim().length() == 0) {
text = CubridManagerUIPlugin.getPluginDialogSettings().get(KEY_DATABASE_PATH + database.getId());
}
if (text != null) {
dialog.setFilterPath(text);
}
dialog.setFilterPath(text);
dialog.setText(Messages.msgSelectDir);
dialog.setMessage(Messages.msgSelectDir);
String newPath = dialog.open();
if (newPath != null) {
destinationDBLogPathText.setText(newPath);
isDefaultChanged = true;
CubridManagerUIPlugin.getPluginDialogSettings().put(KEY_LOG_FILE_PATH + database.getId(), newPath);
}
}
});
}
}
Aggregations