use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.
the class QueryNewCustomAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
Object[] selected = getSelectedObj();
LoginQueryEditDialog dialog = new LoginQueryEditDialog(getShell());
if (selected != null && selected.length == 1 && selected[0] instanceof ISchemaNode) {
dialog.setSelServerName(((ISchemaNode) selected[0]).getServer().getServerName());
dialog.setSelDatabaseName(((ISchemaNode) selected[0]).getDatabase().getName());
} else if (selected != null && selected.length == 1 && selected[0] instanceof CubridServer) {
dialog.setSelServerName(((CubridServer) selected[0]).getName());
} else {
dialog.setSelServerName(DatabaseNavigatorMenu.SELF_DATABASE_SELECTED_LABEL);
}
if (dialog.open() == IDialogConstants.OK_ID) {
try {
IEditorInput input = new QueryUnit();
IEditorPart editor = window.getActivePage().openEditor(input, QueryEditorPart.ID);
((QueryEditorPart) editor).connect(DatabaseNavigatorMenu.SELF_DATABASE);
} catch (PartInitException e) {
LOGGER.error(e.getMessage());
}
}
}
use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.
the class OpenTargetAction method openTriggersDetailInfoEditor.
/**
* open trigger detail info part
* @param database
*/
public void openTriggersDetailInfoEditor(CubridDatabase database) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == window) {
return;
}
if (database == null) {
return;
}
/*Check it open same editor*/
IEditorPart editorPart = getOpenedEditorPart(database, TriggerDashboardEditorPart.ID);
if (editorPart == null) {
OpenTriggerDetailInfoPartProgress progress = new OpenTriggerDetailInfoPartProgress(database);
progress.loadTriggerInfoList();
if (progress.isSuccess()) {
TriggerDashboardInput input = new TriggerDashboardInput(database, progress.getTriggerList());
try {
window.getActivePage().openEditor(input, TriggerDashboardEditorPart.ID);
} catch (PartInitException e) {
LOGGER.error("Can not initialize the trigger view list UI.", e);
}
}
} else {
TriggerDashboardEditorPart triggerDetailInfoPart = (TriggerDashboardEditorPart) editorPart;
window.getActivePage().activate(triggerDetailInfoPart);
triggerDetailInfoPart.refresh();
}
}
use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.
the class OpenTargetAction method run.
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
final Object[] obj = this.getSelectedObj();
if (!isSupported(obj)) {
setEnabled(false);
return;
}
for (int i = 0; i < obj.length; i++) {
if (!NodeUtil.isCubridNode(obj[i])) {
continue;
}
ICubridNode node = (ICubridNode) obj[i];
if (NodeUtil.isTableViewNode(node)) {
DefaultSchemaNode table = (DefaultSchemaNode) obj[i];
showObjectInfo(table);
} else if (NodeUtil.isTableFolderNode(node)) {
CubridNavigatorView view = CubridNavigatorView.findNavigationView();
if (view == null) {
return;
}
//if not expand ,expand the node and wait until all children be added
TreeViewer treeViewer = view.getViewer();
if (!treeViewer.getExpandedState(node)) {
treeViewer.expandToLevel(node, 1);
while (node.getChildren().size() == 0) {
ThreadUtil.sleep(500);
}
}
showTableDashboard(NodeUtil.getCubridDatabase(node));
} else if (NodeUtil.isViewFolderNode(node)) {
CubridNavigatorView view = CubridNavigatorView.getNavigatorView("com.cubrid.cubridquery.connection.navigator");
if (view == null) {
view = CubridNavigatorView.getNavigatorView("com.cubrid.cubridmanager.host.navigator");
}
if (view == null) {
return;
}
//if not expand ,expand the node and wait until all children be added
TreeViewer treeViewer = view.getViewer();
if (!treeViewer.getExpandedState(node)) {
treeViewer.expandToLevel(node, 1);
while (node.getChildren().size() == 0) {
ThreadUtil.sleep(500);
}
}
openViewsDetailInfoEditor(NodeUtil.getCubridDatabase(node));
} else if (NodeUtil.isSerialFolderNode(node)) {
CubridNavigatorView view = CubridNavigatorView.findNavigationView();
if (view == null) {
return;
}
//if not expand ,expand the node and wait until all children be added
TreeViewer treeViewer = view.getViewer();
if (!treeViewer.getExpandedState(node)) {
treeViewer.expandToLevel(node, 1);
while (node.getChildren().size() == 0) {
ThreadUtil.sleep(500);
}
}
openSerialsDetailInfoEditor(NodeUtil.getCubridDatabase(node), null);
} else if (NodeUtil.isTriggerFolderNode(node)) {
CubridNavigatorView view = CubridNavigatorView.findNavigationView();
if (view == null) {
return;
}
//if not expand ,expand the node and wait until all children be added
TreeViewer treeViewer = view.getViewer();
if (!treeViewer.getExpandedState(node)) {
treeViewer.expandToLevel(node, 1);
while (node.getChildren().size() == 0) {
ThreadUtil.sleep(500);
}
}
openTriggersDetailInfoEditor(NodeUtil.getCubridDatabase(node));
} else if (NodeUtil.isUserFolderNode(node)) {
CubridNavigatorView view = CubridNavigatorView.findNavigationView();
if (view == null) {
return;
}
//if not expand ,expand the node and wait until all children be added
TreeViewer treeViewer = view.getViewer();
if (!treeViewer.getExpandedState(node)) {
treeViewer.expandToLevel(node, 1);
while (node.getChildren().size() == 0) {
ThreadUtil.sleep(500);
}
}
openUsersDetailInfoEditor(NodeUtil.getCubridDatabase(node));
}
}
}
use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.
the class AboutAction method run.
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
new AboutDialog(window.getShell(), productName, versionId, aboutImageDescriptor).open();
}
use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.
the class BrokerLogTopMergeAction method run.
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
new BrokerLogTopMergeDialog(window.getShell()).open();
}
Aggregations