Skip to main content


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 13:26
Ricky de Klerck is currently offline Ricky de KlerckFriend
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 13:26]

Report message to a moderator

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


Current Time: Fri Apr 19 07:24:51 GMT 2024

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

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

Back to the top