exceptioninfo.java
来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 224 行
JAVA
224 行
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/exception/data/ExceptionInfo.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.io.PrintWriter;
import java.util.Hashtable;
import java.util.Vector;
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.WebpumpIDEPlugin;
/**
* Class for defining the data structure of the child node <exception> whose parent is <exceptions> in "exception.xml".
*
* @author zhao_f
* @version 2.0.0 2004-2-13
*/
public class ExceptionInfo extends BaseObject{
final static String INDENT = " ";
/** the object which stores the value of the "name" attribute*/
private String m_strName;
/** the object which stores the value of the "key" attribute*/
private String m_strKey;
/** the object which stores the value of the "type" attribute*/
private String m_strType;
/** the object which stores the value of the "scope" attribute*/
private String m_strScope;
/** the object which stores the value of the "handler" attribute*/
private String m_strHandler;
/** the object which stores the value of the "path" attribute*/
private String m_strPath;
/**
* Parse the given node by getting all its attributes and storing them
* @param node the node which is going to be parsed
* @param lineTable
*/
public void parse(Node node, Hashtable lineTable) {
bindSourceLocation(node, lineTable);
m_strName = getNodeAttribute(node, "name");
m_strKey = getNodeAttribute(node, "key");
m_strType = getNodeAttribute(node, "type");
m_strScope = getNodeAttribute(node, "scope");
m_strHandler = getNodeAttribute(node, "handler");
m_strPath = getNodeAttribute(node, "path");
addComments(node);
}
/**
* 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" first
writer.println(indent + "<exception ");
String indent2 = indent + INDENT;
String indenta = indent + INDENT + INDENT + INDENT + INDENT;
//Write each of the node's attribute
writeIfDefined(indenta, writer, "name", WebpumpIDEPlugin.filterXML(m_strName));
writer.println();
writeIfDefined(indenta, writer, "key", WebpumpIDEPlugin.filterXML(m_strKey));
writer.println();
writeIfDefined(indenta, writer, "type", WebpumpIDEPlugin.filterXML(m_strType));
writer.println();
writeIfDefined(indenta, writer, "scope", WebpumpIDEPlugin.filterXML(m_strScope));
writer.println();
writeIfDefined(indenta, writer, "handler", WebpumpIDEPlugin.filterXML(m_strHandler));
writer.println();
writeIfDefined(indenta, writer, "path", WebpumpIDEPlugin.filterXML(m_strPath));
//Write "/>" finally
writer.println("/>");
}
/**
* Write all children nodes of the present node
* @param indent
* @param children
* @param writer
*/
protected void writeChildren(
String indent,
Vector children,
PrintWriter writer) {
//Search all the children nodes of the present node and write each of them using their own write method
for (int i = 0; i < children.size(); i++) {
IWritable writable = (IWritable) children.get(i);
writable.write(indent, writer);
}
}
/**
* Return the name of this node
*/
public String toString() {
//String a = m_strType;
return m_strName == null ? "" : m_strName;
}
public String getTranslatableLabel() {
if (m_strType == null)
return "";
return getModel().getResourceString(m_strType);
}
/**
* Get the node's attribute
* @param node the node who own some attributes
* @param name the name of the attribute
*/
public String getNodeAttribute(Node node, String name) {
//Get the attribute of the given name in the form of node
Node attribute = node.getAttributes().getNamedItem(name);
//Get the value of the attribute
if (attribute != null)
return attribute.getNodeValue();
return null;
}
/**
* Contrl the format of the Document
* @param source the document which will be formatted
*/
protected String getNormalizedText(String source) {
String result = source.replace('\t', ' ');
result = result.trim();
return result;
}
/**
* Return all the attributes in the form of String group
*/
public String[] getParamsInfo()
{
String[] strReturn = new String[6];
strReturn[0] = m_strName;
strReturn[1] = m_strKey;
strReturn[2] = m_strType;
strReturn[3] = m_strScope;
strReturn[4] = m_strHandler;
strReturn[5] = m_strPath;
return strReturn;
}
/**
* Set the value of each attribute using the a String group
* @param strParamInfo the String group which is used to set the value of the attributes
*/
public void setParamsInfo(String[] strParamInfo)
{
m_strName = strParamInfo[0];
m_strKey = strParamInfo[1];
m_strType = strParamInfo[2];
m_strScope = strParamInfo[3];
m_strHandler = strParamInfo[4];
m_strPath = strParamInfo[5];
}
/**
* Set the value of each attribute using a String group and fire structure changed
* @param strParamInfo the String group which is used to set the value of the attributes
*/
public void setParamsInfo1(String[] strParamInfo)
{
m_strName = strParamInfo[0];
m_strKey = strParamInfo[1];
m_strType = strParamInfo[2];
m_strScope = strParamInfo[3];
m_strHandler = strParamInfo[4];
m_strPath = strParamInfo[5];
fireStructureChanged(this, ModelChangedEvent.CHANGE);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?