當前位置: 首頁>>代碼示例>>Java>>正文


Java DND.FEEDBACK_EXPAND屬性代碼示例

本文整理匯總了Java中org.eclipse.swt.dnd.DND.FEEDBACK_EXPAND屬性的典型用法代碼示例。如果您正苦於以下問題:Java DND.FEEDBACK_EXPAND屬性的具體用法?Java DND.FEEDBACK_EXPAND怎麽用?Java DND.FEEDBACK_EXPAND使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.eclipse.swt.dnd.DND的用法示例。


在下文中一共展示了DND.FEEDBACK_EXPAND屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: handleDragOver

protected void handleDragOver() {
	if (TreeViewerTransfer.getInstance().getViewer() != getViewer()) {
		getCurrentEvent().detail = DND.DROP_NONE;
		return;
	}
	getCurrentEvent().feedback = DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
	super.handleDragOver();
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:8,代碼來源:TreeViewerTransferDropListener.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: updateCurrentListener

/**
 * Updates the current listener to one that can handle the drop. There can be many
 * listeners and each listener may be able to handle many <code>TransferData</code> 
 * types. The first listener found that can handle a drop of one of the given 
 * <code>TransferData</code> types will be selected.
 * If no listener can handle the drag operation the <code>event.detail</code> field
 * is set to <code>DND.DROP_NONE</code> to indicate an invalid drop.
 *
 * @param event the drop target event
 */
private void updateCurrentListener(DropTargetEvent event) {
    int originalDetail = event.detail;
    // revert the detail to the "original" drop type that the User indicated.
    // this is necessary because the previous listener may have changed the detail 
    // to something other than what the user indicated.
    event.detail = originalDropType;

    Iterator iter = listeners.iterator();
    while (iter.hasNext()) {
        TransferDropTargetListener listener = (TransferDropTargetListener) iter
                .next();
        TransferData dataType = getSupportedTransferType(event.dataTypes,
                listener);
        if (dataType != null) {
            TransferData originalDataType = event.currentDataType;
            // set the data type supported by the drop listener
            event.currentDataType = dataType;
            if (listener.isEnabled(event)) {
                // if the listener stays the same, set its previously determined  
                // event detail 
                if (!setCurrentListener(listener, event)) {
		event.detail = originalDetail;
	}
                return;
            }
event.currentDataType = originalDataType;
        }
    }
    setCurrentListener(null, event);
    event.detail = DND.DROP_NONE;
    
    // -always- ensure that expand/scroll are on...otherwise
    // if a valid drop target is a child of an invalid one
    // you can't get there...
    event.feedback = DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:46,代碼來源:DelegatingDropAdapter.java

示例7: 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

示例8: dragOver

public void dragOver(DropTargetEvent event) {
 event.feedback = DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL; 
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:3,代碼來源:DragDropUtility.java

示例9: dragOver

@Override
public void dragOver(DropTargetEvent event) {
	// select, expand and scroll the tree node
	event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:5,代碼來源:RepositoryFileResourceDropTargetListener.java

示例10: 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

示例11: handleDragOver

/**
 * The purpose of a template is to be copied. Therefore, the Drop operation
 * is set to <code>DND.DROP_COPY</code> by default.
 * 
 * @see org.eclipse.gef.dnd.AbstractTransferDropTargetListener#handleDragOver()
 */
protected void handleDragOver() {
	getCurrentEvent().detail = DND.DROP_COPY;
	getCurrentEvent().feedback = DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
	super.handleDragOver();
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:11,代碼來源:TemplateTransferDropTargetListener.java


注:本文中的org.eclipse.swt.dnd.DND.FEEDBACK_EXPAND屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。