use of org.jkiss.dbeaver.ui.editors.entity.EntityEditor in project dbeaver by serge-rider.
the class PackageNavigateHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final OracleProcedurePackaged procedure = getSelectedProcedure(event);
if (procedure != null) {
OraclePackage procPackage = procedure.getParentObject();
IEditorPart entityEditor = NavigatorHandlerObjectOpen.openEntityEditor(procPackage);
if (entityEditor instanceof EntityEditor) {
((EntityEditor) entityEditor).switchFolder("source.definition");
SQLEditorBase sqlEditor = entityEditor.getAdapter(SQLEditorBase.class);
if (sqlEditor != null) {
new NavigateJob(procedure, sqlEditor).schedule();
}
}
}
return null;
}
use of org.jkiss.dbeaver.ui.editors.entity.EntityEditor in project dbeaver by dbeaver.
the class SQLEditorNested method refreshPart.
@Override
public void refreshPart(Object source, boolean force) {
// Check if we are in saving process
// If so then no refresh needed (source text was updated during save)
IEditorSite editorSite = getEditorSite();
if (editorSite instanceof MultiPageEditorSite && ((MultiPageEditorSite) editorSite).getMultiPageEditor() instanceof EntityEditor && ((EntityEditor) ((MultiPageEditorSite) editorSite).getMultiPageEditor()).isSaveInProgress()) {
return;
}
final IDocumentProvider documentProvider = getDocumentProvider();
if (documentProvider instanceof SQLEditorNested.ObjectDocumentProvider) {
((SQLEditorNested.ObjectDocumentProvider) documentProvider).sourceText = null;
}
if (force) {
try {
super.init(editorSite, getEditorInput());
// setFocus();
} catch (PartInitException e) {
log.error(e);
}
}
reloadSyntaxRules();
}
use of org.jkiss.dbeaver.ui.editors.entity.EntityEditor in project dbeaver by dbeaver.
the class ItemListControl method fillCustomActions.
@Override
protected void fillCustomActions(IContributionManager contributionManager) {
super.fillCustomActions(contributionManager);
final DBNNode rootNode = getRootNode();
if (rootNode instanceof DBNDatabaseFolder && ((DBNDatabaseFolder) rootNode).getItemsMeta() != null) {
contributionManager.add(new Action(CoreMessages.obj_editor_properties_control_action_filter_setting, DBeaverIcons.getImageDescriptor(UIIcon.FILTER)) {
@Override
public void run() {
NavigatorHandlerFilterConfig.configureFilters(getShell(), rootNode);
}
});
}
addColumnConfigAction(contributionManager);
IWorkbenchSite workbenchSite = getWorkbenchSite();
if (workbenchSite != null) {
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, IWorkbenchCommandConstants.FILE_REFRESH));
}
if (rootNode instanceof DBNDatabaseNode) {
contributionManager.add(new Separator());
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, CoreCommands.CMD_OBJECT_OPEN));
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, CoreCommands.CMD_OBJECT_CREATE));
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, CoreCommands.CMD_OBJECT_DELETE));
}
if (rootNode instanceof DBNDatabaseNode && rootNode.isPersisted()) {
boolean hasReorder = false;
List<Class<?>> childrenTypes = ((DBNDatabaseNode) rootNode).getChildrenTypes(null);
for (Class<?> chilType : childrenTypes) {
if (EntityEditorsRegistry.getInstance().getObjectManager(chilType, DBEObjectReorderer.class) != null) {
hasReorder = true;
break;
}
}
if (hasReorder) {
contributionManager.add(new Separator());
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, CoreCommands.CMD_OBJECT_MOVE_UP));
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, CoreCommands.CMD_OBJECT_MOVE_DOWN));
}
}
if (workbenchSite instanceof MultiPageEditorSite) {
final MultiPageEditorPart editor = ((MultiPageEditorSite) workbenchSite).getMultiPageEditor();
if (editor instanceof EntityEditor) {
contributionManager.add(new Separator());
DatabaseEditorUtils.contributeStandardEditorActions(workbenchSite, contributionManager);
}
}
}
use of org.jkiss.dbeaver.ui.editors.entity.EntityEditor in project dbeaver by serge-rider.
the class WorkbenchContextListener method activatePartContexts.
void activatePartContexts(IWorkbenchPart part) {
IContextService contextService = PlatformUI.getWorkbench().getService(IContextService.class);
if (contextService == null) {
return;
}
try {
contextService.deferUpdates(true);
if (part instanceof INavigatorModelView) {
// We check for instanceof (do not use adapter) because otherwise it become active
// for all entity editor and clashes with SQL editor and other complex stuff.
// if (activationNavigator != null) {
// //log.debug("Double activation of navigator context");
// contextService.deactivateContext(activationNavigator);
// }
// activationNavigator = contextService.activateContext(INavigatorModelView.NAVIGATOR_CONTEXT_ID);
}
if (part instanceof SQLEditorBase || part.getAdapter(SQLEditorBase.class) != null) {
if (activationSQL != null) {
// log.debug("Double activation of SQL context");
contextService.deactivateContext(activationSQL);
}
activationSQL = contextService.activateContext(SQLEditorContributions.SQL_EDITOR_CONTEXT);
}
if (part.getAdapter(ResultSetViewer.class) != null || (part instanceof SQLEditor) || (part instanceof EntityEditor && ((EntityEditor) part).getDatabaseObject() instanceof DBSDataContainer)) {
if (activationResults != null) {
contextService.deactivateContext(activationResults);
}
activationResults = contextService.activateContext(RESULTS_CONTEXT_ID);
}
// Refresh auto-commit element state (#3315)
// Refresh OpenSeparateConnection
ActionUtils.fireCommandRefresh(ConnectionCommands.CMD_TOGGLE_AUTOCOMMIT, SQLEditorCommands.CMD_TOGGLE_SEPARATE_CONNECTION);
} finally {
contextService.deferUpdates(false);
}
}
use of org.jkiss.dbeaver.ui.editors.entity.EntityEditor in project dbeaver by serge-rider.
the class PackageNavigateHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final OracleProcedurePackaged procedure = getSelectedProcedure(event);
if (procedure != null) {
OraclePackage procPackage = procedure.getParentObject();
IEditorPart entityEditor = NavigatorHandlerObjectOpen.openEntityEditor(procPackage);
if (entityEditor instanceof EntityEditor) {
((EntityEditor) entityEditor).switchFolder("source.definition");
SQLEditorBase sqlEditor = entityEditor.getAdapter(SQLEditorBase.class);
if (sqlEditor != null) {
new NavigateJob(procedure, sqlEditor).schedule();
}
}
}
return null;
}
Aggregations