Eclipse编程Tips(4)-Wizard采用进度条指示
来源:互联网 发布:mac怎么打开xlsx文件 编辑:程序博客网 时间:2024/06/05 14:32
采用Wizard的时候,当操作很费时时,采用进度条指示会提供一个良好的界面视觉。幸运的是,Eclipse已经为我们准备了一个进度条,只要合理利用,就可以让它显示出来。
在Wizard的performFinish方法中,不要直接写完成方法,采用如下方法:
public boolean performFinish() {
try {
this.getContainer().run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
monitor.beginTask("task.name", 100);
//下面的代码写业务逻辑,别忘了调用monitor.worked(..)让进度条前进
monitor.done();
}
});
return true;
} catch (InvocationTargetException e) {
//异常处理
} catch (InterruptedException e) {
;//
}
return false;
}
这样,当点击完成时,就会有一个进度条在Wizard底部显示。操作完成后,整个Wizard自动关闭。
以上代码通过阅读WizardProjectsImportPage.java获得。
在Wizard的performFinish方法中,不要直接写完成方法,采用如下方法:
public boolean performFinish() {
try {
this.getContainer().run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
monitor.beginTask("task.name", 100);
//下面的代码写业务逻辑,别忘了调用monitor.worked(..)让进度条前进
monitor.done();
}
});
return true;
} catch (InvocationTargetException e) {
//异常处理
} catch (InterruptedException e) {
;//
}
return false;
}
这样,当点击完成时,就会有一个进度条在Wizard底部显示。操作完成后,整个Wizard自动关闭。
以上代码通过阅读WizardProjectsImportPage.java获得。
- Eclipse编程Tips(4)-Wizard采用进度条指示
- 进度条指示
- Eclipse New Wizard的Wizard
- 使用进度条指示进度
- SWT(JFace)小制作:Wizard(Eclipse插件编程必备)
- android加载WebView进度条指示
- Eclipse编程Tips(3)-实现Preference
- Eclipse编程Tips(3)-实现Preference
- eclipse wizard dialog 按钮控制
- Eclipse Tips
- Eclipse Tips
- eclipse tips
- Eclipse Tips
- eclipse tips
- [eclipse] tips
- 编程tips
- 编程tips
- eclipse对代码的指示
- 测试
- 雪梨九月记(1)
- 转载:What is portal? 杨健伟:IT应用的“门户之见”
- Struts使用Validator
- 20050911
- Eclipse编程Tips(4)-Wizard采用进度条指示
- 2006,一个无法回避的事实
- 互联周记:Web 3.0
- 《程序员》高端采访——普元(未曾公开发表)
- 白话面向智能体编程(Agent Oriented Programmig, AOP)之一
- 白话面向智能体编程(Agent Oriented Programmig, AOP)之三
- 白话面向智能体编程(Agent Oriented Programmig, AOP)之二
- malloc and realloc
- 自然无为 无为而不所不为