Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2016-02-02 21:53:15 +0000
committerKarsten Thoms2016-02-02 21:53:15 +0000
commita15709a102f4ab059655c48c4cb7ee2fa8263082 (patch)
tree65cf217720e6b58fab44f3af5abd841c4bea3dc0
parentc4c5f5a81b76cc6084d12bd7fec95c1bc6e88c21 (diff)
downloadorg.eclipse.xpand-a15709a102f4ab059655c48c4cb7ee2fa8263082.tar.gz
org.eclipse.xpand-a15709a102f4ab059655c48c4cb7ee2fa8263082.tar.xz
org.eclipse.xpand-a15709a102f4ab059655c48c4cb7ee2fa8263082.zip
[480638] Enable debugging for Check files
Change-Id: I18b30f8db6f926ea2549e11f5fb0fce04ca0dedf Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
-rw-r--r--plugins/org.eclipse.xtend.ui/plugin.xml10
-rw-r--r--plugins/org.eclipse.xtend.ui/src/org/eclipse/xtend/ui/debug/CheckPluginAdapter.java46
2 files changed, 52 insertions, 4 deletions
diff --git a/plugins/org.eclipse.xtend.ui/plugin.xml b/plugins/org.eclipse.xtend.ui/plugin.xml
index 060457d4..3f9cf629 100644
--- a/plugins/org.eclipse.xtend.ui/plugin.xml
+++ b/plugins/org.eclipse.xtend.ui/plugin.xml
@@ -49,9 +49,11 @@
pluginClass="org.eclipse.xtend.ui.debug.ExpressionPluginAdapter"
runtimeClass="org.eclipse.internal.xtend.expression.debug.ExpressionElementAdapter">
</adapter>
+ <adapter
+ name="Check Debug Adapters"
+ pluginClass="org.eclipse.xtend.ui.debug.CheckPluginAdapter"
+ runtimeClass="org.eclipse.internal.xtend.expression.debug.ExpressionElementAdapter">
+ </adapter>
</extension>
-
-
-
-
+
</plugin>
diff --git a/plugins/org.eclipse.xtend.ui/src/org/eclipse/xtend/ui/debug/CheckPluginAdapter.java b/plugins/org.eclipse.xtend.ui/src/org/eclipse/xtend/ui/debug/CheckPluginAdapter.java
new file mode 100644
index 00000000..20f97036
--- /dev/null
+++ b/plugins/org.eclipse.xtend.ui/src/org/eclipse/xtend/ui/debug/CheckPluginAdapter.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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
+ *******************************************************************************/
+package org.eclipse.xtend.ui.debug;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.internal.xtend.expression.ast.ISyntaxElement;
+import org.eclipse.internal.xtend.expression.ast.SyntaxElement;
+import org.eclipse.internal.xtend.xtend.ast.Check;
+
+
+/**
+ * @author kia7si - Initial contribution and API
+ * @author Karsten Thoms (itemis) - maintenance
+ * @since 2.2
+ */
+public class CheckPluginAdapter extends ExpressionPluginAdapter {
+ @Override
+ protected String getRequiredExtension() {
+ return "chk";
+ }
+
+ @Override
+ protected ISyntaxElement findElementForPosition(IResource resource, int position, int line) {
+ ISyntaxElement rootElem = getContainingRootElement(resource, position);
+
+ if(rootElem instanceof Check)
+ return getContainingElementOfCheckStatement((Check)rootElem, position);
+
+ return super.getContainingElement((SyntaxElement)rootElem, position);
+ }
+
+ private ISyntaxElement getContainingElementOfCheckStatement(Check rootElem, int position) {
+ List<SyntaxElement> children = new ArrayList<SyntaxElement>();
+ children.add(rootElem.getMsg());
+ children.add(rootElem.getConstraint());
+ return getContainingChild(rootElem, children, position);
+ }
+} \ No newline at end of file

Back to the top