提交 4895e63c 编写于 作者: R RiedNyko

Added_option_to_open_selected_part#4978 fix1

上级 bc9b436e
......@@ -41,27 +41,26 @@ import java.util.Map;
*/
public class SQLSourceViewer<T extends DBPScriptObject & DBSObject> extends SQLEditorNested<T> {
private IAction OPEN_CONSOLE_ACTION = new Action("Open in SQL console", DBeaverIcons.getImageDescriptor(UIIcon.SQL_CONSOLE)) {
@Override
public void run()
{
String sqlText = getDocument().get();
ISelection selection = getSelectionProvider().getSelection();
if (selection instanceof TextSelection) {
sqlText = ((TextSelection) selection).getText();
if (sqlText.isEmpty()) {
sqlText = getDocument().get();
}
}
final DBPDataSource dataSource = getDataSource();
OpenHandler.openSQLConsole(
UIUtils.getActiveWorkbenchWindow(),
dataSource == null ? null : dataSource.getContainer(),
"Source",
sqlText
);
}
};
private IAction OPEN_CONSOLE_ACTION = new Action("Open in SQL console",
DBeaverIcons.getImageDescriptor(UIIcon.SQL_CONSOLE)) {
@Override
public void run() {
String sqlText = getDocument().get();
ISelection selection = getSelectionProvider().getSelection();
if (selection instanceof TextSelection) {
if (((TextSelection) selection).getLength() > 0) {
sqlText = ((TextSelection) selection).getText();
}
}
final DBPDataSource dataSource = getDataSource();
OpenHandler.openSQLConsole(
UIUtils.getActiveWorkbenchWindow(),
dataSource == null ? null : dataSource.getContainer(),
"Source",
sqlText
);
}
};
@Override
protected String getSourceText(DBRProgressMonitor monitor) throws DBException
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册