提交 a0a67032 编写于 作者: A Alexander Fedorov

#2556 restore shortcut contribution

上级 341154e2
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 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.ui.editors.entity;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.edit.DBECommandContext;
import org.jkiss.dbeaver.model.navigator.DBNDataSource;
import org.jkiss.dbeaver.model.navigator.DBNDatabaseNode;
import org.jkiss.dbeaver.model.navigator.DBNNode;
import org.jkiss.dbeaver.model.struct.DBSFolder;
import org.jkiss.dbeaver.ui.editors.DatabaseEditorInput;
/**
* EntityEditorInput
*/
public class EntityEditorInput extends DatabaseEditorInput<DBNDatabaseNode>
{
public EntityEditorInput(@NotNull DBNDatabaseNode dbmNode)
{
super(dbmNode);
}
public EntityEditorInput(@NotNull DBNDatabaseNode dbnDatabaseNode, @Nullable DBECommandContext commandContext)
{
super(dbnDatabaseNode, commandContext);
}
@Override
public String getToolTipText()
{
StringBuilder toolTip = new StringBuilder();
for (DBNNode node = getNavigatorNode(); node != null; node = node.getParentNode()) {
if (node instanceof DBSFolder) {
continue;
}
toolTip.append(node.getNodeType());
toolTip.append(": ");
toolTip.append(node.getNodeName());
toolTip.append(" \n");
if (node instanceof DBNDataSource) {
break;
}
}
return toolTip.toString();
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 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.ui.editors.entity;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.edit.DBECommandContext;
import org.jkiss.dbeaver.model.navigator.DBNDataSource;
import org.jkiss.dbeaver.model.navigator.DBNDatabaseNode;
import org.jkiss.dbeaver.model.navigator.DBNNode;
import org.jkiss.dbeaver.model.struct.DBSFolder;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.ui.editors.DatabaseEditorInput;
/**
* EntityEditorInput
*/
public class EntityEditorInput extends DatabaseEditorInput<DBNDatabaseNode>
{
public EntityEditorInput(@NotNull DBNDatabaseNode dbmNode)
{
super(dbmNode);
}
public EntityEditorInput(@NotNull DBNDatabaseNode dbnDatabaseNode, @Nullable DBECommandContext commandContext)
{
super(dbnDatabaseNode, commandContext);
}
@Override
public <T> T getAdapter(Class<T> adapter) {
if (adapter == DBSObject.class) {
DBSObject databaseObject = getDatabaseObject();
return adapter.cast(databaseObject);
}
return super.getAdapter(adapter);
}
@Override
public String getToolTipText()
{
StringBuilder toolTip = new StringBuilder();
for (DBNNode node = getNavigatorNode(); node != null; node = node.getParentNode()) {
if (node instanceof DBSFolder) {
continue;
}
toolTip.append(node.getNodeType());
toolTip.append(": ");
toolTip.append(node.getNodeName());
toolTip.append(" \n");
if (node instanceof DBNDataSource) {
break;
}
}
return toolTip.toString();
}
}
\ No newline at end of file
......@@ -35,6 +35,13 @@
type="org.eclipse.debug.ui.actions.ILaunchable">
</adapter>
</factory>
<factory
adaptableType="org.jkiss.dbeaver.model.navigator.DBNDatabaseObject"
class="org.jkiss.dbeaver.debug.internal.ui.actions.DebugActionAdapterFactory">
<adapter
type="org.eclipse.debug.ui.actions.ILaunchable">
</adapter>
</factory>
</extension>
<extension
......
......@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.ext.postgresql.debug.internal;
import org.eclipse.osgi.util.NLS;
public class PostgreDebugCoreMessages extends NLS {
private static final String BUNDLE_NAME = "org.jkiss.dbeaver.ext.postgresql.debug.internal.core.PostgreDebugCoreMessages"; //$NON-NLS-1$
private static final String BUNDLE_NAME = "org.jkiss.dbeaver.ext.postgresql.debug.internal.PostgreDebugCoreMessages"; //$NON-NLS-1$
public static String PgSqlDebugController_connection_application_name;
public static String PgSqlDebugController_e_failed_session_close;
public static String PgSqlDebugController_e_failed_session_open;
......
......@@ -65,7 +65,10 @@
ifEmpty="false"
operator="and">
<adapt
type="org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedure">
type="org.jkiss.dbeaver.model.struct.DBSObject">
<instanceof
value="org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedure">
</instanceof>
</adapt>
</iterate>
</with>
......
......@@ -39,6 +39,15 @@ public class DBNDatabaseObject extends DBNDatabaseNode implements DBSObject
this.meta = meta;
registerNode();
}
@Override
public <T> T getAdapter(Class<T> adapter) {
if (adapter == DBSObject.class) {
DBSObject databaseObject = getObject();
return adapter.cast(databaseObject);
}
return super.getAdapter(adapter);
}
@Override
protected void dispose(boolean reflect)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册