use of com.cubrid.cubridmanager.ui.host.editor.HostDashboardEditor in project cubrid-manager by CUBRID.
the class HostDashboardAction method getOpenedEditorPart.
/**
* Get all opened query editor
*
* @return
*/
private HostDashboardEditor getOpenedEditorPart(String serverName) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return null;
}
IEditorReference[] editorReferences = window.getActivePage().getEditorReferences();
for (IEditorReference reference : editorReferences) {
if (reference.getId().equals(HostDashboardEditor.ID)) {
HostDashboardEditor editor = (HostDashboardEditor) reference.getEditor(false);
if (editor != null && editor.getServerInfo() != null && editor.getServerInfo().getServerName().equals(serverName)) {
return editor;
}
}
}
return null;
}
use of com.cubrid.cubridmanager.ui.host.editor.HostDashboardEditor in project cubrid-manager by CUBRID.
the class HostDashboardAction method doRun.
public void doRun(ServerInfo serverInfo) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == window) {
return;
}
// Check it open same editor
HostDashboardEditor editorPart = getOpenedEditorPart(serverInfo.getServerName());
if (editorPart == null) {
HostDashboardEditorInput editorInput = new HostDashboardEditorInput(serverInfo);
editorInput.setName(serverInfo.getServerName());
editorInput.setToolTipText(serverInfo.getServerName());
try {
editorPart = (HostDashboardEditor) window.getActivePage().openEditor(editorInput, HostDashboardEditor.ID);
} catch (PartInitException ex) {
LOGGER.error(ex.getMessage());
}
} else {
window.getActivePage().activate(editorPart);
editorPart.loadAllData();
}
}
use of com.cubrid.cubridmanager.ui.host.editor.HostDashboardEditor in project cubrid-manager by CUBRID.
the class HostDashboardAction method closeEditor.
public void closeEditor(ServerInfo serverInfo) {
HostDashboardEditor editor = getOpenedEditorPart(serverInfo.getServerName());
if (editor != null) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
window.getActivePage().closeEditor(editor, true);
}
}
Aggregations