Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Add OCL Console View to perspective(About creating a new perspective and add the OCL console view)
icon3.gif  Add OCL Console View to perspective [message #641142] Wed, 24 November 2010 12:15 Go to next message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hello everyone,

I just wrote a little Eclipse plugin to create my own, personalized Eclipse perspective. Everything ok so far, I can use it and it shows exactly how I want.

I was wondering if I can add the OCL console view to this new perspective. I installed OCL for Eclipse and then I downloaded the OCL binaries from here.

Then, in the plugin which I built for creating a new Eclipse perspective, in the class which implements IPerspectiveFactory, I want to add the OCL console view, let's say in the lower part of the window, under the editor (just where the normal console would be).

Example:
layout.addView(
	ID_VIEW,
	IPageLayout.BOTTOM,
	0.65f,
	editorArea);


where ID_VIEW is a string, which uniquely identifies the view. Well, here's my question: what is the ID of the OCL Console view? I'm looking for something like "org.eclipse.ocl. ... . OCLConsoleView" or similar.

I looked at the org.eclipse.ocl.examples.interpreter.console.* package, which seemed interesting (especially the classes OCLConsolePage and OCLConsoleFactory). But It didn't work.

Any ideas? Thanks!

[Updated on: Wed, 24 November 2010 12:16]

Report message to a moderator

Re: Add OCL Console View to perspective [message #641154 is a reply to message #641142] Wed, 24 November 2010 12:45 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Darie

I'm afraid that you now know more about this than me. I've configured
Console views in perspectives but not sub-consoles.

If you find that we should have provided an ID please submit a bugzilla.

Regards

Ed Willink

On 24/11/2010 12:15, Darie wrote:
> Hello everyone,
>
> I just wrote a little Eclipse plugin to create my own, personalized
> Eclipse perspective. Everything ok so far, I can use it and it shows
> exactly how I want.
>
> I was wondering if I can add the OCL console view to this new
> perspective. I installed OCL for Eclipse and then I downloaded the OCL
> binaries from http://www.eclipse.org/modeling/mdt/downloads/?project=ocl
> Then, in the plugin which I built for creating a new Eclipse
> perspective, in the class which implements IPerspectiveFactory, I want
> to add the OCL console view, let's say in the lower part of the
> window, under the editor (just where the normal console would be).
>
> Example:
> layout.addView(
> ID_VIEW,
> IPageLayout.BOTTOM,
> 0.65f,
> editorArea);
>
> where ID_VIEW is a string, which uniquely identifies the view. Well,
> here's my question: what is the ID of the OCL Console view? I'm
> looking for something like "org.eclipse.ocl. ... . OCLConsoleView" or
> similar.
> I looked at the org.eclipse.ocl.examples.interpreter.console.*
> package, which seemed interesting (especially the classes
> OCLConsolePage and OCLConsoleFactory). But It didn't work.
>
> Any ideas? Thanks!
>
Re: Add OCL Console View to perspective [message #641156 is a reply to message #641154] Wed, 24 November 2010 12:59 Go to previous messageGo to next message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hi Edward,

thanks for your reply. So, there's no ID mentioned anywhere? I'm now wondering where I could look to see how THEY call the OCL Console and add it as a view, when you go to the menu bar and choose "Show OCL console". Weird.

Anyway, I think I must digg deeper into the sources of the OCL libraries, to see if there is any view that I could add.

Any other help is appreciated. Thanks again, Edward.
Re: Add OCL Console View to perspective [message #641277 is a reply to message #641156] Wed, 24 November 2010 17:09 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Darie

This isn't initially an OCL problem.

In my workspace I have 5 Console views.

If you find out how to, for instance, add the CVS console view, the same
approach should work for OCL.

Regards

Ed Willink

On 24/11/2010 12:59, Darie wrote:
> Hi Edward,
>
> thanks for your reply. So, there's no ID mentioned anywhere? I'm now
> wondering where I could look to see how THEY call the OCL Console and
> add it as a view, when you go to the menu bar and choose "Show OCL
> console". Weird.
> Anyway, I think I must digg deeper into the sources of the OCL
> libraries, to see if there is any view that I could add.
> Any other help is appreciated. Thanks again, Edward.
Re: Add OCL Console View to perspective [message #642205 is a reply to message #641277] Tue, 30 November 2010 11:55 Go to previous messageGo to next message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hi Edward,

thank you again for your reply.
I took a look into the plugin org.eclipse.emf.ecore.editor and I found some interesting stuff, which can lead to the answer of my initial question. For example, I found the code where the plugin adds to the main menu of Eclipse the menu contribution "Sample Reflective Editor". If I click on this menu, one of the menu items is "Show OCL console", which does just what I want - adds the OCL console view to the current perspective.

I'm wondering how I could use the class EcoreEditorPlugin, because I think there is a hidden ID for the OCL console view too.

For example, I found the following lines of code:

EcoreEditorPlugin.INSTANCE.getString("_UI_Information_title")


Could there be an ID to invoke the OCL console something like
EcoreEditorPlugin.INSTANCE.getString("...OCL_Console_View")
?


Or:

return new MenuManager(EcoreEditorPlugin.getPlugin().getString("_UI_ReflectiveEditor_menu"), "org.eclipse.emf.ecoreMenuID");


Maybe the ID of the OCL console is somewhere in org.eclipse.emf. But how can I find it? Any ideas?

I tried printing all the IDs in the workspace, but I'm stuck at this moment.

Any help is appreciated. Thank you.
Re: Add OCL Console View to perspective [message #642293 is a reply to message #642205] Tue, 30 November 2010 17:19 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Darie

Your reports refresh some brain cells. I could have been more helpful.

EcoreEditorPlugin is misleading. It is not part of the OCL release,
since it supports tree editing of OCL ASTs that is really not very
useful, and can can be done reflectively if really needed. A getString
is not the right place to look. getString is usually for strings that
need translation between languages. The Console ID does not need
translation.

The "Show OCL console" menus are contributed by the OCL Interpreter
plugin: org.eclipse.ocl.examples.interpreter. You want to look at
plugin.xml and
org.eclipse.ocl.examples.interpreter.actions.ShowConsoleDele gate to see
how a Console is created. The OCLConsoleFactory seems to be registered
the same sa CVS/PDE/JDT consoles, so there seems to be only a label and
no ID. It seems that new OCLConsoleFactory().openConsole() is the
preferred way.

Regards

Ed Willink

On 30/11/2010 11:55, Darie wrote:
> Hi Edward,
>
> thank you again for your reply.
> I took a look into the plugin org.eclipse.emf.ecore.editor and I found
> some interesting stuff, which can lead to the answer of my initial
> question. For example, I found the code where the plugin adds to the
> main menu of Eclipse the menu contribution "Sample Reflective Editor".
> If I click on this menu, one of the menu items is "Show OCL console",
> which does just what I want - adds the OCL console view to the current
> perspective.
>
> I'm wondering how I could use the class EcoreEditorPlugin, because I
> think there is a hidden ID for the OCL console view too.
> For example, I found the following lines of code:
> EcoreEditorPlugin.INSTANCE.getString("_UI_Information_title ")
>
> Could there be an ID to invoke the OCL console something like
> EcoreEditorPlugin.INSTANCE.getString("...OCL_Console_View")?
>
>
> Or:
>
> return new
> MenuManager(EcoreEditorPlugin.getPlugin().getString("_UI_ReflectiveEditor_menu "),
> "org.eclipse.emf.ecoreMenuID");
>
> Maybe the ID of the OCL console is somewhere in org.eclipse.emf. But
> how can I find it? Any ideas?
>
> I tried printing all the IDs in the workspace, but I'm stuck at this
> moment.
>
> Any help is appreciated. Thank you.
>
Re: Add OCL Console View to perspective [message #642430 is a reply to message #642293] Wed, 01 December 2010 10:19 Go to previous messageGo to next message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hi Edward,

thank you for your hints. I found the things you were talking about, and tried to add the OCL console to the Console View automatically. Unfortunately without any success.

Here's what I tried:

IConsoleFactory factory = new OCLConsoleFactory();
factory.openConsole();


Didn't work.

OCLConsole console = OCLConsole.getInstance();
		
IConsoleManager mgr = ConsolePlugin.getDefault().getConsoleManager();
		
// must do this twice due to a bug in the Console API
mgr.showConsoleView(console);
mgr.showConsoleView(console);


Didn't work either.

OCLConsole console = OCLConsole.getInstance();
console.activate();


Same result. No OCL console...

It seems to me that there is no way (or I somehow missed it) to *automatically* add the OCL console to the Console View when Eclipse starts. I tried creating a perspective by hand (by adding views and placing them with drag and drop wherever I want) and then saving it from the main menu (Window -> Save perspective As...). This does not help either. The perspective retains all the views and their positions in the window, but cannot, for example, remember which were my open consoles in the console view, at the point I saved the perspective.

My guess was initially that I can force Eclipse to save the workbench "as-it-is", with all the open consoles. Well, this does not work. If I close the saved perspective and open it again, the ocl console view is successfully added automatically to the console view. But: if I restart Eclipse and open my perspective, Eclipse successfully loads my saved perspective and adds the console view, but does not show any consoles in it (OCL, CVS, SVN ...). I then have to open it manually, by clicking Open console -> Interactive OCL. That was the thing I wanted to avoid. Not a big deal to do some extra clicks, I know. Smile

I'm kind of busy right now with some other aspects of OCL, so I cannot invest more time in this matter at the moment. But as soon as I have more time for this, I'll come back with ideas or, hopefully, a solution. If there is one Rolling Eyes

Best Regards,

Darie
Re: Add OCL Console View to perspective [message #642550 is a reply to message #642430] Wed, 01 December 2010 18:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Darie
>
> It seems to me that there is no way (or I somehow missed it) to
> *automatically* add the OCL console to the Console View when Eclipse
> starts.
Eclipse start up goes through a variety of stages. You are perhaps
putting code in too soon, or too late.

One late option is to activate the console from the startup of a plugin
that is configured to always start.

Regards

Ed Willink
Re: Add OCL Console View to perspective [message #643521 is a reply to message #641142] Tue, 07 December 2010 09:05 Go to previous message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hm, that is an interesting idea. I'll think about it Wink

Thank you very much!
Previous Topic:Question to OCL-expression used in EMF Query
Next Topic:extend OCL String Operation by contains - need help
Goto Forum:
  


Current Time: Fri Apr 19 22:12:30 GMT 2024

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

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

Back to the top