* Add Dependenceis in MANIFEST.MF
- MANIFEST.MF > Dependencies > Add > org.eclipse.core.resources
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
IProject[] projects = root.getProjects();
//ws.toString:org.eclipse.core.internal.resources.Worksapce@**
//root.toString : R
IProject project = projects[0];
IFolder tmpDir = null;
IFile file = null;
if(project.exists()){
//1. Create in Project not System
tmpDir = project.getFolder((new Path("tmp")));
if(!tmpDir.exists()){
try {
//2. Create in System
tmpDir.create(false, true, null);
}catch (CoreException e) {
e.printStackTrace();
}
}
file = tmpDir.getFile(new Path("boo.txt"));
if(!file.exists()){
try{
String str = "dummy";
InputStream is = new ByteArrayInputStream(str.getBytes());
file.create(is, false, null);
}catch(CoreException e){
e.printStackTrace();
}
}
Log.logInfo(file.getLocation().toString());
}else{
Log.logInfo("project is NOT exist");
}
- reference :
--http://www.masatom.in/pukiwiki/Eclipse/%A5%D7%A5%E9%A5%B0%A5%A4%A5%F3%B3%AB%C8%AF%A4%CETIPS%BD%B8/%A5%EF%A1%BC%A5%AF%A5%B9%A5%DA%A1%BC%A5%B9%A4%CE%A5%EA%A5%BD%A1%BC%A5%B9%A4%F2%BC%E8%A4%EA%B0%B7%A4%A6/
0 件のコメント:
コメントを投稿