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


Java DND.DROP_NONE屬性代碼示例

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


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

示例1: dragOver

@Override
public int dragOver(AvroNode draggedNode, AvroNode targetNode, TargetPosition position) {
	
	int detail = DND.DROP_NONE;
	
	AvroSchemaController schemaController = context.getService(AvroSchemaController.class);				

	if (schemaController.canDnDElement(DragAndDropPolicy.Action.MOVE, draggedNode, targetNode, position)) {
		detail = DND.DROP_MOVE;
	} else if (schemaController.canDnDElement(DragAndDropPolicy.Action.COPY, draggedNode, targetNode, position))  {
		detail = DND.DROP_COPY;
	} else if (schemaController.canDnDElement(DragAndDropPolicy.Action.REFERENCE, draggedNode, targetNode, position))  {
		detail = DND.DROP_MOVE;
	} 
	
	return detail;
}
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:17,代碼來源:AvroSchemaViewerDropPolicy.java

示例2: getDropItems

/**
 * get the outline items being dropped, or null if there are none or if the event does not
 * qualify for a drop.
 */
@SuppressWarnings("unchecked")
private List<PagePart> getDropItems(DropTargetEvent event) {
	if (event.operations == DND.DROP_NONE || event.item == null) {
		return null;
	}
	Object targetData = event.item.getData();
	if (!(targetData instanceof PagePart)) {
		return null;
	}

	ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
	if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		List<?> list = structuredSelection.toList();
		if (!list.isEmpty()) {
			for (Object i : list) {
				if (!(i instanceof PagePart)) return null;
			}
			return (List<PagePart>) list;
		}
	}
	return null;
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:27,代碼來源:OutlineDropTargetListener.java

示例3: handleDrop

@Override
protected void handleDrop() {
  factory.handle = (ModelHandle) getCurrentEvent().data;
  factory.targetTreeNode = (PaletteTreeNodeEditPart) getCurrentEvent().item.getData();
  // We need to override the default logic to find the target edit part for the drop,
  // as this is failing with our hybrid GEF/JFace Tree implementation.
  // So, no call to super.handleDrop() here, but a slightly modified reimplementation.
  // We need the direct setTargetEditPart as the default logic is failing.
  updateTargetRequest();
  setTargetEditPart(factory.targetTreeNode);

  if (getTargetEditPart() != null) {
    Command command = getCommand();
    if (command != null && command.canExecute())
      getViewer().getEditDomain().getCommandStack().execute(command);
    else
      getCurrentEvent().detail = DND.DROP_NONE;
  } else
    getCurrentEvent().detail = DND.DROP_NONE;
}
 
開發者ID:eclipse,項目名稱:triquetrum,代碼行數:20,代碼來源:UserLibraryTransferDropListener.java

示例4: handleDrop

