use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec in project cubrid-manager by CUBRID.
the class PstmtSQLDialog method updateData.
/**
* Update the data
*
* @param parameterList List<PstmtParameter>
*/
private void updateData(List<List<PstmtParameter>> jobList) {
beginTimestamp = System.currentTimeMillis();
String jobName = Messages.executeSqlJobName;
JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getServerInfo().getServerName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
TaskJobExecutor taskExec = new CommonTaskJobExec(this);
for (int i = 0; i < jobList.size(); i++) {
List<PstmtParameter> parameterList = jobList.get(i);
PstmtDataTask task = new PstmtDataTask(sqlTxt.getText(), database, parameterList, null, i + 1);
taskExec.addTask(task);
}
taskExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec in project cubrid-manager by CUBRID.
the class ObjectInfoComposite method init.
public void init() {
/*Tool bar composite*/
Composite toolBarComposite = new Composite(this, SWT.NONE);
RowLayout rowLayout = new RowLayout();
toolBarComposite.setLayout(rowLayout);
toolBarComposite.setLayoutData(CommonUITool.createGridData(-1, -1, -1, 25));
dataTabButton = new Button(toolBarComposite, SWT.None);
dataTabButton.setText(Messages.tabTitleData);
dataTabButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (objInfoFolder == null) {
return;
}
objInfoFolder.setSelection(0);
}
});
ddlTabButton = new Button(toolBarComposite, SWT.None);
ddlTabButton.setText(Messages.tabTitleDDL);
ddlTabButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (objInfoFolder == null) {
return;
}
objInfoFolder.setSelection(1);
}
});
columnTabButton = new Button(toolBarComposite, SWT.None);
columnTabButton.setText(Messages.tabTitleColumn);
columnTabButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (objInfoFolder == null) {
return;
}
objInfoFolder.setSelection(2);
}
});
indexTabButton = new Button(toolBarComposite, SWT.None);
indexTabButton.setText(Messages.tabTitleIndex);
indexTabButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (objInfoFolder == null) {
return;
}
objInfoFolder.setSelection(3);
}
});
new Label(toolBarComposite, SWT.None).setText(" ");
/*Select * button*/
selectButton = new Button(toolBarComposite, SWT.None);
selectButton.setText(Messages.txtSelect);
selectButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processSelectAction();
}
});
/*Select column button*/
selectColumnButton = new Button(toolBarComposite, SWT.None);
selectColumnButton.setText(Messages.txtSelectColumn);
selectColumnButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processSelectColumnAction();
}
});
/*Insert Button*/
insertButton = new Button(toolBarComposite, SWT.None);
insertButton.setText(Messages.txtInsert);
insertButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processInsertAction();
}
});
/*Update button*/
updateButton = new Button(toolBarComposite, SWT.None);
updateButton.setText(Messages.txtUpdate);
updateButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processUpdateAction();
}
});
/*Delete button*/
deleteButton = new Button(toolBarComposite, SWT.None);
deleteButton.setText(Messages.txtDelete);
deleteButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processDeleteAction();
}
});
/*Database object information*/
objInfoFolder = new CTabFolder(this, SWT.BOTTOM);
objInfoFolder.setSimple(false);
objInfoFolder.setUnselectedImageVisible(true);
objInfoFolder.setUnselectedCloseVisible(true);
objInfoFolder.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
objInfoFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
objInfoFolder.setLayout(new GridLayout(1, true));
objInfoFolder.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, -1, -1, -1, -1));
/*Demo data tab item*/
initDataTabItem();
/*DDL tab item*/
initDDLTabItem();
/*Column tab item*/
initColumnTabItem();
/*If is table, create index tab item*/
if (isTable) {
initIndexTabItem();
}
/*Initial the data*/
TaskJobExecutor taskExec = new CommonTaskJobExec() {
public IStatus exec(IProgressMonitor monitor) {
IStatus status = super.exec(monitor);
if (Status.CANCEL_STATUS == status) {
return status;
}
return Status.OK_STATUS;
}
public void done(IJobChangeEvent event) {
getInfoDataTask = null;
}
};
GetInfoDataTask getInfoDataTask = new GetInfoDataTask(Messages.getInfoJobName, this, schemaNode, isTable);
taskExec.addTask(getInfoDataTask);
/*Get data job*/
TaskJob job = new TaskJob(Messages.bind(Messages.getInfoJobName, schemaNode.getName()), taskExec);
job.setPriority(Job.LONG);
job.setUser(false);
job.schedule();
}
use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec in project cubrid-manager by CUBRID.
the class CheckDatabaseDialog method buttonPressed.
/**
* When press button in button bar,call this method
*
* @param buttonId the button id
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
if (!verify()) {
return;
}
CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.CHECK_DATABASE_TASK_NAME, database.getServer().getServerInfo(), CommonSendMsg.getCheckDbSendMsg());
task.setDbName(database.getName());
task.setRepairDb(repairButton.getSelection() ? YesNoType.Y : YesNoType.N);
String serverName = database.getServer().getName();
String dbName = database.getName();
jobName = Messages.msgCheckDbRearName + " - " + dbName + "@" + serverName;
TaskJobExecutor taskExec = new CommonTaskJobExec(this);
taskExec.addTask(task);
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
taskExec.schedule(jobName, jobFamily, true, Job.SHORT);
return;
}
super.buttonPressed(buttonId);
}
use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec in project cubrid-manager by CUBRID.
the class CompactDatabaseDialog method buttonPressed.
/**
* When press button in button bar,call this method
*
* @param buttonId the button id
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
if (!verify()) {
return;
}
if (CommonUITool.openConfirmBox(parentComp.getShell(), Messages.msgCompactConfirm)) {
CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.COMPACT_DATABASE_TASK_NANE, database.getServer().getServerInfo(), CommonSendMsg.getCompactDbSendMsg());
task.setDbName(database.getName());
if (verboseBtn != null) {
task.setVerbose(verboseBtn.getSelection() ? YesNoType.Y : YesNoType.N);
}
String serverName = database.getServer().getName();
String dbName = database.getName();
jobName = Messages.msgCompactDbRearJobName + " - " + dbName + "@" + serverName;
TaskJobExecutor taskExec = new CommonTaskJobExec(this);
taskExec.addTask(task);
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
taskExec.schedule(jobName, jobFamily, true, Job.SHORT);
return;
} else {
return;
}
}
super.buttonPressed(buttonId);
}
use of com.cubrid.common.ui.spi.progress.CommonTaskJobExec in project cubrid-manager by CUBRID.
the class DeleteTableAction method doRun.
/**
* Do run
*
* @param obj
*/
private void doRun(Object[] obj) {
StringBuilder sb = new StringBuilder();
final List<String> tableList = new ArrayList<String>();
CubridDatabase database = null;
for (int i = 0; i < obj.length; i++) {
DefaultSchemaNode table = (DefaultSchemaNode) obj[i];
database = table.getDatabase();
final String tableName = table.getName();
tableList.add(tableName);
if (i < 100) {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(tableName);
}
}
if (obj.length > 100) {
sb.append("...");
}
String message = Messages.bind(Messages.confirmTableDeleteWarn, sb.toString());
if (!CommonUITool.openConfirmBox(message)) {
return;
}
final DelAllRecordsTask task = new DelAllRecordsTask(database.getDatabaseInfo());
TaskJobExecutor taskExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
int[] rowCount = task.getDeleteRecordsCount();
List<String> rowCountList = new ArrayList<String>();
for (int i = 0; i < rowCount.length; i++) {
rowCountList.add(String.valueOf(rowCount[i]));
}
String message = Messages.bind(Messages.resultTableDeleteInformantion, tableList, rowCountList);
CommonUITool.openInformationBox(Messages.msg_information, message);
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
String[] tableNames = new String[tableList.size()];
tableNames = tableList.toArray(tableNames);
task.setTableName(tableNames);
taskExec.addTask(task);
JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
String jobName = Messages.msgDeleteTableDataJobName + " - " + tableList.toString() + "@" + dbName + "@" + serverName;
taskExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
Aggregations