Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
d0363435
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,发现更多精彩内容 >>
提交
d0363435
编写于
6月 23, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Images model refactoring
上级
2db5512c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
27 deletion
+16
-27
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBIcon.java
...kiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBIcon.java
+0
-5
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBIconCustom.java
...beaver.core/src/org/jkiss/dbeaver/model/DBIconCustom.java
+0
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBPImage.java
...ss.dbeaver.core/src/org/jkiss/dbeaver/model/DBPImage.java
+0
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/DBeaverIcons.java
...s.dbeaver.core/src/org/jkiss/dbeaver/ui/DBeaverIcons.java
+14
-12
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/TrayIconHandler.java
...beaver.core/src/org/jkiss/dbeaver/ui/TrayIconHandler.java
+2
-1
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBIcon.java
浏览文件 @
d0363435
...
...
@@ -281,10 +281,5 @@ public class DBIcon implements DBPImage
return
path
;
}
@Override
public
File
getFile
()
throws
IOException
{
return
RuntimeUtils
.
getPlatformFile
(
path
);
}
static
final
String
ICON_LOCATION_PREFIX
=
"platform:/plugin/org.jkiss.dbeaver.core/icons/"
;
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBIconCustom.java
浏览文件 @
d0363435
...
...
@@ -18,9 +18,6 @@
package
org.jkiss.dbeaver.model
;
import
java.io.File
;
import
java.io.IOException
;
/**
* Image with overlays
*/
...
...
@@ -64,8 +61,4 @@ public class DBIconCustom implements DBPImage
return
main
.
getLocation
();
}
@Override
public
File
getFile
()
throws
IOException
{
return
main
.
getFile
();
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBPImage.java
浏览文件 @
d0363435
...
...
@@ -30,6 +30,4 @@ public interface DBPImage
String
getLocation
();
File
getFile
()
throws
IOException
;
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/DBeaverIcons.java
浏览文件 @
d0363435
...
...
@@ -23,7 +23,9 @@ import org.eclipse.swt.graphics.Image;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.model.DBPImage
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
java.io.File
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.net.URL
;
...
...
@@ -51,7 +53,8 @@ public class DBeaverIcons
}
}
private
static
Map
<
String
,
IconDescriptor
>
iconMap
=
new
HashMap
<
String
,
IconDescriptor
>();
private
static
Map
<
String
,
DBPImage
>
iconMap
=
new
HashMap
<
String
,
DBPImage
>();
private
static
Map
<
String
,
IconDescriptor
>
imageMap
=
new
HashMap
<
String
,
IconDescriptor
>();
static
{
for
(
Field
field
:
DBIcon
.
class
.
getDeclaredFields
())
{
...
...
@@ -60,21 +63,20 @@ public class DBeaverIcons
}
try
{
DBIcon
icon
=
(
DBIcon
)
field
.
get
(
null
);
ImageDescriptor
imageDescriptor
=
ImageDescriptor
.
createFromURL
(
new
URL
(
icon
.
getLocation
()));
IconDescriptor
iconDescriptor
=
new
IconDescriptor
(
icon
.
getLocation
(),
imageDescriptor
);
if
(
iconDescriptor
.
image
==
null
)
{
File
file
=
RuntimeUtils
.
getPlatformFile
(
icon
.
getLocation
());
if
(!
file
.
exists
())
{
log
.
warn
(
"Bad image '"
+
icon
.
getToken
()
+
"' location: "
+
icon
.
getLocation
());
continue
;
}
iconMap
.
put
(
icon
.
getToken
(),
icon
Descriptor
);
iconMap
.
put
(
icon
.
getToken
(),
icon
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
);
}
}
}
public
static
Collection
<
String
>
getPredefinedImages
()
{
return
new
ArrayList
<
String
>(
iconMap
.
keySet
());
public
static
Collection
<
DBPImage
>
getPredefinedImages
()
{
return
new
ArrayList
<
DBPImage
>(
iconMap
.
values
());
}
public
static
Image
getImage
(
DBPImage
image
)
...
...
@@ -91,15 +93,15 @@ public class DBeaverIcons
public
static
Image
getImageById
(
String
token
)
{
IconDescriptor
iconDescriptor
=
iconMap
.
get
(
token
);
if
(
i
conDescriptor
==
null
)
{
DBPImage
image
=
iconMap
.
get
(
token
);
if
(
i
mage
==
null
)
{
return
null
;
}
return
iconDescriptor
.
image
;
return
getImage
(
image
)
;
}
private
static
IconDescriptor
getIconByLocation
(
String
location
)
{
IconDescriptor
icon
=
i
con
Map
.
get
(
location
);
IconDescriptor
icon
=
i
mage
Map
.
get
(
location
);
if
(
icon
==
null
)
{
try
{
ImageDescriptor
imageDescriptor
=
ImageDescriptor
.
createFromURL
(
new
URL
(
location
));
...
...
@@ -108,7 +110,7 @@ public class DBeaverIcons
log
.
warn
(
"Bad image: "
+
location
);
return
null
;
}
else
{
i
con
Map
.
put
(
location
,
icon
);
i
mage
Map
.
put
(
location
,
icon
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/TrayIconHandler.java
浏览文件 @
d0363435
...
...
@@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IStatus;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
...
...
@@ -48,7 +49,7 @@ public class TrayIconHandler {
File
logoFile
;
try
{
logoFile
=
DBIcon
.
DBEAVER_LOGO
.
getFile
(
);
logoFile
=
RuntimeUtils
.
getPlatformFile
(
DBIcon
.
DBEAVER_LOGO
.
getLocation
()
);
}
catch
(
IOException
e
)
{
log
.
error
(
e
);
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录