use of com.cubrid.cubridmanager.ui.host.dialog.ExportConfigDialog in project cubrid-manager by CUBRID.
the class ExportBrokerConfigAction method run.
/**
* Open the export broker property dialog
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (obj == null || obj.length <= 0) {
setEnabled(false);
return;
}
CubridServer server = (CubridServer) getSelectedObj()[0];
ExportConfigDialog dialog = new ExportConfigDialog(getShell(), ConfigType.CUBRID_BROKER);
if (dialog.open() == Dialog.OK) {
String fileFullName = dialog.getOutputFileFullName();
String fileCharset = dialog.getOutputFileCharset();
ConfigParaHelp.performExportBrokerConf(server.getServerInfo(), fileFullName, fileCharset);
}
}
use of com.cubrid.cubridmanager.ui.host.dialog.ExportConfigDialog in project cubrid-manager by CUBRID.
the class ExportCubridConfigAction method run.
/**
* Open the export cubrid property dialog
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (obj == null || obj.length <= 0) {
setEnabled(false);
return;
}
CubridServer server = (CubridServer) getSelectedObj()[0];
ExportConfigDialog dialog = new ExportConfigDialog(getShell(), ConfigType.CUBRID);
if (dialog.open() == Dialog.OK) {
String fileFullName = dialog.getOutputFileFullName();
String fileCharset = dialog.getOutputFileCharset();
ConfigParaHelp.performExportCubridConf(server.getServerInfo(), fileFullName, fileCharset);
}
}
use of com.cubrid.cubridmanager.ui.host.dialog.ExportConfigDialog 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();
}
});
}
use of com.cubrid.cubridmanager.ui.host.dialog.ExportConfigDialog in project cubrid-manager by CUBRID.
the class EditConfigEditor method doExport.
/**
* Perform the export based upon the given ConfigType.
*
* @param configType the ConfigType
*/
protected void doExport(ConfigType configType) {
IEditorInput input = this.getEditorInput();
if (!(input instanceof ConfEditInput)) {
return;
}
ExportConfigDialog dialog = new ExportConfigDialog(this.getSite().getShell(), configType, 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();
ConfigParaHelp.exportConf(contents, fileFullName, defaultExportFileCharset);
}
}
use of com.cubrid.cubridmanager.ui.host.dialog.ExportConfigDialog in project cubrid-manager by CUBRID.
the class ExportCmConfigAction method run.
/**
* Open the export cm property dialog
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (obj == null || obj.length <= 0) {
setEnabled(false);
return;
}
CubridServer server = (CubridServer) getSelectedObj()[0];
ExportConfigDialog dialog = new ExportConfigDialog(getShell(), ConfigType.CUBRID_MANAGER);
if (dialog.open() == Dialog.OK) {
String fileFullName = dialog.getOutputFileFullName();
String fileCharset = dialog.getOutputFileCharset();
ConfigParaHelp.performExportCmConf(server.getServerInfo(), fileFullName, fileCharset);
}
}
Aggregations