use of com.cubrid.common.ui.cubrid.view.editor.ViewDashboardEditorPart in project cubrid-manager by CUBRID.
the class OpenTargetAction method openViewsDetailInfoEditor.
/**
* open view detail info part
* @param database
*/
public void openViewsDetailInfoEditor(CubridDatabase database) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == window) {
return;
}
if (database == null) {
return;
}
/*Check it open same editor*/
IEditorPart editorPart = getOpenedEditorPart(database, ViewDashboardEditorPart.ID);
if (editorPart == null) {
OpenViewsDetailInfoPartProgress progress = new OpenViewsDetailInfoPartProgress(database);
progress.loadViewsInfo();
if (progress.isSuccess()) {
ViewDashboardInput input = new ViewDashboardInput(database, progress.getViewList());
try {
window.getActivePage().openEditor(input, ViewDashboardEditorPart.ID);
} catch (PartInitException e) {
LOGGER.error("Can not initialize the view view list UI.", e);
}
}
} else {
ViewDashboardEditorPart viewsDetailInfoPart = (ViewDashboardEditorPart) editorPart;
window.getActivePage().activate(viewsDetailInfoPart);
viewsDetailInfoPart.refresh();
}
}
use of com.cubrid.common.ui.cubrid.view.editor.ViewDashboardEditorPart in project cubrid-manager by CUBRID.
the class OpenTargetAction method getOpenedEditorPart.
/**
* Get opened IEditorPart
* @param database CubridDatabase
* @param editorId String
* @return
*/
private IEditorPart getOpenedEditorPart(CubridDatabase database, String editorId) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return null;
}
IEditorReference[] editorReferences = window.getActivePage().getEditorReferences();
for (IEditorReference reference : editorReferences) {
if (reference.getId().equals(editorId)) {
IEditorPart editor = reference.getEditor(false);
if (editor != null) {
if (editor instanceof TriggerDashboardEditorPart) {
TriggerDashboardEditorPart triggerDetailInfoPart = (TriggerDashboardEditorPart) editor;
if (triggerDetailInfoPart.getDatabase().equals(database)) {
return editor;
}
} else if (editor instanceof SerialDashboardEditorPart) {
SerialDashboardEditorPart serialDetailInfoPart = (SerialDashboardEditorPart) editor;
if (serialDetailInfoPart.getDatabase().equals(database)) {
return editor;
}
} else if (editor instanceof ViewDashboardEditorPart) {
ViewDashboardEditorPart viewsDetailInfoPart = (ViewDashboardEditorPart) editor;
if (viewsDetailInfoPart.getDatabase().equals(database)) {
return editor;
}
} else if (editor instanceof UserDashboardEditorPart) {
UserDashboardEditorPart userDetailInfoPart = (UserDashboardEditorPart) editor;
if (userDetailInfoPart.getDatabase().equals(database)) {
return editor;
}
} else {
return editor;
}
}
}
}
return null;
}
Aggregations