KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > eclipse > mapper > views > contentoutline > JFaceNodeAdapterFactoryForXML


1 /*******************************************************************************
2  * Copyright (c) 2001, 2004 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  * Jens Lukowski/Innoopract - initial API and implementation
10  *
11  *******************************************************************************/

12 package org.hibernate.eclipse.mapper.views.contentoutline;
13
14
15
16 import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
17 import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
18 import org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter;
19 import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeAdapterFactory;
20
21
22 /**
23  * General enhancements to the xml outline.
24  * e.g. show first attribute of a node in the outline for easy recognition.
25  *
26  * An adapter factory to create JFaceNodeAdapters. Use this
27  * adapter factory with a JFaceAdapterContentProvider to display
28  * DOM nodes in a tree.
29  */

30 public class JFaceNodeAdapterFactoryForXML extends JFaceNodeAdapterFactory {
31
32     public JFaceNodeAdapterFactoryForXML() {
33         this(IJFaceNodeAdapter.class, true);
34     }
35
36     public JFaceNodeAdapterFactoryForXML(Object JavaDoc adapterKey, boolean registerAdapters) {
37         super(adapterKey, registerAdapters);
38     }
39
40     /**
41      * Create a new JFace adapter for the DOM node passed in
42      */

43     protected INodeAdapter createAdapter(INodeNotifier node) {
44         if (singletonAdapter == null) {
45             // create the JFaceNodeAdapter
46
singletonAdapter = new JFaceNodeAdapterForXML(this);
47             initAdapter(singletonAdapter, node);
48         }
49         return singletonAdapter;
50     }
51
52 }
53
Popular Tags