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


Java SnapToGeometry类代码示例

本文整理汇总了Java中org.eclipse.gef.SnapToGeometry的典型用法代码示例。如果您正苦于以下问题:Java SnapToGeometry类的具体用法?Java SnapToGeometry怎么用?Java SnapToGeometry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SnapToGeometry类属于org.eclipse.gef包,在下文中一共展示了SnapToGeometry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAdapter

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
@Override 
public Object getAdapter(Class key) {
    if (key == SnapToHelper.class) {
        List<SnapToHelper> helpers = new ArrayList<SnapToHelper>();
        if (Boolean.TRUE.equals(getViewer().getProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED))) {
            helpers.add(new SnapToGeometry(this));
        }
        if (Boolean.TRUE.equals(getViewer().getProperty(SnapToGrid.PROPERTY_GRID_ENABLED))) {
            helpers.add(new SnapToGrid(this));
        }
        if(helpers.size()==0) {
            return null;
        } else {
            return new CompoundSnapToHelper(helpers.toArray(new SnapToHelper[0]));
        }
    }
    if (key == IPropertySource.class) {
       return new GW4EGraphEditPartProperties(this);
    }
    return null;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:22,代码来源:GraphPart.java

示例2: initializeGraphicalViewer

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void initializeGraphicalViewer() {
    final GraphicalViewer viewer = getGraphicalViewer();
    viewer.setEditPartFactory(editPartFactory);

    initViewerAction(viewer);
    initDragAndDrop(viewer);

    viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON);
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);
    viewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, true);

    final MenuManager menuMgr = new ERDiagramPopupMenuManager(getActionRegistry(), diagram);

    extensionLoader.addERDiagramPopupMenu(menuMgr, getActionRegistry());

    viewer.setContextMenu(menuMgr);

    viewer.setContents(diagram);

    outlineMenuMgr = new ERDiagramOutlinePopupMenuManager(diagram, getActionRegistry(), outlinePage.getOutlineActionRegistory(), outlinePage.getViewer());
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:27,代码来源:ERDiagramEditor.java

示例3: initializeGraphicalViewer

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void initializeGraphicalViewer() {
	GraphicalViewer viewer = this.getGraphicalViewer();
	viewer.setEditPartFactory(editPartFactory);

	this.initViewerAction(viewer);
	this.initDragAndDrop(viewer);

	viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
			MouseWheelZoomHandler.SINGLETON);
	viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
	viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);
	viewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, true);

	MenuManager menuMgr = new ERDiagramPopupMenuManager(
			this.getActionRegistry(), this.diagram, this);

	this.extensionLoader.addERDiagramPopupMenu(menuMgr,
			this.getActionRegistry());

	viewer.setContextMenu(menuMgr);

	viewer.setContents(diagram);
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:28,代码来源:ERDiagramEditor.java

示例4: showTargetFeedback

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.EditPolicy#showTargetFeedback(org.eclipse.gef.Request)
 */
public void showTargetFeedback(Request req) {
	if (req.getType().equals(REQ_MOVE) || req.getType().equals(REQ_RESIZE) || req.getType().equals(REQ_CLONE)
			|| req.getType().equals(REQ_ADD) || req.getType().equals(REQ_CREATE)) {

		Integer value;
		value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_WEST_ANCHOR);
		highlightGuide(value, ColorConstants.lightBlue, 0);

		value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_NORTH_ANCHOR);
		highlightGuide(value, ColorConstants.lightBlue, 1);

		value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_EAST_ANCHOR);
		highlightGuide(value, ColorConstants.lightBlue, 2);

		value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_SOUTH_ANCHOR);
		highlightGuide(value, ColorConstants.lightBlue, 3);

		value = (Integer) req.getExtendedData().get(SnapToGuides.KEY_VERTICAL_GUIDE);
		highlightGuide(value, ColorConstants.red, 4);

		value = (Integer) req.getExtendedData().get(SnapToGuides.KEY_HORIZONTAL_GUIDE);
		highlightGuide(value, ColorConstants.red, 5);
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:28,代码来源:SimpleSnapFeedbackPolicy.java

示例5: initializeGraphicalViewer

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
@Override
protected void initializeGraphicalViewer() {
    final GraphicalViewer viewer = getGraphicalViewer();
    viewer.setEditPartFactory(editPartFactory);
    initViewerAction(viewer);
    initDragAndDrop(viewer);
    viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON);
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);
    viewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, true);

    prepareERDiagramPopupMenu(viewer);

    prepareERDiagramOutlinePopupMenu();

    this.gotoMaker = new ERDiagramGotoMarker(this);
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:18,代码来源:MainDiagramEditor.java

示例6: getAdapter

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
/**
 * {@inheritDoc} In this {@link EditPart} this method add adapter types for creating a
 * {@link SnapToHelper} when the editor is in snapping mode (either to grid or to shapes).
 */
