2 gangfeng90 gangfeng90 于 2013.10.22 15:51 提问

如何在eclipse rcp_gef应用中实现eclipse的outline视图的工具条栏?

如图,这是系统的outline,有工具条的
CSDN移动问答
如图,这是gef应用中做的outline,无工具条

CSDN移动问答
如图,这就是要实现的工具条以及其上的功能,亦是问题之所在
CSDN移动问答
求高手,求解!

这是MyGraphicalEditor类中实现outline的代码:
protected class OutlinePage extends ContentOutlinePage {
private ScrollableThumbnail thumbnail;
private DisposeListener disposeListener;

    private SashForm sash;

    public OutlinePage() {
        super(new TreeViewer());
    }

    public void createControl(Composite parent) {
        sash = new SashForm(parent, SWT.VERTICAL);
        IActionBars bars = getSite().getActionBars();
        ActionRegistry ar = getActionRegistry();

        bars.setGlobalActionHandler(ActionFactory.COPY.getId(), 
                ar.getAction(ActionFactory.COPY.getId()));
        bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), 
                ar.getAction(ActionFactory.PASTE.getId()));

        getViewer().createControl(sash);

        getViewer().setEditDomain(getEditDomain());
        getViewer().setEditPartFactory(new AppTreeEditPartFactory());
        getViewer().setContents(model);

        getSelectionSynchronizer().addViewer(getViewer());
        Canvas canvas = new Canvas(sash, SWT.BORDER);
        LightweightSystem lws = new LightweightSystem(canvas);

        thumbnail = new ScrollableThumbnail(
                (Viewport) ((ScalableRootEditPart) getGraphicalViewer()
                        .getRootEditPart()).getFigure());
        thumbnail.setSource(((ScalableRootEditPart) getGraphicalViewer()
                .getRootEditPart())
                .getLayer(LayerConstants.PRINTABLE_LAYERS));

        lws.setContents(thumbnail);

        disposeListener = new DisposeListener() {
            @Override
            public void widgetDisposed(DisposeEvent e) {
                if (thumbnail != null) {
                    thumbnail.deactivate();
                    thumbnail = null;
                }
            }
        };
        getGraphicalViewer().getControl().addDisposeListener(
                disposeListener);

    }

1个回答

gangfeng90
gangfeng90   2013.10.23 17:10

没人关注下这个问题吗?

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!