use of org.jkiss.dbeaver.ui.editors.sql.SQLEditorBase in project dbeaver by dbeaver.
the class SQLEditorHandlerExpandCollapseAllFoldings method execute.
@Override
public Object execute(ExecutionEvent event) {
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
if (activeEditor == null) {
return null;
}
SQLEditorBase sqlEditor = activeEditor.getAdapter(SQLEditorBase.class);
if (sqlEditor == null || !sqlEditor.isFoldingEnabled()) {
return null;
}
ProjectionAnnotationModel model = sqlEditor.getAnnotationModel();
if (model == null) {
return null;
}
IDocument document = sqlEditor.getDocument();
if (document == null) {
return null;
}
int length = sqlEditor.getDocument().getLength();
String commandId = event.getCommand().getId();
if (EXPAND_COMMAND_ID.equals(commandId)) {
model.expandAll(0, length);
} else if (COLLAPSE_COMMAND_ID.equals(commandId)) {
model.collapseAll(0, length);
}
return null;
}
use of org.jkiss.dbeaver.ui.editors.sql.SQLEditorBase in project dbeaver by dbeaver.
the class SQLEditorHandlerNavigateObject method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
if (activeEditor != null) {
SQLEditorBase sqlEditor = DBUtils.getAdapter(SQLEditorBase.class, activeEditor);
if (sqlEditor != null) {
IHyperlink hyperlink = getCurrentHyperlink(sqlEditor);
if (hyperlink != null) {
IRegion selRegion2 = hyperlink.getHyperlinkRegion();
TextViewer textViewer = sqlEditor.getTextViewer();
if (textViewer != null) {
textViewer.setSelectedRange(selRegion2.getOffset(), selRegion2.getLength());
}
hyperlink.open();
}
}
}
return null;
}
use of org.jkiss.dbeaver.ui.editors.sql.SQLEditorBase in project dbeaver by dbeaver.
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