如何自定义GridView的元素
1个回答
2014-11-30
展开全部
新建一个MenuPaletteProvider,继承自PaletteViewerProvider,这样我们可以在
configurePaletteViewer方法中添加我们自己的菜单就可以了,完整代码如下:
import org.eclipse.gef.EditDomain;
import org.eclipse.gef.ui.palette.PaletteViewer;
import org.eclipse.gef.ui.palette.PaletteViewerProvider;
import org.eclipse.gef.ui.palette.PaletteContextMenuProvider;
import org.eclipse.jface.action.IMenuManager;
import umldesigner.actions.AddNewPaletteObjectAction;
public class MenuPaletteProvider extends PaletteViewerProvider{
private BasicGraphicalEditor edit;
public MenuPaletteProvider(BasicGraphicalEditor editor, EditDomain graphicalViewerDomain)
{
super(graphicalViewerDomain);
this.edit = editor;
}
configurePaletteViewer方法中添加我们自己的菜单就可以了,完整代码如下:
import org.eclipse.gef.EditDomain;
import org.eclipse.gef.ui.palette.PaletteViewer;
import org.eclipse.gef.ui.palette.PaletteViewerProvider;
import org.eclipse.gef.ui.palette.PaletteContextMenuProvider;
import org.eclipse.jface.action.IMenuManager;
import umldesigner.actions.AddNewPaletteObjectAction;
public class MenuPaletteProvider extends PaletteViewerProvider{
private BasicGraphicalEditor edit;
public MenuPaletteProvider(BasicGraphicalEditor editor, EditDomain graphicalViewerDomain)
{
super(graphicalViewerDomain);
this.edit = editor;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询