本文整理汇总了Java中org.eclipse.swt.dnd.DND.DROP_DEFAULT属性的典型用法代码示例。如果您正苦于以下问题:Java DND.DROP_DEFAULT属性的具体用法?Java DND.DROP_DEFAULT怎么用?Java DND.DROP_DEFAULT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.dnd.DND
的用法示例。
在下文中一共展示了DND.DROP_DEFAULT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureDragAndDrop
protected void configureDragAndDrop(DragAndDropConfiguration dragAndDropConfiguration, TreeViewer treeViewer) {
// drop
Transfer[] transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer() };
int operations = dragAndDropConfiguration.getSupportedDropOperations(this);
DropTarget target = new DropTarget(treeViewer.getControl(), operations);
target.setTransfer(transferTypes);
// Drop listeners pour le drop des elements sur l'arbre
SchemaViewerDropPolicy dropPolicy = dragAndDropConfiguration.getDropPolicy(this);
DnDTargetListener targetListener = new DnDTargetListener(this, nodeConverter, dropPolicy);
target.addDropListener(targetListener);
// Drag listener pour le drag des elements de l'arbre
DragSourceListener sourceListener = new DnDSourceListener(this);
operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT;
transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer() };
treeViewer.addDragSupport(operations, transferTypes, sourceListener);
}
示例2: validateDrop
@Override
public boolean validateDrop(Object target, int operation, TransferData type) {
overrideOperation(DND.DROP_COPY);
// if (application == null)
// return false;
if (operation == DND.DROP_COPY || operation == DND.DROP_DEFAULT) {
if (LocalSelectionTransfer.getTransfer().isSupportedType(type)) {
IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer()
.getSelection();
Object[] objects = selection.toArray();
for (Object obj : objects) {
if (obj instanceof CFServiceInstance) {
return true;
}
}
}
}
return false;
}
示例3: handleDrop
/**
* @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#handleDrop(org.eclipse.ui.navigator.CommonDropAdapter,
* org.eclipse.swt.dnd.DropTargetEvent, java.lang.Object)
*/
@Override
public IStatus handleDrop(CommonDropAdapter dropAdapter, DropTargetEvent event, Object target) {
switch (event.detail) {
case DND.DROP_DEFAULT:
case DND.DROP_MOVE:
return handleDropMove(target, event);
case DND.DROP_COPY:
return handleDropCopy(target, event);
default:
break;
}
return Status.CANCEL_STATUS;
}
示例4: validateDrop
@Override
public boolean validateDrop(Object target, int operation, TransferData type) {
overrideOperation(DND.DROP_COPY);
// if (application == null)
// return false;
if (operation == DND.DROP_COPY || operation == DND.DROP_DEFAULT) {
if (LocalSelectionTransfer.getTransfer().isSupportedType(type)) {
IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer()
.getSelection();
Object[] objects = selection.toArray();
for (Object obj : objects) {
if (obj instanceof CloudService) {
return true;
}
}
}
}
return false;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
}
示例8: determineOperation
@Override
protected int determineOperation(Object target, int operation, TransferData transferType, int operations) {
setSelectionFeedbackEnabled(false);
setExpandEnabled(false);
initializeSelection();
if (target != null) {
return super.determineOperation(target, operation, transferType, operations);
} else if (getInputElement(getSelection()) != null) {
setSelectionFeedbackEnabled(false);
setExpandEnabled(false);
return operation == DND.DROP_DEFAULT || operation == DND.DROP_MOVE ? DND.DROP_LINK : operation;
} else {
return DND.DROP_NONE;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:CallHierarchyTransferDropAdapter.java
示例9: createDropTarget
public DropTarget createDropTarget ( final Transfer[] transfers, final DropTargetListener dropTargetListener )
{
checkWidget ();
final DropTarget target = new DropTarget ( this.chartArea, DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_LINK );
target.setTransfer ( transfers );
target.addDropListener ( dropTargetListener );
return target;
}
示例10: addDropSupport
private void addDropSupport(Section section) {
int ops = DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT;
Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
DropTarget dropTarget = new DropTarget(section, ops);
dropTarget.setTransfer(transfers);
dropTarget.addDropListener(servicesDropListener);
}
示例11: 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);
}
示例12: initializeDragAndDrop
private void initializeDragAndDrop() {
int ops = DND.DROP_COPY | DND.DROP_DEFAULT;
Transfer[] transfers = new Transfer[] { FileTransfer.getInstance() };
TreeViewer viewer = getViewer();
JSBuildFileViewDropAdapter adapter = new JSBuildFileViewDropAdapter(
this);
viewer.addDropSupport(ops, transfers, adapter);
}
示例13: dragOperationChanged
public void dragOperationChanged(DropTargetEvent event) {
if (event.detail == DND.DROP_DEFAULT) {
if ((event.operations & DND.DROP_COPY) != 0) {
event.detail = DND.DROP_COPY;
} else {
event.detail = DND.DROP_NONE;
}
}
}
示例14: getDetailString
/**
* Utility function to get a string to print out a "detail"
* @param detail
* @return the string name of the detail.
*/
protected final String getDetailString(int detail) {
switch (detail) {
case DND.DROP_DEFAULT: return "DND.DROP_DEFAULT";
case DND.DROP_COPY: return "DND.DROP_COPY";
case DND.DROP_LINK: return "DND.DROP_LINK";
case DND.DROP_MOVE: return "DND.DROP_MOVE";
case DND.DROP_NONE: return "DND.DROP_NONE";
case DND.DROP_TARGET_MOVE: return "DND.DROP_TARGET_MOVE";
default: return "DND.???";
}
}
示例15: getDetailString
protected final String getDetailString(int detail) {
switch (detail) {
case DND.DROP_DEFAULT: return "DND.DROP_DEFAULT";
case DND.DROP_COPY: return "DND.DROP_COPY";
case DND.DROP_LINK: return "DND.DROP_LINK";
case DND.DROP_MOVE: return "DND.DROP_MOVE";
case DND.DROP_NONE: return "DND.DROP_NONE";
case DND.DROP_TARGET_MOVE: return "DND.DROP_TARGET_MOVE";
default: return "DND.???";
}
}