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

📄 importaction.java

📁 Eclipse RCP下编写的工作管理软件代码
💻 JAVA
字号:
/*
 * Created on 2003-4-10
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package net.sf.pim.action;

import net.sf.pim.UiUtil;
import net.sf.pim.model.psp.WorkList;
import net.sf.util.ConfigHelper;
import net.sf.util.persistence.LegacyWorkDataManager;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;

/**
 * @author lzhang
 */
public class ImportAction extends UiAction {
    //记忆上次打开的位置
    private String path = ConfigHelper.getImportHome();

    public ImportAction() {
        super();
        name = "查看...";
        gif = "import.gif";
    }

    public void run() {
    	super.run();
		if (UiUtil.getActiveTableEditor().getName().equals("日志")) {
	        parent.checkSave();
	        FileDialog fd = new FileDialog(parent.getTv().getTable().getShell(), SWT.OPEN | SWT.MULTI);
	        fd.setText("查看文件中的工作列表");
	        fd.setFilterExtensions(new String[]{"*.xml"});
	        fd.setFilterPath(path);
	        fd.open();
	        String fnames[] = fd.getFileNames();
	        if (fnames == null || fnames.length == 0)
	            return;
	        //记忆位置
	        path=fd.getFilterPath();
	        //处理文件名
	        for (int i = 0; i < fnames.length; i++)
	            fnames[i] = fd.getFilterPath() + "/" + fnames[i];
	        //导入
	        parent.setMulti(true);
	        parent.setData(new WorkList(LegacyWorkDataManager.importWork(fnames)));
		}
    }
}

⌨️ 快捷键说明

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