use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class DatabaseDashboardViewPart method init.
/**
* Initializes
*
* @param dbNode The DatabaseNode
*/
public void init(DatabaseNode dbNode) {
this.dbNode = dbNode;
HostNode hostNode = dbNode.getParent();
String partName = getPartName();
String suffix = " - " + dbNode.getDbName() + "@" + hostNode.getIp() + ":" + hostNode.getPort();
if (!partName.endsWith(suffix)) {
setPartName(partName + suffix);
}
ServerInfo serverInfo = hostNode.getServerInfo();
if (serverInfo != null) {
String hostAddress = serverInfo.getHostAddress();
int monPort = serverInfo.getHostMonPort();
historyFileName = HistoryComposite.DBDASHBOARD_HISTORY_FILE_PREFIX + dbNode.getDbName() + "@" + hostAddress + "_" + monPort + HistoryComposite.HISTORY_SUFFIX;
IPath histPath = CubridManagerCorePlugin.getDefault().getStateLocation();
historyPath = histPath.toOSString() + File.separator + historyFileName;
historyFileHelp = new HistoryFileHelp();
historyFileHelp.setHistoryPath(historyPath);
}
List<String> typeLst = new ArrayList<String>();
for (DbProcStatEnum dbProcEnum : DbProcStatEnum.values()) {
typeLst.add(dbProcEnum.getName());
}
for (StandbyServerStatEnum standbyEnum : StandbyServerStatEnum.values()) {
typeLst.add(standbyEnum.getName());
}
for (DbStatDumpEnum dbDumpEnum : DbStatDumpEnum.values()) {
typeLst.add(dbDumpEnum.getName());
}
typeNames = typeLst.toArray(new String[typeLst.size()]);
DataGeneratorPool pool = DataGeneratorPool.getInstance();
String generatorName = hostNode.getUserName() + "@" + hostNode.getIp() + ":" + hostNode.getPort();
generator = pool.getDataGenerator(generatorName, new DataProvider());
generator.addDataUpdateListener(this);
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class DbDashboardHistoryViewPart method init.
/**
* Initializes
*
* @param dbNode The DatabaseNode
*/
public void init(DatabaseNode dbNode) {
HostNode hostNode = dbNode.getParent();
String hostAddress = hostNode.getIp();
String hostPort = hostNode.getPort();
String partName = getPartName();
String suffix = " - " + dbNode.getDbName() + "@" + hostAddress + ":" + hostPort;
if (!partName.endsWith(suffix)) {
setPartName(partName + suffix);
}
historyFileName = HistoryComposite.DBDASHBOARD_HISTORY_FILE_PREFIX + dbNode.getDbName() + "@" + hostAddress + "_" + hostPort + HistoryComposite.HISTORY_SUFFIX;
IPath path = CubridManagerCorePlugin.getDefault().getStateLocation();
historyPath = path.toOSString() + File.separator + historyFileName;
historyFileHelp = new HistoryFileHelp();
historyFileHelp.setHistoryPath(historyPath);
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class BrokerMonitorPart method performRequest.
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#performRequest(org.eclipse.gef.Request)
* @param req Request
*/
public void performRequest(Request req) {
if (req.getType() == RequestConstants.REQ_OPEN) {
BrokerNode bn = (BrokerNode) getModel();
String brokerName = bn.getBrokerName();
HostNode hn = bn.getParent();
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
IWorkbenchPage page = window.getActivePage();
if (page == null) {
return;
}
String secondaryId = new StringBuffer(brokerName + "@" + hn.getUserName()).append("&").append(hn.getIp()).append("&").append(hn.getPort()).toString();
IViewReference viewReference = page.findViewReference(BrokerDashboardViewPart.ID, secondaryId);
if (viewReference == null) {
try {
IViewPart viewPart = page.showView(BrokerDashboardViewPart.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
((BrokerDashboardViewPart) viewPart).init((BrokerNode) getModel());
} catch (PartInitException ex) {
viewReference = null;
}
} else {
IViewPart viewPart = viewReference.getView(false);
window.getActivePage().bringToTop(viewPart);
((BrokerDashboardViewPart) viewPart).init((BrokerNode) getModel());
}
}
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class BrokerMonitorPart method createFigure.
/**
* get a database monitor figure.
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
* @return a database figure
*/
protected IFigure createFigure() {
BrokerMonitorFigure figure = new BrokerMonitorFigure();
BrokerNode broker = (BrokerNode) getModel();
setMode2View(figure, broker);
HostNode hostNode = broker.getParent();
figure.setHint(new StringBuffer(" ").append(broker.getBrokerName()).append("@").append(hostNode.getIp()).append(":").append(hostNode.getPort()).append(" ").toString());
return figure;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class DatabaseMonitorPart method performRequest.
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#performRequest(org.eclipse.gef.Request)
* @param req Request
*/
public void performRequest(Request req) {
if (req.getType() == RequestConstants.REQ_OPEN) {
DatabaseNode databaseNode = (DatabaseNode) getModel();
if (!databaseNode.isConnected()) {
return;
}
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
IWorkbenchPage page = window.getActivePage();
if (page == null) {
return;
}
HostNode hn = databaseNode.getParent();
String secondaryId = new StringBuffer(databaseNode.getDbName()).append("&").append(hn.getUserName()).append("&").append(hn.getIp()).append("&").append(hn.getPort()).toString();
IViewReference viewReference = page.findViewReference(DatabaseDashboardViewPart.ID, secondaryId);
if (viewReference == null) {
try {
IViewPart viewPart = page.showView(DatabaseDashboardViewPart.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
((DatabaseDashboardViewPart) viewPart).init(databaseNode);
} catch (PartInitException ex) {
viewReference = null;
}
} else {
IViewPart viewPart = viewReference.getView(false);
window.getActivePage().bringToTop(viewPart);
((DatabaseDashboardViewPart) viewPart).init(databaseNode);
}
}
}
Aggregations