Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Re: JavaScript in CVS are broken.

Ok i created a special interface that FakeField just implements:

Below the patch.
Now IField and SourceField stay untouched.
only add an interface IHoverSnippetProvider that i places right besides IScriptEditorTextHover (dltk.ui)

Is that the right place? Now _javascript_.core has to depend on dltk.ui



### Eclipse Workspace Patch 1.0
#P org.eclipse.dltk.ui
Index: src/org/eclipse/dltk/ui/text/hover/IHoverSnippetProvider.java
===================================================================
RCS file: src/org/eclipse/dltk/ui/text/hover/IHoverSnippetProvider.java
diff -N src/org/eclipse/dltk/ui/text/hover/IHoverSnippetProvider.java
--- /dev/null    1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/dltk/ui/text/hover/IHoverSnippetProvider.java    1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package org.eclipse.dltk.ui.text.hover;
+
+/**
+ * @author jcompagner
+ *
+ */
+public interface IHoverSnippetProvider
+{
+   
+    public String getSnippet();
+   
+    public void setSnippet(String snippet);
+
+}
#P org.eclipse.dltk._javascript_.core
Index: src/org/eclipse/dltk/_javascript_/internal/core/codeassist/selection/_javascript_SelectionEngine.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.dltk/_javascript_/plugins/org.eclipse.dltk._javascript_.core/src/org/eclipse/dltk/_javascript_/internal/core/codeassist/selection/_javascript_SelectionEngine.java,v
retrieving revision 1.9
diff -u -r1.9 _javascript_SelectionEngine.java
--- src/org/eclipse/dltk/_javascript_/internal/core/codeassist/selection/_javascript_SelectionEngine.java    28 Apr 2008 15:09:50 -0000    1.9
+++ src/org/eclipse/dltk/_javascript_/internal/core/codeassist/selection/_javascript_SelectionEngine.java    29 Apr 2008 10:51:13 -0000
@@ -40,6 +40,7 @@
 import org.eclipse.dltk.internal._javascript_.typeinference.VaribleDeclarationReference;
 import org.eclipse.dltk._javascript_.core._javascript_Nature;
 import org.eclipse.dltk._javascript_.internal.core.codeassist.AssitUtils;
