Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
58c3c124
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,发现更多精彩内容 >>
提交
58c3c124
编写于
12月 27, 2019
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#7488 Save current workspace config
上级
86c3f6dd
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
48 addition
and
1 deletion
+48
-1
plugins/org.jkiss.dbeaver.core.application/src/org/jkiss/dbeaver/core/application/DBeaverApplication.java
...rg/jkiss/dbeaver/core/application/DBeaverApplication.java
+48
-1
未找到文件。
plugins/org.jkiss.dbeaver.core.application/src/org/jkiss/dbeaver/core/application/DBeaverApplication.java
浏览文件 @
58c3c124
...
...
@@ -30,6 +30,7 @@ import org.eclipse.ui.IWorkbench;
import
org.eclipse.ui.IWorkbenchPreferenceConstants
;
import
org.eclipse.ui.PlatformUI
;
import
org.eclipse.ui.internal.WorkbenchPlugin
;
import
org.eclipse.ui.internal.ide.ChooseWorkspaceData
;
import
org.eclipse.ui.internal.ide.ChooseWorkspaceDialog
;
import
org.eclipse.ui.internal.ide.application.DelayedEventsProcessor
;
import
org.jkiss.code.NotNull
;
...
...
@@ -156,6 +157,8 @@ public class DBeaverApplication extends BaseApplicationImpl {
instance
=
this
;
Location
instanceLoc
=
Platform
.
getInstanceLocation
();
boolean
ideWorkspaceSet
=
setIDEWorkspace
(
instanceLoc
);
CommandLine
commandLine
=
DBeaverCommandLine
.
getCommandLine
();
{
String
defaultHomePath
=
getDefaultInstanceLocation
();
...
...
@@ -171,7 +174,7 @@ public class DBeaverApplication extends BaseApplicationImpl {
if
(!
setDefaultWorkspacePath
(
instanceLoc
))
{
return
IApplication
.
EXIT_OK
;
}
}
else
if
(
instanceLoc
.
isLocked
())
{
}
else
if
(
instanceLoc
.
isLocked
()
&&
!
ideWorkspaceSet
)
{
// Check for locked workspace
if
(!
setDefaultWorkspacePath
(
instanceLoc
))
{
return
IApplication
.
EXIT_OK
;
...
...
@@ -265,6 +268,50 @@ public class DBeaverApplication extends BaseApplicationImpl {
}
}
private
boolean
setIDEWorkspace
(
Location
instanceLoc
)
{
if
(
instanceLoc
.
isSet
())
{
return
false
;
}
ChooseWorkspaceData
launchData
=
new
ChooseWorkspaceData
(
instanceLoc
.
getDefault
());
String
[]
recentWorkspaces
=
launchData
.
getRecentWorkspaces
();
if
(
recentWorkspaces
!=
null
&&
recentWorkspaces
.
length
>
1
&&
!
ArrayUtils
.
contains
(
recentWorkspaces
,
WORKSPACE_DIR_CURRENT
))
{
// Add default workspace in the recent list
boolean
added
=
false
;
for
(
int
i
=
0
;
i
<
recentWorkspaces
.
length
;
i
++)
{
if
(
recentWorkspaces
[
i
]
==
null
)
{
recentWorkspaces
[
i
]
=
WORKSPACE_DIR_CURRENT
;
added
=
true
;
break
;
}
}
if
(!
added
)
{
recentWorkspaces
[
recentWorkspaces
.
length
-
1
]
=
WORKSPACE_DIR_CURRENT
;
}
launchData
.
setRecentWorkspaces
(
recentWorkspaces
);
launchData
.
writePersistedData
();
}
if
(!
ArrayUtils
.
isEmpty
(
recentWorkspaces
))
{
String
lastWorkspace
=
recentWorkspaces
[
0
];
if
(!
CommonUtils
.
isEmpty
(
lastWorkspace
)
&&
!
WORKSPACE_DIR_CURRENT
.
equals
(
lastWorkspace
))
{
try
{
final
URL
selectedWorkspaceURL
=
new
URL
(
"file"
,
//$NON-NLS-1$
null
,
lastWorkspace
);
instanceLoc
.
set
(
selectedWorkspaceURL
,
true
);
return
true
;
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"Can't set IDE workspace to '"
+
lastWorkspace
+
"'"
);
e
.
printStackTrace
();
}
}
}
return
false
;
}
private
String
getDefaultInstanceLocation
()
{
String
defaultHomePath
=
WORKSPACE_DIR_CURRENT
;
Location
instanceLoc
=
Platform
.
getInstanceLocation
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录