Subversion Repositories general

Rev

Rev 545 | Blame | Last modification | View Log | RSS feed

PK
óù.        META-INF/þÊPK
óù.ù$+Ñ66META-INF/MANIFEST.MFManifest-Version: 1.0
Class-Path: 
Transform-To-File: src/plugins/textEditorPlugin/TextEditorPluginTransf
 orm.xsl
XMLEditor-Plugin-Name: TextEditor
Created-By: 1.4.2 (Sun Microsystems Inc.)
Main-Class: src.plugins.textEditorPlugin.TextEditorPlugin
Description: ...(todo)
Transform-Fro-File: src/plugins/textEditorPlugin/TextEditorPluginTrans
 formBack.xsl
Comment: view everything as text, best as default plugin

Name: src/plugins/textEditorPlugin
Specification-Title: plugin for XMLEditor
Implementation-Title: src.plugins.textEditorPlugin
Specification-Version: 0.4 (05/07/03)
Specification-Vendor: group5, software practice SS_2003, University Bi
 elefeld, Germany
Implementation-Version: 0.1 (05/07/03)
Implementation-Vendor: group5, software practice SS_2003, University B
 ielefeld, Germany

PK
A‰ù.càFííBsrc/plugins/textEditorPlugin/TextEditorPlugin$MyUndoListener.classÊþº¾-=<src/plugins/textEditorPlugin/TextEditorPlugin$MyUndoListenerjava/lang/Object&javax/swing/event/UndoableEditListenerthis$0/Lsrc/plugins/textEditorPlugin/TextEditorPlugin;        Synthetic<init>2(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)VCode()V

       LineNumberTableLocalVariableTablethis>Lsrc/plugins/textEditorPlugin/TextEditorPlugin$MyUndoListener;undoableEditHappened((Ljavax/swing/event/UndoableEditEvent;)V-src/plugins/textEditorPlugin/TextEditorPluginaccess$22(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)Z
access$0O(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)Ljavax/swing/undo/UndoManager;
 #javax/swing/event/UndoableEditEvent"getEdit!()Ljavax/swing/undo/UndoableEdit;$%
#&javax/swing/undo/UndoManager(addEdit"(Ljavax/swing/undo/UndoableEdit;)Z*+
),access$3k(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)Lsrc/plugins/textEditorPlugin/TextEditorPlugin$UndoAction;./
08src/plugins/textEditorPlugin/TextEditorPlugin$UndoAction2=(Lsrc/plugins/textEditorPlugin/TextEditorPlugin$UndoAction;)V4
35uee%Ljavax/swing/event/UndoableEditEvent;
SourceFileTextEditorPlugin.javaInnerClassesMyUndoListener  
4
*·*+µ±S
d$*´¸™*´¸!+¶'¶-W*´¸1¸6±k
nq#s$$789:;
<PK
A‰ù.èÇN
ƒƒEsrc/plugins/textEditorPlugin/TextEditorPlugin$OwnStyledDocument.classÊþº¾-"?src/plugins/textEditorPlugin/TextEditorPlugin$OwnStyledDocument&javax/swing/text/DefaultStyledDocumentthis$0/Lsrc/plugins/textEditorPlugin/TextEditorPlugin; Synthetic<init>2(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)VCode()V
       LineNumberTableLocalVariableTablethisALsrc/plugins/textEditorPlugin/TextEditorPlugin$OwnStyledDocument;addUndoableEditListener+(Ljavax/swing/event/UndoableEditListener;)V!javax/swing/text/AbstractDocument
listener(Ljavax/swing/event/UndoableEditListener;
SourceFileTextEditorPlugin.javaInnerClasses-src/plugins/textEditorPlugin/TextEditorPluginOwnStyledDocument  
8
*·
*+µ±
78

>*+·±
EF
 !PK
A‰ù.N¹Èo##>src/plugins/textEditorPlugin/TextEditorPlugin$UndoAction.classÊþº¾-T8src/plugins/textEditorPlugin/TextEditorPlugin$UndoActionjavax/swing/AbstractActionthis$0/Lsrc/plugins/textEditorPlugin/TextEditorPlugin;   Synthetic<init>2(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)VCodeUndo(Ljava/lang/String;)V
       
setEnabled(Z)V
LineNumberTableLocalVariableTablethis:Lsrc/plugins/textEditorPlugin/TextEditorPlugin$UndoAction;actionPerformed(Ljava/awt/event/ActionEvent;)V-src/plugins/textEditorPlugin/TextEditorPluginaccess$0O(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)Ljavax/swing/undo/UndoManager;
 javax/swing/undo/UndoManager"undo()V$%
#&java/lang/StringBuffer(Cannot undo : *
)append,(Ljava/lang/Object;)Ljava/lang/StringBuffer;-.
)/toString()Ljava/lang/String;12
)3access$1E(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;ILjava/lang/String;)V56
7checkIfUndo9%
:$javax/swing/undo/CannotUndoException<aeLjava/awt/event/ActionEvent;cue&Ljavax/swing/undo/CannotUndoException;canUndo()ZBC
#DNameFgetUndoPresentationNameH2
#IputValue'(Ljava/lang/String;Ljava/lang/Object;)VKL
M=(Lsrc/plugins/textEditorPlugin/TextEditorPlugin$UndoAction;)V
SourceFileTextEditorPlugin.javaInnerClasses
UndoAction        
C*·*+µ*¶±çêë
+*´¸!¶'§M*´»)Y+·,,¶0¶4¸8*·;±

