use of com.cubrid.common.ui.cubrid.serial.editor.SerialDashboardEditorPart in project cubrid-manager by CUBRID.
the class OpenTargetAction method openSerialsDetailInfoEditor.
/**
* open serial detail info part
* @param database
*/
public void openSerialsDetailInfoEditor(CubridDatabase database, String serialName) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == window) {
return;
}
if (database == null) {
return;
}
/*Check it open same editor*/
IEditorPart editorPart = getOpenedEditorPart(database, SerialDashboardEditorPart.ID);
if (editorPart == null) {
OpenSerialDetailInfoPartProgress progress = new OpenSerialDetailInfoPartProgress(database);
progress.loadSerialInfoList();
if (progress.isSuccess()) {
SerialDashboardInput input = new SerialDashboardInput(database, progress.getSerialList());
try {
SerialDashboardEditorPart serialDetailInfoPart = null;
serialDetailInfoPart = (SerialDashboardEditorPart) window.getActivePage().openEditor(input, SerialDashboardEditorPart.ID);
serialDetailInfoPart.select(serialName);
} catch (PartInitException e) {
LOGGER.error("Can not initialize the serial view list UI.", e);
}
}
} else {
SerialDashboardEditorPart serialDetailInfoPart = (SerialDashboardEditorPart) editorPart;
window.getActivePage().activate(serialDetailInfoPart);
serialDetailInfoPart.refresh();
serialDetailInfoPart.select(serialName);
}
}
use of com.cubrid.common.ui.cubrid.serial.editor.SerialDashboardEditorPart 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