@Override
public Object getAdapter(final Class key) {
  if (key == SnapToHelper.class) {
    List<SnapToHelper> helpers = new ArrayList<SnapToHelper>();
    if (Boolean.TRUE.equals(getViewer().getProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED))) {
      helpers.add(new SnapToGeometry(this));
    }
    if (Boolean.TRUE.equals(getViewer().getProperty(SnapToGrid.PROPERTY_GRID_ENABLED))) {
      helpers.add(new SnapToGrid(this));
    }
    if (helpers.size() == 0) {
      return null;
    } else {
      return new CompoundSnapToHelper(helpers.toArray(new SnapToHelper[0]));
    }
  }
  return super.getAdapter(key);
}
 
开发者ID:leondart,项目名称:FRaMED,代码行数:23,代码来源:ORMModelEditPart.java

示例7: getAdapter

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class key) {
	if (IPropertySource.class == key) {
		return getPropertySource();
	}
	if (key == SnapToHelper.class) {
		List<SnapToHelper> helpers = new ArrayList<SnapToHelper>();
		if (Boolean.TRUE.equals(getViewer().getProperty(
				SnapToGeometry.PROPERTY_SNAP_ENABLED))) {
			helpers.add(new SnapToGeometry(this));
		}
		if (Boolean.TRUE.equals(getViewer().getProperty(
				SnapToGrid.PROPERTY_GRID_ENABLED))) {
			helpers.add(new SnapToGrid(this));
		}
		if (helpers.size() == 0) {
			return null;
		} else {
			return new CompoundSnapToHelper(
					helpers.toArray(new SnapToHelper[0]));
		}
	}

	return super.getAdapter(key);
}
 
开发者ID:snakerflow,项目名称:snaker-designer,代码行数:27,代码来源:ProcessEditPart.java

示例8: initializeGraphicalViewer

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
/**
 * 初始化View
 */
@Override
protected void initializeGraphicalViewer() {
	GraphicalViewer viewer = this.getGraphicalViewer();
	viewer.setEditPartFactory(editPartFactory);
	
	this.initViewerAction(viewer);
	
	
	super.getGraphicalViewer().addDropTargetListener(
			new DiagramTemplateTransferDropTargetListener(super.getGraphicalViewer()));
	viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
			MouseWheelZoomHandler.SINGLETON);
	viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
	viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);
	viewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, true);
	 GraphicalViewer view=getGraphicalViewer();
	viewer.setContents(diagram);

}
 
开发者ID:winture,项目名称:wt-studio,代码行数:23,代码来源:BODesignerEditor.java

示例9: getAdapter

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
public Object getAdapter(Class adapter)
{
	if (adapter == SnapToHelper.class) {
		List snapStrategies = new ArrayList();
		Boolean val = (Boolean) getViewer()
				.getProperty(RulerProvider.PROPERTY_RULER_VISIBILITY);
		if (val != null && val.booleanValue())
			snapStrategies.add(new SnapToGuides(this));
		val = (Boolean) getViewer().getProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED);
		if (val != null && val.booleanValue())
			snapStrategies.add(new SnapToGeometry(this));
		val = (Boolean) getViewer().getProperty(SnapToGrid.PROPERTY_GRID_ENABLED);
		if (val != null && val.booleanValue())
			snapStrategies.add(new SnapToGrid(this));

		if (snapStrategies.size() == 0)
			return null;
		if (snapStrategies.size() == 1)
			return snapStrategies.get(0);
		SnapToHelper ss[] = new SnapToHelper[snapStrategies.size()];
		for (int i = 0; i < snapStrategies.size(); i++)
			ss[i] = (SnapToHelper) snapStrategies.get(i);
		return new CompoundSnapToHelper(ss);
	}
	return super.getAdapter(adapter);
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:27,代码来源:BONodeEditPart.java

示例10: initializeGraphicalViewer

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
/**
 * 初始化View
 */
@Override
protected void initializeGraphicalViewer() {
	GraphicalViewer viewer = this.getGraphicalViewer();
	viewer.setEditPartFactory(editPartFactory);
	
	this.initViewerAction(viewer);
	
	super.getGraphicalViewer().addDropTargetListener(
			new DiagramTemplateTransferDropTargetListener(super.getGraphicalViewer()));
	viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
			MouseWheelZoomHandler.SINGLETON);
	viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
	viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);
	viewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, true);
	 GraphicalViewer view=getGraphicalViewer();
	viewer.setContents(diagram);

}
 
开发者ID:winture,项目名称:wt-studio,代码行数:22,代码来源:FunctionDesignerEditor.java

