Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Adding content assist to non-javadoc in java editor.(Adding content assist to non-javadoc in java editor)
Adding content assist to non-javadoc in java editor. [message #985420] Thu, 15 November 2012 11:30 Go to next message
Nikhil chulli is currently offline Nikhil chulli
Messages: 9
Registered: June 2012
Junior Member
I am trying to achieve content assist in non-javadoc of the java editor, i.e. suppose I type "MY" and press crtl+space-bar it should list the possible completions(like MYSPACE, MYWORK, MYNETWORK etc) provide by me. To accomplish this I implemented IJavaCompletionProposalComputer.

public class MyProposalComputer implements IJavaCompletionProposalComputer {
	private final LinksToProposalProcessor fProcessor = new LinksToProposalProcessor();
	
	@Override
	public List<ICompletionProposal> computeCompletionProposals(
		ContentAssistInvocationContext context, IProgressMonitor monitor) {
			List<ICompletionProposal> result= new ArrayList<ICompletionProposal>();
			IContextInformation info= new ContextInformation("MYSPACE", "MYSPACE Test");
			result.add( new CompletionProposal("MYSPACE", context.getInvocationOffset(), 0, "MYSPACE".length(), null, "MYSPACE", info, "Test MYSPACE"));
			
			return result;
	}

	@Override
	public List<IContextInformation> computeContextInformation(
			ContentAssistInvocationContext context, IProgressMonitor monitor) {
		return Arrays.asList(fProcessor.computeContextInformation(context.getViewer(), context.getInvocationOffset()));
	}

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

	@Override
	public void sessionEnded() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sessionStarted() {
		// TODO Auto-generated method stub
		
	}
}


But this is not working. Do I need to add anything else?
Re: Adding content assist to non-javadoc in java editor. [message #986091 is a reply to message #985420] Sun, 18 November 2012 17:58 Go to previous message
Stephan Herrmann is currently offline Stephan Herrmann
Messages: 1004
Registered: July 2009
Senior Member
Have you registered your proposal computer using the corresponding extension point?
Previous Topic:GWT - What happens when one selects "Use Google Web Toolkit"?
Next Topic:Converting IFile to IDocument
Goto Forum:
  


Current Time: Mon Sep 15 02:05:43 GMT 2014

Powered by FUDForum. Page generated in 0.01772 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software