exceptionlist.java
来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 235 行
JAVA
235 行
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/exception/data/ExceptionList.java,v 1.1.1.1 2004/07/01 09:07:45 wang_j Exp $
* $Revision: 1.1.1.1 $
* $Date: 2004/07/01 09:07:45 $
*
* ====================================================================
*
* The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
*
* Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
* IT Forest Corporation
* All rights reserved.
*
* This software is the confidential and proprietary information of
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
* You shall not disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into with
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
*/
package com.webpump.ui.exception.data;
import java.util.Hashtable;
import java.util.Vector;
import java.io.PrintWriter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.*;
import org.w3c.dom.*;
import com.webpump.ui.base.data.*;
import com.webpump.ui.perspective.MacroResource;
import com.webpump.ui.perspective.WebpumpIDEPlugin;
/**
* Class for defining the whole data structure of the file "exception.xml"
*
* @author zhao_f
* @version 2.0.0 2004-2-13
*/
public class ExceptionList extends BaseDataObject
{
final static String INDENT = " ";
/** a data structure which is in responding to the <global-exceptions> child node in "exception.xml"*/
private GlobalExceptions m_objGlobalExceptions;
/** a data structure which is in responding to the <action-exceptions> child node in "exception.xml"*/
private ActionList m_objActionList;
/** a data structure which is in responding to the <exceptions> child node in "exception.xml"*/
private AllException m_objAllException;
/**
* Parse the given node by searching all its children repeatingly and parsing each of them respectively
* @param node the node which is going to be parsed
* @param lineTable
*/
public void parse(Node node, Hashtable lineTable) {
bindSourceLocation(node, lineTable);
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
parseChild(child, lineTable) ;
}
addComments(node);
}
/**
* Parse the child node got from the method above
* @param node the child node which is going to be parsed
* @param lineTable
*/
protected void parseChild(Node node, Hashtable lineTable) {
//Get the tag of the given node
String tag = node.getNodeName().toLowerCase();
//Identify whether the tag is "glabal-exceptions" and process it accordingly
if (tag.equals("global-exceptions"))
{
m_objGlobalExceptions = new GlobalExceptions();
m_objGlobalExceptions.setModel(getModel());
m_objGlobalExceptions.setParent(this);
m_objGlobalExceptions.setInTheModel(true);
//Parse the given node according to the method in GlobalExceptions
m_objGlobalExceptions.parse(node, lineTable);
}
//Identify whether the tag is "action-exceptions" and process it accordingly
if (tag.equals("action-exceptions"))
{
m_objActionList = new ActionList();
m_objActionList.setModel(getModel());
m_objActionList.setParent(this);
m_objActionList.setInTheModel(true);
//Parse the given node according to the method in ActionList
m_objActionList.parse(node, lineTable);
}
//Identify whether the tag is "exceptions" and process it accordingly
if (tag.equals("exceptions"))
{
m_objAllException = new AllException();
m_objAllException.setModel(getModel());
m_objAllException.setParent(this);
m_objAllException.setInTheModel(true);
//Parse the given node according to the method in AllException
m_objAllException.parse(node, lineTable);
}
}
/**
* Restore the Property
* @param name
* @param oldValue
* @param newValue
*/
public void restoreProperty(String name, Object oldValue, Object newValue)
throws CoreException {
super.restoreProperty(name, oldValue, newValue);
}
/**
* Write this node in "exception.xml"
* @param indent
* @param writer
*/
public void write(String indent, PrintWriter writer) {
writeComments(writer);
//write "<exception-list>" in "exception.xml"
writer.println(indent + "<exception-list>");
writeComments(writer);
String indent2 = indent + INDENT;
String indenta = indent + INDENT + INDENT;
//write the three child nodes of the present node
m_objGlobalExceptions.write(indenta,writer);
writer.println();
m_objActionList.write(indenta,writer);
writer.println();
m_objAllException.write(indenta,writer);
writer.println(indent + "</exception-list>");
}
/**
* Write the children nodes repeatingly
* @param indent
* @param children
* @param writer
*/
protected void writeChildren(
String indent,
Vector children,
PrintWriter writer) {
for (int i = 0; i < children.size(); i++) {
IWritable writable = (IWritable) children.get(i);
writable.write(indent, writer);
}
}
/**
* Get the three children of present node and return them in an array
*/
public Object[] getChild()
{
Object[] objArray = new Object[3];
objArray[0] = m_objGlobalExceptions;
objArray[1] = m_objActionList;
objArray[2] = m_objAllException;
return objArray;
}
/**
* Return the globalExceptions
*/
public GlobalExceptions getGlobalExcetpions()
{
return m_objGlobalExceptions;
}
/**
* Return the actionList
*/
public ActionList getActionExcetpions()
{
return m_objActionList;
}
/**
* Return the AllException
*/
public AllException getExcetpions()
{
return m_objAllException;
}
/**
* Return the ExceptionConfig which includes GolbalExceptions and ActionList
*/
public ExceptionConfig getExceptionConfig()
{
return new ExceptionConfig(m_objGlobalExceptions,m_objActionList);
}
/**
* Return
*/
public String toString()
{
return WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONLIST_NAME);
}
/**
* Update the ExceptionList by resetting its three children
*/
public void renew()
{
m_objGlobalExceptions = new GlobalExceptions();
m_objActionList = new ActionList();
m_objAllException = new AllException();
m_objGlobalExceptions.setParent(this);
m_objGlobalExceptions.setInTheModel(true);
m_objActionList.setParent(this);
m_objActionList.setInTheModel(true);
m_objAllException.setParent(this);
m_objAllException.setInTheModel(true);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?