Home » Modeling » Graphiti » First Editor
| |
Re: First Editor [message #727575 is a reply to message #727146] |
Wed, 21 September 2011 14:43 |
Soeren M Messages: 77 Registered: September 2011 |
Member |
|
|
At first, thanks
But thats just that is my problem, how should I open an editor wich doesnt exist?
I just wrote the .java files and wrote everything I need into the plugin.xml.
So if I start a second instance of eclipse, what should I do?
I create a sample project, from the examples, I create in that project a diagram file, from the examples and now? Its everything from the example editor, and nothing from my own editor.
If I create in my developing eclipse a diagram file from the wizard, how should I open it? There is, in my opinion, no way to open it and nowhere in the tutorial is that explained.
Edit: Maybe I read the word "editor" it too often, I suggest you mean the following:
create a diagram file in the developing eclipse, open a new instance and open the diagram via File->Open File.
I did that, but it throws an exception:
Unable to create editor ID org.eclipse.graphiti.ui.editor.DiagramEditor: Unknown editor input: org.eclipse.ui.ide.FileStoreEditorInput@5797c16c
I think the stacktrace is not necessary.
I hope you can help me again.
[Updated on: Wed, 21 September 2011 15:05] Report message to a moderator
|
|
|
Re: First Editor [message #727610 is a reply to message #727575] |
Wed, 21 September 2011 16:05 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
mr_sniper wrote on Wed, 21 September 2011 11:43
create a diagram file in the developing eclipse, open a new instance and open the diagram via File->Open File.
I did that, but it throws an exception:
Unable to create editor ID org.eclipse.graphiti.ui.editor.DiagramEditor: Unknown editor input: org.eclipse.ui.ide.FileStoreEditorInput@5797c16c
To clarify: we have the "first" eclipse instance ("developing eclipse") and the "second " eclipse instance (the one started from our first one). Each instance has its own workspace, so you can't (well, you should't) create the diagram in the first and try to open from the second - because the graphiti editor expects to see its input in its running workspace [1]
So, you should test the full workflow (create a new diagram, open the editor) in the "second" instance.
First try it with the tutorial [2] diagram type (.diagram) and the standard Graphiti editor (DiagramEditor).
If this works for you, please clarify what you want to do:
In a first scenario the graphiti developer defines its own diagramtype, (extension "org.eclipse.graphiti.ui.diagramTypes") and provider ("org.eclipse.graphiti.ui.diagramTypeProviders") and code the Features.
In this scenario, you will edit "your" diagram, with all your defined ui elements, behaviours etc (totally different from the tutorial). You can call this "your editor" (as different from the tutorial), though it actually it's the same defined editor in the graphiti plugin.xml , with same default extension and same underlying Java class (DiagramEditor).
In a second scenario, you can add you own editor definition (extension point "org.eclipse.ui.editors" in your plugin.xml), so you have your own name for the editor (appears in the menus, "open with..."), icon, default extension, etc, but using the same graphiti DiagramEditor java class.
In a third scenario you can code your own editor (extending DiagramEditor). This is less needed and frequent, I think, and not much supported by Graphiti today.
I suspect that when you speak of "your editor" you are alluding to scenario 1, (your own diagramtype/provider, actually).
Then, what matters is that, when the diagram is created, it is created with "your" diagramType id (you can check it reading the xml source; look for the tag <pi:Diagram...> ). If that is so, the when you click on it it will open what you call "your editor" (actually, graphiti default editor; he will discover the typediagram and use "your" diagramTypeProvider, etc)
[1] I'm not sure if this prohibition is justified, and if that expection is kind of a bug, but nevertheless...
[2] Actually, the diagram type with its extension and its association with the DiagramEditor is specified not in the tutorial plugings but in the core graphiti plugin (I wonder if this is right...)
[Updated on: Wed, 21 September 2011 16:19] Report message to a moderator
|
|
|
Re: First Editor [message #728961 is a reply to message #727610] |
Sat, 24 September 2011 15:18 |
Soeren M Messages: 77 Registered: September 2011 |
Member |
|
|
Hey
thank you again, now it works, a bit -.-
I dont want to say it, but I think I have to, I tried it with a new instance of eclipse, wich Ive opened by myself.
Ive never tried to start it out of the working eclipse -> couldnt test my own editor.
And I had a fault in my plugin.xml.
Next issue is, if I create a new diagram, there is no EClass in the menu.
So I couldnt create anything.
The only thing I get is an exception:
Contributor mytutorial.PropertyContributor cannot be created.
I looked it up and found it in the tutorial.
But now, I got no object and no exception, it happens nothing.
I am sorry, I realy try to make this tutorial and just want to test Graphiti, but until now, it wont let me.
Maybe my plugin.xml is wrong?
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.graphiti.ui.diagramTypes">
<diagramType
id="mytutorial.MyTutorialDiagramType"
name="My Graphiti Tutorial Diagram Type"
type="mytutorial">
</diagramType>
</extension>
<extension
point="org.eclipse.graphiti.ui.diagramTypeProviders">
<diagramTypeProvider
class="Graphiti.MyTutorialDiagramTypeProvider"
id="mytutorial.MyTutorialDiagramTypeProvider"
name="My tutorial editor Test">
<diagramType
id="mytutorial.MyTutorialDiagramType">
</diagramType>
</diagramTypeProvider>
</extension>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
<propertyContributor contributorId="mytutorial.PropertyContributor">
<propertyCategory category="Graphiti">
</propertyCategory>
</propertyContributor>
</extension>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
<propertyTabs contributorId="mytutorial.PropertyContributor">
<propertyTab label="Main" category="Graphiti"
id="graphiti.main.tab">
</propertyTab>
</propertyTabs>
</extension>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertySections">
<propertySections contributorId="mytutorial.PropertyContributor">
<propertySection tab="graphiti.main.tab"
class="Graphiti.MyTutorialEClassSection"
filter="Graphiti.MyTutorialEClassFilter"
id="graphiti.main.tab.emfclass">
</propertySection>
</propertySections>
</extension>
</plugin>
[Updated on: Sat, 24 September 2011 15:18] Report message to a moderator
|
|
| | |
Re: First Editor [message #730411 is a reply to message #729912] |
Wed, 28 September 2011 10:51 |
Soeren M Messages: 77 Registered: September 2011 |
Member |
|
|
Yes, indeed.
Jörg had already told me that I have to add this.
I was confused by the picture below the tutorial, because that already has a EClass.
Thanks anyway.
Next question:
In the tutorial is this line of code:
String newClassName = ExampleUtil.askString(TITLE, USER_QUESTION, "");
In wich library is ExampleUtil?
[Updated on: Wed, 28 September 2011 11:04] Report message to a moderator
|
|
| | | |
Re: First Editor [message #757306 is a reply to message #731930] |
Thu, 17 November 2011 16:00 |
Soeren M Messages: 77 Registered: September 2011 |
Member |
|
|
Hernan wrote on Mon, 03 October 2011 09:57Soeren wrote on Sun, 02 October 2011 10:20Last try, to see if this forum is usefull -.-'
Well, that comment is certainly not useful.
Thats right and I am sorry about it.
I worked on my editor daily and couldnt wait for an answer...
Hernan wrote on Mon, 03 October 2011 09:57
Quote:
Next line wich is not explained in the Tutorial is:
boxAnchor.setReferencedGraphicsAlgorithm(roundedRectangle);
This is in TutorialAddEClassFeature.java, looks inconsistent to me, because roundedRectangle is declared outside of
public PictogramElement add(IAddContext context) { ... }
Uh? That does not make sense. Read again (the method and your question).
Maybe I havent explained it well enough.
In "Add Connection Feature" - "Anchors", we have to add
boxAnchor.setReferencedGraphicsAlgorithm(roundedRectangle);
But in my point of view ( and Eclipse says that also ), we couldnt use "roundedRectangle".
The class ExampleUtil ("Create Feature") isnt available as well.
I had to ask for it and got the hint to look into your SVN.
Sören
|
|
| | | | | | | | | |
Re: First Editor [message #776144 is a reply to message #774748] |
Sat, 07 January 2012 16:16 |
Soeren M Messages: 77 Registered: September 2011 |
Member |
|
|
If I have three EClasses and it looks like this:
(Spaces have been deleted, i used dots instead.)
_____________
|..__......__ .....|
|.|__|->|__|....|
|_____________|
The arrow points to the other inner EClass.
Now I take the arrow and point him on the parent EClass, in my point of view the canAdd function
in the AddConnectionFeature has to be called or the canCreate in the CreateArrowFeature, but this never happens?
I want to check it, because sometimes I want to disallow that.
[Updated on: Sat, 07 January 2012 16:21] Report message to a moderator
|
|
| | | | | | | | | | | |
Re: First Editor [message #811386 is a reply to message #727042] |
Fri, 02 March 2012 09:33 |
Soeren M Messages: 77 Registered: September 2011 |
Member |
|
|
Maybe I am wrong, but that:
public void refresh() {
PictogramElement pe = getSelectedPictogramElement();
if (pe != null) {
Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
// the filter assured, that it is a EClass
if (bo == null)
return;
String name = ((EClass) bo).getName();
nameText.setText(name == null ? "" : name); //$NON-NLS-1$
}
}
looks like the same, isnt it?
The only difference is that this method use an EClass.
Edit: I tried it with an EClass and it works, the only difference is the decorator.
What I can imagine is that I cant write into a decorator like I tried it...
[Updated on: Fri, 02 March 2012 10:06] Report message to a moderator
|
|
| | | | | | | |
Goto Forum:
Current Time: Tue Sep 24 00:06:13 GMT 2024
Powered by FUDForum. Page generated in 0.06576 seconds
|