1
|
/*******************************************************************************
|
2
|
* Copyright (c) 2006, 2010 IBM Corporation and others.
|
3
|
* All rights reserved. This program and the accompanying materials
|
4
|
* are made available under the terms of the Eclipse Public License v1.0
|
5
|
* which accompanies this distribution, and is available at
|
6
|
* http://www.eclipse.org/legal/epl-v10.html
|
7
|
*
|
8
|
* Contributors:
|
9
|
* IBM Corporation - initial API and implementation
|
10
|
******************************************************************************/
|
11
|
|
12
|
package org.eclipse.ui.internal.navigator.extensions;
|
13
|
|
14
|
import org.eclipse.core.runtime.IConfigurationElement;
|
15
|
import org.eclipse.core.runtime.SafeRunner;
|
16
|
import org.eclipse.ui.internal.navigator.NavigatorSafeRunnable;
|
17
|
import org.eclipse.ui.navigator.CommonDragAdapterAssistant;
|
18
|
|
19
|
/**
|
20
|
*
|
21
|
* Drag assistants allow clients to provide new TransferTypes to a particular
|
22
|
* viewer.
|
23
|
*
|
24
|
* @since 3.2
|
25
|
*
|
26
|
*/
|
27
|
public final class CommonDragAssistantDescriptor implements IViewerExtPtConstants {
|
28
|
|
29
|
private IConfigurationElement element;
|
30
|
|
31
|
|
32
|
/* package */ CommonDragAssistantDescriptor(IConfigurationElement aConfigElement) {
|
33
|
element = aConfigElement;
|
34
|
}
|
35
|
|
36
|
/**
|
37
|
* Create an instance of the {@link CommonDragAdapterAssistant} defined by
|
38
|
* this descriptor.
|
39
|
*
|
40
|
* @return an instance of the {@link CommonDragAdapterAssistant} or
|
41
|
* {@link SkeletonCommonDragAssistant} if a problem occurs with the
|
42
|
* instantiation.
|
43
|
*/
|
44
|
public CommonDragAdapterAssistant createDragAssistant() {
|
45
|
|
46
|
final CommonDragAdapterAssistant[] da = new CommonDragAdapterAssistant[1];
|
47
|
|
48
|
SafeRunner.run(new NavigatorSafeRunnable(element) {
|
49
|
public void run() throws Exception {
|
50
|
da[0] = (CommonDragAdapterAssistant) element.createExecutableExtension(ATT_CLASS);
|
51
|
}
|
52
|
});
|
53
|
if (da[0] != null)
|
54
|
return da[0];
|
55
|
return SkeletonCommonDragAssistant.INSTANCE;
|
56
|
|
57
|
}
|
58
|
|
59
|
}
|