=ü
&* ++>?@A9%
q3*´¸!¶E™*¶*G*´¸!¶J¶N§*¶*G¶N±
%*2!3O
%*·;±PQR
SPK
A‰ù.˜xîpŒ-Œ-3src/plugins/textEditorPlugin/TextEditorPlugin.classÊþº¾-!-src/plugins/textEditorPlugin/TextEditorPluginjavax/swing/JPanelsrc/plugins/PluginInterfacejava/awt/event/ActionListenerjavax/swing/event/CaretListener    "javax/swing/event/DocumentListener
pluginNameLjava/lang/String;
ConstantValue
TextEditorguiInterfaceLsrc/gui/GuiInterface;logInterfaceLsrc/gui/LogInterface;ourEventListenerLsrc/control/OurEventListener;statusInterfaceLsrc/gui/StatusInterface;textDocumentALsrc/plugins/textEditorPlugin/TextEditorPlugin$OwnStyledDocument;textAreaLjavax/swing/JTextArea;
scrollPaneLjavax/swing/JScrollPane;
syncButtonLjavax/swing/JButton;transformer!Ljavax/xml/transform/Transformer;changedNodeLorg/w3c/dom/Node;oldNode
oldContentmodifiedZ
undoAction:Lsrc/plugins/textEditorPlugin/TextEditorPlugin$UndoAction;undoManagerLjavax/swing/undo/UndoManager;<init>()VCode./
1
       3?src/plugins/textEditorPlugin/TextEditorPlugin$OwnStyledDocument52(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)V.7
