Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » SqlStatementArea (sourceviewer) code completion doesn't work
SqlStatementArea (sourceviewer) code completion doesn't work [message #909642] Fri, 07 September 2012 09:26
Ricky de Klerck is currently offline Ricky de Klerck
Messages: 295
Registered: January 2011
Senior Member
Hi,

For a couple of days now, I'm trying to create an Eclipse view with an area where I can edit sql. I want this area to have syntax highlighting, code completion, auto format, line numbers etc.

I found out that the SqlStatementArea of the Eclipse Data Tools project has this ability. I've used this in my project and the syntax highlighting works out of the box but when I hit CTRL+SPACE nothing happens.

This is my code:

SQLSourceEditingEnvironment.connect();
service = new CustomSQLSourceViewerService();
sta = new SQLStatementArea(this, SWT.BORDER, service, true);
sta.setEditable(true);
sta.setEnabled(true);
CustomSQLSourceViewerConfiguration sqlSourceViewerConfiguration = new CustomSQLSourceViewerConfiguration();
sqlSourceViewerConfiguration.setIsContentAssistActive(true);
sta.configureViewer(sqlSourceViewerConfiguration);
sta.setLayoutData(new GridData(GridData.FILL_BOTH));
document = new Document();
document.set("select * from test");
sta.getViewer().setDocument(document);


Allso I made a class which extends SQLSourceViewerConfiguration so I could override getContentFormatter (I want all keywords to be uppercase). This is the code for that:

@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
  ContentFormatter formatter = new ContentFormatter();
  formatter.setFormattingStrategy(new SQLWordStrategy(new DefaultSQLSyntax()),
				IDocument.DEFAULT_CONTENT_TYPE);
  return formatter;		
}


But there is no formatting applied.. Hope someone can help? Thanks in advance.

[Updated on: Fri, 07 September 2012 09:26]

Report message to a moderator

Previous Topic:Custom MRU list
Next Topic:org.eclipse.ui.views.properties error
Goto Forum:
  


Current Time: Wed Apr 23 20:59:04 EDT 2014

Powered by FUDForum. Page generated in 0.03654 seconds