Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Compilation error for expression XYZ, headless mode(Programmatically generating an SVG file of an diagram in Headless mode)
Compilation error for expression XYZ, headless mode [message #1706296] Tue, 25 August 2015 13:41 Go to next message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
Hello,

i have a problem with generating an SVG file of a Diagram in headless mode (console version of eclipse). I've loaded the "aird" resource, the semantic model resource but during the running of the following code line

DRepresentation representation = dialectManager.createRepresentation("ProcessDiagram", eObject,
repDescription, session, new NullProgressMonitor());


I get a bunch of errors of the following pattern:

Compilation error for expression [self.XYZ()/] : Cannot find operation (XYZ()) for the type (ABC)

for example:
!MESSAGE Compilation error for expression [self.getActions()/] : Cannot find operation (getActions()) for the type (Process)


In normal Eclipse Workbench it is working, it could find the Methods. Do i have to do something special for the programmatic way of generating the diagram?

Thanks in advance.

Best regards
m.emin
Re: Compilation error for expression XYZ, headless mode [message #1706297 is a reply to message #1706296] Tue, 25 August 2015 13:51 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi,

I need more details to help you. Then some questions :
- Which release of Sirius do you use?
- Can you show the code you execute to do SVG diagram export
programmatically in headless?
- Do you have the XYZ(), getActions() operation and the ABC, Process
EClasses in your classpath?
- If the previous XYZ(), getActions() operations are java services, you
can try service interpreter [1] instead of using Acceleo 3.

[1]
https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html#specialized

Best Regards.

Le 25/08/2015 15:41, Emin M. a écrit :
> Hello,
>
> i have a problem with generating an SVG file of a Diagram in headless
> mode (console version of eclipse). I've loaded the "aird" resource, the
> semantic model resource but during the running of the following code line
>
> DRepresentation representation =
> dialectManager.createRepresentation("ProcessDiagram", eObject,
> repDescription, session, new NullProgressMonitor());
>
>
> I get a bunch of errors of the following pattern:
> Compilation error for expression [self.XYZ()/] : Cannot find operation
> (XYZ()) for the type (ABC)
>
> for example: !MESSAGE Compilation error for expression
> [self.getActions()/] : Cannot find operation (getActions()) for the type
> (Process)
>
>
> In normal Eclipse Workbench it is working, it could find the Methods. Do
> i have to do something special for the programmatic way of generating
> the diagram?
>
> Thanks in advance.
>
> Best regards
> m.emin



--
Esteban Dugueperoux - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Compilation error for expression XYZ, headless mode [message #1706302 is a reply to message #1706297] Tue, 25 August 2015 14:04 Go to previous messageGo to next message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
the version i am using is 2 (qualified 2.0.0.201410241344).

final RepresentationDescription repDescription = representationDescription;
editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain) {

	@Override
	protected void doExecute() {
		dAnalysisImpl.getModels().add(eObject);
		dAnalysisImpl.getSelectedViews().add(representationContainer);
					
		// Attach eObject to session see https://www.eclipse.org/forums/index.php/t/1068187/
		eObject.eAdapters().add(new SessionTransientAttachment(session));  // experimentally..

		DRepresentation representation = dialectManager.createRepresentation("ProcessDiagram", eObject, repDescription, session, new NullProgressMonitor());
		representationContainer.getOwnedRepresentations().add(representation);
	}
});

DRepresentation representation = representationContainer.getOwnedRepresentations().get(0); // experimentally..
DialectUIManager.INSTANCE.export(representation, session, Path.fromOSString(path + "testfile.svg"), new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.SVG), new NullProgressMonitor());


Like i've tried to describe, it currently even can't generate the diagram. The exceptions are thrown in the line

DRepresentation representation = dialectManager.createRepresentation("ProcessDiagram", eObject, repDescription, session, new NullProgressMonitor());
		representationContainer.getOwnedRepresentations().add(representation);


---- EDIT:

All needed bundles are listed as required bundles in my plugins dependencies.

[Updated on: Tue, 25 August 2015 14:07]

Report message to a moderator

