01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.ui.internal.navigator.extensions;
11:
12: import org.eclipse.core.runtime.CoreException;
13: import org.eclipse.core.runtime.IConfigurationElement;
14: import org.eclipse.ui.internal.navigator.NavigatorPlugin;
15: import org.eclipse.ui.navigator.CommonDragAdapterAssistant;
16:
17: /**
18: *
19: * Drag assistants allow clients to provide new TransferTypes to a particular
20: * viewer.
21: *
22: * @since 3.2
23: *
24: */
25: public final class CommonDragAssistantDescriptor implements
26: IViewerExtPtConstants {
27:
28: private IConfigurationElement element;
29:
30: /* package */CommonDragAssistantDescriptor(
31: IConfigurationElement aConfigElement) {
32: element = aConfigElement;
33: }
34:
35: /**
36: * Create an instance of the {@link CommonDragAdapterAssistant} defined by
37: * this descriptor.
38: *
39: * @return an instance of the {@link CommonDragAdapterAssistant} or
40: * {@link SkeletonCommonDragAssistant} if a problem occurs with the
41: * instantiation.
42: */
43: public CommonDragAdapterAssistant createDragAssistant() {
44:
45: try {
46: return (CommonDragAdapterAssistant) element
47: .createExecutableExtension(ATT_CLASS);
48: } catch (CoreException e) {
49: NavigatorPlugin.logError(0, e.getMessage(), e);
50: } catch (RuntimeException re) {
51: NavigatorPlugin.logError(0, re.getMessage(), re);
52: }
53: return SkeletonCommonDragAssistant.INSTANCE;
54:
55: }
56:
57: }
|