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

📄 importthirdpartcommand.java

📁 Eclipse代码生成器,支持Eclipse3.3 WTP版本,该项目实现了Spring + hibernate + webService + struts 框架文件的自动生成,有这方面需求的个人公司
💻 JAVA
字号:
package com.newegg.eclipse.soaw.facet.codegen.ui.command.common;

import java.io.File;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.wst.common.environment.IEnvironment;
import org.eclipse.wst.common.environment.IStatusHandler;

import com.newegg.eclipse.soaw.facet.codegen.ui.CodeGenUIMessages;
import com.newegg.eclipse.soaw.facet.codegen.ui.util.Utils;
import com.newegg.eclipse.soaw.facet.codegen.ui.util.ValidataTool;

public class ImportThirdPartCommand
{
	private String strutsVersion = null;
	private String springVersion = null;
	private String presistentVersion = null;
	private IProject pj = null;
	private IProgressMonitor monitor = null;
	private IStatusHandler handler = null;

	public ImportThirdPartCommand ( IProject pj , IProgressMonitor monitor , IStatusHandler handler )
	{
		super();
		this.pj = pj;
		this.monitor = monitor;
		this.handler = handler;
	}

	public ImportThirdPartCommand ( String strutsVersion , String springVersion , String presistentVersion ,
			IProject pj , IProgressMonitor monitor , IStatusHandler handler )
	{
		super();
		this.strutsVersion = strutsVersion;
		this.springVersion = springVersion;
		this.presistentVersion = presistentVersion;
		this.pj = pj;
		this.monitor = monitor;
		this.handler = handler;
	}

	public ImportThirdPartCommand ( String strutsVersion , String springVersion , String presistentVersion , IProject pj )
	{
		super();
		this.strutsVersion = strutsVersion;
		this.springVersion = springVersion;
		this.presistentVersion = presistentVersion;
		this.pj = pj;
	}

	/**
	 * Copy jars from third part plug in.
	 * 
	 * @throws CoreException
	 */
	public void execute() throws CoreException
	{
		List<String> list = new ArrayList<String>();
		if (!ValidataTool.stringIsNull(strutsVersion))
		{
			String strutsLib = CodeGenUIMessages.NEWEGG_THIRDPART_CONTROLLER_LIB_FOLDER + strutsVersion;
			list.add(strutsLib);
		}
		if (!ValidataTool.stringIsNull(springVersion))
		{
			String springLib = CodeGenUIMessages.NEWEGG_THIRDPART_CONTEXT_LIB_FOLDER + springVersion;
			list.add(springLib);
		}
		if (!ValidataTool.stringIsNull(presistentVersion))
		{
			String presistentLib = CodeGenUIMessages.NEWEGG_THIRDPART_PERSISTENT_LIB_FOLDER + presistentVersion;
			list.add(presistentLib);
		}
		String p6LogLib = CodeGenUIMessages.NEWEGG_THIRDPART_LIB_COMMON;
		list.add(p6LogLib);
		copySpecifyFrameworkJars(list);
	}

	/**
	 * Copy specify jars.
	 * 
	 * @param list
	 * @throws CoreException
	 */
	public void copySpecifyFrameworkJars(List<String> list) throws CoreException
	{
		IPath thirdPartParentFolderPath = Utils.getThirdLibFolderPath();
		for (int i = 0; i < list.size(); i++)
		{
			iterateCopy(thirdPartParentFolderPath.append(list.get(i)));
		}
	}

	/**
	 * Iterator the resource have exist in thidpart plug in .
	 * 
	 * @param sourcePath
	 * @throws CoreException
	 */
	private void iterateCopy(IPath sourcePath) throws CoreException
	{
		File libFolder = sourcePath.toFile();
		File[] libFiles = libFolder.listFiles();
		IFolder webInfLibFolder = Utils.getWebInfLibDir(pj);
		for (int i = 0; i < libFiles.length; i++)
		{
			if (libFiles[i].isDirectory())
				continue;
			IPath curSrcPath = new Path(libFiles[i].getAbsolutePath());
			Utils.copyFromPlugin(curSrcPath, webInfLibFolder.getFile(libFiles[i].getName()));
		}
	}
}

⌨️ 快捷键说明

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