Search in sources :

Example 1 with CommonDropAdapterAssistant

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;
}
Also used : INavigatorDnDService(org.eclipse.ui.navigator.INavigatorDnDService) CommonDropAdapterAssistant(org.eclipse.ui.navigator.CommonDropAdapterAssistant) RepositoryDropAssistant(org.talend.mdm.repository.core.dnd.RepositoryDropAssistant)

Example 2 with CommonDropAdapterAssistant

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;
}
Also used : CommonDropAdapterAssistant(org.eclipse.ui.navigator.CommonDropAdapterAssistant)

Example 3 with CommonDropAdapterAssistant

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;
}
Also used : NavigatorSafeRunnable(org.eclipse.ui.internal.navigator.NavigatorSafeRunnable) CommonDropAdapterAssistant(org.eclipse.ui.navigator.CommonDropAdapterAssistant)

Example 4 with CommonDropAdapterAssistant

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;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) CommonDropAdapterAssistant(org.eclipse.ui.navigator.CommonDropAdapterAssistant) INavigatorContentService(org.eclipse.ui.navigator.INavigatorContentService)

Example 5 with CommonDropAdapterAssistant

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;
}
Also used : INavigatorDnDService(org.eclipse.ui.navigator.INavigatorDnDService) CommonDropAdapterAssistant(org.eclipse.ui.navigator.CommonDropAdapterAssistant) RepositoryDropAssistant(org.talend.mdm.repository.core.dnd.RepositoryDropAssistant)

Aggregations

CommonDropAdapterAssistant (org.eclipse.ui.navigator.CommonDropAdapterAssistant)6 INavigatorDnDService (org.eclipse.ui.navigator.INavigatorDnDService)3 RepositoryDropAssistant (org.talend.mdm.repository.core.dnd.RepositoryDropAssistant)2 IWorkspaceDescription (org.eclipse.core.resources.IWorkspaceDescription)1 IStatus (org.eclipse.core.runtime.IStatus)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 ManualAssociationAwareWorkingSetManager (org.eclipse.n4js.ui.workingsets.ManualAssociationAwareWorkingSetManager)1 ManualAssociationWorkingSet (org.eclipse.n4js.ui.workingsets.ManualAssociationAwareWorkingSetManager.ManualAssociationWorkingSet)1 ProjectNameFilterAwareWorkingSetManager (org.eclipse.n4js.ui.workingsets.ProjectNameFilterAwareWorkingSetManager)1 ProjectNameFilterWorkingSet (org.eclipse.n4js.ui.workingsets.ProjectNameFilterAwareWorkingSetManager.ProjectNameFilterWorkingSet)1 ProjectTypeAwareWorkingSetManager (org.eclipse.n4js.ui.workingsets.ProjectTypeAwareWorkingSetManager)1 ProjectTypeWorkingSet (org.eclipse.n4js.ui.workingsets.ProjectTypeAwareWorkingSetManager.ProjectTypeWorkingSet)1 WorkingSet (org.eclipse.n4js.ui.workingsets.WorkingSet)1 WorkingSetDiffBuilder (org.eclipse.n4js.ui.workingsets.WorkingSetDiffBuilder)1 WorkingSetManager (org.eclipse.n4js.ui.workingsets.WorkingSetManager)1 N4JSProjectInWorkingSetDropAdapterAssistant (org.eclipse.n4js.ui.workingsets.internal.N4JSProjectInWorkingSetDropAdapterAssistant)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1 NavigatorSafeRunnable (org.eclipse.ui.internal.navigator.NavigatorSafeRunnable)1 CommonDropAdapter (org.eclipse.ui.navigator.CommonDropAdapter)1