Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
882d2101
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
882d2101
编写于
3月 09, 2018
作者:
A
Alexander Fedorov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3118 suggest launch configurations according to attach kind
上级
18f245d3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
72 addition
and
81 deletion
+72
-81
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/ui/DatabaseLaunchShortcut.java
...rc/org/jkiss/dbeaver/debug/ui/DatabaseLaunchShortcut.java
+36
-4
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/src/org/jkiss/dbeaver/ext/postgresql/debug/ui/internal/PgSqlBaseLaunchShortcut.java
...postgresql/debug/ui/internal/PgSqlBaseLaunchShortcut.java
+0
-75
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/src/org/jkiss/dbeaver/ext/postgresql/debug/ui/internal/PgSqlGlobalLaunchShortcut.java
...stgresql/debug/ui/internal/PgSqlGlobalLaunchShortcut.java
+18
-1
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/src/org/jkiss/dbeaver/ext/postgresql/debug/ui/internal/PgSqlLocalLaunchShortcut.java
...ostgresql/debug/ui/internal/PgSqlLocalLaunchShortcut.java
+18
-1
未找到文件。
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/ui/DatabaseLaunchShortcut.java
浏览文件 @
882d2101
...
...
@@ -22,6 +22,7 @@ package org.jkiss.dbeaver.debug.ui;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.runtime.Adapters
;
...
...
@@ -47,6 +48,7 @@ import org.eclipse.ui.IWorkbenchWindow;
import
org.eclipse.ui.PlatformUI
;
import
org.eclipse.ui.dialogs.ElementListSelectionDialog
;
import
org.eclipse.ui.model.WorkbenchLabelProvider
;
import
org.jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.core.DebugCore
;
import
org.jkiss.dbeaver.debug.internal.ui.DebugUIMessages
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
...
...
@@ -133,7 +135,8 @@ public abstract class DatabaseLaunchShortcut implements ILaunchShortcut2 {
}
protected
void
launch
(
DBSObject
launchable
,
String
mode
)
{
List
<
ILaunchConfiguration
>
configs
=
getCandidates
(
launchable
,
getConfigurationType
());
Map
<
String
,
Object
>
databaseContext
=
DebugCore
.
resolveDatabaseContext
(
launchable
);
List
<
ILaunchConfiguration
>
configs
=
getCandidates
(
launchable
,
getConfigurationType
(),
databaseContext
);
if
(
configs
!=
null
)
{
ILaunchConfiguration
config
=
null
;
int
count
=
configs
.
size
();
...
...
@@ -192,7 +195,7 @@ public abstract class DatabaseLaunchShortcut implements ILaunchShortcut2 {
return
(
DBSObject
)
dialog
.
getFirstResult
();
}
protected
List
<
ILaunchConfiguration
>
getCandidates
(
DBSObject
launchable
,
ILaunchConfigurationType
configType
)
{
protected
List
<
ILaunchConfiguration
>
getCandidates
(
DBSObject
launchable
,
ILaunchConfigurationType
configType
,
Map
<
String
,
Object
>
databaseContext
)
{
List
<
ILaunchConfiguration
>
candidateConfigs
=
Collections
.
emptyList
();
try
{
ILaunchManager
launchManager
=
DebugPlugin
.
getDefault
().
getLaunchManager
();
...
...
@@ -200,7 +203,7 @@ public abstract class DatabaseLaunchShortcut implements ILaunchShortcut2 {
candidateConfigs
=
new
ArrayList
<
ILaunchConfiguration
>(
configs
.
length
);
for
(
int
i
=
0
;
i
<
configs
.
length
;
i
++)
{
ILaunchConfiguration
config
=
configs
[
i
];
if
(
isCandidate
(
config
,
launchable
))
{
if
(
isCandidate
(
config
,
launchable
,
databaseContext
))
{
candidateConfigs
.
add
(
config
);
}
}
...
...
@@ -210,7 +213,36 @@ public abstract class DatabaseLaunchShortcut implements ILaunchShortcut2 {
return
candidateConfigs
;
}
protected
abstract
boolean
isCandidate
(
ILaunchConfiguration
config
,
DBSObject
launchable
);
protected
boolean
isCandidate
(
ILaunchConfiguration
config
,
DBSObject
launchable
,
Map
<
String
,
Object
>
databaseContext
)
{
if
(!
config
.
exists
())
{
return
false
;
}
String
datasource
=
DebugCore
.
extractDatasourceId
(
config
);
String
id
=
launchable
.
getDataSource
().
getContainer
().
getId
();
if
(!
datasource
.
equals
(
id
))
{
return
false
;
}
String
database
=
DebugCore
.
extractDatabaseName
(
config
);
String
databaseName
=
String
.
valueOf
(
databaseContext
.
get
(
DBGController
.
DATABASE_NAME
));
if
(!
database
.
equals
(
databaseName
))
{
return
false
;
}
String
schema
=
DebugCore
.
extractSchemaName
(
config
);
String
schemaName
=
String
.
valueOf
(
databaseContext
.
get
(
DBGController
.
SCHEMA_NAME
));
if
(!
schema
.
equals
(
schemaName
))
{
return
false
;
}
String
oid
=
DebugCore
.
extractProcedureOid
(
config
);
String
procedureOid
=
String
.
valueOf
(
databaseContext
.
get
(
DBGController
.
PROCEDURE_OID
));
if
(!
oid
.
equals
(
procedureOid
))
{
return
false
;
}
return
true
;
}
protected
ILaunchConfiguration
chooseConfiguration
(
List
<
ILaunchConfiguration
>
configList
,
String
mode
)
{
IDebugModelPresentation
labelProvider
=
DebugUITools
.
newDebugModelPresentation
();
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/src/org/jkiss/dbeaver/ext/postgresql/debug/ui/internal/PgSqlBaseLaunchShortcut.java
已删除
100644 → 0
浏览文件 @
18f245d3
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2018 Serge Rider (serge@jkiss.org)
* Copyright (C) 2017-2018 Alexander Fedorov (alexander.fedorov@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.postgresql.debug.ui.internal
;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.jkiss.dbeaver.debug.core.DebugCore
;
import
org.jkiss.dbeaver.debug.ui.DatabaseLaunchShortcut
;
import
org.jkiss.dbeaver.ext.postgresql.debug.core.PostgreSqlDebugCore
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedure
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
public
abstract
class
PgSqlBaseLaunchShortcut
extends
DatabaseLaunchShortcut
{
public
PgSqlBaseLaunchShortcut
()
{
super
(
PostgreSqlDebugCore
.
CONFIGURATION_TYPE
,
PostgreDebugUIMessages
.
PgSqlLaunchShortcut_name
);
}
@Override
protected
boolean
isCandidate
(
ILaunchConfiguration
config
,
DBSObject
launchable
)
{
if
(!
config
.
exists
())
{
return
false
;
}
boolean
isInstance
=
launchable
instanceof
PostgreProcedure
;
if
(!
isInstance
)
{
return
false
;
}
PostgreProcedure
procedure
=
(
PostgreProcedure
)
launchable
;
String
datasource
=
DebugCore
.
extractDatasourceId
(
config
);
String
id
=
launchable
.
getDataSource
().
getContainer
().
getId
();
if
(!
datasource
.
equals
(
id
))
{
return
false
;
}
String
database
=
DebugCore
.
extractDatabaseName
(
config
);
String
databaseName
=
procedure
.
getDatabase
().
getName
();
if
(!
database
.
equals
(
databaseName
))
{
return
false
;
}
String
schema
=
DebugCore
.
extractSchemaName
(
config
);
String
schemaName
=
procedure
.
getContainer
().
getName
();
if
(!
schema
.
equals
(
schemaName
))
{
return
false
;
}
try
{
String
oid
=
config
.
getAttribute
(
DebugCore
.
ATTR_PROCEDURE_OID
,
String
.
valueOf
(
0
));
long
objectId
=
procedure
.
getObjectId
();
if
(!(
Long
.
parseLong
(
oid
)
==
objectId
))
{
return
false
;
}
}
catch
(
Exception
e
)
{
// ignore
return
false
;
}
return
true
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/src/org/jkiss/dbeaver/ext/postgresql/debug/ui/internal/PgSqlGlobalLaunchShortcut.java
浏览文件 @
882d2101
...
...
@@ -17,15 +17,22 @@
*/
package
org.jkiss.dbeaver.ext.postgresql.debug.ui.internal
;
import
java.util.Map
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.eclipse.debug.core.ILaunchConfigurationWorkingCopy
;
import
org.jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.core.DebugCore
;
import
org.jkiss.dbeaver.debug.ui.DatabaseLaunchShortcut
;
import
org.jkiss.dbeaver.ext.postgresql.debug.core.PostgreSqlDebugCore
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
public
class
PgSqlGlobalLaunchShortcut
extends
PgSqlBaseLaunchShortcut
{
public
class
PgSqlGlobalLaunchShortcut
extends
DatabaseLaunchShortcut
{
public
PgSqlGlobalLaunchShortcut
()
{
super
(
PostgreSqlDebugCore
.
CONFIGURATION_TYPE
,
PostgreDebugUIMessages
.
PgSqlLaunchShortcut_name
);
}
@Override
protected
ILaunchConfiguration
createConfiguration
(
DBSObject
launchable
)
throws
CoreException
{
...
...
@@ -33,5 +40,15 @@ public class PgSqlGlobalLaunchShortcut extends PgSqlBaseLaunchShortcut {
workingCopy
.
setAttribute
(
DebugCore
.
ATTR_ATTACH_KIND
,
DBGController
.
ATTACH_KIND_GLOBAL
);
return
workingCopy
.
doSave
();
}
@Override
protected
boolean
isCandidate
(
ILaunchConfiguration
config
,
DBSObject
launchable
,
Map
<
String
,
Object
>
databaseContext
)
{
String
kind
=
DebugCore
.
extractAttachKind
(
config
);
if
(!
DBGController
.
ATTACH_KIND_GLOBAL
.
equals
(
kind
))
{
return
false
;
}
return
super
.
isCandidate
(
config
,
launchable
,
databaseContext
);
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/src/org/jkiss/dbeaver/ext/postgresql/debug/ui/internal/PgSqlLocalLaunchShortcut.java
浏览文件 @
882d2101
...
...
@@ -17,15 +17,22 @@
*/
package
org.jkiss.dbeaver.ext.postgresql.debug.ui.internal
;
import
java.util.Map
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.eclipse.debug.core.ILaunchConfigurationWorkingCopy
;
import
org.jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.core.DebugCore
;
import
org.jkiss.dbeaver.debug.ui.DatabaseLaunchShortcut
;
import
org.jkiss.dbeaver.ext.postgresql.debug.core.PostgreSqlDebugCore
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
public
class
PgSqlLocalLaunchShortcut
extends
PgSqlBaseLaunchShortcut
{
public
class
PgSqlLocalLaunchShortcut
extends
DatabaseLaunchShortcut
{
public
PgSqlLocalLaunchShortcut
()
{
super
(
PostgreSqlDebugCore
.
CONFIGURATION_TYPE
,
PostgreDebugUIMessages
.
PgSqlLaunchShortcut_name
);
}
@Override
protected
ILaunchConfiguration
createConfiguration
(
DBSObject
launchable
)
throws
CoreException
{
...
...
@@ -34,4 +41,14 @@ public class PgSqlLocalLaunchShortcut extends PgSqlBaseLaunchShortcut {
return
workingCopy
.
doSave
();
}
@Override
protected
boolean
isCandidate
(
ILaunchConfiguration
config
,
DBSObject
launchable
,
Map
<
String
,
Object
>
databaseContext
)
{
String
kind
=
DebugCore
.
extractAttachKind
(
config
);
if
(!
DBGController
.
ATTACH_KIND_LOCAL
.
equals
(
kind
))
{
return
false
;
}
return
super
.
isCandidate
(
config
,
launchable
,
databaseContext
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录