Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2295846
  • 博文数量: 321
  • 博客积分: 3440
  • 博客等级: 中校
  • 技术积分: 2992
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-24 09:08
个人简介

我就在这里

文章分类

全部博文(321)

文章存档

2015年(9)

2014年(84)

2013年(101)

2012年(25)

2011年(29)

2010年(21)

2009年(6)

2008年(23)

2007年(23)

分类: Java

2014-11-26 21:51:40

There is an example of creating linked resources in code.

  1. IProject project = workspace.getProject("Project");//assume this exists
  2.    IFolder link = project.getFolder("Link");
  3.    IPath location = new Path("C:\TEMP\folder");
  4.    if (workspace.validateLinkLocation(location).isOK()) {
  5.       link.createLink(location, IResource.NONE, null);
  6.    } else {
  7.       //invalid location, throw an exception or warn user
  8.    }

This example will create a linked folder called "Link" that is located at "c:\temp\folder".

link.getFullPath() => "/Project/Link"
link.getLocation() => "c:\temp\folder"
link.getRawLocation() => "temp/folder"
link.isLinked() => "true"
IFile child = link.getFile("abc.txt");
child.create(...);
child.getFullPath() => "/Project/Link/abc.txt"
child.getLocation() => "c:\temp\folder\abc.txt"
child.getRawLocation() => "c:\temp\folder\abc.txt"
child.isLinked() => "false"
阅读(1743) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~