use of com.cubrid.cubridmanager.core.common.xml.IXMLMemento in project cubrid-manager by CUBRID.
the class ApplicationPersistUtil method loadSQLTabItem.
/**
* loadSQLTabItem if has sql_tabItem node ,is new version old version not
* have this node
*
* @param element
* @return
*/
private ArrayList<RestorableQueryEditorInfo> loadSQLTabItem(IXMLMemento element) {
IXMLMemento[] sql_tabItemArray = element.getChildren("sql_tabItem");
ArrayList<RestorableQueryEditorInfo> sql_tabItemList = new ArrayList<RestorableQueryEditorInfo>();
if (sql_tabItemArray != null && sql_tabItemArray.length > 0) {
for (int i = 0; sql_tabItemArray != null && i < sql_tabItemArray.length; i++) {
IXMLMemento child = sql_tabItemArray[i];
sql_tabItemList.add(loadRestorableQueryEditorInfo(child));
}
} else {
if (element.getString("database") != null) {
sql_tabItemList.add(loadRestorableQueryEditorInfo(element));
}
}
return sql_tabItemList;
}
use of com.cubrid.cubridmanager.core.common.xml.IXMLMemento in project cubrid-manager by CUBRID.
the class CubridJdbcManager method loadCubridJdbc.
/**
* Load CUBRID JDBC driver from plugin preference and register these class
* loaders
*
* @param silence if true, the chaning event will not be triggered.
*
* @return all CUBRID Jdbc driver
*/
private void loadCubridJdbc(boolean silence) {
synchronized (CubridJdbcManager.class) {
IXMLMemento memento = PersistUtils.getXMLMemento(CommonUIPlugin.PLUGIN_ID, CUBRID_JDBC_SETTING);
if (memento == null) {
loadDefaultJdbcs();
} else {
IXMLMemento[] children = memento.getChildren("cubridJdbcSetting");
if (children == null || children.length == 0) {
loadDefaultJdbcs();
} else {
for (int i = 0; i < children.length; i++) {
String jdbcURL = children[i].getString("jdbcURL");
registerClassLoader(externalVersion2FileMap, jdbcURL);
}
}
}
}
}
use of com.cubrid.cubridmanager.core.common.xml.IXMLMemento in project cubrid-manager by CUBRID.
the class FavoriteQueryPersistUtil method loadBatchRunList.
public void loadBatchRunList() {
IXMLMemento memento = PersistUtils.getXMLMemento(BatchRunComposite.ID, LIST_ID);
if (memento == null) {
return;
}
try {
listData.clear();
for (IXMLMemento xmlMemento : memento.getChildren("BatchRun")) {
Map<String, String> data = new HashMap<String, String>();
data.put("0", "");
data.put("1", xmlMemento.getString("filename"));
data.put("2", xmlMemento.getString("memo"));
data.put("3", xmlMemento.getString("regdate"));
data.put("4", xmlMemento.getString("directory"));
data.put("5", xmlMemento.getString("charset"));
data.put("6", xmlMemento.getString("managed"));
listData.add(data);
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.cubrid.cubridmanager.core.common.xml.IXMLMemento in project cubrid-manager by CUBRID.
the class RecentlyUsedSQLDetailPersistUtils method saveToXML.
/**
* save the sql to preference
*
* @param id
* @param recentlyUsedSQLContentList
*/
private static void saveToXML(String id, LinkedList<SQLHistoryDetail> sqlHistories) {
if (sqlHistories == null) {
return;
}
XMLMemento memento = XMLMemento.createWriteRoot("SQLHistoryDetails");
for (int i = 0, len = sqlHistories.size(); i < len; i++) {
IXMLMemento subNodes = memento.createChild("SQLHistoryDetail");
SQLHistoryDetail historyDetail = (SQLHistoryDetail) sqlHistories.get(i);
subNodes.putString("SQL", historyDetail.getSql());
subNodes.putString("elapseTime", historyDetail.getElapseTime());
subNodes.putString("executeTime", historyDetail.getExecuteTime());
subNodes.putString("LOG", historyDetail.getExecuteInfo());
}
PersistUtils.saveXMLMemento(RecentlyUsedSQLComposite.ID, id, memento);
}
use of com.cubrid.cubridmanager.core.common.xml.IXMLMemento in project cubrid-manager by CUBRID.
the class BrokerTblColumnSetHelp method loadSetting.
/**
*
* Load broker interval settings from plugin preference
*
* @param <T> the generic type which is the sub type of IColumnSetting
* @param statusColumn the instance of StatusColumn enumeration
* @param ts the instance of generic array
*/
public <T extends IColumnSetting> void loadSetting(StatusColumn statusColumn, T[] ts) {
synchronized (this) {
IEclipsePreferences preference = new InstanceScope().getNode(CubridManagerUIPlugin.PLUGIN_ID);
String xmlString = preference.get(statusColumn.name(), "");
if (xmlString != null && xmlString.length() > 0) {
try {
ByteArrayInputStream in = new ByteArrayInputStream(xmlString.getBytes("UTF-8"));
IXMLMemento memento = XMLMemento.loadMemento(in);
IXMLMemento[] children = memento.getChildren(statusColumn.name());
for (IXMLMemento child : children) {
for (T t : ts) {
t.setValue(child.getInteger(t.getNick()));
}
}
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
}
}
}
Aggregations