Creating an eclipse plugin. When I run my plugin, there should be some default folders already in the project explorer.
创建一个eclipse插件。当我运行我的插件时,项目资源管理器中应该有一些默认文件夹。
The idea is those folder are basically libraries which I can share with all the project created in project explorer.
想法是那些文件夹基本上是库,我可以与项目浏览器中创建的所有项目共享。
1 个解决方案
#1
Check out this tutorial here
在这里查看本教程
public static IProject createProject(String projectName, URI location) {
Assert.isNotNull(projectName);
Assert.isTrue(projectName.trim().length() > 0);
IProject project = createBaseProject(projectName, location);
try {
addNature(project);
String[] paths = { "parent/child1-1/child2", "parent/child1-2/child2/child3" }; //$NON-NLS-1$ //$NON-NLS-2$
addToProjectStructure(project, paths);
} catch (CoreException e) {
e.printStackTrace();
project = null;
}
return project;
}
Follow the tutorial in the above link , its quite good for complete project developent
按照上面链接中的教程,它非常适合完整的项目开发
Though you havent asked this , but if there is a need for prewritten files in the project created by plugin. Use this code for achieving that
虽然你没有问这个,但是如果需要在插件创建的项目中预先写好文件。使用此代码实现此目的
IFile htaccess=project.getFile("--.htaccess");
String contents = sb.toString();
InputStream sourceone = new ByteArrayInputStream(contents.getBytes());
htaccess.create(sourceone, false, null);
Hope it helps.
希望能帮助到你。
#1
Check out this tutorial here
在这里查看本教程
public static IProject createProject(String projectName, URI location) {
Assert.isNotNull(projectName);
Assert.isTrue(projectName.trim().length() > 0);
IProject project = createBaseProject(projectName, location);
try {
addNature(project);
String[] paths = { "parent/child1-1/child2", "parent/child1-2/child2/child3" }; //$NON-NLS-1$ //$NON-NLS-2$
addToProjectStructure(project, paths);
} catch (CoreException e) {
e.printStackTrace();
project = null;
}
return project;
}
Follow the tutorial in the above link , its quite good for complete project developent
按照上面链接中的教程,它非常适合完整的项目开发
Though you havent asked this , but if there is a need for prewritten files in the project created by plugin. Use this code for achieving that
虽然你没有问这个,但是如果需要在插件创建的项目中预先写好文件。使用此代码实现此目的
IFile htaccess=project.getFile("--.htaccess");
String contents = sb.toString();
InputStream sourceone = new ByteArrayInputStream(contents.getBytes());
htaccess.create(sourceone, false, null);
Hope it helps.
希望能帮助到你。