以下代码仅删除它在Web目录中获取的第一个文件.我想删除web目录中的所有文件和文件夹并保留web目录.我怎样才能做到这一点?
- name: remove web dir contents
file: path='/home/mydata/web/{{ item }}' state=absent
with_fileglob:
- /home/mydata/web/*
Run Code Online (Sandbox Code Playgroud)
注意:我尝试过rm -rf使用命令和shell,但它们不起作用.也许我错误地使用它们.
任何正确方向的帮助将不胜感激.
我使用的是ansible 2.1.0.0
我在http://eclipse.geekyramblings.net/2010/12/14/preventing-multiple-instances/上阅读了有关如何防止启动RCP的多个实例的信息.但是当我制作我的RCP(它是一个基于"Hello RCP"模板的简单RCP)可执行文件并尝试启动它时,它会抛出我的错误
java.io.IOException: The location has not been set.
at org.eclipse.core.runtime.internal.adaptor.BasicLocation.lock(BasicLocation.java:174)
at testrcp.Application.start(Application.java:43)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Run Code Online (Sandbox Code Playgroud)
我正在为Web开发人员使用Eclipse Java EE IDE.
版本:Helios Service Release 1 Build id:20100917-0705
这是我的Application.java文件中的代码
package testrcp;
import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
/**
* This class controls all …Run Code Online (Sandbox Code Playgroud) 我有一个线程,可以通过调用Canvas控件的redraw方法来对gif图像进行动画处理。但是会观察到图像闪烁。我尝试使用SWT.NO_REDRAW_RESIZE样式位,但没有帮助。
下面是线程的运行代码
while (!UIManager.stop){
long currentTime = System.currentTimeMillis();
int delayTime = UIManager.loader.data[UIManager.imageNumber].delayTime;
while(currentTime + delayTime * 10 > System.currentTimeMillis()){
// Wait till the delay time has passed
}
UIManager.imageNumber = UIManager.imageNumber == UIManager.loader.data.length-1 ? 0 : UIManager.imageNumber+1;
display.asyncExec(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
if(!UIManager.stop){
UIManager.image = new Image(display, UIManager.loader.data[UIManager.imageNumber] );
if(!UIManager.gifCanvas.isDisposed())
UIManager.gifCanvas.redraw();
}
}
});
Run Code Online (Sandbox Code Playgroud)
画布绘制侦听器如下
gifCanvas = new Canvas(gifComposite,SWT.NO_REDRAW_RESIZE);
gifCanvas.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
gifCanvas.setLayoutData(introGifData);
gifCanvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.drawImage(image,0,0);
}
}); …Run Code Online (Sandbox Code Playgroud)