JFace progress in the application of Article

In the project using the progress bar, custom-specific function of the progress of the Covenant. Must use Dongdong.

Create a progress bar dialog box ProgressMonitorDialog, the implementation of the relevant run method.

To achieve a variety of information related to IRunnableWithProgress.

package com.vnvntrip.plugin.dev.views.custom;

import java.lang.reflect.InvocationTargetException;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
/**
 *  Common progress bar
 * @author longgangbai
 *
 */
public class OrdinaryProgress{
    private Shell shell;
    public OrdinaryProgress(Shell parent) {
       this.shell=shell;
    }

    public void run(){
        try {
            new ProgressMonitorDialog(shell).run(true, true, new IRunnableWithProgress(){
                public void run(IProgressMonitor monitor)
                    throws InvocationTargetException, InterruptedException {
                    monitor.beginTask("generate", 30);
                    for (int i = 0; i < 100; i++) {
                        if(monitor.isCanceled())
                        {
                             return ;
                        }
                        monitor.worked(1);
                        Thread.sleep(50);
                    }
                    monitor.done();
                }
            });
        } catch (InvocationTargetException e) {
        } catch (InterruptedException e) {
        }
    }

}
分类:Java 时间:2010-03-29 人气:265
分享到:
blog comments powered by Disqus

相关文章

  • an important class java.lang review, reflection and thread 2010-04-05

    java.lang package is a Java-based package, at compile time, java.lang package is automatically imported source files. contains the Object class and java.lang wrapper classes (Boolean, Character, Byte, Short, Integer, Long, Float and Double) and so on

  • Solution - java.lang.OutOfMemoryError: unable to create new native thread 2010-03-23

    Work, come across this issue several times, I feel it is necessary to sum up, so has this article, this article is divided into three parts: understanding, analyzing and solving problems. One to know the problems: First, we test through the following

  • java.lang Package Overview 2010-03-26

    1, interface java.lang.Appendable Can append (append) interfaces. Class implements this interface has an instance of an object can be an additional character or sequence of characters to their ability. Formatter hope to receive the output class must

  • Inside java.lang.Enum 2010-08-04

    1 Introduction to enum Java SE 5 introduced the enumeration, and add a new keyword enum. Here is a enumeration of examples: public enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES; } Enumeration type is an ordinary Java class, inherited from the java.lang

  • Error: java.lang.NoClassDefFoundError: javax / persistence / Cacheable 2010-12-10

    Error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax / p

  • [JVM-translation] lifted the veil of one of the java.lang.OutOfMemoryError 2010-03-23

    What is the Java.lang.OutOfMemoryError Java.lang.OutOfMemory is a subclass of java.lang.VirtualMachineError, when the Java virtual machine interrupt, or throw beyond the available resources. Obviously, OutOfMemory in the Java virtual machine, resourc

  • java.lang.NoClassDefFoundError: javax / el / ELException 2010-09-06

    In maven dependency to configure the following: <dependency> <groupId> javax.servlet </ groupId> <artifactId> jstl </ artifactId> <version> 1.2 </ version> </ Dependency> In the resin-3.0.28 run, reported th

  • tomcat5.0.27 + jdk1.4 + jsf appear java.lang.UnsupportedClassVersionError 2010-09-19

    Tomcat5.0.27 + jdk1.4 + jsf 2010-09-19 21:03:28 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News /

  • java.lang.NoClassDefFoundError: javax / el / ExpressionFactory 2010-10-25

    Today myeclipse6.5 written before the development environment will be deployed to a web project tomcat, deployment after the start, error, exception information is as follows: Information: XML validation disabled 2010-10-25 9:58:42 org.apache.catalin

  • java.lang.IllegalStateException: Cannot forward after response has been committed 2010-01-04

    Today, view the application's log files, found that repeated emergence of the following exceptions: Servlet.service() for servlet action threw exception java.lang.IllegalStateException: Cannot forward after response has been committed at org.apache.c

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.217 (s). 12 q(s)