重复使用Project Explorer'查看您的自定义插件项目 [英] Reuse Project Explorer' view for your custom plugin project

查看:75
本文介绍了重复使用Project Explorer'查看您的自定义插件项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用eclipse插件,并重新使用项目资源管理器"视图来显示树内容.

I am working on a eclipse plugin and reusing the 'Project Explorer' view to display the tree content.

我有几个问题可以最好地重用:

I have few questions to make it best possible reuse:

  1. 如何禁用排序-当前不需要的"Project Explorer"视图排序树节点.这是我可以更改标志或其他内容的地方吗?还是我必须实现一个View Sorter?

  1. How can I disable the sort - currently 'Project Explorer' view sort tree nodes which I dont want. Is thr a single place where i can change the flags or something? Or I will have to implement a View Sorter ?

我如何像保存Java项目一样保存项目的扩展状态,我希望为自定义插件项目实现相同的状态.

How can I save the expanded state of projects the way it does for a java project , i want the same to implemented for custom plugin project.

如何标记某些不显示的节点.我希望隐藏几个文件夹,并且不显示在项目资源管理器"视图中.

How can I mark some nodes not to be displayed. I want few folders to be hidden and not displayed in 'Project Explorer' view.

插件正在使用向导(INewWizard)创建一个IProject并向其中添加一些IFolder.

Plugin is using Wizards (INewWizard) to create a IProject and add some IFolder(s) to it.

代码段:

private static IProject createBaseProject(String projectName, URI location) {
        // it is acceptable to use the ResourcesPlugin class
        IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

        if (!newProject.exists()) {
            URI projectLocation = location;
            IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName());
            if (location != null && ResourcesPlugin.getWorkspace().getRoot().getLocationURI().equals(location)) {
                projectLocation = null;
            }

            desc.setLocationURI(projectLocation);
            try {
                newProject.create(desc, null);
                if (!newProject.isOpen()) {
                    newProject.open(null);
                }
            } catch (CoreException e) {
                e.printStackTrace();
            }
        }

        return newProject;
    }

private static void createFolder(IFolder folder) throws CoreException {
        IContainer parent = folder.getParent();
        if (parent instanceof IFolder) {
            createFolder((IFolder) parent);
        }
        if (!folder.exists()) {
            folder.create(false, true, null);
        }
    }

推荐答案

如果要自定义自己的ProjectExplorer视图,则需要研究 Common Navigator Framework 文档和这一个

If you want to customize your own ProjectExplorer view, you need to study the Common Navigator Framework docs and tutorials like this one

这篇关于重复使用Project Explorer'查看您的自定义插件项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