本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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");
}
}
示例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);
}
}
示例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);
}