本文整理汇总了Java中org.eclipse.gef.CompoundSnapToHelper类的典型用法代码示例。如果您正苦于以下问题:Java CompoundSnapToHelper类的具体用法?Java CompoundSnapToHelper怎么用?Java CompoundSnapToHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompoundSnapToHelper类属于org.eclipse.gef包,在下文中一共展示了CompoundSnapToHelper类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的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;
}
示例2: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的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);
}
示例3: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的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);
}
示例4: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的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);
}
示例5: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的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);
}
示例6: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的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);
}
示例7: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的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);
}
示例8: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class key) {
if (key == SnapToHelper.class) {
List<SnapToHelper> snapStrategies = new ArrayList<SnapToHelper>();
Boolean val = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWRULER, Boolean.TRUE);
Boolean stg = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGUIDES, Boolean.TRUE);
if (val.booleanValue() && stg != null && stg.booleanValue())
snapStrategies.add(new SnapToGuides(this));
val = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGEOMETRY, Boolean.TRUE);
if (val.booleanValue()) {
SnapToGeometryThreshold snapper = new SnapToGeometryThreshold(this);
snapper.setThreshold(2.0);
snapStrategies.add(snapper);
}
val = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGRID, Boolean.TRUE);
if (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] = snapStrategies.get(i);
return new CompoundSnapToHelper(ss);
}
return super.getAdapter(key);
}
示例9: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class key) {
if (key == SnapToHelper.class) {
List<SnapToHelper> snapStrategies = new ArrayList<SnapToHelper>();
Boolean val = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWRULER, Boolean.TRUE);
Boolean stg = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGUIDES, Boolean.TRUE);
if (val.booleanValue() && stg != null && stg.booleanValue())
snapStrategies.add(new SnapToGuides(this));
val = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGEOMETRY, Boolean.TRUE);
if (val.booleanValue()) {
SnapToGeometryThreshold snapper = new SnapToGeometryThreshold(this);
snapper.setThreshold(6.0);
snapStrategies.add(snapper);
}
val = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGRID, Boolean.TRUE);
if (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] = snapStrategies.get(i);
return new CompoundSnapToHelper(ss);
}
return super.getAdapter(key);
}
示例10: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的package包/类
@Override
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);
}
示例11: getAdapter
import org.eclipse.gef.CompoundSnapToHelper; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class key) {
if (key == SnapToHelper.class) {
List<SnapToHelper> snapStrategies = new ArrayList<SnapToHelper>();
Boolean val = jConfig.getPropertyBoolean(
RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWRULER,
Boolean.TRUE);
Boolean stg = jConfig.getPropertyBoolean(
RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGUIDES,
Boolean.TRUE);
if (val.booleanValue() && stg != null && stg.booleanValue())
snapStrategies.add(new SnapToGuides(this));
val = jConfig.getPropertyBoolean(
RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGEOMETRY,
Boolean.TRUE);
if (val.booleanValue()) {
SnapToGeometryThreshold snapper = new SnapToGeometryThreshold(
this);
snapper.setThreshold(2.0);
snapStrategies.add(snapper);
}
val = jConfig.getPropertyBoolean(
RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGRID,
Boolean.TRUE);
if (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] = snapStrategies.get(i);
return new CompoundSnapToHelper(ss);
}
return super.getAdapter(key);
}