示例11: initializeGraphicalViewer

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
@Override
protected void initializeGraphicalViewer() {

	super.initializePaletteViewer();

	super.getGraphicalViewer().setContents(this.diagram);
	super.getGraphicalViewer().addDropTargetListener(
			new DiagramTemplateTransferDropTargetListener(super
					.getGraphicalViewer()));
	super.getGraphicalViewer().setProperty(
			SnapToGrid.PROPERTY_GRID_ENABLED, true);
	super.getGraphicalViewer().setProperty(
			SnapToGrid.PROPERTY_GRID_VISIBLE, true);
	super.getGraphicalViewer().setProperty(
			SnapToGeometry.PROPERTY_SNAP_ENABLED, true);
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:17,代码来源:PageDesignerEditor.java

示例12: getAdapter

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
@Override
public Object getAdapter(final Class key) {

    if (key == SnapToHelper.class) {
        final List<SnapToHelper> helpers = new ArrayList<SnapToHelper>();

        helpers.add(new SnapToGeometry(this));

        if (Boolean.TRUE.equals(getViewer().getProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED))) {
            helpers.add(new SnapToGrid(this));
        }

        // if (Boolean.TRUE.equals(getViewer().getProperty(
        // SnapToGrid.PROPERTY_GRID_ENABLED))) {
        // helpers.add(new SnapToGrid(this));
        // }

        if (helpers.size() == 0) {
            return null;

        } else {
            return new CompoundSnapToHelper(helpers.toArray(new SnapToHelper[0]));
        }
    }

    return super.getAdapter(key);
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:28,代码来源:ERDiagramEditPart.java

示例13: getAdapter

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
@Override
public Object getAdapter(Class key) {

	if (key == SnapToHelper.class) {
		List<SnapToHelper> helpers = new ArrayList<SnapToHelper>();

		helpers.add(new SnapToGeometry(this));

		if (Boolean.TRUE.equals(getViewer().getProperty(
				SnapToGeometry.PROPERTY_SNAP_ENABLED))) {
			helpers.add(new SnapToGrid(this));
		}

		// if (Boolean.TRUE.equals(getViewer().getProperty(
		// SnapToGrid.PROPERTY_GRID_ENABLED))) {
		// helpers.add(new SnapToGrid(this));
		// }

		if (helpers.size() == 0) {
			return null;

		} else {
			return new CompoundSnapToHelper(
					helpers.toArray(new SnapToHelper[0]));
		}
	}

	return super.getAdapter(key);
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:30,代码来源:ERDiagramEditPart.java

示例14: showTargetFeedback

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.EditPolicy#showTargetFeedback(org.eclipse.gef.Request)
 */
public void showTargetFeedback(Request req) {
	if (req.getType().equals(REQ_MOVE) || req.getType().equals(REQ_RESIZE)
			|| req.getType().equals(REQ_CLONE)
			|| req.getType().equals(REQ_ADD)
			|| req.getType().equals(REQ_CREATE)) {

		Integer value;
		value = (Integer) req.getExtendedData().get(
				SnapToGeometry.KEY_WEST_ANCHOR);
		highlightGuide(value, ColorConstants.blue, 0);

		value = (Integer) req.getExtendedData().get(
				SnapToGeometry.KEY_NORTH_ANCHOR);
		highlightGuide(value, ColorConstants.blue, 1);

		value = (Integer) req.getExtendedData().get(
				SnapToGeometry.KEY_EAST_ANCHOR);
		highlightGuide(value, ColorConstants.blue, 2);

		value = (Integer) req.getExtendedData().get(
				SnapToGeometry.KEY_SOUTH_ANCHOR);
		highlightGuide(value, ColorConstants.blue, 3);

		value = (Integer) req.getExtendedData().get(
				SnapToGuides.KEY_VERTICAL_GUIDE);
		highlightGuide(value, ColorConstants.blue, 4);

		value = (Integer) req.getExtendedData().get(
				SnapToGuides.KEY_HORIZONTAL_GUIDE);
		highlightGuide(value, ColorConstants.blue, 5);
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:36,代码来源:SnapFeedbackPolicy.java

示例15: getAdapter

import org.eclipse.gef.SnapToGeometry; //导入依赖的package包/类
public Object getAdapter(Class adapter) {
	if (adapter == SnapToHelper.class) {
		List<SnapToHelper> snapStrategies = new ArrayList<SnapToHelper>();
		Boolean val = (Boolean)getViewer().getProperty(RulerProvider.PROPERTY_RULER_VISIBILITY);
		/*if (val != null && val.booleanValue())*/
			//snapStrategies.add(new SnapToGuides((GraphicalEditPart) this.getParent()));

		val = (Boolean)getViewer().getProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED);
		//if (val != null && val.booleanValue())
			snapStrategies.add(new SnapToGeometry(this){
				@Override
				protected List generateSnapPartsList(List exclusions) {
					List children = super.generateSnapPartsList(exclusions);
					children.add(container);//add snapToParent edges behaviour
					return children;
				}
			});

		val = (Boolean)getViewer().getProperty(SnapToGrid.PROPERTY_GRID_ENABLED);
		if (val != null && val.booleanValue())
			snapStrategies.add(new SnapToGrid(this));
		
		if (snapStrategies.size() == 0)
			return null;
		if (snapStrategies.size() == 1)
			return snapStrategies.get(0);

		SnapToHelper ss[] = new SnapToHelper[snapStrategies.size()];
		for (int i = 0; i < snapStrategies.size(); i++)
			ss[i] = (SnapToHelper)snapStrategies.get(i);
		return new CompoundSnapToHelper(ss);
	}
	return super.getAdapter(adapter);
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:35,代码来源:ElementEditPart.java


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