Re: Compilation error for expression XYZ, headless mode [message #1706305 is a reply to message #1706302] Tue, 25 August 2015 14:27 Go to previous messageGo to next message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
first i will try to update my sirius plugin versions to 3.0. Then i will try to use the service interpreter instead of acceleo 3
Re: Compilation error for expression XYZ, headless mode [message #1706391 is a reply to message #1706305] Wed, 26 August 2015 14:14 Go to previous messageGo to next message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
The update to sirius 3 caused dependency problems to other bundles that i need. So i reverted the update. I've also cleaned up the model, so it doesn't uses any acceleo expressions nor java services..

It fails now during the image generation in the following line
DialectUIManager.INSTANCE.export(representation, session, Path.fromOSString("C:\\Users\\mkaraman\\Desktop\\testfile.svg"), new ExportFormat(
					ExportDocumentFormat.NONE, ImageFileFormat.SVG), new NullProgressMonitor());


How can i reach that the OffscreenEditPart will be used to generate it in headless mode, or are there any other ways to generate image in headless mode?

[Updated on: Wed, 26 August 2015 14:15]

Report message to a moderator

Re: Compilation error for expression XYZ, headless mode [message #1706469 is a reply to message #1706391] Thu, 27 August 2015 06:47 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi,

Your snippet code seems correct and it uses already OffscreenEditPart in
headless. Can you give more details on the failure?

Best Regards.

Le 26/08/2015 16:14, Emin M. a écrit :
> The update to sirius 3 caused dependency problems to other bundles that
> i need. So i reverted the update. I've also cleaned up the model, so it
> doesn't uses any acceleo expressions nor java services..
>
> It fails now during the creation in the line
> DialectUIManager.INSTANCE.export(representation, session,
> Path.fromOSString("C:\\Users\\mkaraman\\Desktop\\testfile.svg"), new
> ExportFormat(
> ExportDocumentFormat.NONE, ImageFileFormat.SVG),
> new NullProgressMonitor());
>
> How can i reach that the OffscreenEditPart will be used to generate it
> in headless mode, or are there any other ways to generate image in
> headless mode?



--
Esteban Dugueperoux - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Compilation error for expression XYZ, headless mode [message #1706472 is a reply to message #1706469] Thu, 27 August 2015 07:31 Go to previous messageGo to next message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
I think it didn't used the OffscreenEditPart.. so i have created the OffscreenEditPart with the help of its factory in the following way:

OffscreenEditPartFactory instance = OffscreenEditPartFactory.getInstance();
Shell shell = new Shell();
shell.open();

DiagramEditPart editPart = instance.createDiagramEditPart(diagram, shell);
layoutEditPart(editPart);
CopyToImageUtil copyImageUtil = new CopyToImageUtil();
copyImageUtil.copyToImage(editPart, Path.fromOSString(path + "testfile.svg"), ImageFileFormat.SVG, new NullProgressMonitor());
shell.dispose();


In this way it worked. Thank you for your help.
Re: Compilation error for expression XYZ, headless mode [message #1706490 is a reply to message #1706472] Thu, 27 August 2015 10:07 Go to previous messageGo to next message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
The problem with the expressions still appear. I found that the service class in the headless mode doesn't get load.. i am watching for breakpoint hits on the ServiceInterpreter's registerServiceClass and registerService methods, they get called in the normal runtime mode, but in headless mode these methods didn't get called. Is this a bug or do i have to trigger something manually?
Re: Compilation error for expression XYZ, headless mode [message #1706497 is a reply to message #1706490] Thu, 27 August 2015 11:18 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
By headless, you mean that your example is executed in OSGI environment?
There are some improvements on service interpreter with Sirius 3.0, what
are the dependencies issues you have when using Sirius 3.0?

Best Regards.

Le 27/08/2015 12:07, Emin M. a écrit :
> The problem with the expressions still appear. I found that the service
> class in the headless mode doesn't get load.. i am watching for
> breakpoint hits on the ServiceInterpreter's registerServiceClass and
> registerService methods, they get called in the normal runtime mode, but
> in headless mode these methods didn't get called. Is this a bug or do i
> have to trigger something manually?



--
Esteban Dugueperoux - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Compilation error for expression XYZ, headless mode [message #1706499 is a reply to message #1706497] Thu, 27 August 2015 11:53 Go to previous messageGo to next message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
Xtext 2.8.3 is what i need and during the update of Sirius eclipse wanted me to update xtext to 2.8.4.

Yes, with headless mode i mean a console version of eclipse, without the workbench ui..

[Updated on: Thu, 27 August 2015 12:11]

Report message to a moderator

Re: Compilation error for expression XYZ, headless mode [message #1706501 is a reply to message #1706499] Thu, 27 August 2015 12:21 Go to previous message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
I've found the problem and could solve it. For all others hwo encounter the same problem: I had to load the project bundle and trigger the import loading,

final IInterpreter interpreter = SiriusPlugin.getDefault().getInterpreterRegistry().getInterpreter(eObject);
interpreter.setProperty("files", Collections.singletonList("/" + PLUGIN_ID + "/" PATH_TO_ODESIGN_FILE));
InterpreterRegistry.prepareImportsFromSession(interpreter, SessionManager.INSTANCE.getSession(eObject));

[Updated on: Thu, 27 August 2015 12:22]

Report message to a moderator

Previous Topic:Using a Java Service in a TreeItemStyleDescription
Next Topic:Migrating representation files from Sirius 2 to Sirius 3
Goto Forum:
  


Current Time: Thu Mar 28 13:11:03 GMT 2024

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

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

Back to the top