| author | Marc Aubry | 2012-08-16 05:20:36 (EDT) |
|---|---|---|
| committer | Kevin KIN-FOO | 2012-08-16 09:13:48 (EDT) |
| commit | e7bd40fa6945fdd196e0128cff0953ba5f499508 (patch) (side-by-side diff) | |
| tree | 5dbcc693d8427e92f77b152f91b7ce04b431cdba | |
| parent | af82b7dc8441d60612a345555943d4d2db00f531 (diff) | |
| download | org.eclipse.koneki.ldt-e7bd40fa6945fdd196e0128cff0953ba5f499508.zip org.eclipse.koneki.ldt-e7bd40fa6945fdd196e0128cff0953ba5f499508.tar.gz org.eclipse.koneki.ldt-e7bd40fa6945fdd196e0128cff0953ba5f499508.tar.bz2 | |
Add "Run As" shortcuts to launch Lua applications
16 files changed, 163 insertions, 39 deletions
diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.koneki.ldt.debug.core/META-INF/MANIFEST.MF index 276e5ce..f42401c 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.koneki.ldt.debug.core/META-INF/MANIFEST.MF @@ -12,6 +12,9 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.dltk.debug;bundle-version="3.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Export-Package: org.eclipse.koneki.ldt.debug.core.internal, - org.eclipse.koneki.ldt.debug.core.internal.attach +Export-Package: org.eclipse.koneki.ldt.debug.core, + org.eclipse.koneki.ldt.debug.core.internal;x-internal:=true, + org.eclipse.koneki.ldt.debug.core.internal.attach;x-internal:=true, + org.eclipse.koneki.ldt.debug.core.internal.interpreter.generic;x-friends:="org.eclipse.koneki.ldt.support.lua51", + org.eclipse.koneki.ldt.debug.core.internal.local;x-internal:=true Bundle-Vendor: %Bundle-Vendor diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaDebugConstant.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/LuaDebugConstants.java index da2e1a6..37efb78 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaDebugConstant.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/LuaDebugConstants.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2011 Sierra Wireless and others.
+ * Copyright (c) 2011-2012 Sierra Wireless and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,12 +8,18 @@ * Contributors:
* Sierra Wireless - initial API and implementation
*******************************************************************************/
-package org.eclipse.koneki.ldt.debug.core.internal;
+package org.eclipse.koneki.ldt.debug.core;
/**
* Constant for attribute of Lua launch configuration
*/
-public interface LuaDebugConstant {
+public interface LuaDebugConstants {
+
+ /**
+ * Extension point constants
+ */
+ String ATTACH_LAUNCH_CONFIGURATION_ID = "org.eclipse.koneki.ldt.debug.core.luaattachdebug"; //$NON-NLS-1$
+ String LOCAL_LAUNCH_CONFIGURATION_ID = "org.eclipse.koneki.ldt.debug.core.lualocaldebug"; //$NON-NLS-1$
/**
* Launch Configuration constant
diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaFunctionType.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaFunctionType.java index ae83e95..6593a81 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaFunctionType.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaFunctionType.java @@ -14,6 +14,7 @@ import java.net.URI; import org.eclipse.dltk.debug.core.model.AtomicScriptType; import org.eclipse.dltk.debug.core.model.IScriptValue; +import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants; /** * Represents a function defined in Lua and allows to retrieve its URI and file name. @@ -48,7 +49,7 @@ public class LuaFunctionType extends AtomicScriptType { * @param name */ public LuaFunctionType() { - super(LuaDebugConstant.TYPE_LUAFUNC); + super(LuaDebugConstants.TYPE_LUAFUNC); } /** diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaMultivalType.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaMultivalType.java index 200dfa2..66ea54c 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaMultivalType.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaMultivalType.java @@ -14,13 +14,14 @@ import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IVariable; import org.eclipse.dltk.debug.core.model.CollectionScriptType; import org.eclipse.dltk.debug.core.model.IScriptValue; +import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants; /** * Represents a "multival" type in Lua like function return values, ... */ public class LuaMultivalType extends CollectionScriptType { public LuaMultivalType() { - super(LuaDebugConstant.TYPE_MULTIVAL); + super(LuaDebugConstants.TYPE_MULTIVAL); } /** diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaSequenceType.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaSequenceType.java index f3923b3..270f7ab 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaSequenceType.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaSequenceType.java @@ -14,6 +14,7 @@ import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IIndexedValue; import org.eclipse.dltk.debug.core.model.CollectionScriptType; import org.eclipse.dltk.debug.core.model.IScriptValue; +import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants; /** * Represents a special case of Lua table. A sequence is a table with only 1..n consecutive keys. It is identified as "sequcence" type by Lua @@ -26,7 +27,7 @@ public class LuaSequenceType extends CollectionScriptType { } public LuaSequenceType() { - this(LuaDebugConstant.TYPE_SEQUENCE); + this(LuaDebugConstants.TYPE_SEQUENCE); } public String formatValue(IScriptValue value) { diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaTableType.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaTableType.java index 64c70ee..1b99133 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaTableType.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaTableType.java @@ -12,6 +12,7 @@ package org.eclipse.koneki.ldt.debug.core.internal; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IVariable; +import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants; /** * A general Lua table with arbitrary keys. @@ -19,7 +20,7 @@ import org.eclipse.debug.core.model.IVariable; public class LuaTableType extends LuaSequenceType { public LuaTableType() { - super(LuaDebugConstant.TYPE_TABLE); + super(LuaDebugConstants.TYPE_TABLE); } /** diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaTypeFactory.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaTypeFactory.java index 7de3ccb..eea026c 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaTypeFactory.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaTypeFactory.java @@ -13,6 +13,7 @@ package org.eclipse.koneki.ldt.debug.core.internal; import org.eclipse.dltk.debug.core.model.AtomicScriptType;
import org.eclipse.dltk.debug.core.model.IScriptType;
import org.eclipse.dltk.debug.core.model.IScriptTypeFactory;
+import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants;
public class LuaTypeFactory implements IScriptTypeFactory {
@@ -22,13 +23,13 @@ public class LuaTypeFactory implements IScriptTypeFactory { @Override
public IScriptType buildType(String type) {
// TODO: script types are stateless, do only one instance of them
- if (type.equals(LuaDebugConstant.TYPE_TABLE))
+ if (type.equals(LuaDebugConstants.TYPE_TABLE))
return new LuaTableType();
- else if (type.equals(LuaDebugConstant.TYPE_MULTIVAL))
+ else if (type.equals(LuaDebugConstants.TYPE_MULTIVAL))
return new LuaMultivalType();
- else if (type.equals(LuaDebugConstant.TYPE_SEQUENCE))
+ else if (type.equals(LuaDebugConstants.TYPE_SEQUENCE))
return new LuaSequenceType();
- else if (type.equals(LuaDebugConstant.TYPE_LUAFUNC))
+ else if (type.equals(LuaDebugConstants.TYPE_LUAFUNC))
return new LuaFunctionType();
else
return new AtomicScriptType(type);
diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaVariableComparator.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaVariableComparator.java index 198432d..a20cea1 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaVariableComparator.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaVariableComparator.java @@ -15,12 +15,13 @@ import java.util.Comparator; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IVariable; +import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants; public class LuaVariableComparator implements Comparator<IVariable>, Serializable { private static final long serialVersionUID = -5828968181211469862L; public int category(IVariable var) throws DebugException { - return var.getReferenceTypeName().equals(LuaDebugConstant.TYPE_SPECIAL) ? 0 : 1; + return var.getReferenceTypeName().equals(LuaDebugConstants.TYPE_SPECIAL) ? 0 : 1; } @Override diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/attach/LuaAttachDebugTarget.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/attach/LuaAttachDebugTarget.java index 41640e1..cab2675 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/attach/LuaAttachDebugTarget.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/attach/LuaAttachDebugTarget.java @@ -23,9 +23,9 @@ import org.eclipse.dltk.internal.debug.core.model.ScriptDebugTarget; import org.eclipse.dltk.internal.debug.core.model.ScriptThread; import org.eclipse.dltk.internal.debug.core.model.operations.DbgpDebugger; import org.eclipse.dltk.internal.launching.LaunchConfigurationUtils; +import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants; import org.eclipse.koneki.ldt.debug.core.internal.Activator; import org.eclipse.koneki.ldt.debug.core.internal.LuaAbsoluteFileURIBreakpointPathMapper; -import org.eclipse.koneki.ldt.debug.core.internal.LuaDebugConstant; import org.eclipse.koneki.ldt.debug.core.internal.LuaDebugTarget; import org.eclipse.koneki.ldt.debug.core.internal.LuaModuleURIBreakpointPathMapper; @@ -35,7 +35,7 @@ public abstract class LuaAttachDebugTarget extends LuaDebugTarget { super(modelId, dbgpService, sessionId, launch, process); // initialize DBGP client - if (LuaDebugConstant.MODULE_MAPPING_TYPE.equals(getSourceMappingType())) { + if (LuaDebugConstants.MODULE_MAPPING_TYPE.equals(getSourceMappingType())) { setScriptDebugThreadConfigurator(new IScriptDebugThreadConfigurator() { @Override @@ -77,9 +77,9 @@ public abstract class LuaAttachDebugTarget extends LuaDebugTarget { @Override protected IScriptBreakpointPathMapper createPathMapper() { String mappingType = getSourceMappingType(); - if (mappingType.equals(LuaDebugConstant.MODULE_MAPPING_TYPE)) { + if (mappingType.equals(LuaDebugConstants.MODULE_MAPPING_TYPE)) { return new LuaModuleURIBreakpointPathMapper(getScriptProject()); - } else if (mappingType.equals(LuaDebugConstant.REPLACE_PATH_MAPPING_TYPE)) { + } else if (mappingType.equals(LuaDebugConstants.REPLACE_PATH_MAPPING_TYPE)) { return new LuaAttachBreakpointPathMapper(getScriptProject(), folder()); } else { @@ -96,7 +96,7 @@ public abstract class LuaAttachDebugTarget extends LuaDebugTarget { protected abstract String folder(); protected String getSourceMappingType() { - return LaunchConfigurationUtils.getString(getLaunch().getLaunchConfiguration(), LuaDebugConstant.ATTR_LUA_SOURCE_MAPPING_TYPE, - LuaDebugConstant.LOCAL_MAPPING_TYPE); + return LaunchConfigurationUtils.getString(getLaunch().getLaunchConfiguration(), LuaDebugConstants.ATTR_LUA_SOURCE_MAPPING_TYPE, + LuaDebugConstants.LOCAL_MAPPING_TYPE); } } diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/attach/LuaAttachSourcePathComputer.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/attach/LuaAttachSourcePathComputer.java index 1b1a95b..5e3d89c 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/attach/LuaAttachSourcePathComputer.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/attach/LuaAttachSourcePathComputer.java @@ -16,8 +16,8 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.dltk.internal.launching.LaunchConfigurationUtils;
import org.eclipse.dltk.launching.sourcelookup.ScriptSourcePathComputer;
+import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants;
import org.eclipse.koneki.ldt.debug.core.internal.LuaAbsoluteFileURIBuildpathSourceContainer;
-import org.eclipse.koneki.ldt.debug.core.internal.LuaDebugConstant;
import org.eclipse.koneki.ldt.debug.core.internal.LuaModuleURIBuildpathSourceContainer;
import org.eclipse.koneki.ldt.debug.core.internal.LuaReplacePathSourceContainer;
@@ -30,12 +30,12 @@ public class LuaAttachSourcePathComputer extends ScriptSourcePathComputer { @Override
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
- String mappingType = LaunchConfigurationUtils.getString(configuration, LuaDebugConstant.ATTR_LUA_SOURCE_MAPPING_TYPE,
- LuaDebugConstant.LOCAL_MAPPING_TYPE);
+ String mappingType = LaunchConfigurationUtils.getString(configuration, LuaDebugConstants.ATTR_LUA_SOURCE_MAPPING_TYPE,
+ LuaDebugConstants.LOCAL_MAPPING_TYPE);
- if (mappingType.equals(LuaDebugConstant.MODULE_MAPPING_TYPE)) {
+ if (mappingType.equals(LuaDebugConstants.MODULE_MAPPING_TYPE)) {
return new ISourceContainer[] { new LuaModuleURIBuildpathSourceContainer() };
- } else if (mappingType.equals(LuaDebugConstant.REPLACE_PATH_MAPPING_TYPE)) {
+ } else if (mappingType.equals(LuaDebugConstants.REPLACE_PATH_MAPPING_TYPE)) {
return new ISourceContainer[] { new LuaReplacePathSourceContainer() };
} else {
return new ISourceContainer[] { new LuaAbsoluteFileURIBuildpathSourceContainer() };
diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/interpreter/generic/LuaGenericDebuggingEngineConfigurer.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/interpreter/generic/LuaGenericDebuggingEngineConfigurer.java index 6c1c884..31941ec 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/interpreter/generic/LuaGenericDebuggingEngineConfigurer.java +++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/interpreter/generic/LuaGenericDebuggingEngineConfigurer.java @@ -24,8 +24,8 @@ import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunch;
import org.eclipse.dltk.launching.InterpreterConfig;
import org.eclipse.dltk.launching.debug.DbgpConnectionConfig;
+import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants;
import org.eclipse.koneki.ldt.debug.core.internal.Activator;
-import org.eclipse.koneki.ldt.debug.core.internal.LuaDebugConstant;
public class LuaGenericDebuggingEngineConfigurer extends LuaGenericInterpreterConfigurer {
@@ -44,7 +44,7 @@ public class LuaGenericDebuggingEngineConfigurer extends LuaGenericInterpreterCo // add debugger path to lua path
try {
- URL debuggerEntry = Activator.getDefault().getBundle().getEntry(LuaDebugConstant.SCRIPT_PATH);
+ URL debuggerEntry = Activator.getDefault().getBundle().getEntry(LuaDebugConstants.SCRIPT_PATH);
File debuggerFolder = new File(FileLocator.toFileURL(debuggerEntry).getFile());
luaPath.add(new Path(debuggerFolder.getPath()));
} catch (IOException e) {
diff --git a/plugins/org.eclipse.koneki.ldt.debug.ui/OSGI-INF/l10n/bundle.properties b/plugins/org.eclipse.koneki.ldt.debug.ui/OSGI-INF/l10n/bundle.properties index ab86560..9162343 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.ui/OSGI-INF/l10n/bundle.properties +++ b/plugins/org.eclipse.koneki.ldt.debug.ui/OSGI-INF/l10n/bundle.properties @@ -20,4 +20,8 @@ action.label.GotoFunctionDefinitionAction = Goto definition LuaAttachLaunchConfigurationTabGroup.description = Launch DBGP server and wait for debug connection from Lua Application. LuaLocalLaunchConfigurationTabGroup.description = Launch a Lua Application. -interpreterspage.name = Interpreters
\ No newline at end of file +interpreterspage.name = Interpreters +launchShortcut.luaApp.label = Lua Application +launchShortcut.luaApp.description = Launch a local Lua application +launchShortcut.luaApp.run.description = Runs a local Lua application +launchShortcut.luaApp.debug.description = Debugs a local Lua application
\ No newline at end of file diff --git a/plugins/org.eclipse.koneki.ldt.debug.ui/plugin.xml b/plugins/org.eclipse.koneki.ldt.debug.ui/plugin.xml index ab48265..fb85696 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.ui/plugin.xml +++ b/plugins/org.eclipse.koneki.ldt.debug.ui/plugin.xml @@ -176,4 +176,47 @@ name="%interpreterspage.name">
</page>
</extension>
+ <extension point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ label="%launchShortcut.luaApp.label"
+ icon="icons/obj16/lua_local.gif"
+ helpContextId="org.eclipse.jdt.debug.ui"
+ modes="run, debug"
+ class="org.eclipse.koneki.ldt.debug.ui.internal.launchconfiguration.local.LuaApplicationLaunchShortcut"
+ description="%launchShortcut.luaApp.description"
+ id="org.eclipse.koneki.ldt.debug.ui.localLuaShortcut">
+ <description
+ description="%launchShortcut.luaApp.run.description"
+ mode="run">
+ </description>
+ <description
+ description="%launchShortcut.luaApp.debug.description"
+ mode="debug">
+ </description>
+ <contextualLaunch>
+ <enablement>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <and>
+ <test property="org.eclipse.core.resources.projectNature"
+ value="org.eclipse.koneki.ldt.nature"/>
+ <or>
+ <test property="org.eclipse.core.resources.extension" value="lua"/>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <test property="org.eclipse.core.resources.open"/>
+ </adapt>
+ </or>
+ </and>
+ </adapt>
+ </iterate>
+ </with>
+ </enablement>
+ </contextualLaunch>
+ <configurationType
+ id="org.eclipse.koneki.ldt.debug.core.lualocaldebug">
+ </configurationType>
+ </shortcut>
+</extension>
</plugin>
diff --git a/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/LuaDebugModelPresentation.java b/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/LuaDebugModelPresentation.java index 3da8f63..31d55ff 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/LuaDebugModelPresentation.java +++ b/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/LuaDebugModelPresentation.java @@ -32,8 +32,8 @@ import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; +import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants; import org.eclipse.koneki.ldt.debug.core.internal.LuaCoroutine; -import org.eclipse.koneki.ldt.debug.core.internal.LuaDebugConstant; import org.eclipse.koneki.ldt.debug.core.internal.LuaModuleURIUtil; import org.eclipse.koneki.ldt.debug.core.internal.UnreachableStackFrame; import org.eclipse.koneki.ldt.ui.internal.editor.LuaEditor; @@ -199,7 +199,7 @@ public class LuaDebugModelPresentation extends ScriptDebugModelPresentation { @Override protected Image getVariableImage(IScriptVariable variable) { try { - if (variable.getReferenceTypeName().equals(LuaDebugConstant.TYPE_SPECIAL)) { + if (variable.getReferenceTypeName().equals(LuaDebugConstants.TYPE_SPECIAL)) { return Activator.getDefault().getImageRegistry().get(ImageConstants.LUA_DEBUG_SPECIAL_VAR); } // CHECKSTYLE:OFF diff --git a/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/launchconfiguration/attach/LuaAttachMainTab.java b/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/launchconfiguration/attach/LuaAttachMainTab.java index 2060858..c36e200 100644 --- a/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/launchconfiguration/attach/LuaAttachMainTab.java +++ b/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/launchconfiguration/attach/LuaAttachMainTab.java @@ -26,7 +26,7 @@ import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.koneki.ldt.core.internal.LuaLanguageToolkit;
-import org.eclipse.koneki.ldt.debug.core.internal.LuaDebugConstant;
+import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants;
import org.eclipse.koneki.ldt.debug.ui.internal.Activator;
import org.eclipse.koneki.ldt.debug.ui.internal.Messages;
import org.eclipse.swt.SWT;
@@ -50,7 +50,7 @@ public class LuaAttachMainTab extends ScriptLaunchConfigurationTab { private static final String DEFAULT_IDEKEY = "luaidekey"; //$NON-NLS-1$
private static final String DEFAULT_REPLACE_PATH = ""; //$NON-NLS-1$
- private static final String DEFAULT_MAPPING_TYPE = LuaDebugConstant.LOCAL_MAPPING_TYPE;
+ private static final String DEFAULT_MAPPING_TYPE = LuaDebugConstants.LOCAL_MAPPING_TYPE;
private Text txtIdeKey;
private Text txtTimeout;
@@ -111,7 +111,7 @@ public class LuaAttachMainTab extends ScriptLaunchConfigurationTab { txtTimeout.setText(Integer.toString(LaunchConfigurationUtils.getConnectionTimeout(config, getDefaultRemoteTimeout()) / 1000));
- String mappingType = LaunchConfigurationUtils.getString(config, LuaDebugConstant.ATTR_LUA_SOURCE_MAPPING_TYPE, DEFAULT_MAPPING_TYPE);
+ String mappingType = LaunchConfigurationUtils.getString(config, LuaDebugConstants.ATTR_LUA_SOURCE_MAPPING_TYPE, DEFAULT_MAPPING_TYPE);
selectSourceMapping(mappingType);
txtReplacePath.setText(LaunchConfigurationUtils.getString(config, ScriptLaunchConfigurationConstants.ATTR_DLTK_DBGP_REMOTE_WORKING_DIR,
@@ -122,9 +122,9 @@ public class LuaAttachMainTab extends ScriptLaunchConfigurationTab { * select the source mapping graphicaly
*/
private void selectSourceMapping(String mappingType) {
- if (mappingType.equals(LuaDebugConstant.MODULE_MAPPING_TYPE)) {
+ if (mappingType.equals(LuaDebugConstants.MODULE_MAPPING_TYPE)) {
btnModuleResolution.setSelection(true);
- } else if (mappingType.equals(LuaDebugConstant.REPLACE_PATH_MAPPING_TYPE)) {
+ } else if (mappingType.equals(LuaDebugConstants.REPLACE_PATH_MAPPING_TYPE)) {
btnReplacePathResolution.setSelection(true);
} else {
@@ -159,7 +159,7 @@ public class LuaAttachMainTab extends ScriptLaunchConfigurationTab { // set source mapping type
String sourceMapping = getSelectedSourceMapping();
- config.setAttribute(LuaDebugConstant.ATTR_LUA_SOURCE_MAPPING_TYPE, sourceMapping);
+ config.setAttribute(LuaDebugConstants.ATTR_LUA_SOURCE_MAPPING_TYPE, sourceMapping);
// set replace path
config.setAttribute(ScriptLaunchConfigurationConstants.ATTR_DLTK_DBGP_REMOTE_WORKING_DIR, txtReplacePath.getText().trim());
@@ -170,11 +170,11 @@ public class LuaAttachMainTab extends ScriptLaunchConfigurationTab { */
private String getSelectedSourceMapping() {
if (btnModuleResolution.getSelection()) {
- return LuaDebugConstant.MODULE_MAPPING_TYPE;
+ return LuaDebugConstants.MODULE_MAPPING_TYPE;
} else if (btnReplacePathResolution.getSelection()) {
- return LuaDebugConstant.REPLACE_PATH_MAPPING_TYPE;
+ return LuaDebugConstants.REPLACE_PATH_MAPPING_TYPE;
} else {
- return LuaDebugConstant.LOCAL_MAPPING_TYPE;
+ return LuaDebugConstants.LOCAL_MAPPING_TYPE;
}
}
diff --git a/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/launchconfiguration/local/LuaApplicationLaunchShortcut.java b/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/launchconfiguration/local/LuaApplicationLaunchShortcut.java new file mode 100644 index 0000000..2b345a8 --- a/dev/null +++ b/plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/launchconfiguration/local/LuaApplicationLaunchShortcut.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2012 Sierra Wireless and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sierra Wireless - initial API and implementation + *******************************************************************************/ +package org.eclipse.koneki.ldt.debug.ui.internal.launchconfiguration.local; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.dltk.internal.debug.ui.launcher.AbstractScriptLaunchShortcut; +import org.eclipse.koneki.ldt.core.LuaConstants; +import org.eclipse.koneki.ldt.core.LuaNature; +import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants; + +public class LuaApplicationLaunchShortcut extends AbstractScriptLaunchShortcut { + + @Override + protected ILaunchConfigurationType getConfigurationType() { + return DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(LuaDebugConstants.LOCAL_LAUNCH_CONFIGURATION_ID); + } + + @Override + protected String getNatureId() { + return LuaNature.ID; + } + + /** + * By default, select the main.lua script, if it does't exist, ask the user. + * + * @see org.eclipse.dltk.internal.debug.ui.launcher.AbstractScriptLaunchShortcut#chooseScript(org.eclipse.core.resources.IResource[], + * java.lang.String) + */ + @Override + protected IResource chooseScript(IResource[] scripts, String title) { + IPath defaultPath = new Path(LuaConstants.SOURCE_FOLDER).append(LuaConstants.DEFAULT_MAIN_FILE); + for (IResource script : scripts) { + IPath scriptPath = script.getLocation(); + + // test if the script path ends with the default path + if (scriptPath.segmentCount() > defaultPath.segmentCount()) { + + // remove the beginning of the script to test the end + int numberOfSegmentToTest = scriptPath.segmentCount() - defaultPath.segmentCount(); + scriptPath = scriptPath.removeFirstSegments(numberOfSegmentToTest); + + if (scriptPath.equals(defaultPath)) { + return script; + } + } + } + return super.chooseScript(scripts, title); + } + +} |

