use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project cubrid-manager by CUBRID.
the class DataCompareDetailEditorPart method createContent.
private void createContent(Composite parent) {
compareTableViewer = new TableViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
compareTableViewer.setUseHashlookup(true);
CommonUITool.createGridLayout(compareTableViewer.getTable(), 1, 0, 10, 0, 10, 0, 0, 0, 0);
compareTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
compareTableViewer.getTable().setLinesVisible(true);
compareTableViewer.getTable().setHeaderVisible(true);
try {
new ProgressMonitorDialog(this.getSite().getShell()).run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
monitor.beginTask(Messages.msgLoadingData, 1);
loadData(1);
monitor.done();
Display.getDefault().syncExec(new Runnable() {
public void run() {
initTableViewer();
compareTableViewer.setInput(dataList);
CommonUITool.packTable(compareTableViewer.getTable(), 20, 200);
}
});
}
});
} catch (Exception e) {
LOGGER.error("", e);
}
}
use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project cubrid-manager by CUBRID.
the class DataCompareDetailEditorPart method showPage.
private void showPage(int direction) {
int newPage = page;
if (direction == -1) {
newPage -= 1;
} else if (direction == 1) {
newPage += 1;
} else {
newPage = 1;
}
if (newPage < 1) {
page = 1;
CommonUITool.openWarningBox(Messages.msgStartPageAlert);
return;
}
final int newPageParam = newPage;
try {
new ProgressMonitorDialog(this.getSite().getShell()).run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
monitor.beginTask(Messages.msgLoadingData, 1);
if (loadData(newPageParam)) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
compareTableViewer.setInput(dataList);
CommonUITool.packTable(compareTableViewer.getTable(), 20, 200);
}
});
page = newPageParam;
} else {
Display.getDefault().syncExec(new Runnable() {
public void run() {
CommonUITool.openWarningBox(Messages.msgLastPageAlert);
}
});
}
monitor.done();
}
});
} catch (Exception e) {
LOGGER.error("", e);
}
}
use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project cubrid-manager by CUBRID.
the class DataCompareEditorPart method exportData.
private boolean exportData(final String basePath) {
if (compareList == null || compareList.size() == 0) {
CommonUITool.openErrorBox(Messages.msgNotExistsToExportData);
return false;
}
printToConsole("\n", false);
printToConsole(Messages.msgBeginToCompareData + "\n", true);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
IRunnableWithProgress progress = new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) {
int total = compareList.size();
monitor.beginTask(Messages.msgLoadingData, total);
Display.getDefault().syncExec(new Runnable() {
public void run() {
for (DataCompare comp : compareList) {
int counts = exportDataToFile(basePath, comp.getTableName());
if (counts == -1) {
if (comp.getRecordsTarget() == -1) {
String msg = Messages.bind(Messages.msgDataCompareNoTable, comp.getTableName()) + "\n";
printToConsoleOnWorkThread(msg, true);
} else {
String msg = Messages.bind(Messages.msgDataCompareNoData, comp.getTableName()) + "\n";
printToConsoleOnWorkThread(msg, true);
}
} else {
String msg = Messages.bind(Messages.msgDataCompareResultStatus, comp.getTableName(), counts) + "\n";
printToConsoleOnWorkThread(msg, true);
}
monitor.worked(1);
}
monitor.done();
}
});
}
};
try {
new ProgressMonitorDialog(shell).run(true, false, progress);
} catch (InvocationTargetException e) {
LOGGER.error(e.getMessage(), e);
} catch (InterruptedException e) {
LOGGER.error(e.getMessage(), e);
}
String msg = Messages.bind(Messages.msgEndToCompareData, basePath) + "\n";
printToConsole(msg, true);
return true;
}
use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project cubrid-manager by CUBRID.
the class ExportErrorDataProgress method export.
/**
* export to excel
* @return
*/
public boolean export() {
Display display = Display.getDefault();
display.syncExec(new Runnable() {
public void run() {
try {
new ProgressMonitorDialog(null).run(true, false, ExportErrorDataProgress.this);
} catch (Exception e) {
LOGGER.error("", e);
}
}
});
return success;
}
use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project azure-tools-for-java by Microsoft.
the class AzureDockerUIResources method createArtifact.
public static void createArtifact(Shell shell, IProject project) {
if (project == null) {
return;
}
String projectName = project.getName();
String destinationPath = project.getLocation() + "/" + projectName + ".war";
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
try {
dialog.run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor progressMonitor) {
progressMonitor.beginTask("Creating WAR artifact", 100);
try {
progressMonitor.subTask(String.format("Building selected project: %s ...", project.getName()));
progressMonitor.worked(35);
project.build(IncrementalProjectBuilder.FULL_BUILD, null);
progressMonitor.subTask("Exporting to WAR ...");
progressMonitor.worked(75);
IDataModel dataModel = DataModelFactory.createDataModel(new WebComponentExportDataModelProvider());
dataModel.setProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME, projectName);
dataModel.setProperty(IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION, destinationPath);
if (dataModel.getDefaultOperation() != null)
try {
dataModel.getDefaultOperation().execute(null, null);
} catch (Exception ignored) {
}
// progressMonitor.subTask("");
// progressMonitor.worked(1);
// if (progressMonitor.isCanceled()) {
// if (displayWarningOnCreateKeyVaultCancelAction() == 0) {
// progressMonitor.done();
// return Status.CANCEL_STATUS;
// }
// }
progressMonitor.done();
} catch (Exception e) {
String msg = "An error occurred while attempting to create WAR artifact" + "\n" + e.getMessage();
log.log(Level.SEVERE, "createArtifact: " + msg, e);
e.printStackTrace();
}
progressMonitor.done();
}
});
} catch (Exception e) {
CANCELED = true;
log.log(Level.SEVERE, "updateAzureResourcesWithProgressDialog: " + e.getMessage(), e);
e.printStackTrace();
}
}
Aggregations