📄 eclassloader.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: EClassLoader.java * Written by: Dmitry Nadezhin, Sun Microsystems. * * Copyright (c) 2008 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.tool.sandbox;import com.sun.electric.database.geometry.EGraphics;import com.sun.electric.database.geometry.Poly;import com.sun.electric.technology.ArcProto;import com.sun.electric.technology.DRCTemplate;import com.sun.electric.technology.Layer;import com.sun.electric.technology.PrimitiveNode;import java.awt.geom.Point2D;import java.io.IOException;import java.io.InputStream;import java.lang.reflect.Constructor;import java.lang.reflect.Field;import java.lang.reflect.Method;import java.net.URL;import java.net.URLClassLoader;import java.util.HashMap;import java.util.List;/** * A ClassLoader which loads "electric.jar" (possibly with old Electric version) and finds there * some important classes, consructors, fields and methods. */class EClassLoader extends URLClassLoader { protected final Class<?> classMain = loadElectricClass("Main"); protected final Class<?> classMainUserInterfaceDummy= loadElectricClass("Main$UserInterfaceDummy"); protected final Class<?> classUndo = loadElectricClass("database.change.Undo"); protected final Class<?> classEGraphics = loadElectricClass("database.geometry.EGraphics"); protected final Class<?> classEGraphicsOutline = loadElectricClass("database.geometry.EGraphics$Outline"); protected final Class<?> classPoly = loadElectricClass("database.geometry.Poly"); protected final Class<?> classPolyType = loadElectricClass("database.geometry.Poly$Type"); protected final Class<?> classCell = loadElectricClass("database.hierarchy.Cell"); protected final Class<?> classCellVersionGroup = loadElectricClass("database.hierarchy.Cell$VersionGroup"); protected final Class<?> classEDatabase = loadElectricClass("database.hierarchy.EDatabase"); protected final Class<?> classLibrary = loadElectricClass("database.hierarchy.Library"); protected final Class<?> classNodeProto = loadElectricClass("database.prototype.NodeProto"); protected final Class<?> classPref = loadElectricClass("database.text.Pref"); protected final Class<?> classSetting = loadElectricClass("database.text.Setting"); protected final Class<?> classVersion = loadElectricClass("database.text.Version"); protected final Class<?> classNodeInst = loadElectricClass("database.topology.NodeInst"); protected final Class<?> classAbstractTextDescriptor= loadElectricClass("database.variable.AbstractTextDescriptor"); protected final Class<?> classElectricObject = loadElectricClass("database.variable.ElectricObject"); protected final Class<?> classEditWindow0 = loadElectricClass("database.variable.EditWindow0"); protected final Class<?> classEditWindow_ = loadElectricClass("database.variable.EditWindow_"); protected final Class<?> classTextDescriptor = loadElectricClass("database.variable.TextDescriptor"); protected final Class<?> classTextDescriptorSize = loadElectricClass("database.variable.TextDescriptor$Size", "database.variable.AbstractTextDescriptor$Size"); protected final Class<?> classUserInterface = loadElectricClass("database.variable.UserInterface"); protected final Class<?> classVarContext = loadElectricClass("database.variable.VarContext"); protected final Class<?> classVariable = loadElectricClass("database.variable.Variable"); protected final Class<?> classArcProto = loadElectricClass("technology.ArcProto", "database.prototype.ArcProto"); protected final Class<?> classArcProtoFunction = loadElectricClass("technology.ArcProto$Function", "database.prototype.ArcProto$Function"); protected final Class<?> classDRCTemplate = loadElectricClass("technology.DRCTemplate"); protected final Class<?> classDRCTemplateDRCMode = loadElectricClass("technology.DRCTemplate$DRCMode"); protected final Class<?> classDRCTemplateDRCRuleType= loadElectricClass("technology.DRCTemplate$DRCRuleType"); protected final Class<?> classEdgeH = loadElectricClass("technology.EdgeH"); protected final Class<?> classEdgeV = loadElectricClass("technology.EdgeV"); protected final Class<?> classFoundry = loadElectricClass("technology.Foundry"); protected final Class<?> classLayer = loadElectricClass("technology.Layer"); protected final Class<?> classLayerFunction = loadElectricClass("technology.Layer$Function"); protected final Class<?> classLayerFunctionSet = loadElectricClass("technology.Layer$Function$Set"); protected final Class<?> classPrimitiveArc = loadElectricClass("technology.PrimitiveArc"); protected final Class<?> classPrimitiveNode = loadElectricClass("technology.PrimitiveNode"); protected final Class<?> classPrimitiveNodeFunction = loadElectricClass("technology.PrimitiveNode$Function", "database.prototype.NodeProto$Function"); protected final Class<?> classPrimitiveNodeNodeSizeRule = loadElectricClass("technology.PrimitiveNode$NodeSizeRule"); protected final Class<?> classPrimitivePort = loadElectricClass("technology.PrimitivePort"); protected final Class<?> classTechnology = loadElectricClass("technology.Technology"); protected final Class<?> classTechnologyArcLayer = loadElectricClass("technology.Technology$ArcLayer"); protected final Class<?> classTechnologyNodeLayer = loadElectricClass("technology.Technology$NodeLayer"); protected final Class<?> classTechnologyTechPoint = loadElectricClass("technology.Technology$TechPoint"); protected final Class<?> classSizeOffset = loadElectricClass("technology.SizeOffset"); protected final Class<?> classAbstractUserInterface = loadElectricClass("tool.AbstractUserInterface"); protected final Class<?> classJob = loadElectricClass("tool.Job"); protected final Class<?> classJobMode = loadElectricClass("tool.Job$Mode"); protected final Class<?> classTool = loadElectricClass("tool.Tool"); protected final Class<?> classERC = loadElectricClass("tool.erc.ERC"); protected final Class<?> classUser = loadElectricClass("tool.user.User"); protected final Class<?> classEditWindow = loadElectricClass("tool.user.ui.EditWindow"); protected final Field Main_NOTHREADING = getField(classMain, "NOTHREADING"); protected final Field Cell_versionGroup = getDeclaredField(classCell, "versionGroup"); protected final Field Pref_allPrefs = getDeclaredField(classPref, "allPrefs"); protected final Field Pref_prefs = getDeclaredField(classPref, "prefs"); protected final Field Setting_prefs = getDeclaredField(classSetting, "prefs"); protected final Field ArcProto_layers = getDeclaredField(classPrimitiveArc != null ? classPrimitiveArc : classArcProto, "layers"); protected final Field DRCTemplate_ruleName = getField(classDRCTemplate, "ruleName"); protected final Field DRCTemplate_when = getField(classDRCTemplate, "when"); protected final Field DRCTemplate_ruleType = getField(classDRCTemplate, "ruleType"); protected final Field DRCTemplate_name1 = getField(classDRCTemplate, "name1"); protected final Field DRCTemplate_name2 = getField(classDRCTemplate, "name2"); protected final Field DRCTemplate_value1 = getField(classDRCTemplate, "value1"); protected final Field DRCTemplate_value2 = getField(classDRCTemplate, "value2"); protected final Field DRCTemplate_values = getField(classDRCTemplate, "values"); protected final Field DRCTemplate_maxWidth = getField(classDRCTemplate, "maxWidth"); protected final Field DRCTemplate_minLength = getField(classDRCTemplate, "minLength"); protected final Field DRCTemplate_nodeName = getField(classDRCTemplate, "nodeName"); protected final Field DRCTemplate_multiCuts = getField(classDRCTemplate, "multiCuts"); protected final Field PrimitiveNode_LOWVTBIT = getField(classPrimitiveNode, "LOWVTBIT"); protected final Field PrimitiveNode_HIGHVTBIT = getField(classPrimitiveNode, "HIGHVTBIT"); protected final Field PrimitiveNode_NATIVEBIT = getField(classPrimitiveNode, "NATIVEBIT"); protected final Field PrimitiveNode_OD18BIT = getField(classPrimitiveNode, "OD18BIT"); protected final Field PrimitiveNode_OD25BIT = getField(classPrimitiveNode, "OD25BIT"); protected final Field PrimitiveNode_OD33BIT = getField(classPrimitiveNode, "OD33BIT"); protected final Field Job_NOTHREADING = getField(classJob, "NOTHREADING"); protected final Field JobMode_SERVER = getField(classJobMode, "SERVER"); protected final Field JobMode_BATCH = getField(classJobMode, "BATCH"); protected final Field JobMode_CLIENT = getField(classJobMode, "CLIENT"); protected final Field ERC_tool = getDeclaredField(classERC, "tool"); protected final Constructor MainUserInterfaceDummy_constructor = getDeclaredConstructor(classMainUserInterfaceDummy); protected final Constructor CellVersionGroup_constructor = getDeclaredConstructor(classCellVersionGroup); protected final Method Undo_changesQuiet = getMethod(classUndo, "changesQuiet", Boolean.TYPE); protected final Method EGraphics_getColor = getMethod(classEGraphics, "getColor"); protected final Method EGraphics_getForeground = getMethod(classEGraphics, "getForeground"); protected final Method EGraphics_getOpacity = getMethod(classEGraphics, "getOpacity"); protected final Method EGraphics_getOutlined = getMethod(classEGraphics, "getOutlined"); protected final Method EGraphics_getPattern = getMethod(classEGraphics, "getPattern"); protected final Method EGraphics_getTransparentLayer = getMethod(classEGraphics, "getTransparentLayer"); protected final Method EGraphics_isOutlinedOnDisplay = getMethod(classEGraphics, "isOutlinedOnDisplay"); protected final Method EGraphics_isOutlinedOnPrinter = getMethod(classEGraphics, "isOutlinedOnPrinter"); protected final Method EGraphics_isPatternedOnDisplay = getMethod(classEGraphics, "isPatternedOnDisplay"); protected final Method EGraphics_isPatternedOnPrinter = getMethod(classEGraphics, "isPatternedOnPrinter"); protected final Method Poly_getPoints = getMethod(classPoly, "getPoints"); protected final Method Poly_getStyle = getMethod(classPoly, "getStyle"); protected final Method Cell_lowLevelAllocate = getDeclaredMethod(classCell, "lowLevelAllocate", classLibrary); protected final Method Cell_lowLevelLink = getDeclaredMethod(classCell, "lowLevelLink"); protected final Method Cell_lowLevelPopulate = getDeclaredMethod(classCell, "lowLevelPopulate", String.class); protected final Method Cell_newInstance = getMethod(classCell, "newInstance", classLibrary, String.class); protected final Method CellVersionGroup_add = getDeclaredMethod(classCellVersionGroup, "add", classCell); protected final Method EDatabase_lock = getMethod(classEDatabase, "lock", Boolean.TYPE); protected final Method EDatabase_lowLevelBeginChanges = getMethod(classEDatabase, "lowLevelBeginChanging", classTool); protected final Method EDatabase_lowLevelSetCanChanging = getMethod(classEDatabase, "lowLevelSetCanChanging", classTool); protected final Method EDatabase_serverDatabase = getMethod(classEDatabase, "serverDatabase"); protected final Method Library_getLibraries = getMethod(classLibrary, "getLibraries"); protected final Method Library_getName = getMethod(classLibrary, "getName"); protected final Method Library_newInstance = getMethod(classLibrary, "newInstance", String.class, URL.class); protected final Method Pref_getFactoryValue = getMethod(classPref, "getFactoryValue"); protected final Method Pref_getMeaning = getMethod(classPref, "getMeaning"); protected final Method Pref_getPrefName = getMethod(classPref, "getPrefName"); protected final Method Setting_getFactoryValue = getMethod(classSetting, "getFactoryValue"); protected final Method Setting_getPrefName = getMethod(classSetting, "getPrefName"); protected final Method Setting_getSettings = getMethod(classSetting, "getSettings"); protected final Method Setting_getXmlPath = getMethod(classSetting, "getXmlPath"); protected final Method Version_getVersion = getMethod(classVersion, "getVersion"); protected final Method NodeInst_getAngle = getMethod(classNodeInst, "getAngle"); protected final Method NodeInst_getFunction = getMethod(classNodeInst, "getFunction");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -