Eclipse插件开发。如何以编程方式设置排除过滤器?

时间:2014-04-17 12:57:29

标签: eclipse plugins sdk

我使用以下代码创建了一个源文件夹:

Folder folder = proj.getFolder("resources");
folder.create(false, true, null);
IPackageFragmentRoot root = jproject.getPackageFragmentRoot(folder);
IClasspathEntry[] oldEntries = jproject.getRawClasspath();
IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
newEntries[oldEntries.length] = JavaCore.newSourceEntry(root.getPath());
jproject.setRawClasspath(newEntries, null);
i18Resource = folder;

现在我想将**添加到其排除路径中,就像在此对话框中一样:

enter image description here

我该怎么做?

1 个答案:

答案 0 :(得分:1)

JavaCore.newSourceEntry的变体支持此功能:

public static IClasspathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns,
       IPath[] exclusionPatterns, IPath specificOutputLocation, 
       IClasspathAttribute[] extraAttributes)