01: /*
02: * $Id: JGraphpadJGXPlugin.java,v 1.1.1.1 2005/08/04 11:21:58 gaudenz Exp $
03: * Copyright (c) 2001-2005, Gaudenz Alder
04: *
05: * All rights reserved.
06: *
07: * See LICENSE file for license details. If you are unable to locate
08: * this file please contact info (at) jgraph (dot) com.
09: */
10: package com.jgraph.jgxplugin;
11:
12: import java.io.IOException;
13:
14: import javax.xml.parsers.ParserConfigurationException;
15:
16: import org.w3c.dom.Node;
17: import org.xml.sax.SAXException;
18:
19: import com.jgraph.JGraphEditor;
20: import com.jgraph.JGraphpad;
21: import com.jgraph.codecplugin.JGraphpadCodecAction;
22: import com.jgraph.editor.JGraphEditorPlugin;
23: import com.jgraph.editor.JGraphEditorResources;
24: import com.jgraph.editor.JGraphEditorSettings;
25:
26: /**
27: * Plugin for reading older JGraphpad files.
28: */
29: public class JGraphpadJGXPlugin implements JGraphEditorPlugin {
30:
31: /**
32: * Defines the path to the UI configuration to be merged into the existing
33: * UI configuration.
34: */
35: public static String PATH_UICONFIG = "/com/jgraph/jgxplugin/resources/ui.xml";
36:
37: /**
38: * Adds resource bundles.
39: */
40: static {
41: JGraphEditorResources
42: .addBundles(new String[] { "com.jgraph.jgxplugin.resources.strings" });
43: }
44:
45: /**
46: * Initializes the plugin by registering all factory methods and action
47: * bundles and merging the UI configuration into the main configuration.
48: *
49: * @param editor
50: * The enclosing editor for the plugin.
51: * @param configuration
52: * The object to configure the plugin with.
53: */
54: public void initialize(JGraphEditor editor, Node configuration)
55: throws ParserConfigurationException, SAXException,
56: IOException {
57: editor.getKit().addBundle(
58: new JGraphpadCodecAction.AllActions(editor));
59: editor.getSettings().add(
60: JGraphpad.NAME_UICONFIG,
61: JGraphEditorSettings.parse(JGraphEditorResources
62: .getInputStream(PATH_UICONFIG)));
63: }
64:
65: }
|