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

相关文章

  • 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

  • 解决java.lang.OutOfMemoryError: unable to create new 2015-03-23

    工作中碰到过这个问题好几次了,觉得有必要总结一下,所以有了这篇文章,这篇文章分为三个部分:认识问题.分析问题.解决问题. 认识问题 首先我们通过下面这个 测试程序 来认识这个问题.运行的环境 (有必要说明一下,不同环境会有不同的结果):32位 Windows XP,Sun JDK 1.6.0_18, eclipse 3.4,测试程序: import java.util.concurrent.CountDownLatch; public class TestNativeOutOfMemoryErr

  • 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

  • 用流读取幻灯片报java.lang.IllegalStateException,不知哪有问题? 2012-02-24

    后台查出一个List:[{KEYID=1495, TITLE=mm, FILEURL=uploadfile/webmanagefiles/2012216/201202161449470000562.bmp}, {KEYID=1535, TITLE=whmtest0216-1, FILEURL=uploadfile/webmanagefiles/2012216/201202161427270000440.jpg}, {KEYID=1515, TITLE=m2, FILEURL=uploadfile

  • [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

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

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

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

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