use of com.cubrid.common.ui.cubrid.table.dialog.imp.model.ImportMonitor in project cubrid-manager by CUBRID.
the class TableContentProvider 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));
progressIndicator = new ProgressIndicator(progressPanel, SWT.NONE);
progressIndicator.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(importConfig.getErrorLogFolderPath()));
} catch (IOException e) {
e.printStackTrace();
}
}
});
progressTableViewer = new TableViewer(backPanel, SWT.BORDER | SWT.FULL_SELECTION);
progressTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
progressTableViewer.getTable().setLinesVisible(true);
progressTableViewer.getTable().setHeaderVisible(true);
final TableViewerColumn tableName = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn totalCount = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn parseCount = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn failedCount = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn status = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn elapsedTime = new TableViewerColumn(progressTableViewer, SWT.NONE);
final TableViewerColumn buttonColumn = new TableViewerColumn(progressTableViewer, SWT.NONE);
tableName.getColumn().setWidth(250);
tableName.getColumn().setText(Messages.columnName);
totalCount.getColumn().setWidth(100);
totalCount.getColumn().setText(Messages.columnCount);
parseCount.getColumn().setWidth(100);
parseCount.getColumn().setText(Messages.columnFinished);
failedCount.getColumn().setWidth(100);
failedCount.getColumn().setText(Messages.columnFailed);
status.getColumn().setWidth(100);
status.getColumn().setText(Messages.columnStatus);
elapsedTime.getColumn().setWidth(130);
elapsedTime.getColumn().setText(Messages.columnTime);
buttonColumn.getColumn().setWidth(90);
progressTableViewer.setContentProvider(new TableContentProvider());
progressTableViewer.setLabelProvider(new TableLabelProvider());
progressTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
ImportMonitor monitor = (ImportMonitor) selection.getFirstElement();
openViewDialog(monitor);
}
});
Composite historyComposite = new Composite(backPanel, SWT.NONE);
historyComposite.setLayout(new GridLayout(4, false));
historyComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
historyLabel = new Label(historyComposite, SWT.NONE);
historyLabel.setText(Messages.lblHistory);
historyText = new Text(historyComposite, SWT.BORDER);
historyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
saveButton = new Button(historyComposite, SWT.NONE);
saveButton.setText(Messages.btnSaveAndClose);
saveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (historyText.getText().trim().length() == 0) {
CommonUITool.openErrorBox(Messages.errHistoryEmpty);
return;
}
if (ImportConfigManager.getInstance().getConfig(historyText.getText()) != null) {
CommonUITool.openErrorBox(Messages.errHistoryExist);
return;
}
importConfig.setName(historyText.getText().trim());
ImportConfigManager.getInstance().addConfig(importConfig);
close();
}
});
closeButton = new Button(historyComposite, SWT.NONE);
closeButton.setText(Messages.btnClose);
closeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
close();
}
});
setHistroyWidgetStatus(false);
init();
}
use of com.cubrid.common.ui.cubrid.table.dialog.imp.model.ImportMonitor in project cubrid-manager by CUBRID.
the class TableContentProvider method initTableView.
/**
* intiTableView
*/
private void initTableView() {
/*Init the data*/
for (TableConfig tableConfig : importConfig.getSelectedMap().values()) {
ImportMonitor monitor = new ImportMonitor(tableConfig.getName());
monitor.setTotalCount(tableConfig.getLineCount());
tableList.add(monitor);
}
progressTableViewer.setInput(tableList);
}
use of com.cubrid.common.ui.cubrid.table.dialog.imp.model.ImportMonitor in project cubrid-manager by CUBRID.
the class TableContentProvider method processStop.
/**
* process stop logic
*/
public void processStop() {
if (manager != null) {
if (!btnStop.isDisposed()) {
btnStop.setEnabled(false);
progressIndicator.done();
for (ImportMonitor monitor : tableList) {
if (monitor.getStatus() == 1) {
monitor.setStatus(ImportMonitor.STATUS_STOPED);
}
}
progressTableViewer.refresh(tableList);
}
isStoped = true;
manager.stopProcess();
}
if (importDataMonitor.hasError() && !openLogFolderButton.isDisposed()) {
openLogFolderButton.setEnabled(true);
}
setHistroyWidgetStatus(true);
saveButton.forceFocus();
}
Aggregations