Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Showing progress monitor
Showing progress monitor [message #190065] Thu, 29 May 2008 12:19 Go to next message
Eclipse UserFriend
Originally posted by: novak.igor.gmail.com

Hi!

I define progress monitor as following:

"
AbstractTransactionalCommand command = new
AbstractTransactionalCommand(...){
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
monitor.beginTask("Updating model", 100);
doStuff(monitor);
monitor.done(); return CommandResult.newOKCommandResult();
}
};
Shell shell =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShel l();
ProgressMonitorPart progressMonitor = new ProgressMonitorPart(shell, null);
OperationHistoryFactory.getOperationHistory().execute(comman d,
progressMonitor, null);
"
but the progress monitor is not shown.

How to define a progress monitor to be shown in doExecuteWithResult or in
my doStuff method?

P.S. This is my third post of the same subject, I always get answer to my
questions, except this one ... should this question be in some other forum?

Thanks in advance, Igor Novak
Re: Showing progress monitor [message #190114 is a reply to message #190065] Thu, 29 May 2008 13:34 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Igor,

> ProgressMonitorPart progressMonitor = new ProgressMonitorPart(shell, null);
Here you create ProgressMonitor directly inside the Shell. I think it's good
idea to put yout progress monitor into another Composite located inside your
dialog/view..
In addition you have to specify some layout constraints to make it correcltly
displayed.

-----------------
Alex Shatalin
Re: Showing progress monitor [message #190276 is a reply to message #190065] Fri, 30 May 2008 11:55 Go to previous message
Eclipse UserFriend
Originally posted by: jan.herriger.gmx.de

Hi Igor,

following opens a JFace dialog with progress bar:

ProgressMonitorDialog pmd = new ProgressMonitorDialog(myShell);
pmd.setCancelable(true);
pmd.create();
IProgressMonitor monitor = pmd.getProgressMonitor();

try {
pmd.run(true, true,
new IRunnableWithProgress() {

public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {

int steps = 100

monitor.beginTask("My Task", steps);
while (steps >0)
{
if (monitor.isCanceled()) {
//do something or just break loop...
}

monitor.subTask("My Subtask");
//do some work...
monitor.worked(1);
steps--;
}
}
}
);
}
catch (InvocationTargetException ex1) {...}
catch (InterruptedException ex2) {...}
if (monitor.isCanceled()) {...}

Regards,
Jan
Previous Topic:How to detect a malformed SVG image
Next Topic:Bounds / figures / compartment / visible
Goto Forum:
  


Current Time: Sat Apr 27 03:48:06 GMT 2024

Powered by FUDForum. Page generated in 0.02763 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top