Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
1e9eef71
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,发现更多精彩内容 >>
提交
1e9eef71
编写于
6月 23, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1652 ERD palette/tools
Former-commit-id:
2efa6b6d
上级
ad3aee11
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
174 addition
and
6 deletion
+174
-6
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/editor/ERDEditorPart.java
...d/src/org/jkiss/dbeaver/ext/erd/editor/ERDEditorPart.java
+42
-5
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/editor/tools/ActionToolEntry.java
...g/jkiss/dbeaver/ext/erd/editor/tools/ActionToolEntry.java
+55
-0
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/editor/tools/CommandToolEntry.java
.../jkiss/dbeaver/ext/erd/editor/tools/CommandToolEntry.java
+64
-0
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/ActionUtils.java
...kiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/ActionUtils.java
+13
-1
未找到文件。
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/editor/ERDEditorPart.java
浏览文件 @
1e9eef71
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-201
7
Serge Rider (serge@jkiss.org)
* Copyright (C) 2010-201
8
Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -162,6 +162,7 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
@Override
public
void
init
(
IEditorSite
site
,
IEditorInput
input
)
throws
PartInitException
{
rootPart
=
new
ScalableFreeformRootEditPart
();
editDomain
=
new
DefaultEditDomain
(
this
);
setEditDomain
(
editDomain
);
...
...
@@ -397,7 +398,6 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
// configure the viewer
viewer
.
getControl
().
setBackground
(
UIUtils
.
getColorRegistry
().
get
(
ERDConstants
.
COLOR_ERD_DIAGRAM_BACKGROUND
));
rootPart
=
new
ScalableFreeformRootEditPart
();
viewer
.
setRootEditPart
(
rootPart
);
viewer
.
setKeyHandler
(
new
GraphicalViewerKeyHandler
(
viewer
));
...
...
@@ -589,9 +589,6 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
// use selection tool as default entry
paletteRoot
.
setDefaultEntry
(
selectionTool
);
// the marquee selection tool
controls
.
add
(
new
MarqueeToolEntry
());
if
(!
isReadOnly
())
{
// separator
PaletteSeparator
separator
=
new
PaletteSeparator
(
"tools"
);
...
...
@@ -622,6 +619,46 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
}
}
/*
{
//PaletteDrawer controls = new PaletteDrawer("Diagram", ERDActivator.getImageDescriptor("icons/erd.png"));
PaletteToolbar controls = new PaletteToolbar("Diagram");
paletteRoot.add(controls);
controls.add(new ActionToolEntry(new ZoomInAction(rootPart.getZoomManager())));
controls.add(new ActionToolEntry(new ZoomOutAction(rootPart.getZoomManager())));
controls.add(new ActionToolEntry(new DiagramLayoutAction(ERDEditorPart.this)));
controls.add(new ActionToolEntry(new DiagramToggleGridAction()));
controls.add(new ActionToolEntry(new DiagramRefreshAction(ERDEditorPart.this)));
controls.add(new PaletteSeparator());
{
controls.add(new CommandToolEntry(
IWorkbenchCommandConstants.FILE_SAVE_AS,
ERDMessages.erd_editor_control_action_save_external_format,
UIIcon.PICTURE_SAVE));
controls.add(new CommandToolEntry(
IWorkbenchCommandConstants.FILE_PRINT,
ERDMessages.erd_editor_control_action_print_diagram,
UIIcon.PRINT));
}
{
Action configAction = new Action(ERDMessages.erd_editor_control_action_configuration) {
@Override
public void run()
{
UIUtils.showPreferencesFor(
getSite().getShell(),
ERDEditorPart.this,
ERDPreferencePage.PAGE_ID);
}
};
configAction.setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.CONFIGURATION));
controls.add(new ActionToolEntry(configAction));
}
}
*/
/*
PaletteDrawer drawer = new PaletteDrawer("New Component",
ERDActivator.getImageDescriptor("icons/connection.gif"));
...
...
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/editor/tools/ActionToolEntry.java
0 → 100644
浏览文件 @
1e9eef71
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2018 Serge Rider (serge@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.erd.editor.tools
;
import
org.eclipse.gef.Tool
;
import
org.eclipse.gef.palette.PaletteEntry
;
import
org.eclipse.gef.palette.ToolEntry
;
import
org.eclipse.gef.tools.AbstractTool
;
import
org.eclipse.gef.tools.SelectionTool
;
import
org.eclipse.jface.action.IAction
;
public
class
ActionToolEntry
extends
ToolEntry
{
private
final
IAction
action
;
public
ActionToolEntry
(
IAction
action
)
{
super
(
action
.
getText
().
replace
(
"&"
,
""
),
action
.
getDescription
(),
action
.
getImageDescriptor
(),
action
.
getImageDescriptor
());
this
.
action
=
action
;
this
.
setUserModificationPermission
(
PaletteEntry
.
PERMISSION_NO_MODIFICATION
);
}
public
Tool
createTool
()
{
return
new
ActionTool
();
}
public
class
ActionTool
extends
SelectionTool
{
@Override
protected
String
getCommandName
()
{
return
action
.
getId
();
}
@Override
public
void
activate
()
{
action
.
run
();
super
.
activate
();
}
}
}
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/editor/tools/CommandToolEntry.java
0 → 100644
浏览文件 @
1e9eef71
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2018 Serge Rider (serge@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.erd.editor.tools
;
import
org.eclipse.gef.Tool
;
import
org.eclipse.gef.palette.PaletteEntry
;
import
org.eclipse.gef.palette.ToolEntry
;
import
org.eclipse.gef.tools.AbstractTool
;
import
org.eclipse.gef.tools.SelectionTool
;
import
org.eclipse.ui.menus.CommandContributionItem
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.model.DBPImage
;
import
org.jkiss.dbeaver.ui.ActionUtils
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIUtils
;
public
class
CommandToolEntry
extends
ToolEntry
{
private
final
String
commandId
;
public
CommandToolEntry
(
String
commandId
,
String
label
,
DBPImage
image
)
{
super
(
label
,
ActionUtils
.
findCommandDescription
(
commandId
,
UIUtils
.
getActiveWorkbenchWindow
(),
false
),
DBeaverIcons
.
getImageDescriptor
(
image
),
null
);
this
.
commandId
=
commandId
;
this
.
setUserModificationPermission
(
PaletteEntry
.
PERMISSION_NO_MODIFICATION
);
}
public
Tool
createTool
()
{
return
new
ActionTool
();
}
public
class
ActionTool
extends
SelectionTool
{
@Override
protected
String
getCommandName
()
{
return
commandId
;
}
@Override
public
void
activate
()
{
ActionUtils
.
runCommand
(
commandId
,
UIUtils
.
getActiveWorkbenchWindow
());
super
.
activate
();
}
}
}
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/ActionUtils.java
浏览文件 @
1e9eef71
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-201
7
Serge Rider (serge@jkiss.org)
* Copyright (C) 2010-201
8
Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -31,7 +31,9 @@ import org.eclipse.jface.bindings.TriggerSequence;
import
org.eclipse.jface.resource.ImageDescriptor
;
import
org.eclipse.jface.viewers.ISelection
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.ui.*
;
import
org.eclipse.ui.commands.ICommandImageService
;
import
org.eclipse.ui.commands.ICommandService
;
import
org.eclipse.ui.handlers.IHandlerService
;
import
org.eclipse.ui.keys.IBindingService
;
...
...
@@ -165,6 +167,16 @@ public class ActionUtils
return
"???"
;
}
@Nullable
public
static
ImageDescriptor
findCommandImage
(
String
commandId
)
{
ICommandImageService
commandService
=
PlatformUI
.
getWorkbench
().
getService
(
ICommandImageService
.
class
);
if
(
commandService
!=
null
)
{
return
commandService
.
getImageDescriptor
(
commandId
);
}
return
null
;
}
@Nullable
public
static
String
findCommandDescription
(
String
commandId
,
IServiceLocator
serviceLocator
,
boolean
shortcutOnly
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录