eclipse中打开文件夹以及ftp插件

// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   EasyLookAction.java

package org.jxc.easylook.popup.actions;

import java.io.File;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.internal.core.JarPackageFragmentRoot;
import org.eclipse.jdt.internal.core.PackageFragment;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;

public class EasyLookAction
	implements IObjectActionDelegate
{

	private Object selected;
	private Class selectedClass;

	public EasyLookAction()
	{
		selected = null;
		selectedClass = null;
	}

	public void setActivePart(IAction iaction, IWorkbenchPart iworkbenchpart)
	{
	}

	public void run(IAction action)
	{
		if (selected == null)
			return;
		File directory = null;
		if (selected instanceof IResource)
			directory = new File(((IResource)selected).getLocation().toOSString());
		if (selected instanceof IFile)
			directory = directory.getParentFile();
		if (directory == null)
			return;
		try
		{
			Runtime.getRuntime().exec((new StringBuilder("explorer.exe /n,")).append(directory.toString()).toString());
		}
		catch (Exception ) { }
	}

	public void selectionChanged(IAction action, ISelection selection)
	{
		try
		{
			IAdaptable adaptable = null;
			selected = "unknown";
			if (selection instanceof IStructuredSelection)
			{
				adaptable = (IAdaptable)((IStructuredSelection)selection).getFirstElement();
				selectedClass = adaptable.getClass();
				if (adaptable instanceof IResource)
					selected = (IResource)adaptable;
				else
				if ((adaptable instanceof PackageFragment) && (((PackageFragment)adaptable).getPackageFragmentRoot() instanceof JarPackageFragmentRoot))
					selected = getJarFile(((PackageFragment)adaptable).getPackageFragmentRoot());
				else
				if (adaptable instanceof JarPackageFragmentRoot)
					selected = getJarFile(adaptable);
				else
					selected = (IResource)adaptable.getAdapter(org/eclipse/core/resources/IResource);
			}
		}
		catch (Throwable ) { }
	}

	protected File getJarFile(IAdaptable adaptable)
	{
		JarPackageFragmentRoot jpfr = (JarPackageFragmentRoot)adaptable;
		File selected = jpfr.getPath().makeAbsolute().toFile();
		if (!selected.exists())
		{
			File projectFile = new File(jpfr.getJavaProject().getProject().getLocation().toOSString());
			selected = new File((new StringBuilder(String.valueOf(projectFile.getParent()))).append(selected.toString()).toString());
		}
		return selected;
	}
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Eclipse插件- Sexftp 说明:简单实现了FTP上传功能,可装在Eclipse3.5以上,Myclipse 8.5 以上版本。Jdk版本1.5以上。 简介: 1、可轻松将eclipse的项目上传到FTP生产环境服务器上,省去来回切换工具的麻烦。 2、根据设定好的基准目录自动定位服务器目录,例如.../com/cm/service 的文件 会自动上传到 FTP .../com/cm/service 目录 ,省去来回选择目录的麻烦。 3、考虑到FTP服务器可能会因为网络原因上较慢,可过滤出相对上次上传后的结果新修改的文件,并选择只上传这些文件,从而不必每次修改都来找文件,特别是一次零零散散修改了十几个文件时,只需要轻松一点,即可上传这些新修改过的文件。(我以前的作法是干脆整个工程重新上传,但是网速慢要上传半天。一个一个的选择这些修改了的文件,又很麻烦。) 4、所有服务器及上传配置使用XML文件,复制粘贴更容易。 该插件现有功能主要是为了解决如下场景: 每次有新需求时,总会在不同的包不同的目录下修改或新增各种文件,改好稳定好上传到生产环境时,由于相尽可能减少生产环境文件的变化,只上传修改过的文件,所以这时需要在本地目录和服务器目录来回选择,而且还要一个个找那些修改了的文件,很麻烦,所以实现这个插件来解决这个经常出现的麻烦。 下载以及FTP服务器目录浏览由于使用频率较低,这版就暂时没考虑,下一版本实现。 下一版本计划: 1、服务器目录浏览。 2、服务器文件在线修改,改为后自动传回服务器。减少操作过程。 3、根据本地目录自动定位到服务器目录。 4、XML配置方式计划仍然保留。 本插件不依赖任何插件,不推荐使用 eclipse myeclipse的在线安装方式,因为他需要无故下一些不明白的包,网络不好的还要下半天,而且现在myeclipse的那个在线更新打开慢,据说国内IP又被他封了,在线更新变得不太方便了。这里自带了一个 install.bat 的安装程序,简化及加快安装过程,注意运行这个安装程序需要装有JDK1.5以上版本并且可以使用JAVA命令。 欢迎使用并提建议,联系我:coynnbai@163.com
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值