0

I would like to add some custom results in the code completion pop up in the HTML editor of eclipse (plugin org.eclipse.wst.html.ui) but in the plugin.xml file of the jar I only found one extension point which it seems to be deprecated as there is no schema file in the jar anyway.

<extension-point id="deviceProfileEntryProvider" 
          name="%Device_Profile_Entry_Provider_Extension.name"     
          schema="schema/deviceProfileEntryProvider.exsd"/>

1) Is it possible to add such functionality to the HTML editor?

Assuming that it is not possible to do it , i "hacked" in the jar and added the following lines (added a new proposalComputer of my own) in the plugin.XML

 <proposalComputer activate="false" categoryId="org.eclipse.wst.html.ui.proposalCategory.htmlTemplates"
      class="org.eclipse.wst.html.ui.internal.contentassist.Custom"
      id="org.eclipse.wst.html.ui.proposalComputer.htmlTemplates">
   <contentType id="org.eclipse.wst.html.core.htmlsource">
      <partitionType id="org.eclipse.wst.html.HTML_DEFAULT"/>
   </contentType>
 </proposalComputer>

which is a copy-paste of an already existing proposal computer in the xml file. I only changed the class to map to my custom class (org.eclipse.wst.html.ui.internal.contentassist.Custom)

Then i created a class named Custom, compiled it and added it to the jar (in the appropriate directory denoted by the package name)

package org.eclipse.wst.html.ui.internal.contentassist;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.internal.ui.text.javadoc.HTMLTagCompletionProposalComputer;
import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContextInformation;

public class Custom extends HTMLTagCompletionProposalComputer{

@Override
public List<ICompletionProposal> computeCompletionProposals(
        ContentAssistInvocationContext context, IProgressMonitor monitor) {
    return Arrays.asList(new ICompletionProposal[]{
                new CompletionProposal("Asd",context.getInvocationOffset(),0,0),
                new CompletionProposal("sdf",context.getInvocationOffset(),0,0)}
            );
}

@Override
public List<IContextInformation> computeContextInformation(
        ContentAssistInvocationContext context, IProgressMonitor monitor) {
    return null; 
}

@Override
public String getErrorMessage() { return super.getErrorMessage(); }

@Override
public void sessionEnded() {super.sessionEnded();}


@Override
public void sessionStarted() {super.sessionStarted();}

}

...but unfortunately it didn't work.

2) Any ideas what i have done wrong here and it does not work ?

Thank you!

nfechner
  • 17,295
  • 7
  • 45
  • 64
C.LS
  • 1,319
  • 2
  • 17
  • 35
  • Did you get any error message or exceptions? – Ami Nov 07 '12 at 08:33
  • i was not aware that eclipse had its own log files.. I will check them to see if any error is logged when starting up eclipse. http://www.eclipse.org/eclipse/platform-core/documents/3.1/debug.html – C.LS Nov 07 '12 at 09:47
  • Unfortunately I couldn't trace any exception. I used eclipse -consoleLog – C.LS Nov 08 '12 at 20:40

0 Answers0