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


Java DND.FEEDBACK_INSERT_BEFORE属性代码示例

本文整理汇总了Java中org.eclipse.swt.dnd.DND.FEEDBACK_INSERT_BEFORE属性的典型用法代码示例。如果您正苦于以下问题:Java DND.FEEDBACK_INSERT_BEFORE属性的具体用法?Java DND.FEEDBACK_INSERT_BEFORE怎么用?Java DND.FEEDBACK_INSERT_BEFORE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.swt.dnd.DND的用法示例。


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

示例1: getDropSelection

@Override
public Object getDropSelection(final Widget item, final Position position, final int dropFeedback) {
    final TreeNodeImpl node = items.get(item);
    if (node != null) {
        if ((dropFeedback & DND.FEEDBACK_INSERT_BEFORE) != 0) {
            return new TreeDropLocationSpiImpl(node, TreeDropPositionSpi.BEFORE);
        }
        else if ((dropFeedback & DND.FEEDBACK_INSERT_AFTER) != 0) {
            return new TreeDropLocationSpiImpl(node, TreeDropPositionSpi.AFTER);
        }
        else if ((dropFeedback & DND.FEEDBACK_SELECT) != 0) {
            return new TreeDropLocationSpiImpl(node, TreeDropPositionSpi.ON);
        }
    }
    return null;
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:16,代码来源:TreeImpl.java

示例2: dragOver

public void dragOver(DropTargetEvent event) {
	event.feedback = DND.FEEDBACK_SELECT;
	float location = computeRelativeLocation(event);
	if (location > THRESHOLD) {
		event.feedback = DND.FEEDBACK_INSERT_AFTER;
	} else {
		event.feedback = DND.FEEDBACK_INSERT_BEFORE;
	}
	// always provide expand/scroll capability when dragging
	event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:11,代码来源:OutlineDropTargetListener.java

示例3: getFeedback

/**
 * Get the feedback given the semantics
 *  
 * @param semantics
 * @return the feedback to use.
 */
private int getFeedback(InsertionSemantics semantics) {
	switch (semantics) {
	case BEFORE: return DND.FEEDBACK_INSERT_BEFORE;
	case ON:     return DND.FEEDBACK_SELECT | DND.FEEDBACK_EXPAND;
	case AFTER:  return DND.FEEDBACK_INSERT_AFTER;
	default:     return DND.FEEDBACK_NONE;
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:14,代码来源:TreeTableViewerDropTargetListener.java

示例4: setFeedback

private void setFeedback(DropTargetEvent event, int location) {
      if (feedbackEnabled) {
          switch (location) {
          case LOCATION_BEFORE:
              event.feedback = DND.FEEDBACK_INSERT_BEFORE;
              break;
          case LOCATION_AFTER:
              event.feedback = DND.FEEDBACK_INSERT_AFTER;
              break;
          case LOCATION_ON:
          default:
              event.feedback = DND.FEEDBACK_SELECT;
              break;
          }
      }

       // Explicitly inhibit SELECT feedback if desired
if (!selectFeedbackEnabled) {
	event.feedback &= ~DND.FEEDBACK_SELECT;
}

if (expandEnabled) {
	event.feedback |= DND.FEEDBACK_EXPAND;
}
if (scrollEnabled) {
	event.feedback |= DND.FEEDBACK_SCROLL;
}
  }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:JdtViewerDropAdapter.java

示例5: setFeedback

private void setFeedback(DropTargetEvent event, int location) {
      if (feedbackEnabled) {
          switch (location) {
          case LOCATION_BEFORE:
              event.feedback = DND.FEEDBACK_INSERT_BEFORE;
              break;
          case LOCATION_AFTER:
              event.feedback = DND.FEEDBACK_INSERT_AFTER;
              break;
          case LOCATION_ON:
          default:
              event.feedback = DND.FEEDBACK_SELECT;
              break;
          }
      }
      
       // Explicitly inhibit SELECT feedback if desired
if (!selectFeedbackEnabled) {
	event.feedback &= ~DND.FEEDBACK_SELECT;
}

if (expandEnabled) {
	event.feedback |= DND.FEEDBACK_EXPAND;
}
if (scrollEnabled) {
	event.feedback |= DND.FEEDBACK_SCROLL;
}
  }
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:28,代码来源:ViewerDropAdapter.java

示例6: dragOver

@Override
public void dragOver(DropTargetEvent event) {
	super.dragOver(event);
	
	// Overrides feedback: by default is DND.FEEDBACK_SELECT
	feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
	
	boolean shouldFeedBack = true;
	if (PaletteSourceTransfer.getInstance().isSupportedType(event.currentDataType)) {
		shouldFeedBack = false;
	}
	
	// Handles feedback for objects that can be ordered
	if (shouldFeedBack && getCurrentOperation() == DND.DROP_MOVE) {
		Object targetObject = getCurrentTarget();
		Object sourceObject = getSelectedObject();
		if ((sourceObject != null) && (targetObject != null)) {
			// Source and target objects must be different
			if (!sourceObject.equals(targetObject)) {
				if ((sourceObject instanceof TreeObject) && (targetObject instanceof TreeObject)) {
					// Source and target objects can be ordered
					if ((sourceObject instanceof IOrderableTreeObject) && (targetObject instanceof IOrderableTreeObject)) {
						// Source and target objects must have the same parent
						if (((TreeObject)sourceObject).getParent().equals(((TreeObject)targetObject).getParent())) {
							boolean srcInherited = false;
							if (sourceObject instanceof DatabaseObjectTreeObject) srcInherited = ((DatabaseObjectTreeObject)sourceObject).isInherited;
							else if (sourceObject instanceof IPropertyTreeObject) srcInherited = ((IPropertyTreeObject)sourceObject).isInherited();
							// Source object musn't be inherited
							if (!srcInherited) {
								int currentLocation = getCurrentLocation();
								switch (currentLocation) {
									case LOCATION_BEFORE:
										feedback = DND.FEEDBACK_INSERT_BEFORE;
										break;
									case LOCATION_AFTER:
										feedback = DND.FEEDBACK_INSERT_AFTER;
										break;
									case LOCATION_ON:
									default:
										feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
										break;
								}									
							}
						}
					}
				}
			}
		}
	}
	
	// Set feedback
	event.feedback = feedback;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:53,代码来源:TreeDropAdapter.java

示例7: checkEffect

int checkEffect(int effect) {
	// Some effects are mutually exclusive.  Make sure that only one of the mutually exclusive effects has been specified.
	if ((effect & DND.FEEDBACK_SELECT) != 0) effect = effect & ~DND.FEEDBACK_INSERT_AFTER & ~DND.FEEDBACK_INSERT_BEFORE;
	if ((effect & DND.FEEDBACK_INSERT_BEFORE) != 0) effect = effect & ~DND.FEEDBACK_INSERT_AFTER;
	return effect;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:6,代码来源:GridDropTargetEffect.java

示例8: dragOver

@Override
public void dragOver(DropTargetEvent event) {
	
	event.feedback = DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
       
	IStructuredSelection structuredSelection = (IStructuredSelection) LocalSelectionTransfer
               .getTransfer().getSelection();
	
	if (structuredSelection.size() == 1) {
		
		Object element = structuredSelection.getFirstElement();
		
		if (element instanceof AvroNode) {

			AvroNode sourceNode = (AvroNode) element;

			TreeItem item = (TreeItem) event.item;
			if (item != null) {					
				
				AvroNode targetNode = nodeConverter.convertToAvroNode(item.getData());
				
				if (targetNode == sourceNode) {
					
					event.detail = DND.DROP_NONE;
					
				} else {
				
					int tolerance = dropPolicy.getTargetPositionTolerance();
					
					Point pt = schemaViewer.getTreeViewer().getTree().toControl(event.x, event.y);
					Rectangle bounds = item.getBounds();

					if (pt.y < bounds.y + tolerance) {
						position = TargetPosition.BEFORE;
						event.feedback |= DND.FEEDBACK_INSERT_BEFORE;
					}
					else if (pt.y > bounds.y + bounds.height - tolerance) {
						position = TargetPosition.AFTER;
						event.feedback |= DND.FEEDBACK_INSERT_AFTER;
					}
					else {
						position = TargetPosition.UPON;
						event.feedback |= DND.FEEDBACK_SELECT;
					}

					event.detail = dropPolicy.dragOver(sourceNode, targetNode, position);											
					
				}
			}
			
		} else {
			event.detail = DND.DROP_NONE;
		}
           
	}

}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:57,代码来源:DnDTargetListener.java


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