Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Mylyn Intent » How can I synchronize Java code with Intent ?
How can I synchronize Java code with Intent ? [message #755666] Wed, 09 November 2011 09:11 Go to next message
Alex Lagarde is currently offline Alex LagardeFriend
Messages: 193
Registered: May 2010
Senior Member

This conversation has been started by Andy Dunkel in this post http://www.eclipse.org/forums/index.php/t/261682/ .

Andy asked us what was the syntax to define JavaCode inside Modeling fragments (the "@M...M@" parts of the Intent document).

Here is a copy of my answer :
==============================================================
Hi Andy,

the tutorial explains how to synchronize any model with your doc. To
synchronize any other technical artifact (javaClasses, MANIFEST.MF
files, code examples on the Internet...), Intent uses pluggable
synchronization bridges, that are in charge of computing a model out of
concrete artifacts like java files(see
http://www.eclipse.org/intent/pages/transcripts/2011_EclipseConEurope/img18.html).

I wrote very quickly a basic synchronization bridge that allows to
synchronize java test projects. I'll soon work on a more generic
synchronization bridge, that allows to document any java file. Writing a
new synchronization bridge is quite easy, and I'll work hard to make it
as straighforward as possible.

Would you explain to me how do you want to represent java files in your
use case ? I explain myself : I'll have to write a metamodel to
represent a plugin with its java files.

If I define the metamodel as below :
- a JavaPlugin contains JavaClasses
- a JavaClass contains Method

You could write inside Intent :
Section {
	Specifications of the Intent RCP Plugin

	The prupose of the Intent RCP Plugin is to... It has been defined to 
fulfill requirements definined in @see "1.2 Project requirements".

	@M
		new Plugin intentRCPPlugin {
			qualifiedName = "com.da.intent.rcp";
		};
	M@

}
Section {
	Implementation of the RCP Plugin

	We define inside the IntentRCPPlugin the SquareRoot class to represent.....
	@M
    	intentRCPPlugin {
		classes += new JavaClass SquareRoot {
			methods += new Method getChildren{};
		};
    	}
	M@
}


But you have many other ways to represent a plugin, freeying you from
your physical structure.

Let's say I add to the metamodel defined previously the following
concepts :
- A Software contains Features
- A Software contains Plugin
- Each JavaClass should be at least associated to a feature

This will add many useful informations : by reading the doc you could
say by looking this fragment :
	SquareRoot {
		relatedFeatures += [drawSquares, persistency];
	}


You understand that the SquareRoot class has been defined to ensure 2
different features. That's an information that could be hard to get from
the code or javadoc, in which you're often missing the big picture. What
is more, Intent will allows you to to plugin custom validation rules
like "Any javaClass of my plugin should be associated to at least one
Feature" or "Any feature should be covered by at least one Test".

To have an example of how can Intent synchronize JavaCode and check
custom validation rules, I invite you to check this demo
http://www.eclipse.org/intent/pages/transcripts/2011_EclipseConEurope/img22.html
..

So I'll be glad that you give me your opinion on what could be the best
way for you to represent eclipse plugin & java files. Be sure that I
will take this opinion into account when writing the Java
synchronization bridge. I've got some tasks to do first (documentation
export for example), but I'll keep you in tuch.

Thanks a lot for your interest in Intent, there's a lot to do to make
the project work in all usecases but the core & architecture have been
wrote for this purpose Smile

Cheers,
Alex

[Updated on: Wed, 09 November 2011 10:58]

Report message to a moderator

Re: How can I synchronize Java code with Intent ? [message #755865 is a reply to message #755666] Wed, 09 November 2011 21:38 Go to previous messageGo to next message
Andy Dunkel is currently offline Andy DunkelFriend
Messages: 6
Registered: November 2011
Junior Member
Hi,

thanks Alex for your response. I will try this out and give you more feedback later.

I am not sure want I want to achieve exactly at the moment. Currently its just trying out new technology.
So no need for you to hurry anything. Smile

For the moment its simple, I want that Intent notifies me about changes in classes and methods.

When you write about the synch bridge. I installed the first Intent 0.7 first build. Is the bridge included there?
When I try your example code it says "The entity Plugin cannot resolved."

Andy



Re: How can I synchronize Java code with Intent ? [message #756023 is a reply to message #755865] Thu, 10 November 2011 13:56 Go to previous messageGo to next message
Alex Lagarde is currently offline Alex LagardeFriend
Messages: 193
Registered: May 2010
Senior Member

Hi Andy,

the syntax I presented in my previous message was just a proposition and
is not yet implemented (although it would not take much time).

For now on, you can synchronize javacode as shown in this demo
http://www.eclipse.org/intent/pages/transcripts/2011_EclipseConEurope/img22.html
.. This synchronization bridge represent all java files as JUnit tests.

Basically you have to do two things :

1. Define your test project inside the Intent document and fill it with
tests

Section {
	Testing strategy for my Software

	All the tests are in the following test project :
	@M
		new Project myTestProject {
			id = "com.my.software.tests";
		}
	M@
}
Section {
	Parser related tests

	The following tests have been written to test the parser :
	@M
	myTestProject {
		acceptanceTests += new AcceptanceTest {
			swtBotClassName = "TestParserScalability";
			package = "parser.scalability";
		};
	}
	M@

}


2. Map this testProject with a physical technical artifact (here your
java plugin). The resource URI allows you to ignore some java files of
your plugin thanks to regular expressions :
URI = retro:/ [plugin name] (optionnal : / file_regexp)

@M
	Resource myTestPlugin {
		URI = "retro:/com.my.software.tests/*tests.parser*";
		content += myTestProject;
	}
M@


When you will add a new test inside the java plugin, you'll get a
synchronization issue. If you define a new test in your Intent document,
you'll also get a synchronization issue.

Notice that this is just an example, basically we can represent java
files in many many ways, I'll have to propose off-the-shell
synchronizers that fit the community needs.

By the way, we're fixing issues and develop new features on Intent,
available through the nightly builds
https://hudson.eclipse.org/hudson/job/mylyn-docs-intent-0.7-nightly/ .
In the latest, you will be able to test textile export to LaTeX and nice
rendered HTML :)

Cheers,
Alex
Re: How can I synchronize Java code with Intent ? [message #756371 is a reply to message #755666] Sat, 12 November 2011 13:30 Go to previous messageGo to next message
Andy Dunkel is currently offline Andy DunkelFriend
Messages: 6
Registered: November 2011
Junior Member
Hi,

Alex, thanks, I will try that out. I will also have a look to the nightly builds.

Andy
Re: How can I synchronize Java code with Intent ? [message #1009153 is a reply to message #756371] Thu, 14 February 2013 14:59 Go to previous message
Alex Lagarde is currently offline Alex LagardeFriend
Messages: 193
Registered: May 2010
Senior Member

Hi Andy,

just to let you know that a Java Bridge for Intent will be available in
the next milestone. Meanwhile, you can test it using the latest Intent
build
https://hudson.eclipse.org/hudson/job/mylyn-docs-intent-0.7-nightly/lastSuccessfulBuild/artifact/features/org.eclipse.mylyn.docs.intent.update/target/org.eclipse.mylyn.docs.intent.update.zip

Just drop a Java file/class/method/field in your Intent document, and
Intent will;
- add automatically a reference to your java file
- display an image providing an overview of this java element (see
https://dl.dropbox.com/u/25353760/work/java_sync_with_Intent.png )

When you make change on this java file, Intent will as always detect
that a desynchronization occured, and will place synchronization markers
in the documentation the appropriate location.

Notice that by ctrl-clicking (or using F3) on inside your document, a
java editor will be opened on the appropriate file, selecting the
synchronized class/method/field.

I'm interested in any feedback you may have, this is still a work in
progress.

Best regards,
Alex
Le 12/11/2011 14:30, Andy Dunkel a écrit :
> Hi,
>
> Alex, thanks, I will try that out. I will also have a look to the
> nightly builds.
>
> Andy
Previous Topic:Connecting Java ..
Next Topic:Intents breaking JDT code coloring?
Goto Forum:
  


Current Time: Thu Mar 28 20:37:50 GMT 2024

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

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

Back to the top