use of com.cubrid.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class EditFunctionDialog method execute.
/**
* Execute tasks
*
* @param buttonId the button id
* @param tasks the task array
*/
public void execute(final int buttonId, final ITask[] tasks) {
TaskExecutor taskExcutor = new CommonTaskExec(null);
taskExcutor.setTask(tasks);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess() && buttonId >= 0) {
setReturnCode(buttonId);
close();
}
}
use of com.cubrid.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class RowDetailDialog method exportData.
/**
* Export data
*
* @param filePath String
*/
private void exportData(final String filePath) {
final String oidStr = dataItem.getText(1);
final String value = columnValueText.getText();
final String fileCharset = fileCharsetCombo.getText();
AbstractUITask task = new AbstractUITask() {
boolean isSuccess = false;
public void execute(final IProgressMonitor monitor) {
try {
export(filePath, oidStr, value, fileCharset);
isSuccess = true;
} catch (IOException e) {
errorMsg = e.getMessage();
} catch (SQLException e) {
errorMsg = e.getMessage();
}
}
public void cancel() {
//empty
}
public void finish() {
//empty
}
public boolean isCancel() {
return false;
}
public boolean isSuccess() {
return isSuccess;
}
};
TaskExecutor taskExecutor = new CommonTaskExec(Messages.exportDataTaskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
CommonUITool.openInformationBox(getShell(), com.cubrid.common.ui.common.Messages.titleSuccess, Messages.msgExportData);
}
}
use of com.cubrid.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class RowDetailDialog method updateData.
/**
* Update data
*/
private void updateData() {
if (!validate()) {
return;
}
final String columnValue = columnValueText.getText();
final String fileCharset = fileCharsetCombo.getText();
final String oid = dataItem.getText(1);
final boolean updateDB = !QueryExecuter.isNewInsertedRecordItem(dataItem);
AbstractUITask task = new AbstractUITask() {
boolean isSuccess = false;
public void execute(IProgressMonitor monitor) {
errorMsg = update(columnValue, fileCharset, oid, updateDB);
isSuccess = errorMsg == null;
}
public void cancel() {
//empty
}
public void finish() {
//empty
}
public boolean isCancel() {
return false;
}
public boolean isSuccess() {
return isSuccess;
}
};
TaskExecutor taskExecutor = new CommonTaskExec(Messages.updateDataTaskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
}
use of com.cubrid.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class RenameColumnDialog method okPressed.
/**
* Save the new text.
*/
protected void okPressed() {
newName = newText.getText().trim();
TaskExecutor taskExec = new CommonTaskExec(Messages.bind(Messages.renameShellTitle, tableName, column));
RenameTableColumnTask task = new RenameTableColumnTask(database.getDatabaseInfo());
task.setTableName(tableName);
task.setNewName(newName);
task.setOldName(column);
taskExec.addTask(task);
new ExecTaskWithProgress(taskExec).busyCursorWhile();
if (taskExec.isSuccess()) {
super.okPressed();
}
}
use of com.cubrid.common.ui.spi.progress.TaskExecutor in project cubrid-manager by CUBRID.
the class LongTextCellPopupDialog method exportData.
/**
*
* Export data to file
*
* @param filePath String
*/
private void exportData(final String filePath) {
final String charsetName = fileCharsetCombo.getText();
final String content = columnValueText.getText();
AbstractUITask task = new AbstractUITask() {
boolean isSuccess = false;
public void execute(final IProgressMonitor monitor) {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath), charsetName));
writer.write(content);
writer.flush();
isSuccess = true;
} catch (IOException e) {
errorMsg = e.getMessage();
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
// ignore
}
}
}
}
public void cancel() {
//empty
}
public void finish() {
//empty
}
public boolean isCancel() {
return false;
}
public boolean isSuccess() {
return isSuccess;
}
};
TaskExecutor taskExecutor = new CommonTaskExec(Messages.msgExportFieldData);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
CommonUITool.openInformationBox(getShell(), Messages.titleSuccess, Messages.msgExportSuccess);
}
}
Aggregations