@Override
protected void handleDrop() {
	updateTargetRequest();
	updateTargetEditPart();

	if (getTargetEditPart() != null) {
		Command command = getCommand();
		if (command instanceof CreateImageCommand && command.canExecute()){
			setImageExpression((CreateImageCommand)command);
			getViewer().getEditDomain().getCommandStack().execute(command);
		}
		else
			getCurrentEvent().detail = DND.DROP_NONE;
	} else
		getCurrentEvent().detail = DND.DROP_NONE;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:16,代碼來源:ImageResourceDropTargetListener.java

示例5: dragOver

@Override
public void dragOver(DropTargetEvent event)
{
  boolean match = false;
  for (CoreDropTargetListener listener : listeners)
  {
    if(listener.appliesTo(event))
    {
      match = true;
      listener.dragOver(event);
    }
    else
    {
      listener.reset();
    }
  }
  if(!match)
  {
    event.detail = DND.DROP_NONE;
  }

}
 
開發者ID:debrief,項目名稱:limpet,代碼行數:22,代碼來源:ProxyDropTargetListener.java

示例6: createOperations

static int createOperations(final Set<DropAction> actions) {
    int result = 0;
    if (actions.contains(DropAction.NONE)) {
        result = result | DND.DROP_NONE;
    }
    if (actions.contains(DropAction.DEFAULT)) {
        result = result | DND.DROP_DEFAULT;
    }
    if (actions.contains(DropAction.COPY)) {
        result = result | DND.DROP_COPY;
    }
    if (actions.contains(DropAction.MOVE)) {
        result = result | DND.DROP_MOVE;
    }
    if (actions.contains(DropAction.LINK)) {
        result = result | DND.DROP_LINK;
    }
    return result;
}
 
開發者ID:jo-source,項目名稱:jo-widgets,代碼行數:19,代碼來源:DragDropUtil.java

示例7: createActions

static Set<DropAction> createActions(final int operations) {
    final Set<DropAction> result = new HashSet<DropAction>();
    if ((operations & DND.DROP_NONE) != 0) {
        result.add(DropAction.NONE);
    }
    if ((operations & DND.DROP_DEFAULT) != 0) {
        result.add(DropAction.DEFAULT);
    }
    if ((operations & DND.DROP_COPY) != 0) {
        result.add(DropAction.COPY);
    }
    if ((operations & DND.DROP_MOVE) != 0) {
        result.add(DropAction.MOVE);
    }
    if ((operations & DND.DROP_LINK) != 0) {
        result.add(DropAction.LINK);
    }
    return result;
}
 
開發者ID:jo-source,項目名稱:jo-widgets,代碼行數:19,代碼來源:DragDropUtil.java

示例8: getDropAction

static DropAction getDropAction(final int detail) {
    if (detail == DND.DROP_NONE) {
        return DropAction.NONE;
    }
    else if (detail == DND.DROP_DEFAULT) {
        return DropAction.DEFAULT;
    }
    else if (detail == DND.DROP_COPY) {
        return DropAction.COPY;
    }
    else if (detail == DND.DROP_MOVE) {
        return DropAction.MOVE;
    }
    else if (detail == DND.DROP_LINK) {
        return DropAction.LINK;
    }
    else {
        return DropAction.NONE;
    }
}
 
開發者ID:jo-source,項目名稱:jo-widgets,代碼行數:20,代碼來源:DragDropUtil.java

示例9: handleDrop

/**
 * Overriden for debug purposes.
 * Note: the drop is actually performed in the DropEditPolicy.
 */
@Override
protected void handleDrop() {
	trace.debug("handleDrop");
	updateTargetRequest();
	updateTargetEditPart();
	if (getTargetEditPart() != null) {
		final Command command = getCommand();
		if (command != null && command.canExecute()) {
			EditPartViewer viewer = getViewer();
			final CommandStack commandStack = viewer.getEditDomain().getCommandStack();
			WidgetUtils.runLaterInDisplayThread(viewer.getControl(), new Runnable() {
				@Override
				public void run() {
					commandStack.execute(command);
				}
			});
		} else {
			getCurrentEvent().detail = DND.DROP_NONE;
		}
	} else {
		getCurrentEvent().detail = DND.DROP_NONE;
	}
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:27,代碼來源:TransferDropTargetListener.java

示例10: drop

@Override
public void drop(DropTargetEvent event) {
	if (!URLTransfer.getInstance().isSupportedType(event.currentDataType)) {
		traceUnsupportedDataType(event);
		//ignore
		return;
	}
	if (event.data == null) {
		traceMissingEventData(event);
		//reject
		event.detail = DND.DROP_NONE;
		return;
	}
	if (!dropTargetIsValid(event, true)) {
		//reject
		event.detail = DND.DROP_NONE;
		return;
	}
	final String url = getUrl(event.data);
	ForceIdeUrlActionHandler urlActionHandler = new ForceIdeUrlActionHandler(url, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay());
	ForceIdeUrlActionHandler.ProjectAction result = urlActionHandler.processCommand();
	if (result == ForceIdeUrlActionHandler.ProjectAction.IGNORE || result == ForceIdeUrlActionHandler.ProjectAction.INVALID)
		traceInvalidEventData(event);
}
 
開發者ID:forcedotcom,項目名稱:idecore,代碼行數:24,代碼來源:ForceIdeUrlDropHandler.java

示例11: determineOperation

/**
 * {@inheritDoc}
 */
@Override
protected int determineOperation(Object target, int operation, TransferData transferType, int operations) {

	boolean isPackageFragment= target instanceof IPackageFragment;
	boolean isJavaProject= target instanceof IJavaProject;
	boolean isPackageFragmentRoot= target instanceof IPackageFragmentRoot;
	boolean isContainer= target instanceof IContainer;

	if (!(isPackageFragment || isJavaProject || isPackageFragmentRoot || isContainer))
		return DND.DROP_NONE;

	if (isContainer) {
		IContainer container= (IContainer)target;
		if (container.isAccessible() && !Resources.isReadOnly(container))
			return DND.DROP_COPY;
	} else {
		IJavaElement element= (IJavaElement)target;
		if (!element.isReadOnly())
			return DND.DROP_COPY;
	}

	return DND.DROP_NONE;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:26,代碼來源:FileTransferDropAdapter.java

示例12: handleValidateMove

private int handleValidateMove(Object target) throws JavaModelException {
	if (target == null)
		return DND.DROP_NONE;

	IMovePolicy policy= ReorgPolicyFactory.createMovePolicy(ReorgUtils.getResources(fElements), ReorgUtils.getJavaElements(fElements));
	fMoveProcessor= (policy.canEnable()) ? new JavaMoveProcessor(policy) : null;

	if (!canMoveElements())
		return DND.DROP_NONE;

	if (fMoveProcessor == null)
		return DND.DROP_NONE;

	if (!fMoveProcessor.setDestination(ReorgDestinationFactory.createDestination(target)).isOK())
		return DND.DROP_NONE;

	return DND.DROP_MOVE;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:18,代碼來源:JavaDropAdapterAssistant.java

示例13: getDragAction

int getDragAction(TransferMode tm) {
    if (tm == null) {
      return DND.DROP_NONE;
    }
    switch (tm) {
        case COPY: return DND.DROP_COPY;
        case MOVE: return DND.DROP_MOVE;
        case LINK: return DND.DROP_LINK;
        default:
            throw new IllegalArgumentException("Invalid transfer mode");
    }
}
 
開發者ID:TRUEJASONFANS,項目名稱:JavaFX-FrameRateMeter,代碼行數:12,代碼來源:OldFXCanvas.java

示例14: drop

public void drop(DropTargetEvent event) {
  if (event.data == null) {
  	event.detail = DND.DROP_NONE;
  	return;
  }
  String[] dropData = ((String) event.data).split(Pattern.quote("#"));
  for(String result:dropData)
  {	
   dragDropOperation.saveResult(result);
  }
  
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:12,代碼來源:DragDropUtility.java

示例15: dragEnter

@Override
public void dragEnter(DropTargetEvent event) {
	if (event.detail == DND.DROP_DEFAULT || event.detail == DND.DROP_NONE) {
		event.detail = DND.DROP_COPY;
	}
	super.dragEnter(event);
}
 
開發者ID:eclipse,項目名稱:cft,代碼行數:7,代碼來源:ServicesViewerDropListener.java


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