use of com.cubrid.common.ui.query.editor.QueryUnit in project cubrid-manager by CUBRID.
the class OpenTargetAction method showObjectInfo.
public void showObjectInfo(DefaultSchemaNode table) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
try {
QueryEditorPart queryEditPart = null;
IEditorPart editorPart = window.getActivePage().getActiveEditor();
if (editorPart != null && editorPart instanceof QueryEditorPart) {
QueryEditorPart activeQueryEditorPart = (QueryEditorPart) editorPart;
if (table.getDatabase().equals(activeQueryEditorPart.getSelectedDatabase())) {
queryEditPart = activeQueryEditorPart;
}
}
if (queryEditPart != null) {
queryEditPart.getCombinedQueryComposite().createObjInfoFolder(table);
window.getActivePage().activate(queryEditPart);
} else {
QueryUnit input = new QueryUnit();
input.setDatabase(table.getDatabase());
queryEditPart = (QueryEditorPart) window.getActivePage().openEditor(input, QueryEditorPart.ID);
queryEditPart.connect(table.getDatabase());
queryEditPart.getCombinedQueryComposite().createObjInfoFolder(table);
}
} catch (PartInitException e) {
LOGGER.error("Can not initialize the query editor UI.", e);
}
}
use of com.cubrid.common.ui.query.editor.QueryUnit in project cubrid-manager by CUBRID.
the class RestoreQueryEditorAction method run.
public void run() {
ApplicationPersistUtil util = ApplicationPersistUtil.getInstance();
List<ArrayList<RestorableQueryEditorInfo>> restoreList = util.getEditorStatusListAtLastSession();
if (restoreList == null || restoreList.size() == 0) {
CommonUITool.openInformationBox(Messages.errNoRestoreQueryEditor);
return;
}
if (!CommonUITool.openConfirmBox(Messages.restoreQueryEditorConfirm)) {
return;
}
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
CommonUITool.openErrorBox(Messages.restoreQueryEditorRestoreFailed);
return;
}
for (List<RestorableQueryEditorInfo> editorStatusList : ApplicationPersistUtil.getInstance().getEditorStatusListAtLastSession()) {
QueryUnit input = new QueryUnit();
try {
QueryEditorPart editor = (QueryEditorPart) window.getActivePage().openEditor(input, QueryEditorPart.ID);
if (editor == null) {
continue;
}
for (int i = 0; i < editorStatusList.size(); i++) {
RestorableQueryEditorInfo editorStatus = editorStatusList.get(i);
if (editorStatus == null) {
continue;
}
String sql = CheckQueryEditorTask.getQuery(editorStatus);
CombinedQueryEditorComposite combinedQueryComposite = null;
if (i == 0) {
combinedQueryComposite = editor.getCombinedQueryComposite();
} else {
combinedQueryComposite = editor.addEditorTab();
}
if (combinedQueryComposite != null) {
combinedQueryComposite.getSqlEditorComp().setQueries(sql);
}
}
editor.setCombinedQueryEditortabFolderSelecton(0);
} catch (PartInitException e) {
e.printStackTrace();
}
}
ApplicationPersistUtil.getInstance().clearRestorableQueryEditors();
StatusLineContrItem statusCont = LayoutManager.getInstance().getStatusLineContrItem();
statusCont.changeStuatusLineForNavigator(null);
CommonUITool.openInformationBox(Messages.restoreQueryEditorTitle, Messages.restoreQueryEditorRestoreSuccess);
}
Aggregations