Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Null pointer through customizing outline view
Null pointer through customizing outline view [message #1004520] Wed, 23 January 2013 11:43 Go to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi,

according to the documentation, I tried to style my outline view. Where it works for the rule ConfiguratioName (see below), I got the following Errormessage by modeling a Model or Parameters: "'Refreshing outline' has encountered a problem. Error refreshing outline" ( Error stack). When I ignore this error and model on, the element will be shown in the outline view in the defined styled way.

Here are my Grammar Rules:
Element:
	(name=ConfigurationName) &
	(model=Model) &
	(paramaters=Parameters)? &
;

ConfigurationName:
	'name:' configurationname=ID
;

Model:
	'modelfile:' modelfile=ModelFile
;

ModelFile:
	(ABSOLUTE_FILEPATH | RELATIVE_FILEPATH)
;

Parameters:
	'parameters' '{'
		(parameterdesc += ParameterDesc)+
	 '}'
;

ParameterDesc:
	datatype=[DataType] name=ID value=Value
;


Here are my text(modelElement) methods:

public Object _text(ConfigurationName cname) {
		return new StyledString(
				cname.getConfigurationname(),
				stylerFactory		.createXtextStyleAdapterStyler(getCnTextStyle()));
	}

	protected TextStyle getCnTextStyle() {
		TextStyle textStyle = new TextStyle();
		textStyle.setBackgroundColor(new RGB(219, 219, 219));
		return textStyle;
	}

public Object _text(Model model) {
		System.out.println(model.getModelfile());
		return new StyledString(model.getModelfile(),				stylerFactory.createXtextStyleAdapterStyler(getModelStyle()));
	}

...

public Object _text(ParameterDesc param) {
		return new StyledString(param.getName(),
				stylerFactory					.createXtextStyleAdapterStyler(getInterfaceStyle()));
	}

...
Re: Null pointer through customizing outline view [message #1004534 is a reply to message #1004520] Wed, 23 January 2013 12:13 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi since you enter first the reference and then the name what about a
classical null check on get name?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Rename shifts from expectation
Next Topic:Problem running xtext workflow in Plugin Environment
Goto Forum:
  


Current Time: Thu Apr 18 23:36:49 GMT 2024

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

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

Back to the top