Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » how do i set an orientation specifically to views and editors? (wanting to selectivlyh set orientation for views and editors.)
icon5.gif  how do i set an orientation specifically to views and editors? [message #519112] Sat, 06 March 2010 12:05 Go to next message
elhanan Maayan is currently offline elhanan Maayan
Messages: 131
Registered: November 2009
Senior Member
hi..

i would like to create a small plugin that used on startup and listens to views and editors being opened.

when they are opened i wanna set certain views and editors to be Right to left.

i've implemented earlyStartUP, but i still need to get a listener to the editors and somehow get it's formToolkit, i don't even know how to do it with views.
Re: how do i set an orientation specifically to views and editors? [message #519115 is a reply to message #519112] Sat, 06 March 2010 07:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26000
Registered: July 2009
Senior Member
Elhanan,

Probably IPartListener2 will be useful.

elhanan wrote:
> hi..
>
> i would like to create a small plugin that used on startup and listens
> to views and editors being opened.
>
> when they are opened i wanna set certain views and editors to be Right
> to left.
>
> i've implemented earlyStartUP, but i still need to get a listener to
> the editors and somehow get it's formToolkit, i don't even know how to
> do it with views.
Re: how do i set an orientation specifically to views and editors? [message #519116 is a reply to message #519115] Sat, 06 March 2010 12:33 Go to previous messageGo to next message
elhanan Maayan is currently offline elhanan Maayan
Messages: 131
Registered: November 2009
Senior Member
yes i know about that, but how do i "connect the dots?"

to create a plugin that will enable the user to define for each view and editor a screen if it should be Right ToLeft or viceversa. this plugin would have a preference page listing them all.

this would be a good learning point for me (i believe) on how to develop eclipse
the original motivation for this , was that mylyn task editors should be RightToleft (because of hebrew ) while the rest of the workbench would remain the same (programing doesn't go well with Right To left orientation).

i figured if it goes well , i might open source it, and contribute it to the foundation. (or just open source it).

so far i have no idea how to plug-in something that listens to every window opening. this is becouse on startup i get null for the workbench reference (it's documented in the sdk).
Re: how do i set an orientation specifically to views and editors? [message #519403 is a reply to message #519116] Mon, 08 March 2010 07:58 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Right now I believe it's all or nothing. The orientation is set based
on either -dir rtl or the locale (iw will switch to RTL mode).

An individual view can support this by creating its composite in a
certain mode and doing the work itself. But the views that come with
eclipse don't support anything like that, they're just not coded to do it.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


icon5.gif  Re: how do i set an orientation specifically to views and editors? [message #519432 is a reply to message #519112] Mon, 08 March 2010 14:32 Go to previous messageGo to next message
elhanan Maayan is currently offline elhanan Maayan
Messages: 131
Registered: November 2009
Senior Member
ok, so how do plug into the mechanisem of the editors considering what' i said eariler?
Re: how do i set an orientation specifically to views and editors? [message #519724 is a reply to message #519432] Tue, 09 March 2010 09:26 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

elhanan wrote:
> ok, so how do plug into the mechanisem of the editors considering what'
> i said eariler?

You mean how would you code this into your own editors? Contributed
editors that you don't write will work the same way as contributed views
you don't write ... they won't support this.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


icon5.gif  Re: how do i set an orientation specifically to views and editors? [message #519842 is a reply to message #519724] Wed, 10 March 2010 02:49 Go to previous messageGo to next message
elhanan Maayan is currently offline elhanan Maayan
Messages: 131
Registered: November 2009
Senior Member
so you mean there is no way i can get partListener to any editor being opened?
Re: how do i set an orientation specifically to views and editors? [message #519918 is a reply to message #519842] Wed, 10 March 2010 09:11 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can use IPartListener2 to listen for new editor open events. You
can use org.eclipse.ui.IWorkbenchPage.getEditorReferences() to get the
list of currently open editors, and editorReference.getPart(false) to
actually get the IEditorPart.

But then what? IEditorPart does not offer you any methods for accessing
the orientation or even the SWT controls within the editor.

AFAIK eclipse switches to RTL mode if the locale is RTL (like iw, eg) or
if the command line contains -dir rtl. That orientation is set at
startup, and is used when creating shells and composites (and every
child control inherits this flag).

In theory if you wrote an editor you could deliberately set the
direction in your createPartControl(*) method on your Composite ... but
that means you cannot effect editors you didn't write, and by the time
the IEditorPart becomes available that editor's createPartControl(*) has
already been called.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: how do i set an orientation specifically to views and editors? [message #539895 is a reply to message #519918] Mon, 14 June 2010 04:43 Go to previous message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
Paul Webster wrote:
> You can use IPartListener2 to listen for new editor open events. You
> can use org.eclipse.ui.IWorkbenchPage.getEditorReferences() to get the
> list of currently open editors, and editorReference.getPart(false) to
> actually get the IEditorPart.
>
> But then what? IEditorPart does not offer you any methods for
> accessing the orientation or even the SWT controls within the editor.
>
> AFAIK eclipse switches to RTL mode if the locale is RTL (like iw, eg)
> or if the command line contains -dir rtl. That orientation is set at
> startup, and is used when creating shells and composites (and every
> child control inherits this flag).
>
> In theory if you wrote an editor you could deliberately set the
> direction in your createPartControl(*) method on your Composite ...
> but that means you cannot effect editors you didn't write, and by the
> time the IEditorPart becomes available that editor's
> createPartControl(*) has already been called.
As Paul said: you can only control this for parts that you own and in
that case see
org.eclipse.ui.part.IWorkbenchPartOrientation.getOrientation ().

Dani
>
> PW
>
Previous Topic:How can I modify existing Package Explorer view
Next Topic:Unsupported Content Type for package-info.java
Goto Forum:
  


Current Time: Fri Aug 22 17:46:54 EDT 2014

Powered by FUDForum. Page generated in 0.01928 seconds