本文整理汇总了Java中org.eclipse.jface.dialogs.ProgressMonitorDialog.run方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressMonitorDialog.run方法的具体用法?Java ProgressMonitorDialog.run怎么用?Java ProgressMonitorDialog.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.dialogs.ProgressMonitorDialog
的用法示例。
在下文中一共展示了ProgressMonitorDialog.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refresh
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
public static void refresh() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
ValidationView instance = (ValidationView) page.showView("views.problems");
List<ModelStatus> result = new ArrayList<>();
ProgressMonitorDialog dialog = new ProgressMonitorDialog(UI.shell());
dialog.run(true, true, (monitor) -> {
DatabaseValidation validation = DatabaseValidation.with(monitor);
result.addAll(validation.evaluateAll());
});
StatusList[] model = createModel(result);
instance.viewer.setInput(model);
if (model.length == 0)
Info.showBox(M.DatabaseValidationCompleteNoErrorsWereFound);
} catch (Exception e) {
log.error("Error validating database", e);
}
}
示例2: generateEMFCode
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
/**
* TODO merge monitor
*/
private void generateEMFCode(String genModelPath) throws InvocationTargetException, InterruptedException {
/*
* Generate model & edit
*/
List<URI> uris = new ArrayList<URI>();
uris.add(URI.createFileURI(genModelPath));
List<GenModel> genModels = GeneratorUIUtil.loadGenModels(new NullProgressMonitor(), uris, shell);
GeneratorUIUtil.GeneratorOperation editOp = new GeneratorUIUtil.GeneratorOperation(shell);
editOp.addGeneratorAndArguments(GenModelUtil.createGenerator(genModels.get(0)), genModels.get(0),
"org.eclipse.emf.codegen.ecore.genmodel.generator.EditProject", "Edit");
editOp.addGeneratorAndArguments(GenModelUtil.createGenerator(genModels.get(0)), genModels.get(0),
"org.eclipse.emf.codegen.ecore.genmodel.generator.ModelProject", "Model");
ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(shell);
progressMonitorDialog.run(true, true, editOp);
}
示例3: run
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
// 진행 모니터 다이얼로그 생성
ProgressMonitorDialog dialog = new ProgressMonitorDialog(parentShell);
// 작업공간 변경 처리 생성
workspaceModifyOperation = new UMLWorkspaceModifyOperation();
try {
// 진행 모니터 다이얼로그 실행
dialog.run(false, true, workspaceModifyOperation);
} catch (InvocationTargetException ite) {
ite.printStackTrace();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
示例4: actionPerformed
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
public void actionPerformed(final List<MObject> selectedElements, final IModule module) {
ProgressMonitorDialog progress = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
try {
progress.run(true, false, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor arg0)
throws InvocationTargetException, InterruptedException {
arg0.beginTask("Running...", IProgressMonitor.UNKNOWN);
runScript(selectedElements, module);
arg0.done();
}
});
} catch (InvocationTargetException | InterruptedException e) {
e.printStackTrace();
}
}
示例5: run
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
@Override
public void run() {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
try {
dialog.run(false, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
new StopRuntimeProgress().run(monitor);
}
});
} catch (Throwable e) {
ExceptionHandler.process(e);
IStatus status = new Status(IStatus.ERROR, ESBRunContainerPlugin.PLUGIN_ID, e.getMessage(), e);
if (e.getCause() != null) {
status = new Status(IStatus.ERROR, ESBRunContainerPlugin.PLUGIN_ID, e.getCause().getMessage(), e.getCause());
}
RuntimeErrorDialog.openError(shell,
RunContainerMessages.getString("RunContainerPreferencePage.InitailzeDialog6"),
RunContainerMessages.getString("RunContainerPreferencePage.InitailzeDialog6"), status);
}
}
示例6: run
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
@Override
public void run() {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
try {
dialog.run(false, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
new StartRuntimeProgress(true).run(monitor);
}
});
} catch (Throwable e) {
ExceptionHandler.process(e);
IStatus status = new Status(IStatus.ERROR, ESBRunContainerPlugin.PLUGIN_ID, e.getMessage(), e);
if (e.getCause() != null) {
status = new Status(IStatus.ERROR, ESBRunContainerPlugin.PLUGIN_ID, e.getCause().getMessage(), e.getCause());
}
RuntimeErrorDialog.openError(shell,
RunContainerMessages.getString("RunContainerPreferencePage.InitailzeDialog3"),
RunContainerMessages.getString("RunContainerPreferencePage.InitailzeDialog3"), status);
}
}
示例7: main
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
/**
* Test code below
*/
public static void main(String[] arg) {
Shell shl = new Shell();
ProgressMonitorDialog dlg = new AsynchronousProgressMonitorDialog(shl);
long l = System.currentTimeMillis();
try {
dlg.run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Testing", 100000);
for (long i = 0; i < 100000 && !monitor.isCanceled(); i++) {
//monitor.worked(1);
monitor.setTaskName("Task " + i);
}
}
});
} catch (Exception e) {
Log.log(e);
}
System.out.println("Took " + ((System.currentTimeMillis() - l)));
}
示例8: jump
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
private void jump() {
Preconditions.checkArgument(currentRecord != null);
long duration = currentRecord.getEnd() - currentRecord.getStart();
long relativeTime = scale.getSelection() * duration / scale.getMaximum();
final long time = currentRecord.getStart() + relativeTime;
try {
if (selectedHandler == null) {
// run with progress monitor
ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(scale.getShell());
progressMonitorDialog.run(false, false, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) {
runJump(time, monitor);
}
});
} else {
runJump(time, new NullProgressMonitor());
}
} catch (Exception e) {
MessageDialog.openError(scale.getShell(), "Exception", "Exception (" + e.getClass().getSimpleName()
+ ") during jumping in time: " + e.getMessage());
}
}
示例9: execute
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
@Execute
public void execute(
IEclipseContext context,
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
@Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
throws InvocationTargetException, InterruptedException {
final IEclipseContext pmContext = context.createChild();
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
dialog.open();
dialog.run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
pmContext.set(IProgressMonitor.class.getName(), monitor);
if (contribution != null) {
Object clientObject = contribution.getObject();
// ContextInjectionFactory.invoke(clientObject, Persist.class, //$NON-NLS-1$
// pmContext, null);
}
}
});
pmContext.dispose();
}
示例10: okPressed
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
@Override
protected void okPressed(){
ProgressMonitorDialog progress = new ProgressMonitorDialog(getShell());
QueryProposalRunnable runnable = new QueryProposalRunnable();
try {
progress.run(true, true, runnable);
if (runnable.isCanceled()) {
return;
} else {
proposal = runnable.getProposal();
}
} catch (InvocationTargetException | InterruptedException e) {
LoggerFactory.getLogger(BillingProposalWizardDialog.class)
.error("Error running proposal query", e);
MessageDialog.openError(getShell(), "Fehler",
"Fehler beim Ausführen des Rechnungs-Vorschlags.");
return;
}
super.okPressed();
}
示例11: doCheckout
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
private void doCheckout(Commit commit) throws Exception {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(UI.shell());
dialog.run(true, false, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor m) throws InvocationTargetException, InterruptedException {
try {
FetchNotifierMonitor monitor = new FetchNotifierMonitor(m, M.CheckingOutCommit);
RepositoryClient client = Database.getRepositoryClient();
client.checkout(commit.id, monitor);
} catch (WebRequestException e) {
throw new InvocationTargetException(e, e.getMessage());
}
}
});
}
示例12: close
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
@Override
public boolean close()
{
ProgressMonitorDialog dialog = new ProgressMonitorDialog(this.getShell());
try
{
IRunnableWithProgress runnable = new ShutdownRunnable();
dialog.run(true, false, runnable);
}
catch (Throwable e)
{
this.error(e);
return false;
}
return super.close();
}
示例13: setComparison
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
/**
* Creates a new default comparison of all API / implementation projects in the default workspace (i.e. the one
* accessed via {@link IN4JSCore}) and shows this comparison in the widget.
*/
public void setComparison() {
final ProgressMonitorDialog dlg = new ProgressMonitorDialog(getTree().getShell());
try {
dlg.run(false, false, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
setComparison(monitor);
}
});
} catch (InvocationTargetException | InterruptedException e) {
// ignore
}
}
示例14: execute
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
/**
* @see AbstractHandler#execute
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
setShell(HandlerUtil.getActiveShell(event));
ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
try {
Runnable update = () -> updateViews(event);
dialog.run(true, true, new IRunnableWithProgress(){
public void run(IProgressMonitor monitor) {
monitor.beginTask("Measuring", 16);
for (int i = 0; i < 16; i++){
monitor.subTask("Getting measure values " + (i+1) + " of "+ 16 + "...");
Display.getDefault().syncExec(update);
monitor.worked(1);
if(monitor.isCanceled()){
monitor.done();
return;
}
}
monitor.done();
}
});
} catch (InvocationTargetException exception1) {
logger.error(exception1);
} catch (InterruptedException exception2) {
logger.error(exception2);
// Restore interrupted state...
Thread.currentThread().interrupt();
}
return null;
}
示例15: execute
import org.eclipse.jface.dialogs.ProgressMonitorDialog; //导入方法依赖的package包/类
@Execute
public void execute(final Shell shell) {
final RunnableImportScrapingBooking runnable = new RunnableImportScrapingBooking(manager);
final ProgressMonitorDialog monitor = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
try {
monitor.run(true, true, runnable);
} catch (final Exception e) {
logger.error(e.getLocalizedMessage(), e);
}
}