本文整理汇总了Java中org.eclipse.gef.EditPartViewer.setEditPartFactory方法的典型用法代码示例。如果您正苦于以下问题:Java EditPartViewer.setEditPartFactory方法的具体用法?Java EditPartViewer.setEditPartFactory怎么用?Java EditPartViewer.setEditPartFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.EditPartViewer
的用法示例。
在下文中一共展示了EditPartViewer.setEditPartFactory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createControl
import org.eclipse.gef.EditPartViewer; //导入方法依赖的package包/类
@Override
public void createControl(Composite parent) {
EditPartViewer viewer=this.getViewer();
viewer.createControl(parent);
viewer.setEditDomain(getEditDomain());
viewer.setEditPartFactory(new DesignerTreeEditPartFactory());
viewer.setContents(graphData);
getSelectionSynchronizer().addViewer(viewer);
super.createControl(parent);
}
示例2: configureOutlineViewer
import org.eclipse.gef.EditPartViewer; //导入方法依赖的package包/类
/**
* Configure outline viewer.
*/
protected void configureOutlineViewer() {
final EditPartViewer viewer = getViewer();
viewer.setEditDomain(editor.getEditDomain());
viewer.setEditPartFactory(getEditPartFactory());
ContextMenuProvider provider = getMenuContentProvider();
viewer.setContextMenu(provider);
viewer.addDropTargetListener(new JSSTemplateTransferDropTargetListener(viewer));
viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer) {
@Override
protected Object getTemplate() {
List<Object> models = new ArrayList<Object>();
Object obj = super.getTemplate();
if (obj == null) {
List<?> selection = getViewer().getSelectedEditParts();
for (Object it : selection) {
if (it instanceof EditPart) {
Object model = ((EditPart) it).getModel();
if (model instanceof IDragable) {
models.add(model);
}
if (model instanceof MBand){
BandTypeEnum bandType =((MBand)model).getBandType();
if (BandTypeEnum.DETAIL.equals(bandType) || BandTypeEnum.GROUP_FOOTER.equals(bandType) || BandTypeEnum.GROUP_HEADER.equals(bandType)){
models.add(model);
}
}
}
}
}
return models;
}
});
// Add images drop listeners
viewer.addDropTargetListener(new ImageResourceDropTargetListener(viewer, ResourceTransfer.getInstance()));
viewer.addDropTargetListener(new ImageResourceDropTargetListener(viewer, FileTransfer.getInstance()));
viewer.addDropTargetListener(new ImageResourceDropTargetListener(viewer, ImageURLTransfer.getInstance()));
IPageSite site = getSite();
site.registerContextMenu(provider.getId(), provider, site.getSelectionProvider());
IToolBarManager tbm = site.getActionBars().getToolBarManager();
registerToolbarAction(tbm);
showPage(ID_ACTION_OUTLINE);
}