use of com.cubrid.cubridmanager.core.common.socket.SocketTask in project cubrid-manager by CUBRID.
the class KillTransactionDialog method executeKillTrans.
/**
*
* Execute to kill transaction
*
* @param buttonId the button id
* @param tasks the task array
* @param cancelable whether it can be cancelable
* @param shell the shell
*/
public void executeKillTrans(final int buttonId, final SocketTask[] tasks, boolean cancelable, Shell shell) {
final Display display = shell.getDisplay();
isRunning = false;
try {
new ProgressMonitorDialog(getShell()).run(true, cancelable, new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(com.cubrid.common.ui.spi.Messages.msgRunning, IProgressMonitor.UNKNOWN);
if (monitor.isCanceled()) {
return;
}
isRunning = true;
Thread thread = new Thread() {
public void run() {
while (!monitor.isCanceled() && isRunning) {
try {
sleep(1);
} catch (InterruptedException e) {
}
}
if (monitor.isCanceled()) {
for (SocketTask t : tasks) {
if (t != null) {
t.cancel();
}
}
}
}
};
thread.start();
if (monitor.isCanceled()) {
isRunning = false;
return;
}
for (SocketTask task : tasks) {
if (task != null) {
task.execute();
final String msg = task.getErrorMsg();
if (monitor.isCanceled()) {
isRunning = false;
return;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
display.syncExec(new Runnable() {
public void run() {
CommonUITool.openErrorBox(getShell(), msg);
}
});
isRunning = false;
return;
}
}
if (monitor.isCanceled()) {
isRunning = false;
return;
}
}
if (monitor.isCanceled()) {
isRunning = false;
return;
}
if (!monitor.isCanceled()) {
display.syncExec(new Runnable() {
public void run() {
if (buttonId > 0) {
setReturnCode(buttonId);
close();
}
}
});
}
isRunning = false;
monitor.done();
}
});
} catch (InvocationTargetException e) {
LOGGER.error(e.getMessage(), e);
} catch (InterruptedException e) {
LOGGER.error(e.getMessage(), e);
}
}
use of com.cubrid.cubridmanager.core.common.socket.SocketTask in project cubrid-manager by CUBRID.
the class TransactionInfoDialog method execTask.
/**
*
* Execute tasks
*
* @param buttonId the button id
* @param tasks the tasks array
* @param cancelable whether it is cancelable
* @param shell the shell
*/
public void execTask(final int buttonId, final SocketTask[] tasks, boolean cancelable, Shell shell) {
final Display display = shell.getDisplay();
isRunning = false;
try {
new ProgressMonitorDialog(getShell()).run(true, cancelable, new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// FIXME more simple
monitor.beginTask(com.cubrid.common.ui.spi.Messages.msgRunning, IProgressMonitor.UNKNOWN);
if (monitor.isCanceled()) {
return;
}
isRunning = true;
Thread thread = new Thread() {
public void run() {
while (!monitor.isCanceled() && isRunning) {
try {
sleep(1);
} catch (InterruptedException e) {
}
}
if (monitor.isCanceled()) {
for (SocketTask t : tasks) {
if (t != null) {
t.cancel();
}
}
}
}
};
thread.start();
if (monitor.isCanceled()) {
isRunning = false;
return;
}
for (SocketTask task : tasks) {
if (task != null) {
task.execute();
final String msg = task.getErrorMsg();
if (monitor.isCanceled()) {
isRunning = false;
return;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
display.syncExec(new Runnable() {
public void run() {
CommonUITool.openErrorBox(getShell(), msg);
}
});
isRunning = false;
return;
}
}
if (monitor.isCanceled()) {
isRunning = false;
return;
}
}
if (monitor.isCanceled()) {
isRunning = false;
return;
}
if (!monitor.isCanceled()) {
display.syncExec(new Runnable() {
public void run() {
if (buttonId > 0) {
setReturnCode(buttonId);
close();
}
}
});
}
isRunning = false;
monitor.done();
}
});
} catch (InvocationTargetException e) {
LOGGER.error(e.getMessage(), e);
} catch (InterruptedException e) {
LOGGER.error(e.getMessage(), e);
}
}
use of com.cubrid.cubridmanager.core.common.socket.SocketTask in project cubrid-manager by CUBRID.
the class LockInfoDialog method execTask.
/**
*
* Execute the task
*
* @param buttonId the button id
* @param tasks the task array
* @param cancelable whether it is cancelable
* @param shell the shell
*/
public void execTask(final int buttonId, final SocketTask[] tasks, boolean cancelable, Shell shell) {
final Display display = shell.getDisplay();
isRunning = false;
try {
new ProgressMonitorDialog(getShell()).run(true, cancelable, new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(com.cubrid.common.ui.spi.Messages.msgRunning, IProgressMonitor.UNKNOWN);
if (monitor.isCanceled()) {
return;
}
isRunning = true;
Thread thread = new Thread() {
public void run() {
while (!monitor.isCanceled() && isRunning) {
try {
sleep(1);
} catch (InterruptedException e) {
}
}
if (monitor.isCanceled()) {
for (SocketTask task : tasks) {
if (task != null) {
task.cancel();
}
}
}
}
};
thread.start();
if (monitor.isCanceled()) {
isRunning = false;
return;
}
for (SocketTask task : tasks) {
if (task != null) {
task.execute();
final String msg = task.getErrorMsg();
if (monitor.isCanceled()) {
isRunning = false;
return;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
showErrorMessage(display, msg);
isRunning = false;
return;
}
}
if (monitor.isCanceled()) {
isRunning = false;
return;
}
}
if (monitor.isCanceled()) {
isRunning = false;
return;
}
if (!monitor.isCanceled()) {
display.syncExec(new Runnable() {
public void run() {
if (buttonId > 0) {
setReturnCode(buttonId);
close();
}
}
});
}
isRunning = false;
monitor.done();
}
});
} catch (InvocationTargetException e) {
LOGGER.error(e.getMessage(), e);
} catch (InterruptedException e) {
LOGGER.error(e.getMessage(), e);
}
}
use of com.cubrid.cubridmanager.core.common.socket.SocketTask in project cubrid-manager by CUBRID.
the class VolumeFolderInfoEditor method execTask.
/**
* execute the task
*
* @param buttonId int
* @param tasks SocketTask[]
* @param cancelable boolean
*/
public void execTask(final int buttonId, final SocketTask[] tasks, boolean cancelable) {
final Shell shell = parentComp.getShell();
final Display display = shell.getDisplay();
isRunning = false;
try {
new ProgressMonitorDialog(shell).run(true, cancelable, new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// FIXME more simple
monitor.beginTask(com.cubrid.common.ui.spi.Messages.msgRunning, IProgressMonitor.UNKNOWN);
if (monitor.isCanceled()) {
return;
}
isRunning = true;
Thread thread = new Thread() {
public void run() {
while (!monitor.isCanceled() && isRunning) {
try {
sleep(1);
} catch (InterruptedException e) {
}
}
if (monitor.isCanceled()) {
for (SocketTask t : tasks) {
if (t != null) {
t.cancel();
}
}
}
}
};
thread.start();
if (monitor.isCanceled()) {
isRunning = false;
return;
}
for (SocketTask task : tasks) {
if (task != null) {
task.execute();
final String msg = task.getErrorMsg();
if (monitor.isCanceled()) {
isRunning = false;
return;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
display.syncExec(new Runnable() {
public void run() {
CommonUITool.openErrorBox(shell, msg);
}
});
isRunning = false;
return;
}
}
if (monitor.isCanceled()) {
isRunning = false;
return;
}
}
if (monitor.isCanceled()) {
isRunning = false;
return;
}
isRunning = false;
monitor.done();
}
});
} catch (InvocationTargetException e) {
LOGGER.error(e.getMessage(), e);
} catch (InterruptedException e) {
LOGGER.error(e.getMessage(), e);
}
}
Aggregations