+import org.eclipse.dltk.ui.text.hover.IHoverSnippetProvider;
 
 public class _javascript_SelectionEngine extends ScriptSelectionEngine {
 
@@ -81,9 +82,9 @@
         sm.toArray(resultA);
         for (int j = 0; j < resultA.length; j++)
         {
-            if (resultA[j] instanceof IField)
+            if (resultA[j] instanceof IHoverSnippetProvider)
             {
-                ((IField)resultA[j]).setSnippet(selection);
+                ((IHoverSnippetProvider)resultA[j]).setSnippet(selection);
             }
         }
         return resultA;
#P org.eclipse.dltk.debug.ui
Index: src/org/eclipse/dltk/internal/debug/ui/ScriptDebugHover.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.dltk/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/ScriptDebugHover.java,v
retrieving revision 1.15
diff -u -r1.15 ScriptDebugHover.java
--- src/org/eclipse/dltk/internal/debug/ui/ScriptDebugHover.java    28 Mar 2008 14:50:00 -0000    1.15
+++ src/org/eclipse/dltk/internal/debug/ui/ScriptDebugHover.java    29 Apr 2008 10:51:14 -0000
@@ -26,6 +26,7 @@
 import org.eclipse.dltk.internal.ui.text.HTMLTextPresenter;
 import org.eclipse.dltk.internal.ui.text.ScriptWordFinder;
 import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.dltk.ui.text.hover.IHoverSnippetProvider;
 import org.eclipse.dltk.ui.text.hover.IScriptEditorTextHover;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.text.DefaultInformationControl;
@@ -95,6 +96,10 @@
                 if (scriptElement instanceof IField) {
                     IField field = (IField) scriptElement;
                     String snippet = field.getElementName();
+                    if (field instanceof IHoverSnippetProvider)
+                    {
+                        snippet = ((IHoverSnippetProvider)field).getSnippet();
+                    }
                     try {
                         IDbgpProperty property = propCmds.getProperty(snippet);
                         return getResultText(snippet, ScriptValue.createValue(



On Tue, Apr 29, 2008 at 9:29 AM, Andrei Sobolev <andrei.sobolev@xxxxxxxxx> wrote:
Hi Johan,
> ahh ok
> i was just getting to that part in my commit last night.
> The problem is that for that i had changed the core of dltk IField and
> the implementation SourceField.
> any objections to the patch below?
I suppose better way it to create special interface for it. And
implement it in FakeField.
I've not sure about other implementations. I'will check it.

Best regards, Andrei Sobolev.
>
> I have to use that because hoover information and so on gets in the
> end ModelElement so the SourceFields
> and so on. But the source fields just have the name of the field. The
> problem is that in the hoover info
> i need the compleet snippet not just "myfield" but
> "myobject.mytest.myfield"
> because else hoover doesn't work. It has to eval the compleet snippet
> instead of just myfield because
> that doesnt work for the current context..
>
> Arent other script debugger having this same problem?
>
> If we dont want this in field, do you know another place?
> Maybe i can patch _javascript_ that it returns a different field for
> that (we sort al already have a fake field)
> I tried that first but that wasnt possible because the core ofcourse
> doesnt know about the fake field
> so i cant cast to it and then get the snippet..
>
> johan
>
>
>
>
> ### Eclipse Workspace Patch 1.0
> #P org.eclipse.dltk.core
> Index: model/org/eclipse/dltk/internal/core/SourceField.java
> ===================================================================
> RCS file:
> /cvsroot/technology/org.eclipse.dltk/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceField.java,v
> retrieving revision 1.4
> diff -u -r1.4 SourceField.java
> --- model/org/eclipse/dltk/internal/core/SourceField.java    12 Mar
> 2008 11:06:00 -0000    1.4
> +++ model/org/eclipse/dltk/internal/core/SourceField.java    29 Apr
> 2008 07:17:01 -0000
> @@ -15,6 +15,8 @@
>
>  public class SourceField extends NamedMember implements IField {
>
> +    private String snippet;
> +
>      public SourceField(ModelElement parent, String name) {
>          super(parent, name);
>      }
> @@ -54,4 +56,25 @@
>      public String getFullyQualifiedName() {
>          return getFullyQualifiedName("$"); //$NON-NLS-1$
>      }
> +
> +    /**
> +     * @see org.eclipse.dltk.core.IField#setSnippet(java.lang.String)
> +     */
> +    public void setSnippet(String snippet)
> +    {
> +        this.snippet = snippet;
> +    }
> +
> +
> +    /**
> +     * @see org.eclipse.dltk.core.IField#getSnippet()
> +     */
> +    public String getSnippet()
> +    {
> +        if (snippet == null)
> +        {
> +            return getElementName();
> +        }
> +        return snippet;
> +    }
>  }
> Index: model/org/eclipse/dltk/core/IField.java
> ===================================================================
> RCS file:
> /cvsroot/technology/org.eclipse.dltk/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/IField.java,v
> retrieving revision 1.2
> diff -u -r1.2 IField.java
> --- model/org/eclipse/dltk/core/IField.java    2 May 2007 15:05:03
> -0000    1.2
> +++ model/org/eclipse/dltk/core/IField.java    29 Apr 2008 07:17:01 -0000
> @@ -15,4 +15,8 @@
>      String getFullyQualifiedName();
>
>      public String getTypeQualifiedName(String enclosingTypeSeparator,
> boolean showParameters) throws ModelException;
> +
> +    public String getSnippet();
> +
> +    public void setSnippet(String snippet);
>  }
>
>
> On Tue, Apr 29, 2008 at 9:05 AM, Andrei Sobolev
> <andrei.sobolev@xxxxxxxxx <mailto:andrei.sobolev@xxxxxxxxx>> wrote:
>
>     Hi Johan,
>
>     Ok, No problem.
>     > Will check asap, i am checking stuff in slowely because i want to be
>     > carefull what i do, the problem is that some files have many changes
>     > that again rely on other stuff :(
>     >
>     > On 4/29/08, Andrei Sobolev <andrei.sobolev@xxxxxxxxx
>     <mailto:andrei.sobolev@xxxxxxxxx>> wrote:
>     >
>     >> Hi Johan,
>     >>
>     >> Could you please check _javascript_SelectionEngine class.
>     >> It has one compilation error at line 86.
>     >> I suppose you not committed some changes.
>     >>
>     >> Best regards, Andrei.
>     >>
>     >>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top