use of org.eclipse.ui.navigator.CommonDropAdapterAssistant in project tmdm-studio-se by Talend.
the class PasteAction method getDropAssistant.
private RepositoryDropAssistant getDropAssistant() {
INavigatorDnDService dndService = commonViewer.getNavigatorContentService().getDnDService();
CommonDropAdapterAssistant[] dropAssistants = dndService.findCommonDropAdapterAssistants(getSelectedDropViewObj(), getStructuredSelection());
for (CommonDropAdapterAssistant assistant : dropAssistants) {
if (assistant instanceof RepositoryDropAssistant) {
return (RepositoryDropAssistant) assistant;
}
}
return null;
}
use of org.eclipse.ui.navigator.CommonDropAdapterAssistant in project polymap4-core by Polymap4.
the class NavigatorDnDService method getAssistant.
private CommonDropAdapterAssistant getAssistant(CommonDropAdapterDescriptor descriptor) {
CommonDropAdapterAssistant asst = (CommonDropAdapterAssistant) dropAssistants.get(descriptor);
if (asst != null) {
return asst;
}
synchronized (dropAssistants) {
asst = (CommonDropAdapterAssistant) dropAssistants.get(descriptor);
if (asst == null) {
dropAssistants.put(descriptor, (asst = descriptor.createDropAssistant()));
asst.init(contentService);
asst.setCommonDropAdapter(dropAdapter);
}
}
return asst;
}
use of org.eclipse.ui.navigator.CommonDropAdapterAssistant in project polymap4-core by Polymap4.
the class CommonDropAdapterDescriptor method createDropAssistant.
/**
* @return An instance of {@link CommonDropAdapterAssistant} from the
* descriptor or {@link SkeletonCommonDropAssistant}.
*/
public CommonDropAdapterAssistant createDropAssistant() {
final CommonDropAdapterAssistant[] retValue = new CommonDropAdapterAssistant[1];
SafeRunner.run(new NavigatorSafeRunnable(element) {
public void run() throws Exception {
retValue[0] = (CommonDropAdapterAssistant) element.createExecutableExtension(ATT_CLASS);
}
});
if (retValue[0] != null)
return retValue[0];
return SkeletonCommonDropAssistant.INSTANCE;
}
use of org.eclipse.ui.navigator.CommonDropAdapterAssistant in project polymap4-core by Polymap4.
the class NavigatorPluginDropAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.IDropActionDelegate#run(java.lang.Object,
* java.lang.Object)
*/
public boolean run(Object sourceData, Object target) {
if (Policy.DEBUG_DND) {
// $NON-NLS-1$
System.out.println("NavigatorPluginDropAction.run (begin)");
}
String sourceViewerId = new String((byte[]) sourceData);
IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
INavigatorContentService contentService = NavigatorContentServiceTransfer.getInstance().findService(sourceViewerId);
if (contentService == null) {
return false;
}
try {
CommonDropAdapterAssistant[] assistants = contentService.getDnDService().findCommonDropAdapterAssistants(target, selection);
IStatus valid = null;
for (int i = 0; i < assistants.length; i++) {
valid = assistants[i].validatePluginTransferDrop(selection, target);
if (valid != null && valid.isOK()) {
valid = assistants[i].handlePluginTransferDrop(selection, target);
return valid != null && valid.isOK();
}
}
} finally {
NavigatorContentServiceTransfer.getInstance().unregisterContentService(contentService);
}
if (Policy.DEBUG_DND) {
// $NON-NLS-1$
System.out.println("NavigatorPluginDropAction.run (exit)");
}
return false;
}
use of org.eclipse.ui.navigator.CommonDropAdapterAssistant in project tmdm-studio-se by Talend.
the class DuplicateAction method getDropAssistant.
private RepositoryDropAssistant getDropAssistant() {
INavigatorDnDService dndService = commonViewer.getNavigatorContentService().getDnDService();
CommonDropAdapterAssistant[] dropAssistants = dndService.findCommonDropAdapterAssistants(getSelectedViewObj(), getStructuredSelection());
for (CommonDropAdapterAssistant assistant : dropAssistants) {
if (assistant instanceof RepositoryDropAssistant) {
return (RepositoryDropAssistant) assistant;
}
}
return null;
}
Aggregations