Debian Codegraph @

plugins/org.eclipse.xsd.edit/src/org/eclipse/xsd/provider/XSDSchemaDirectiveItemProvider.java

raw
1 /**
2 * Copyright (c) 2002-2006 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 v2.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v20.html
7 *
8 * Contributors:
9 * IBM - Initial API and implementation
10 */
11 package org.eclipse.xsd.provider;
12
13
14 import java.util.List;
15
16 import org.eclipse.emf.common.notify.AdapterFactory;
17 import org.eclipse.emf.common.notify.Notification;
18 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
19 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
20 import org.eclipse.emf.edit.provider.IItemLabelProvider;
21 import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
22 import org.eclipse.emf.edit.provider.IItemPropertySource;
23 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
24 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
25 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
26
27
28 /**
29 * This is the item provider adpater for a {@link org.eclipse.xsd.XSDSchemaDirective} object.
30 */
31 public class XSDSchemaDirectiveItemProvider
32 extends XSDSchemaContentItemProvider
33 implements
34 IEditingDomainItemProvider,
35 IStructuredItemContentProvider,
36 ITreeItemContentProvider,
37 IItemLabelProvider,
38 IItemPropertySource
39 {
40 /**
41 * This constructs an instance from a factory and a notifier.
42 */
43 public XSDSchemaDirectiveItemProvider(AdapterFactory adapterFactory)
44 {
45 super(adapterFactory);
46 }
47
48 /**
49 * This returns the property descriptors for the adapted class.
50 */
51 @Override
52 public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object)
53 {
54 if (itemPropertyDescriptors == null)
55 {
56 super.getPropertyDescriptors(object);
57
58 // This is for the schemaLocation feature.
59 //
60 itemPropertyDescriptors.add
61 (new ItemPropertyDescriptor
62 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
63 XSDEditPlugin.INSTANCE.getString("_UI_SchemaLocation_label"),
64 XSDEditPlugin.INSTANCE.getString("_UI_SchemaLocationOfDirective_description"),
65 xsdPackage.getXSDSchemaDirective_SchemaLocation(),
66 true,
67 ItemPropertyDescriptor.TEXT_VALUE_IMAGE));
68 }
69 return itemPropertyDescriptors;
70 }
71
72 /**
73 * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}.
74 */
75 @Override
76 public void notifyChanged(Notification msg)
77 {
78 if (msg.getFeature() == xsdPackage.getXSDSchemaDirective_SchemaLocation())
79 {
80 fireNotifyChanged(msg);
81 return;
82 }
83 super.notifyChanged(msg);
84 }
85 }