Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325535 - [Doc] Tutorial not clear on adding sources to targets
Summary: [Doc] Tutorial not clear on adding sources to targets
Status: ASSIGNED
Alias: None
Product: AMP
Classification: Modeling
Component: General (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Miles Parker CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 325597
  Show dependency tree
 
Reported: 2010-09-16 18:34 EDT by Miles Parker CLA
Modified: 2010-09-22 13:12 EDT (History)
2 users (show)

See Also:


Attachments
StupidModel1 with compilation error in Bug.java (7.75 KB, application/octet-stream)
2010-09-22 02:17 EDT, Jonas Ruttimann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miles Parker CLA 2010-09-16 18:34:19 EDT
Section 4.2.5 needs improvement..

see:

http://eclipse.org/amp/documentation/amp.pdf
Comment 1 Miles Parker CLA 2010-09-16 18:35:39 EDT
original source: https://sourceforge.net/projects/ascape/forums/forum/731620/topic/3854156
Comment 2 Miles Parker CLA 2010-09-17 18:18:42 EDT
Note that we have control key instructions wrong for Windows. 

Ranier, if you could verify that the behavior is actually:

"Ctrl" for move and..
"Ctrl-Shift" for link

I'll change docs to reflect and save other users a lot of hassle.
Comment 3 Rainer Hilscher CLA 2010-09-17 21:44:12 EDT
wow ... this is interesting: you don't need any additional key at all!

Here's the most reliable way: grab the Intersection, drag it slowly over the Within Query until a link symbol appears (dragged Intersection is basically above the input line), let go of it ... basta, that's it :)

Rainer
Comment 4 Rainer Hilscher CLA 2010-09-17 21:53:19 EDT
I should have paid attention to the icon change in the first place ... it might make sense to mention this change ... provides people with recognizable feedback.

