📄 codegenconfigmanager.java
字号:
package org.jawin.browser.codegen;
import java.util.ArrayList;
import org.jawin.browser.config.ConfigManager;
/**
* A bucket to manage the currently available code generation
* configurations loaded.
*
* <p>Title: Jawin Code Generation GUI</p>
* <p>Description: GUI for exploring type libraries and generating Java code</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: Open Source Incentive</p>
*
* @author Josh Passenger
* @version 1.0
*/
public class CodeGenConfigManager
{
private static CodeGenConfigManager instance = null;
private ArrayList codeGenConfig = new ArrayList();
/**
* Empty private constructor
*/
private CodeGenConfigManager()
{
}
/**
* Initialize the manager, loading and storing the configuration
*/
public static synchronized void initialize()
{
instance = new CodeGenConfigManager();
instance.loadConfiguration();
}
/**
* Fetch the shared CodeGenConfigManager singleton instance
*
* @return the singleton CodeGenConfigManager instance
*/
public static CodeGenConfigManager getInstance()
{
if (instance == null)
{
throw new IllegalStateException("CodeGenConfigManager.getInstance() CodeGenConfigManager was not initialized");
}
return instance;
}
/**
* Fetch the configuration at the requested index
*
* @param index the index to fetch
* @return the CodeGenConfig at the requested index
*/
public CodeGenConfig getConfigAt(int index)
{
return (CodeGenConfig) codeGenConfig.get(index);
}
/**
* Fetch the number of laoded configuration items
*
* @return the number of active configurations
*/
public int getConfigCount()
{
return codeGenConfig.size();
}
/**
* Adds a new configuration to the collection
*
* @param newConfig the configuration item to store
*/
public void addCodeGenConfig(CodeGenConfig newConfig)
{
codeGenConfig.add(newConfig);
}
/**
* Clears the currently loaded configuration
*/
public void clearConfig()
{
codeGenConfig.clear();
}
/**
* Loads the configuration from disk
*/
private void loadConfiguration()
{
String codeGenConfigFile = ConfigManager.getInstance().getString("codegen.config", "config/codegen.xml");
CodeGenConfigParser parser = new CodeGenConfigParser();
parser.parseCodeGenConfig(codeGenConfigFile);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -