通过java程序在WebContent下刷新文件夹(在eclipse项目中)

时间:2016-06-11 10:05:57

标签: java eclipse-plugin

我正在制作一个WEB系统(Windows 32x上的最新Java8和eclipse_mars.2)。 并且该系统具有文件下载功能(文件由java制作)。 当文件(用于下载)放在myproject / WebContent / tempfolder中时, 用户可以通过URL访问这些文件,并可以获取文件。

(我想在Eclipse Control下管理Web系统。不在Tomcat上)

但eclipse不会立即识别文件(由java制作)。 在我的准备服务器条件下,  当我按下这个系统上的下载按钮时,我必须等待大约7--8秒。

用户不会等待7--8秒(我认为)。

(eclipse工作区设置((窗口) - (首选项) - (常规) - (工作区))是这样的: ·在本机挂钩或轮询上刷新(选中) ·访问时刷新(已检查)
) 我在许多WEB网站上研究了programatcally刷新插件,但我找不到这个。

所以我开始制作Eclipse-Plugin,    使myproject / WebContent / tempfolder以编程方式刷新,  就在java程序设置好要下载的新文件之后..

(现在,工作区名称是“myworkspace_m”。 Dinamic Web Project名称是“myproject”。  要刷新的文件夹是“myproject / WebContent / tempfolder”。  插件项目名称是“myprojectsupport”。 刷新程序是“RefreshFolder.java”。 )

Eclipse插件项目中的程序如下所示。(它不起作用)

package myprojectsupport;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;

public class RefreshFolder {

    public void main() throws CoreException {
        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        IProject project = root.getProject("myproject");
        IPath path = project.getFullPath().append("WebContent/tempfolder");
        IFile iFile  = root.getFile(path);

        iFile.refreshLocal(IResource.DEPTH_INFINITE, null);
   }
}

当我运行此程序时, 我打开了myprojectsupport \ META-INF \ MANIFEST.MF, 在OverView选项卡上,我按下“启动eclipse应用程序”链接

然后打开另一个日食窗口,控制台说像吼叫。 但我无法理解这个控制台日志。 请告诉我该怎么办。 (抱歉英文不好)

!SESSION 2016-06-11 17:52:57.414 -----------------------------------------------
eclipse.buildId=4.5.2.M20160212-1500
java.version=1.8.0_92
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=ja_JP
Framework arguments:  -product org.eclipse.platform.ide
Command-line arguments:  -product org.eclipse.platform.ide -data C:\myworkspace_m/../runtime-EclipseApplication -dev file:C:/myworkspace_m/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog

!ENTRY org.eclipse.jface 2 0 2016-06-11 17:53:02.051
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2016-06-11 17:53:02.051
!MESSAGE A conflict occurred for ALT+F5:
Binding(ALT+F5,
    ParameterizedCommand(Command(com.github.ugrave.tools.ws.refresh.commands.RefreshWorkspaceHandler,Refresh Workspace,
        Refresh the complete Workspace,
        Category(org.eclipse.core.commands.categories.autogenerated,Uncategorized,Commands that were either auto-generated or have no category,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@b94590,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
Binding(ALT+F5,
    ParameterizedCommand(Command(org.eclipse.m2e.core.ui.command.updateProject,Update Project,
        Update Maven Project configuration and dependencies,
        Category(org.eclipse.ui.category.window,Window,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@177fc44,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://933.fwk28054045:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://933.fwk28054045:2/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

!ENTRY org.eclipse.egit.ui 2 0 2016-06-11 17:53:04.854
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\s111111'. 
If this is not correct please set the HOME environment variable and restart Eclipse. 
Otherwise Git for Windows and EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

!ENTRY org.eclipse.core.net 4 0 2016-06-11 17:53:07.437
!MESSAGE WinHttp.DetectAutoProxyConfigUrl for wpad failed with error 'vLV̎©®\¬ ' #12180.

0 个答案:

没有答案