(In reply to comment #3)
> wow ... this is interesting: you don't need any additional key at all!
> 
> Here's the most reliable way: grab the Intersection, drag it slowly over the
> Within Query until a link symbol appears (dragged Intersection is basically
> above the input line), let go of it ... basta, that's it :)
> 
> Rainer
Comment 5 Miles Parker CLA 2010-09-20 19:54:40 EDT
Jonas,

Would you mind just confirming this behavior? I'm not sure exactly how to write this up in a clear way for windows users that will be correct for all cases..

Miles
Comment 6 Jonas Ruttimann CLA 2010-09-21 11:24:48 EDT
(In reply to comment #5)

Hi Miles,
When stepping through the tutorial, I can get as far as 4.2.3.2. But then I get a Java compilation error in StupidModel.java: "StupidModel.Bug cannot be resolved to a type"

And here's the type cast that cannot be compiled:

bugScape.addInitialRule(new Rule("Initialize") {
	private static final long serialVersionUID = 6846144446402098982L;
	public void execute(Agent a) {
		((StupidModel.Bug) a).intializeNonFramework();
	}
});

Have I missed anything when following the tutorial?
Comment 7 Rainer Hilscher CLA 2010-09-21 11:34:38 EDT
Jonas,

you must have ... I can successfully complete the tutorial until I hit 4.2.5 ... I'll try to  figure out what you have missed later today.

Rainer

bugScape.addInitialRule(new Rule("Initialize") {
			private static final long serialVersionUID = 6846144446402098982L;
			public void execute(Agent a) {
				((org.me.StupidModel.Bug) a).intializeNonFramework();
			}
		});
		bugScape.addRule(new Rule("Bug Rule") {
			private static final long serialVersionUID = 6846144446402098981L;
			public void execute(Agent a) {
				((org.me.StupidModel.Bug) a).bugRule();
			}
		});

(In reply to comment #6)
> (In reply to comment #5)
> 
> Hi Miles,
> When stepping through the tutorial, I can get as far as 4.2.3.2. But then I get
> a Java compilation error in StupidModel.java: "StupidModel.Bug cannot be
> resolved to a type"
> 
> And here's the type cast that cannot be compiled:
> 
> bugScape.addInitialRule(new Rule("Initialize") {
>     private static final long serialVersionUID = 6846144446402098982L;
>     public void execute(Agent a) {
>         ((StupidModel.Bug) a).intializeNonFramework();
>     }
> });
> 
> Have I missed anything when following the tutorial?
Comment 8 Jonas Ruttimann CLA 2010-09-21 11:40:26 EDT
Oh... wait. I found what's causing the compilation error. The MetaABM file should not be called the same as the project name!

Actually, in the tutorial the screenshots show a MetaABM file named "StupidModel1.metaabm". But in section 4.2.1.4 the name "StupidModel.metaabm" is proposed. So this should be changed!
Comment 9 Jonas Ruttimann CLA 2010-09-21 11:51:21 EDT
Section 4.2.4.1 should be changed as well. In the trunk version from the CVS, a default Style is being added to the Agent. So creating a Style Rule is not necessary. Instead the user should change default Style behavior.
Comment 10 Jonas Ruttimann CLA 2010-09-21 11:56:43 EDT
In section 4.2.5 I can achieve the drag&drop interaction by pressing CTRL+SHIFT at the same time. Pressing only CTRL will lead to a number of copies of the Intersection.


I still get compilation errors in Bug.java ("duplicate local variable bugCopy").

public void bugRule() {
	Object bugCopy = (Object) ((org.ascape.model.space.Discrete) getStupidModel1()
			.getGrid2D().getSpace()).findRandomAvailable();
	if (bugCopy != null) {
		Object bugCopy = (Object) ((org.ascape.model.space.Discrete) getStupidModel1()
				.getGrid2D().getSpace()).findRandomWithin(
				((org.ascape.model.CellOccupant) this).getHostCell(),
				false, bugCopy.getStupidModel1().getBugVision());
		if (bugCopy != null) {
		}
	}
}
Comment 11 Miles Parker CLA 2010-09-21 15:20:29 EDT
(In reply to comment #8)
> Actually, in the tutorial the screenshots show a MetaABM file named
> "StupidModel1.metaabm". But in section 4.2.1.4 the name "StupidModel.metaabm"
> is proposed. So this should be changed!

OK, done.
Comment 12 Miles Parker CLA 2010-09-21 15:21:45 EDT
(In reply to comment #10)
> In section 4.2.5 I can achieve the drag&drop interaction by pressing CTRL+SHIFT
> at the same time. Pressing only CTRL will lead to a number of copies of the
> Intersection.

What about pressing nothing for linking, as Rainer suggested...does that work?

> 
> 
> I still get compilation errors in Bug.java ("duplicate local variable
> bugCopy").
> 
> public void bugRule() {
>     Object bugCopy = (Object) ((org.ascape.model.space.Discrete)
> getStupidModel1()
>             .getGrid2D().getSpace()).findRandomAvailable();
>     if (bugCopy != null) {
>         Object bugCopy = (Object) ((org.ascape.model.space.Discrete)
> getStupidModel1()
>                 .getGrid2D().getSpace()).findRandomWithin(
>                 ((org.ascape.model.CellOccupant) this).getHostCell(),
>                 false, bugCopy.getStupidModel1().getBugVision());
>         if (bugCopy != null) {
>         }
>     }
> }

Could you attach (just) the .metaabm file?
Comment 13 Miles Parker CLA 2010-09-21 15:23:46 EDT
BTW, I"ve added information on wiki about how to edit and submit documentation directly. ;) http://wiki.eclipse.org/AMP/Building
Comment 14 Rainer Hilscher CLA 2010-09-21 20:45:33 EDT
something I noted several times:

deleting elements in the .metaabm file does not properly roll back the file to its previous state.

For example, I just generated an error with the Within query(rooted it on Available instead on Next Location). Deleting Within does not return the metaabm file to its error free state.

Rainer
Comment 15 Miles Parker CLA 2010-09-21 21:41:28 EDT
(In reply to comment #14)
> something I noted several times:
> 
> deleting elements in the .metaabm file does not properly roll back the file to
> its previous state.
> 
> For example, I just generated an error with the Within query(rooted it on
> Available instead on Next Location). Deleting Within does not return the
> metaabm file to its error free state.

Rainer, please enter a separate bug for this. Do you mean "deleting" or "cutting"? There is a crucial difference there.
Comment 16 Jonas Ruttimann CLA 2010-09-22 02:17:20 EDT
Created attachment 179354 [details]
StupidModel1 with compilation error in Bug.java

(See comment #10)
Comment 17 Jonas Ruttimann CLA 2010-09-22 02:26:29 EDT
(In reply to comment #12)
> What about pressing nothing for linking, as Rainer suggested...does that work?

Dragging slowly without pressing a key does not change anything. (Still, this is Windows 7.)

Oh... think I found it!
When pressing ALT while dragging I can see the mouse cursor changing. Same icon as with CTRL+SHIFT. But it does not seem to have the same affect.

Pressing the ALT key seems to be doing what we're looking for! Haven't tested the functionality. Just visually in the editor.
Comment 18 Jonas Ruttimann CLA 2010-09-22 02:30:29 EDT
(In reply to comment #17)
And me once again...
Yes, after all I think ALT and CTRL+SHIFT do the same thing. It's just absolutely relevant to press SHIFT *before* you press CTRL. Otherwise you'll end up with lots of copies of the Intersection.
Comment 19 Rainer Hilscher CLA 2010-09-22 09:53:53 EDT
I ran through the tutorial yesterday again ... and again I was able to just drag the Intersection to create the double input ... also no copies were generated. Still, the metaabm file was buggy (not the generated code).

I am on XP with latest Eclipse and latest nightly AMP build and Java 1.6_20

Is it possible that different configurations cause different behaviors? Might it make sense to test certain reference configurations? ... only if tis tutorial has wider implications for the code base of AMP.

Rainer 

(In reply to comment #18)
> (In reply to comment #17)
> And me once again...
> Yes, after all I think ALT and CTRL+SHIFT do the same thing. It's just
> absolutely relevant to press SHIFT *before* you press CTRL. Otherwise you'll
> end up with lots of copies of the Intersection.
Comment 20 Miles Parker CLA 2010-09-22 13:12:31 EDT
> 
> > (In reply to comment #17)
> > Yes, after all I think ALT and CTRL+SHIFT do the same thing. It's just
> > absolutely relevant to press SHIFT *before* you press CTRL. Otherwise you'll
> > end up with lots of copies of the Intersection.

That is completely bizarre about needing to do "SHIFT" and then "CTRL". Just the kind of thing that I'd love (not) to have to explain in the docs.

(In reply to comment #19)
> I ran through the tutorial yesterday again ... and again I was able to just
> drag the Intersection to create the double input ... also no copies were
> generated. Still, the metaabm file was buggy (not the generated code).
> 
> I am on XP with latest Eclipse and latest nightly AMP build and Java 1.6_20
> 
> Is it possible that different configurations cause different behaviors? Might
> it make sense to test certain reference configurations? ... only if tis
> tutorial has wider implications for the code base of AMP.

It would be really not good if a plain old drag actually did a link. That would mean that there is no effective way to move anything!

This is actually quite complex 0- Eclipse maps actual keyboard keys such as ctrl, Mac Command, alt, option and so on to M1, M2, M3, etc.. these are specified in SWT. Then those in turn are mapped to SWT DnD values, which then end up being interpreted by EMF framework and customized by the AMF editor. Theoretically, a Windows "alt" should be a Mac "option", i.e. copy I'd think, and a Windows "Ctrl" should be a Mac "Command". But its not clear what a Mac "Ctrl" maps to! That's why I used Ctrl-Shift. But I think that something is getting invoked that should not be getting invoked.

But I think we have a situation where we are not getting the same behavior from XP as we do with Windows 7. Now, that would be a surprise. I'm trying to think of someway to test this behavior outside of AMP. I can't think of any other EMF editor off hand which uses the link behavior. I'll check bugs and see if I can find anything about this. Worst case I think we'd actually need a test case that demonstrated different behavior for XP and SWT to give to someone else to take a look at.