提交 22cd42d3 编写于 作者: S serge-rider

Debug core - launch config and shortcut

上级 bee6d449
/*
* 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.debug;
import org.jkiss.dbeaver.model.DBPObject;
/**
* Object which can be debugged
*/
public interface DBGDebugObject extends DBPObject {
}
......@@ -24,3 +24,8 @@ command.ToggleBreakpoint.label = Toggle Breakpoint
launchConfigurationTabGroup.description = Settings of database debug launch
launchConfigurationTabGroup.launchMode.description=Create a configuration to debug database code
launchGroups.launchGroup.label = Database Debug
launchGroups.launchGroup.title = Select or configure database object debugger
launchShortcuts.shortcut.label=Database Debug
launchShortcuts.shortcut.description=Database object debugger
......@@ -39,6 +39,41 @@
</launchConfigurationTabGroup>
</extension>
<extension point="org.eclipse.debug.ui.launchGroups">
<launchGroup
bannerImage="platform:/plugin/org.jkiss.dbeaver.core/$nl$/icons/database.png"
id="org.jkiss.dbeaver.debug.launchGroup"
image="platform:/plugin/org.jkiss.dbeaver.core/$nl$/icons/database.png"
label="%launchGroups.launchGroup.label"
mode="debug"
title="%launchGroups.launchGroup.title">
</launchGroup>
</extension>
<extension point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
id="org.jkiss.dbeaver.debug.ui.shortcut"
label="%launchShortcuts.shortcut.label"
description="%launchShortcuts.shortcut.description"
class="org.jkiss.dbeaver.debug.ui.internal.DatabaseDebugLaunchShortcut"
icon="platform:/plugin/org.jkiss.dbeaver.core/$nl$/icons/database.png"
modes="debug">
<configurationType id="org.jkiss.dbeaver.debug.ui.configuration"/>
<contextualLaunch>
<contextLabel label="%launchShortcuts.shortcut.label" mode="debug">
</contextLabel>
<enablement>
<with variable="selection">
<count value="1"/>
<iterate ifEmpty="false" operator="and">
<adapt type="org.jkiss.dbeaver.debug.DBGDebugObject"/>
</iterate>
</with>
</enablement>
</contextualLaunch>
</shortcut>
</extension>
<extension point="org.eclipse.core.runtime.adapters">
<factory adaptableType="org.jkiss.dbeaver.ui.editors.entity.EntityEditor"
class="org.jkiss.dbeaver.debug.ui.actions.DebugActionAdapterFactory">
......@@ -86,6 +121,7 @@
style="push"/>
</menuContribution>
</extension>
<extension point="org.eclipse.ui.commands">
<category description="Debug Procedure commands" id="org.jkiss.dbeaver.debug.ui.commands.category.procedure"
name="Debug Procedure"/>
......
......@@ -33,17 +33,14 @@ import org.eclipse.swt.widgets.*;
import org.eclipse.ui.PlatformUI;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.debug.DBGConstants;
import org.jkiss.dbeaver.debug.internal.DebugConfigurationPanelDescriptor;
import org.jkiss.dbeaver.debug.internal.DebugConfigurationPanelRegistry;
import org.jkiss.dbeaver.debug.internal.ui.DebugUIMessages;
import org.jkiss.dbeaver.debug.ui.internal.DebugConfigurationPanelDescriptor;
import org.jkiss.dbeaver.debug.ui.internal.DebugConfigurationPanelRegistry;
import org.jkiss.dbeaver.debug.ui.internal.DebugUIMessages;
import org.jkiss.dbeaver.model.DBIcon;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.DBPImage;
import org.jkiss.dbeaver.model.runtime.DBRRunnableContext;
import org.jkiss.dbeaver.registry.DataSourceDescriptor;
import org.jkiss.dbeaver.registry.DataSourceProviderRegistry;
import org.jkiss.dbeaver.registry.DataSourceRegistry;
import org.jkiss.dbeaver.registry.driver.DriverDescriptor;
import org.jkiss.dbeaver.runtime.RunnableContextDelegate;
import org.jkiss.dbeaver.runtime.ui.DBUserInterface;
import org.jkiss.dbeaver.ui.DBeaverIcons;
......
......@@ -44,7 +44,7 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.jkiss.dbeaver.debug.internal.ui.DebugUIInternals;
import org.jkiss.dbeaver.debug.ui.internal.DebugUIInternals;
import org.jkiss.dbeaver.model.struct.DBSObject;
public class DatabaseLaunchContributionItem extends ContributionItem {
......
......@@ -43,7 +43,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.debug.DBGConstants;
import org.jkiss.dbeaver.debug.core.DebugCore;
import org.jkiss.dbeaver.debug.internal.ui.DebugUIMessages;
import org.jkiss.dbeaver.debug.ui.internal.DebugUIMessages;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.runtime.ui.DBUserInterface;
import org.jkiss.utils.CommonUtils;
......@@ -237,11 +237,7 @@ public abstract class DatabaseLaunchShortcut implements ILaunchShortcut2 {
try {
String dsId = config.getAttribute(DBGConstants.ATTR_DATASOURCE_ID, (String) null);
if (!CommonUtils.equalObjects(dsId, launchable.getDataSource().getContainer().getId())) {
return false;
}
return true;
return CommonUtils.equalObjects(dsId, launchable.getDataSource().getContainer().getId());
} catch (CoreException e) {
return false;
}
......
......@@ -28,7 +28,7 @@ import org.eclipse.debug.ui.IDetailPane;
import org.eclipse.debug.ui.IDetailPaneFactory;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.jkiss.dbeaver.debug.DBGConstants;
import org.jkiss.dbeaver.debug.internal.ui.DebugUIMessages;
import org.jkiss.dbeaver.debug.ui.internal.DebugUIMessages;
public class DatabaseDetailPaneFactory implements IDetailPaneFactory {
......
......@@ -19,7 +19,7 @@
package org.jkiss.dbeaver.debug.ui.details;
import org.eclipse.swt.widgets.Composite;
import org.jkiss.dbeaver.debug.internal.ui.DebugUIMessages;
import org.jkiss.dbeaver.debug.ui.internal.DebugUIMessages;
import org.jkiss.dbeaver.debug.ui.DebugUI;
public class DatabaseStandardBreakpointPane extends DatabaseDebugDetailPane<DatabaseBreakpointEditor> {
......
/*
* 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.debug.ui.internal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.*;
import org.jkiss.dbeaver.debug.ui.DatabaseLaunchShortcut;
import org.jkiss.dbeaver.model.struct.DBSObject;
import java.util.Map;
public class DatabaseDebugLaunchShortcut extends DatabaseLaunchShortcut {
private static final String CONFIG_TYPE = "org.jkiss.dbeaver.debug.launchConfiguration";
public DatabaseDebugLaunchShortcut() {
super(CONFIG_TYPE, "Database Debug");
}
@Override
protected ILaunchConfiguration createConfiguration(DBSObject launchable) throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(CONFIG_TYPE);
ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, "Database debug configuration");
return workingCopy;
}
@Override
protected boolean isCandidate(ILaunchConfiguration config, DBSObject launchable, Map<String, Object> databaseContext) {
return super.isCandidate(config, launchable, databaseContext);
}
}
......@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.debug.internal;
package org.jkiss.dbeaver.debug.ui.internal;
import org.eclipse.core.runtime.IConfigurationElement;
import org.jkiss.code.NotNull;
......
......@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.debug.internal;
package org.jkiss.dbeaver.debug.ui.internal;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
......
......@@ -16,7 +16,7 @@
* limitations under the License.
*/
package org.jkiss.dbeaver.debug.internal.ui;
package org.jkiss.dbeaver.debug.ui.internal;
import java.util.ArrayList;
import java.util.Arrays;
......
......@@ -16,13 +16,13 @@
* limitations under the License.
*/
package org.jkiss.dbeaver.debug.internal.ui;
package org.jkiss.dbeaver.debug.ui.internal;
import org.eclipse.osgi.util.NLS;
public class DebugUIMessages extends NLS {
private static final String BUNDLE_NAME = "org.jkiss.dbeaver.debug.internal.ui.DebugUIMessages"; //$NON-NLS-1$
private static final String BUNDLE_NAME = "org.jkiss.dbeaver.debug.ui.internal.DebugUIMessages"; //$NON-NLS-1$
public static String DatabaseStandardBreakpointPane_description;
public static String DatabaseStandardBreakpointPane_name;
......
......@@ -19,15 +19,6 @@
Bundle-Vendor = JKISS
Bundle-Name = DBeaver PostgreSQL Debug UI
launchShortcuts.shortcut.pgSQL.global.label=PL/pgSQL (Global)
launchShortcuts.shortcut.pgSQL.global.description=PL/pgSQL global debug for PostgreSQL procedures
launchShortcuts.shortcut.pgSQL.local.label=PL/pgSQL (Local)
launchShortcuts.shortcut.pgSQL.local.description=PL/pgSQL local debug for PostgreSQL procedures
launchGroups.launchGroup.pgSQL.label = PL/pgSQL Debug
launchGroups.launchGroup.pgSQL.title = Select or configure PL/pgSQL procedure to debug
actions.ManageBreakpointRulerAction.label = Toggle &Breakpoint
actionSets.actionSet.pgSQL.label=PL/pgSQL Debug
......
......@@ -33,6 +33,7 @@
</panel>
</extension>
<!--
<extension point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
category="org.jkiss.dbeaver.ext.postgresql.debug.ui.pgSQL"
......@@ -82,7 +83,9 @@
</contextualLaunch>
</shortcut>
</extension>
-->
<!--
<extension point="org.eclipse.debug.ui.launchGroups">
<launchGroup
bannerImage="platform:/plugin/org.jkiss.dbeaver.ext.postgresql/$nl$/icons/postgresql_icon.png"
......@@ -94,6 +97,7 @@
title="%launchGroups.launchGroup.pgSQL.title">
</launchGroup>
</extension>
-->
<extension point="org.eclipse.core.runtime.adapters">
<factory adaptableType="org.jkiss.dbeaver.ext.postgresql.ui.editors.PostgreSourceViewEditor" class="org.jkiss.dbeaver.debug.ui.actions.DebugActionAdapterFactory">
......@@ -102,9 +106,16 @@
<factory adaptableType="org.jkiss.dbeaver.model.DBPDataSourceContainer" class="org.jkiss.dbeaver.ext.postgresql.debug.ui.internal.PostgreDebugUIAdapterFactory">
<adapter type="org.jkiss.dbeaver.debug.ui.DBGEditorAdvisor"/>
</factory>
<factory adaptableType="java.lang.Object" class="org.jkiss.dbeaver.ext.postgresql.debug.ui.internal.PostgreDebugObjectAdapterFactory">
<adapter type="org.jkiss.dbeaver.debug.DBGDebugObject"/>
</factory>
</extension>
<extension point="org.eclipse.ui.editorActions">
<!--
Breakpoin toggle contribution.
TODO: move to core debug. Dunno how because we need specific targetID
-->
<editorContribution id="org.jkiss.dbeaver.debug.ui.editorContribution" targetID="postgresql.source.view">
<action
actionID="RulerDoubleClick"
......@@ -128,39 +139,40 @@
</extension>
-->
<extension point="org.eclipse.ui.actionSets">
<actionSet label="%actionSets.actionSet.pgSQL.label" visible="true" id="org.jkiss.dbeaver.ext.postgresql.debug.ui.actionSets.actionSet.pgSQL">
<menu label="%actionSets.actionSet.menu.debug.label" path="additions" id="org.eclipse.ui.debug">
<separator name="pgSQLGroup"/>
</menu>
<!--
<action
label="%actionSets.action.pgSQLMenu.label"
style="pulldown"
icon="platform:/plugin/org.jkiss.dbeaver.ext.postgresql/$nl$/icons/postgresql_icon.png"
class="org.jkiss.dbeaver.ext.postgresql.debug.ui.internal.PgSqlMenuDelegate"
menubarPath="org.eclipse.ui.debug/pgSQLGroup"
id="org.jkiss.dbeaver.ext.postgresql.debug.ui.actionSets.action.pgSQLMenu">
</action>
<action
definitionId="org.jkiss.dbeaver.ext.postgresql.debug.ui.commands.command.pgSQLMenuDelegateToolbar"
label="%actionSets.action.pgSQLToolbar.label"
style="pulldown"
icon="platform:/plugin/org.jkiss.dbeaver.ext.postgresql/$nl$/icons/postgresql_icon.png"
tooltip="%actionSets.action.pgSQLToolbar.tooltip"
class="org.jkiss.dbeaver.ext.postgresql.debug.ui.internal.PgSqlMenuDelegate"
toolbarPath="org.eclipse.debug.ui.launchActionSet/debug"
id="org.jkiss.dbeaver.ext.postgresql.debug.ui.actionSets.action.pgSQLToolbar">
</action>
-->
<action
definitionId="org.jkiss.dbeaver.ext.postgresql.debug.ui.commands.command.pgSQLConfigurations"
label="%actionSets.action.pgSQLConfigurations.label"
class="org.jkiss.dbeaver.ext.postgresql.debug.ui.internal.PgSqlOpenLaunchDialogAction"
id="org.jkiss.dbeaver.ext.postgresql.debug.ui.actionSets.action.pgSQLConfigurations">
</action>
</actionSet>
</extension>
<!--
<extension point="org.eclipse.ui.actionSets">
<actionSet label="%actionSets.actionSet.pgSQL.label" visible="true" id="org.jkiss.dbeaver.ext.postgresql.debug.ui.actionSets.actionSet.pgSQL">
<menu label="%actionSets.actionSet.menu.debug.label" path="additions" id="org.eclipse.ui.debug">
<separator name="pgSQLGroup"/>
</menu>
<action
label="%actionSets.action.pgSQLMenu.label"
style="pulldown"
icon="platform:/plugin/org.jkiss.dbeaver.ext.postgresql/$nl$/icons/postgresql_icon.png"
class="org.jkiss.dbeaver.ext.postgresql.debug.ui.internal.PgSqlMenuDelegate"
menubarPath="org.eclipse.ui.debug/pgSQLGroup"
id="org.jkiss.dbeaver.ext.postgresql.debug.ui.actionSets.action.pgSQLMenu">
</action>
<action
definitionId="org.jkiss.dbeaver.ext.postgresql.debug.ui.commands.command.pgSQLMenuDelegateToolbar"
label="%actionSets.action.pgSQLToolbar.label"
style="pulldown"
icon="platform:/plugin/org.jkiss.dbeaver.ext.postgresql/$nl$/icons/postgresql_icon.png"
tooltip="%actionSets.action.pgSQLToolbar.tooltip"
class="org.jkiss.dbeaver.ext.postgresql.debug.ui.internal.PgSqlMenuDelegate"
toolbarPath="org.eclipse.debug.ui.launchActionSet/debug"
id="org.jkiss.dbeaver.ext.postgresql.debug.ui.actionSets.action.pgSQLToolbar">
</action>
<action
definitionId="org.jkiss.dbeaver.ext.postgresql.debug.ui.commands.command.pgSQLConfigurations"
label="%actionSets.action.pgSQLConfigurations.label"
class="org.jkiss.dbeaver.ext.postgresql.debug.ui.internal.PgSqlOpenLaunchDialogAction"
id="org.jkiss.dbeaver.ext.postgresql.debug.ui.actionSets.action.pgSQLConfigurations">
</action>
</actionSet>
</extension>
<extension point="org.eclipse.ui.commands">
<command
......@@ -176,5 +188,6 @@
id="org.jkiss.dbeaver.ext.postgresql.debug.ui.commands.command.pgSQLConfigurations">
</command>
</extension>
-->
</plugin>
/*
* 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.postgresql.debug.ui.internal;
import org.eclipse.core.runtime.IAdapterFactory;
import org.jkiss.dbeaver.debug.DBGDebugObject;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedure;
import org.jkiss.dbeaver.ext.postgresql.ui.editors.PostgreSourceViewEditor;
import org.jkiss.dbeaver.model.navigator.DBNDatabaseNode;
import org.jkiss.dbeaver.ui.editors.IDatabaseEditorInput;
public class PostgreDebugObjectAdapterFactory implements IAdapterFactory {
private static final Class<?>[] CLASSES = new Class[] { DBGDebugObject.class };
private static final DBGDebugObject DEBUG_OBJECT = new DBGDebugObject() {
};
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adapterType == DBGDebugObject.class) {
if (adaptableObject instanceof PostgreSourceViewEditor &&
((PostgreSourceViewEditor) adaptableObject).getSourceObject() instanceof PostgreProcedure)
{
return adapterType.cast(DEBUG_OBJECT);
}
if (adaptableObject instanceof IDatabaseEditorInput &&
((IDatabaseEditorInput) adaptableObject).getDatabaseObject() instanceof PostgreProcedure)
{
return adapterType.cast(DEBUG_OBJECT);
}
if (adaptableObject instanceof DBNDatabaseNode &&
((DBNDatabaseNode) adaptableObject).getObject() instanceof PostgreProcedure)
{
return adapterType.cast(DEBUG_OBJECT);
}
}
return null;
}
@Override
public Class<?>[] getAdapterList() {
return CLASSES;
}
}
......@@ -27,6 +27,8 @@ Bundle-Vendor: %Bundle-Vendor
Bundle-ClassPath: .
Bundle-Activator: org.jkiss.dbeaver.ext.postgresql.PostgreActivator
Export-Package: org.jkiss.dbeaver.ext.postgresql,
org.jkiss.dbeaver.ext.postgresql.model
org.jkiss.dbeaver.ext.postgresql.model,
org.jkiss.dbeaver.ext.postgresql.ui,
org.jkiss.dbeaver.ext.postgresql.ui.editors
Bundle-Localization: OSGI-INF/l10n/bundle
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册