当前位置: 首页>>代码示例>>Java>>正文


Java EditPartViewer.setEditPartFactory方法代码示例

本文整理汇总了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);
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:11,代码来源:GraphicalEditorPage.java

示例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);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:50,代码来源:JDReportOutlineView.java


注:本文中的org.eclipse.gef.EditPartViewer.setEditPartFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。