68       :javax/swing/JTextArea<(Ljavax/swing/text/Document;)V.>
=?       Ajavax/swing/JScrollPaneC(Ljava/awt/Component;)V.E
DF       Hjavax/swing/JButtonJsynchronizeL(Ljava/lang/String;)V.N
KO !       Q()       S8src/plugins/textEditorPlugin/TextEditorPlugin$UndoActionU
V8*+       Xjavax/swing/undo/UndoManagerZ
[1,-       ]LineNumberTableLocalVariableTablethis/Lsrc/plugins/textEditorPlugin/TextEditorPlugin;init(Lsrc/gui/GuiInterface;)V    esrc/gui/GuiInterfaceggetLogInterface()Lsrc/gui/LogInterface;ijhk      mgetStatusInterface()Lsrc/gui/StatusInterface;ophq  sjavax/swing/JComponentu
setVisible(Z)Vwx
vyjava/awt/BorderLayout{
|1java/awt/Container~  setLayout(Ljava/awt/LayoutManager;)V€
‚Center„add)(Ljava/awt/Component;Ljava/lang/Object;)V†‡
ˆNorthŠjavax/swing/AbstractButtonŒaddActionListener"(Ljava/awt/event/ActionListener;)VŽ
javax/swing/text/JTextComponent’addCaretListener$(Ljavax/swing/event/CaretListener;)V”•
“–<src/plugins/textEditorPlugin/TextEditorPlugin$MyUndoListener˜
™8addUndoableEditListener+(Ljavax/swing/event/UndoableEditListener;)V›œ
6java/lang/SystemŸoutLjava/io/PrintStream;¡¢        £TextEditorPlugin initialized¥java/io/PrintStream§println©N
¨ªstartF(Lorg/w3c/dom/Node;Lorg/w3c/dom/Document;Ljavax/swing/tree/TreePath;)Vjavax/swing/JMenu®Text editor°
¯O-(Ljavax/swing/Action;)Ljavax/swing/JMenuItem;†³
¯´
setPluginMenu(Ljavax/swing/JMenu;)V¶·h¸setPluginPanel(Ljavax/swing/JPanel;)Vº»h¼&%       ¾org/w3c/dom/NodeÀgetNodeType()SÂÃÁÄ!javax/xml/transform/dom/DOMSourceÆ(Lorg/w3c/dom/Node;)V.È
ÇÉjava/io/StringWriterË
Ì1'javax/xml/transform/stream/StreamResultÎ(Ljava/io/Writer;)V.Ð
ÏÑ&javax/xml/transform/TransformerFactoryÓnewInstance*()Ljavax/xml/transform/TransformerFactory;ÕÖ
Ô×newTransformer#()Ljavax/xml/transform/Transformer;ÙÚ
ÔÛ"#     Ýjava/lang/StringBufferßTransformerFactory error: á
àOjava/lang/Throwableä
getMessage()Ljava/lang/String;æç
åèappend,(Ljava/lang/String;)Ljava/lang/StringBuffer;êë
àìtoStringîç
àïsrc/gui/LogInterfaceñlog(ILjava/lang/String;)Vóôòõomit-xml-declaration÷yesùjavax/xml/transform/TransformerûsetOutputProperty'(Ljava/lang/String;Ljava/lang/String;)Výþ
üÿindent){http://xml.apache.org/xslt}indent-amount4methodxml          transform;(Ljavax/xml/transform/Source;Ljavax/xml/transform/Result;)V
ü
Transformer error:         getBuffer()Ljava/lang/StringBuffer;
Ì'      setTextN
“getNodeValueçÁgetDocument()Ljavax/swing/text/Document;
“javax/swing/text/Document!addDocumentListener'(Ljavax/swing/event/DocumentListener;)V#$"%5javax/xml/transform/TransformerConfigurationException'(javax/xml/transform/TransformerException)nodeenvironmentLorg/w3c/dom/Document;elementPathLjavax/swing/tree/TreePath;textEditorMenuLjavax/swing/JMenu;source#Ljavax/xml/transform/dom/DOMSource;stringWriterLjava/io/StringWriter;stream)Ljavax/xml/transform/stream/StreamResult;transformerFactory(Ljavax/xml/transform/TransformerFactory;tce7Ljavax/xml/transform/TransformerConfigurationException;te*Ljavax/xml/transform/TransformerException;stringstopsetOurEventListener!(Lsrc/control/OurEventListener;)V  BnewListenerforceStatusReportgetTextFç
“G!src/parser/ValidationErrorHandlerI
J1setLogInterface(Lsrc/gui/LogInterface;)VLM
JNsetStatusInterface(Lsrc/gui/StatusInterface;)VPQ
JR(javax/xml/parsers/DocumentBuilderFactoryT,()Ljavax/xml/parsers/DocumentBuilderFactory;ÕV
UWsetNamespaceAwareYx
UZnewDocumentBuilder%()Ljavax/xml/parsers/DocumentBuilder;\]
U^!javax/xml/parsers/DocumentBuilder`setErrorHandler(Lorg/xml/sax/ErrorHandler;)Vbc
adjava/io/StringReaderf
gOorg/xml/sax/InputSourcei(Ljava/io/Reader;)V.k
jlparse1(Lorg/xml/sax/InputSource;)Lorg/w3c/dom/Document;no
ap
getFirstChild()Lorg/w3c/dom/Node;rsÁt$%     vchangedNode = x,(Ljava/lang/Object;)Ljava/lang/StringBuffer;êz
à{"org/apache/xerces/dom/DocumentImpl}
~1NOTVALID€&org/apache/xerces/dom/CoreDocumentImpl‚createProcessingInstructionI(Ljava/lang/String;Ljava/lang/String;)Lorg/w3c/dom/ProcessingInstruction;„…
ƒ†Node Type = ˆ(I)Ljava/lang/StringBuffer;êŠ
à‹        cloneNode(Z)Lorg/w3c/dom/Node;ŽÁsetNodeValue‘NÁ’4Errors ignored: Input was interpreted as plain text.”Parser configuration error: –
IO error: ˜Illegal argument error: šSAX parser error: œorg/xml/sax/SAXExceptionž
ŸèReturn this node:¡firePluginChangedElement'(Lorg/w3c/dom/Node;Lorg/w3c/dom/Node;)V£¤
¥.javax/xml/parsers/ParserConfigurationException§java/io/IOException©"java/lang/IllegalArgumentException«validcontenterrorHandler#Lsrc/parser/ValidationErrorHandler;documentBuilderFactory*Ljavax/xml/parsers/DocumentBuilderFactory;documentBuilder#Ljavax/xml/parsers/DocumentBuilder;stringReaderLjava/io/StringReader;inputSourceLorg/xml/sax/InputSource;doc$Lorg/apache/xerces/dom/DocumentImpl;pce0Ljavax/xml/parsers/ParserConfigurationException;ioeLjava/io/IOException;iae$Ljava/lang/IllegalArgumentException;saxeLorg/xml/sax/SAXException;src/control/OurEventÃjava/lang/ObjectÅ([Ljava/lang/Object;)V.Ç
ÄÈsrc/control/OurEventListenerÊ
firedOurEvent(Lsrc/control/OurEvent;)VÌÍËÎeLsrc/control/OurEvent;actionPerformed(Ljava/awt/event/ActionEvent;)Vjava/util/EventObjectÔ      getSource()Ljava/lang/Object;Ö×
ÕØE/
ÚaeLjava/awt/event/ActionEvent;caretUpdate!(Ljavax/swing/event/CaretEvent;)Vjavax/swing/event/CaretEventàgetDot()Iâã
áägetLineOfOffset(I)Iæç
=ègetLineStartOffsetêç
=ëjava/awt/Pointí(II)V.ï
îðsrc/gui/StatusInterfaceòsetPoint(Ljava/awt/Point;)VôõóöBad cursor location: ø%javax/swing/text/BadLocationExceptionúceLjavax/swing/event/CaretEvent;dotIlinecolumnbadLEx'Ljavax/swing/text/BadLocationException;
changedUpdate$(Ljavax/swing/event/DocumentEvent;)Vde!Ljavax/swing/event/DocumentEvent;insertUpdatesetModified   xó
removeUpdate
isModified()Zimessageaccess$0O(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)Ljavax/swing/undo/UndoManager;   Syntheticaccess$1E(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;ILjava/lang/String;)V
õaccess$22(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)Zaccess$3k(Lsrc/plugins/textEditorPlugin/TextEditorPlugin;)Lsrc/plugins/textEditorPlugin/TextEditorPlugin$UndoAction;
SourceFileTextEditorPlugin.javaInnerClasses
UndoActionOwnStyledDocumentMyUndoListener!

 !"#$%&%'()*+,-./0¬^*·2*µ4*»6Y*·9µ;*»=Y*´;·@µB*»DY*´B·GµI*»KYM·PµR*µT*»VY*·WµY*»[Y·\µ^±_*
pM
VW%Z4^AeFhRk]q`^abcd0Åe*+µf*+¹lµn*+¹rµt*¶z*»|Y·}¶ƒ**´I…¶‰**´R‹¶‰*´R*¶‘*´B*¶—*´;»™Y*·š¶ž²¤¦¶«±_2|}~€)3‚=ƒE„M‡\ˆd‰`eabe¬­0c    3»¯Y±·²:*´Y¶µW*´f¹¹*´f*¹½*¶z*+µ¿+¹Å Î»ÇY+·Ê:»ÌY·Í:»ÏY·Ò:¸Ø:*¶ÜµÞ§#:*´n»àYâ·ã¶é¶í¶ð¹ö*´Þøú¶*´Þú¶*´Þ¶*´Þ
¶*´Þ¶§$:*´n»àY·ã¶é¶í¶ð¹ö¶¶ð:*µ*´B¶§*´B+¹¶*´f*¹½*´B¶ *¹&*¶z±\mm(¾ÌÌ*_Ž#˜™œ *ž/ 4¢>£H¤Q¥\¨a©m­o®t®}¯…®±˜²¤³±´¾¶ÌºÎ»Ó»Ý¼å»í¾÷¿ýé       íð ñ-ò2ó`z3ab3+%3,-3./(01HÁ23Q¸45\­67a89o:;Î<=÷>?/04*¶z±_
ýþ`ab@A0>*+µC±_
`abDE/0MÇ<*´B¶HM»JY·KN-*´n¶O-*´t¶S¸X:¶[¶_:-¶e™E»gY,·h:»jY·m:*¶q¹uµw²¤»àYy·ã*´w¶|¶ð¶«§*´¿¹ÅŸ*´¿¹Å &*´B¶HM»~Y·:*,¶‡µw<§á²¤»àY‰·ã*´¿¹Å¶Œ¶ð¶«**´¿¹µw*´w*´B¶H¹“*´n•¹ö<§’:*´n»àY—·ã¶é¶í¶ð¹ö§n:*´n»àY™·ã¶é¶í¶ð¹ö§J:*´n»àY›·ã¶é¶í¶ð¹ö§&:*´n»àY·ã¶ ¶í¶ð¹ö<™þ…²¤»àY¢·ã*´w¶|¶ð¶«**´¿*´w·¦±"

¨"
1ª"
U¬"
yŸ_Ê2
"'-4: >!H"S%c&€*›+£,¬-¹.¾1Ý2ë3û45
;<<=&<1A3B8BBCJBUFWG\GfHnGyL{M€MŠN’MšOœR UºVÆW`„
ÇabÅ­)
½®µ¯°'æ±²4Ù³´H8µ¶S-·¸¬¹º»¼3½¾W¿À{!Á£¤0t$»ÄY½ÆY+SY,SYS·ÉN*´C-¹Ï±_fg#h`*$ab$&%$$%ÐÑÒÓ0L+¶Ù*´R¦*¶Û±_tuw`abÜÝÞß0ÜT+¶å=*´B¶é>*´B¶ìd6*´t»îY``·ñ¹÷§"N*´n»àYù·ã-¶é¶í¶ð¹ö±44û_*
ƒ„…4‡5ˆ:ˆD‰KˆS‹`>TabTüýOþÿ&ÿÿ505±_‘`ab0L*µT*´t¹±_Ÿ ¡`ab0L*µT*´t¹±_¯°±`ab
0/*´T¬_½`abóô0N*´n,¹ö±_
ÎÏ` abÿ0%*´^°_k`0'*,·±_Í`0%*´T¬_e`0%*´Y°_h`V6™ PK
™nù.¡½êÉLÉL2src/plugins/textEditorPlugin/TextEditorPlugin.java/* 
 * This file contains the TextEditorPlugin class.
 * 
 * Coded by: Group 5, software practice summer 2003
 * University of Bielefeld, Germany
 * 
 * @version $Revision: 1.46 $
 *
 * Last modification: $Date: 2003/07/25 11:52:50 $
 * $Id: TextEditorPlugin.java,v 1.46 2003/07/25 11:52:50 smcsporr Exp $
 */

package src.plugins.textEditorPlugin;

import java.awt.BorderLayout;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import java.io.StringReader;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JMenu;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.UndoableEditEvent;
import javax.swing.event.UndoableEditListener;

import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;

import javax.swing.tree.TreePath;

import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoManager;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Node;

import org.xml.sax.InputSource;

import src.control.OurEvent;
import src.control.OurEventListener;
import src.gui.*;
import src.plugins.PluginInterface;

/** 
 * The <code>TextEditor</code> plugin is used for textual XML node editing.
 * 
 * @author Christian Stollenwerk
 * 
 * @version $Revision: 1.46 $ Last modification: $Date: 2003/07/25 11:52:50 $
 */
public class TextEditorPlugin extends JPanel
                                                          implements PluginInterface, ActionListener, CaretListener,
                                                          DocumentListener {
                                                                
        /** Name of the plugin, used in method <code>firePluginChangedElement</code> */
        final private String pluginName = "TextEditor";
        
        /** Reference variables to access other program objects. */     
        private GuiInterface guiInterface;
        private LogInterface logInterface;
        private OurEventListener ourEventListener;
        private StatusInterface statusInterface;

        /** A text area based upon on underlying styled document. */
        private OwnStyledDocument textDocument = new OwnStyledDocument();
        private JTextArea textArea = new JTextArea(textDocument);
        
        /** Put the editing area in a scroll pane. */
        private JScrollPane scrollPane = new JScrollPane(textArea);
        
        /** The 'synchronize' button is used to update the tree display with the text editor
         * current content. */
        private JButton syncButton = new JButton("synchronize");
        private Transformer transformer;
        private Node changedNode;
        private Node oldNode;
        private String oldContent;
        
        /** A variable indicating if the document displayed has been modified. */
        private boolean modified = false;
        
        /** Create an UndoAction. UndoActions will be fired, if an undoable event occured. */
        private UndoAction undoAction = new UndoAction();
        
        /** Create an UndoManager that stores undoable events in an event queue. */
        private UndoManager undoManager = new UndoManager();

        /**
         * Empty constructor.
         */
        public TextEditorPlugin() {
        }
        
        /** 
         * Initializes the Text Editor Plugin, but does not show it.
         * 
         * @param guiInterface: A reference to an object compliant to src.gui.GuiInterface.
         * 
         * @see src.gui.PluginInterface#init(src.gui.GuiInterface)
         */
        public void init(GuiInterface guiInterface) {
                // connects the Plugin to the GUI
                this.guiInterface = guiInterface;
                logInterface = guiInterface.getLogInterface();
                statusInterface = guiInterface.getStatusInterface();
                setVisible(false);
                setLayout(new BorderLayout());
                add(scrollPane, BorderLayout.CENTER);
                add(syncButton, BorderLayout.NORTH);
                syncButton.addActionListener(this);
                textArea.addCaretListener(this);
                
                /* Add a listener for undoable events. */
                textDocument.addUndoableEditListener(new MyUndoListener());
                System.out.println("TextEditorPlugin initialized");
        }


        /** 
         * Starts the Text Editor Plugin if a registered node has been chosen.
         * 
         * @param element The selected node from the XML document, read-only.
         * @param environment The whole XML document, read-only.
         * @param elementPath The <code>TreePath</code> of the selected element in the evironment.
         * 
         * @see src.gui.PluginInterface#start(org.w3c.dom.Element, org.w3c.dom.Document)
         */
        public void start(final Node node, final Document environment, final TreePath elementPath) {
                
                /* Create a JMenu entry for this plugin. */
                JMenu textEditorMenu = new JMenu("Text editor");
                textEditorMenu.add(undoAction);
                
                /* Add the text editor menu to the GUI. */
                this.guiInterface.setPluginMenu(textEditorMenu);
                this.guiInterface.setPluginPanel(this);
                setVisible(true);
                                
                oldNode = node;
                // casts the node into a DOMSource for transforming
                if(node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
                        DOMSource source = new DOMSource(node);
                        java.io.StringWriter stringWriter = new java.io.StringWriter();
                        StreamResult stream = new StreamResult(stringWriter);
                        try {
                                /* Create a TransformerFactory and a new Transformer. */
                                TransformerFactory transformerFactory = TransformerFactory.newInstance();
                                transformer = transformerFactory.newTransformer();
                        }
                
                        /* Catch and log exceptions thrown by the TransformerFactory.*/
                        catch (TransformerConfigurationException tce) {
                                logInterface.log(LogInterface.TYPE_ERROR, "TransformerFactory error: "
                                + tce.getMessage());
                        }
                        transformer.setOutputProperty(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
                        transformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT, "yes");
                        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
                        transformer.setOutputProperty(javax.xml.transform.OutputKeys.METHOD, "xml");
                        try {
                                transformer.transform(source, stream);
                        }
                        
                        /* Catch and log exception thrown during the transformation. */
                        catch (TransformerException te){
                                logInterface.log(LogInterface.TYPE_ERROR, "Transformer error: "
                                + te.getMessage());
                        }
                        String string = stringWriter.getBuffer().toString();
                        oldContent = string;
                        
                        // try syntax highlighting
                        /*javax.swing.text.Document textDocument = textArea.getDocument();
                        StyleContext styleContext = StyleContext.getDefaultStyleContext();
                        Style defaultStyle = styleContext.getStyle(StyleContext.DEFAULT_STYLE);
                
                        Style tagStyle = styleContext.addStyle(null, defaultStyle);
                        StyleConstants.setForeground(tagStyle, java.awt.Color.BLUE);
                        //StyleConstants.setFontFamily(tagStyle, "Arial");
                        System.out.println("tagStyle = " +tagStyle);
                        Style style = defaultStyle;
                        char c;
                        boolean newLine = false;
                        for(int i = 0; i < string.length(); i++) {
                                c = string.charAt(i);
                                try {
                                        if(newLine && c == ' ') {
                                                textDocument.insertString(textDocument.getLength(), 
                                                                                                        "   ", style);
                                        }
                                        if(c != ' ')
                                                newLine = false;
                                        if(c == '\n') {
                                                newLine = true;
                                        }
                                        if(c == '<') {
                                                style = tagStyle;
                                                //textArea.setDisabledTextColor(java.awt.Color.BLUE);
                                        }
                                        if(c == '>') {
                                                style = defaultStyle;
                                                //textArea.setDisabledTextColor(java.awt.Color.BLACK);
                                        }
                                        textDocument.insertString(textDocument.getLength(), 
                                                                                                String.valueOf(c), style);
                                }
                                catch(BadLocationException ble) {
                                        logInterface.log(LogInterface.TYPE_ERROR, ble.getMessage());
                                }
                                //textArea.setText(String.valueOf(c));
                        }*/
                        textArea.setText(string);
                }
                /* If the node ist a text node or similar, only get the value. */
                else {
                        textArea.setText(node.getNodeValue());
                }
                
                guiInterface.setPluginPanel(this);
                textArea.getDocument().addDocumentListener(this);
                setVisible(true);
        }


        /** 
         * Stops showing the TextEditor plugin by setting it invisible. The editor will
         * remain loaded in RAM.
         * 
         * @see src.gui.PluginInterface#stop()
         */
        public void stop() {
                setVisible(false);
        }

        /* (non-Javadoc)
         * @see src.gui.PluginInterface#setOurEventListener(src.control.OurEventListener)
         */
        public void setOurEventListener(OurEventListener newListener) {
                ourEventListener = newListener;
        }


        /**
         * Forces the text editor plugin to update the display status with it's current data.
         * Not well-formed text parts will be capsuled into a processing instruction.
         * 
         * author C. Stollenwerk
         * 
         * @see src.gui.PluginInterface#forceStatusReport()
         */
        public void forceStatusReport() {
                
                /* Parse the content of the JTextArea. */
                boolean valid = true;
                String content = textArea.getText();

                src.parser.ValidationErrorHandler errorHandler = new src.parser.ValidationErrorHandler();
                errorHandler.setLogInterface(logInterface);
                errorHandler.setStatusInterface(statusInterface);
                do {
                        try {
                                DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
                                documentBuilderFactory.setNamespaceAware(true);
                                DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
                                documentBuilder.setErrorHandler(errorHandler);
                                // if the content of the edior is well-formed, parse only
                                if(valid == true) {
                                        StringReader stringReader = new StringReader(content);
                                        InputSource inputSource = new InputSource(stringReader);
                                        //doc.appendChild(documentBuilder.parse(inputSource));
                                        //log(LogInterface.TYPE_INFO, content); //for debugging
                                        changedNode = documentBuilder.parse(inputSource).getFirstChild();
                                        System.out.println("changedNode = " + changedNode);
                                }
                                // if the content is not well-formed, capsule it into a processing instruction
                                else {
                                        if(oldNode.getNodeType() == Node.ELEMENT_NODE || oldNode.getNodeType() == Node.ENTITY_NODE) {
                                                content = textArea.getText();
                                                org.apache.xerces.dom.DocumentImpl doc = new org.apache.xerces.dom.DocumentImpl(); 
                                                changedNode = doc.createProcessingInstruction("NOTVALID", content);
                                                valid = true;
                                        }
                                        else {
                                                System.out.println("Node Type = " + oldNode.getNodeType());
                                                changedNode = oldNode.cloneNode(true);
                                                changedNode.setNodeValue(textArea.getText());
                                                logInterface.log(LogInterface.TYPE_INFO,"Errors ignored: Input was interpreted as plain text.");
                                                valid = true;
                                        }
                                }
                        }
                        
                        /* Catch and log configuration errors. */
                        catch(ParserConfigurationException pce) {
                                logInterface.log(LogInterface.TYPE_ERROR, "Parser configuration error: "
                                + pce.getMessage());
                        }
                        
                        /* Catch and log I/O-errors during parsing. */
                        catch(java.io.IOException ioe) {
                                logInterface.log(LogInterface.TYPE_ERROR, "IO error: "
                                + ioe.getMessage());
                        }
                        
                        catch(IllegalArgumentException iae) {
                                logInterface.log(LogInterface.TYPE_ERROR, "Illegal argument error: "
                                + iae.getMessage());
                        }
                        
                        /* Catch and log parsing errors. */
                        catch(org.xml.sax.SAXException saxe) {
                                logInterface.log(LogInterface.TYPE_ERROR, "SAX parser error: "
                                + saxe.getMessage());
                                valid = false;
                        }
                }
                while(valid == false);

                // return the old and the changed node
                System.out.println("Return this node:" + changedNode);
                firePluginChangedElement(oldNode, changedNode);
        }
        

        /**
         * The methode <code> firePluginChangedEvent</code> fires a new src.contrl.OurEvent
         * to notify a changed Node to classes that implements the src.control.OurEventListener
         * 
         * @param oldNode the original Node see org.w3c.dom.Node;
         * @param changedNode  the Node after the change
         * 
         * @see src.control.OurEvent
         * @see src.control.OurEventListener
         */

        private void firePluginChangedElement(Node oldNode, Node changedNode) {
                OurEvent e = new OurEvent(new Object[] {oldNode, changedNode, pluginName});
                ourEventListener.firedOurEvent(e);
        }
        
        /**
         * Handles the action that the 'synchronize' button has been pressed by
         * starting the <code>forceStatusReport</code> method.
         * 
         * @param ae: An <code>ActionEvent</code> indicating that the
         * 'synchronize' button in the text editor has been pressed.
         * 
         * @see java.awt.event.ActionEvent
         */
        public void actionPerformed(ActionEvent ae) {
                if(ae.getSource() == syncButton) {
                        forceStatusReport();
                }
        }
        
        /**
         * The methode <code> caretUpdate </code> is required  by the Interface <code>CaretListener</code>
         * It is the Listener for changes in the caret position of a text component.
         * 
         * @see javax.swing.event.CaretListener
         * @see javax.swing.event.CaretEvent
         */
        public void caretUpdate(CaretEvent ce) {
                int dot = ce.getDot();
                try {
                        int line = textArea.getLineOfOffset(dot);
                        int column = dot - textArea.getLineStartOffset(line);
                        statusInterface.setPoint(new java.awt.Point(line + 1, column + 1));
                }
                catch(BadLocationException badLEx) {
                        logInterface.log(LogInterface.TYPE_ERROR, "Bad cursor location: "
                        + badLEx.getMessage());
                }
        }
        
        /**
         * Empty method to implement javax.swing.event.DocumentListener. 
         */
        public void changedUpdate(DocumentEvent de) {
        }

        /**
         * Handles insertion <code>DocumentEvent</code>s.
         * 
         * These are events that indicate, that something has been inserted into the
         * associated document. The method will set the 'modified' status display
         * in the GUI visible, so users will see, if the current document has been changed.
         * 
         * @param de A document event fired by a document object.
         * 
         * Last revision: 20-Jul-2003
         */
        public void insertUpdate(DocumentEvent de) {
                modified = true;
                statusInterface.setModified(true);
        }

        /**
         * Handles deletion <code>DocumentEvent</code>s.
         * 
         * These are events that indicate, that something has been deleted from the
         * associated document. The method will set the 'modified' status display
         * in the GUI visible, so users will see, if the current document has been changed.
         * 
         * @param de A document event fired by a document object.
         * 
         * Last revision: 20-Jul-2003
         */
        public void removeUpdate(DocumentEvent de) {
                modified = true;
                statusInterface.setModified(true);
        }
        
        /**
         * Returns the modification status of the current document.
         * This status indicates, if the current document has been changed or not.
         * 
         * @return A <code>boolean</code> value, <code>true</code> if the document has
         * been changed, <code>false</code> otherwise.
         * 
         * author C. Stollenwerk
         */
        public boolean isModified() {
                return modified;
        }
        
        /**
         * Sends a text message of a specified type (info, error, warning) to the
         * registered log panel.
         * A reference to an implementation of a log panel will be set when calling the
         * class constructor via the src.gui.GuiInterface method <code>getLogInterface</code>.
         * 
         * @param i The type of the message as defined in src.gui.LogInterface.
         *                      0 or src.gui.LogInterface.TYPE_INFO     -> info message (black)
         *                      1 or src.gui.LogInterface.TYPE_WARNING  -> warning message (orange)
         *                      2 or src.gui.LogInterface.TYPE_ERROR    -> error message (red)
         * 
         * @param message The text message to display in the log panel.
         */     
        private void log(int i,String message) {
                logInterface.log(i,message);    
        }
        
        /**
         * <code>UndoAction</code> implements an <code>AbstractAction</code>
         * event to form an event that is released when an undoable edit
         * happened in the editor.
         * 
         * @see javax.swing.AbstractAction
         * 
         * @author S. McSporran
         *
         * Last revision: 18-Jul-2003 by S. McSporran
         */
        private class UndoAction extends AbstractAction {

                /* Implemented as inner class, as it it only used in the context of
                 * the text editor. */
                
                /**
                 * The class constructor initializes it's superclass.
                 */
                public UndoAction() {
                        
                        /* Set title for this action. */
                        super("Undo");

                        /* Action is disabled at start. */
                        setEnabled(false);
                }
          
        /**
         * The <code>actionPerformed</code> method is invoked if an
         * <code>UndoAction</code> action was caught by the action listener.
         * 
         * @see java.awt.event.ActionListener
         * 
         * author S. McSporran
         * 
         * Last revision: 18-Jul-2003
         */
                public void actionPerformed(ActionEvent ae) {
                        
                        /* Try to undo the last edit. */
                        try {
                                        
                                undoManager.undo();
                        }
 
                                
                        /* Catch and log undo errors. */
                        catch (CannotUndoException cue) {
                                        
                                log(LogInterface.TYPE_ERROR, "Cannot undo : " + cue);
                        }

                        checkIfUndo();                  
                }
         
        /**
         * <code>checkIfUndo</code> verifies, if an undoable event is
         * available. If not, it will disable the <code>UndoAction</code> event.
         * 
         * @see javax.swing.AbstractAction#setEnabled
         * 
         * author S. McSporran
         * 
         * Last revision: 18-Jul-2003 by S. McSporran
         */
                private void checkIfUndo() {
                                
                        /* Checks, if action can be undone. */
                        if (undoManager.canUndo()) {
                                
                                setEnabled(true);
                                putValue(Action.NAME, undoManager.getUndoPresentationName());
                        } 
                                
                        else {

                                setEnabled(false);
                                putValue(Action.NAME, "Undo");
                        }
                }      
        }    

        /**
         * <code>OwnStyledDocument</code> extends the predefined <code>DefaultStyledDocument</code>
         * and adds a method to register an <UndoableEditListener</code> to the
         * text document.
         * 
         * @see javax.swing.text.DefaultStyledDocument
         * 
         * @author S. McSporran
         *
         * Last revision: 18-Jul-2003 by S. McSporran
         */
        private class OwnStyledDocument extends DefaultStyledDocument {
                
                /* Implemented as inner class, as it is only used in the context
                 * of the text editor. */

                /** 
                 * Empty constructor.
                 */
                public OwnStyledDocument() {
                }
                
                /**
                 * Adds an <code>UndoableEditListener</code> to <code>OwnStyledDocument</code>.
                 * 
                 * @see javax.swing.text.Document
                 * 
                 * author S. McSporran
                 * 
                 * Last revision: 18-Jul-2003 by S. McSporran
                 */
                public void addUndoableEditListener (UndoableEditListener listener) {
                        
                        super.addUndoableEditListener(listener);
                }
        }       
        
        /**
         * <code>MyUndoListener</code> is used to handle undoable events.
         * It will store events in the text editor in an <code>UndoManager</code>.
         * 
         * @see javax.swing.undo.UndoManager
         * 
         * @author S. McSporran
         *
         * Last revision: 18-Jul-2003 by S. McSporran
         */
        private class MyUndoListener implements UndoableEditListener {
                
                /* Implemented as inner class, as it is only used in the context
                 * of the text editor. */
                
                /**
                 * Handles undoable events that are captured by <code>MyUndoListener</code>.
                 * 
                 * New events will be added to a queue in the undo manager.
                 * Undoable events indicate, that an undoable edit has been done on a
                 * document object. These events include insert or delete actions, for
                 * example.
                 * 
                 * @param uee An undoable event.
                 * 
                 * @see javax.swing.event.UndoableEditEvent
                 * 
                 * author S. McSporran
                 * 
                 * Last revision: 18-Jul-2003 by S. McSporran
                 */
                public void undoableEditHappened(UndoableEditEvent uee) {
                        
                        /* If the document has been modified, continue. */
                        if (modified) {

                                /* Register the undoable edit that happened to the UndoManager. */
                                undoManager.addEdit(uee.getEdit());
                        
                                /* Update the undo action's state. */
                                undoAction.checkIfUndo();
                        }
                }
        }
}PK
ù.¹¤¶¶:src/plugins/textEditorPlugin/TextEditorPluginTransform.xsl<!-- to-direction for TextEditor
     status: ready
     updated to given schema from 15/07/2003 
     Last Revision: 17/07/2003 by Sascha Walkenhorst -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />


<xsl:template match="/">
        <xsl:apply-templates />
</xsl:template>

<xsl:template match="node()">
        <xsl:copy-of select="." />
</xsl:template>


</xsl:stylesheet>PK
ù.…±ÁK¸¸>src/plugins/textEditorPlugin/TextEditorPluginTransformBack.xsl<!-- back-direction for TextEditor
     status: ready
     updated to given schema from 15/07/2003 
     Last Revision: 17/07/2003 by Sascha Walkenhorst -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />


<xsl:template match="/">
        <xsl:apply-templates />
</xsl:template>

<xsl:template match="node()">
        <xsl:copy-of select="." />
</xsl:template>


</xsl:stylesheet>PK

óù.        META-INF/þÊPK

óù.ù$+Ñ66+META-INF/MANIFEST.MFPK

A‰ù.càFííB“src/plugins/textEditorPlugin/TextEditorPlugin$MyUndoListener.classPK

A‰ù.èÇN
ƒƒEà      src/plugins/textEditorPlugin/TextEditorPlugin$OwnStyledDocument.classPK

A‰ù.N¹Èo##>Æ
src/plugins/textEditorPlugin/TextEditorPlugin$UndoAction.classPK

A‰ù.˜xîpŒ-Œ-3Esrc/plugins/textEditorPlugin/TextEditorPlugin.classPK

™nù.¡½êÉLÉL2"Csrc/plugins/textEditorPlugin/TextEditorPlugin.javaPK

ù.¹¤¶¶:;src/plugins/textEditorPlugin/TextEditorPluginTransform.xslPK

ù.…±ÁK¸¸>I’src/plugins/textEditorPlugin/TextEditorPluginTransformBack.xslPK          a]”