use of com.cubrid.common.ui.common.sqlrunner.model.SqlRunnerProgress in project cubrid-manager by CUBRID.
the class RunSQLFileViewPart method createPartControl.
/**
* Create part controls
*
* @param parent of the controls
*/
public void createPartControl(Composite parent) {
Composite backPanel = new Composite(parent, SWT.NONE);
backPanel.setLayout(new GridLayout(1, false));
backPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
Composite progressPanel = new Composite(backPanel, SWT.NONE);
progressPanel.setLayout(new GridLayout(3, false));
progressPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
pbTotal = new ProgressBar(progressPanel, SWT.NONE);
pbTotal.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
btnStop = new Button(progressPanel, SWT.NONE);
btnStop.setText(Messages.btnStop);
btnStop.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_run_stop.png"));
btnStop.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
processStop();
}
});
openLogFolderButton = new Button(progressPanel, SWT.NONE);
openLogFolderButton.setText(Messages.runSQLOpenBtn);
openLogFolderButton.setEnabled(false);
openLogFolderButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
try {
java.awt.Desktop.getDesktop().open(new File(input.getLogFolderPath()));
} catch (IOException e) {
e.printStackTrace();
}
}
});
Composite textComp = new Composite(backPanel, SWT.NONE);
GridData textCompGd = new GridData(GridData.FILL_HORIZONTAL);
textCompGd.heightHint = 50;
textCompGd.exclude = true;
textComp.setVisible(false);
textComp.setLayoutData(textCompGd);
textComp.setLayout(new GridLayout(1, false));
Text errorText = new Text(textComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
errorText.setLayoutData(new GridData(GridData.FILL_BOTH));
errorText.setEditable(false);
tvProgress = new TableViewer(backPanel, SWT.BORDER | SWT.FULL_SELECTION);
tvProgress.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
tvProgress.getTable().setLinesVisible(true);
tvProgress.getTable().setHeaderVisible(true);
final TableViewerColumn fileName = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn successCount = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn failCount = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn status = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn elapsedTime = new TableViewerColumn(tvProgress, SWT.NONE);
fileName.getColumn().setWidth(250);
fileName.getColumn().setText(Messages.fileName);
successCount.getColumn().setWidth(100);
successCount.getColumn().setText(Messages.successCount);
failCount.getColumn().setWidth(100);
failCount.getColumn().setText(Messages.failCount);
status.getColumn().setWidth(100);
status.getColumn().setText(Messages.columnStatus);
elapsedTime.getColumn().setWidth(130);
elapsedTime.getColumn().setText(Messages.columnElapsedTime);
tvProgress.setContentProvider(new RunSQLFileTableContentProvider());
tvProgress.setLabelProvider(new RunSQLFileTableLabelProvider());
tvProgress.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
SqlRunnerProgress po = (SqlRunnerProgress) selection.getFirstElement();
new ViewSQLLogDialog(Display.getDefault().getActiveShell(), po.getFileName(), po.getFailList()).open();
}
});
String errorMsg = testConnection();
if (errorMsg != null) {
pbTotal.setEnabled(false);
btnStop.setEnabled(false);
textCompGd.exclude = false;
textComp.setVisible(true);
errorText.setText("Can't get connection : " + errorMsg);
textComp.getParent().layout();
return;
}
initManager();
intiTableView();
}
use of com.cubrid.common.ui.common.sqlrunner.model.SqlRunnerProgress in project cubrid-manager by CUBRID.
the class RunSQLFileViewPart method processStop.
/**
* process stop logic
*/
public void processStop() {
if (manager != null) {
if (!btnStop.isDisposed()) {
btnStop.setEnabled(false);
pbTotal.setSelection(pbTotal.getMaximum());
for (SqlRunnerProgress po : tableList) {
if (po.getStatus() == 1) {
po.setStatus(3);
}
}
tvProgress.refresh(tableList);
}
manager.stopProcess();
stop = true;
}
}
use of com.cubrid.common.ui.common.sqlrunner.model.SqlRunnerProgress in project cubrid-manager by CUBRID.
the class RunSQLFileViewPart method intiTableView.
/**
* intiTableView
*/
private void intiTableView() {
for (String filePath : filesList) {
SqlRunnerProgress po = new SqlRunnerProgress(new File(filePath).getName());
tableList.add(po);
}
tvProgress.setInput(tableList);
}
Aggregations