⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 processtask.java

📁 替换jsp中的中文为sturts中的bundle
💻 JAVA
字号:
package com.pengjj.app;


import org.eclipse.swt.widgets.Display;

public class ProcessTask {
	private GetAllFileToResource replace;
	private ReplaceByInputWindow inputWindow;
	private String text;
	private String sFinish;
	public ProcessTask(GetAllFileToResource getAllFile){
		this.replace = getAllFile;
	}
	public ProcessTask(ReplaceByInputWindow inputWindow){
		this.inputWindow = inputWindow;
	}
	/**
     * 开始执行
     */
    public void start() {
		// 一但发现执行状态为停止,则退出此循环
    	while(sFinish==null||!sFinish.equals("end")){
			// 每隔0.1秒一次循环,用于模拟表示一个需时较长的任务
			try {
				Thread.sleep(50);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			getText();
			getFinish();
			setText(text);
		}
	}
    /**
     * 设置进度信息
     */
    private void setText(final String str) {
        Display.getDefault().syncExec(new Runnable() {
            public void run() {
            	if(replace!=null){
                	replace.setText(str);
            	} else if(inputWindow!=null){
            		inputWindow.setText(str);
            	}
            }
        });
    }
    /**
     * 得到正在操作的文件
     */
    private void getText() {
		Display.getDefault().syncExec(new Runnable() {
			public void run() {
				if (replace != null) {
					text = replace.getResourceProcess();
				} else if (inputWindow != null) {
					text = inputWindow.getResourceProcess();
				}
			}
		});
	}
    /**
	 * 是否已经全部完成
	 * 
	 */
    private void getFinish() {
        Display.getDefault().syncExec(new Runnable() {
            public void run() {
            	if (replace != null) {
            		sFinish=replace.getFinish();
				} else if (inputWindow != null) {
					sFinish=inputWindow.getFinish();
				}
            	
            }
        });
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -