Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Detached views to be brought up independently
Detached views to be brought up independently [message #708008] Tue, 02 August 2011 06:33 Go to next message
Elvis  is currently offline Elvis
Messages: 4
Registered: July 2010
Junior Member
Currently once any of the detached views is brought up, all others will be brought top top together with the main app window. Is there any way so that we can control them as if they were an ordinary window or dialog?
(no subject) [message #711947 is a reply to message #708008] Sat, 06 August 2011 17:01 Go to previous messageGo to next message
Wim Jongman is currently offline Wim Jongman
Messages: 418
Registered: July 2009
Senior Member
Please elaborate.


> Currently once any of the detached views is brought up, all others will be
brought top top together with the main app window. Is there any way so that
we can control them as if they were an ordinary window or dialog?
Re: Detached views to be brought up independently [message #713157 is a reply to message #711947] Mon, 08 August 2011 02:30 Go to previous messageGo to next message
Leung Wang Hei is currently offline Leung Wang Hei
Messages: 62
Registered: July 2010
Member
I got similar problem.

Let's say I have 2 views(A,B) detached. View A on top of view B on top
of workbench shell.

Question 1:
How to let user click at a view to make it on top?

Question 2:
Now I use a window of other app, say, notepad, to cover view A.
Is it possible to let user just click at view A to flip it on top of the
notepad while keeping view B and the main behind notepad?



On 8/7/2011 5:01 AM, Wim Jongman wrote:
> Please elaborate.
>
>
>> Currently once any of the detached views is brought up, all others will be
> brought top top together with the main app window. Is there any way so that
> we can control them as if they were an ordinary window or dialog?
Re: Detached views to be brought up independently [message #713763 is a reply to message #713157] Mon, 08 August 2011 21:16 Go to previous messageGo to next message
Leung Wang Hei is currently offline Leung Wang Hei
Messages: 62
Registered: July 2010
Member
Some dirty work...


<extension
point="org.eclipse.ui.internalTweaklets">
<tweaklet

definition="org.eclipse.ui.internal.tweaklets.WorkbenchImplementation"
description="Customized Detached View"
id="id1"
implementation="tweaklets.WorkbenchImplementation"
name="Customized Detached View">
</tweaklet>
</extension>




import java.lang.reflect.Field;

import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.internal.ShellPool;
import org.eclipse.ui.internal.WorkbenchWindow;
import org.eclipse.ui.internal.tweaklets.Workbench3xImplementation;

public class WorkbenchImplementation extends Workbench3xImplementation {

@Override
public WorkbenchWindow createWorkbenchWindow(int newWindowNumber) {
// return super.createWorkbenchWindow(newWindowNumber);
return new WorkbenchWindow(newWindowNumber) {

@Override
protected void configureShell(Shell shell) {
super.configureShell(shell);

try {
Field field =
WorkbenchWindow.class.getDeclaredField("detachedWindowShells");
field.setAccessible(true);
field.set(this, createShellPool(shell));
} catch (Exception e) {
}
}

};
}

protected ShellPool createShellPool(Shell shell) {
// return new ShellPool(null, SWT.TOOL | SWT.TITLE | SWT.MAX |
SWT.RESIZE | Window.getDefaultOrientation());
return new ShellPool(null, SWT.NO_TRIM | Window.getDefaultOrientation());
}

}



Any other better way?




On 8/8/2011 2:30 PM, Leung Wang Hei wrote:
> I got similar problem.
>
> Let's say I have 2 views(A,B) detached. View A on top of view B on top
> of workbench shell.
>
> Question 1:
> How to let user click at a view to make it on top?
>
> Question 2:
> Now I use a window of other app, say, notepad, to cover view A.
> Is it possible to let user just click at view A to flip it on top of the
> notepad while keeping view B and the main behind notepad?
>
>
>
> On 8/7/2011 5:01 AM, Wim Jongman wrote:
>> Please elaborate.
>>
>>
>>> Currently once any of the detached views is brought up, all others
>>> will be
>> brought top top together with the main app window. Is there any way so
>> that
>> we can control them as if they were an ordinary window or dialog?
>
Re: Detached views to be brought up independently [message #714128 is a reply to message #713763] Tue, 09 August 2011 16:31 Go to previous message
Wim Jongman is currently offline Wim Jongman
Messages: 418
Registered: July 2009
Senior Member
mmm. You should consult with the SWT guru's in the SWT newsgroup.

You can detach both views in the same group. Then they can come on top of
each other.

But it is an interesting topic. Thanks for sharing a solution.

Regards,

Wim


> Some dirty work...
>
>
> <extension
> point="org.eclipse.ui.internalTweaklets">
> <tweaklet
>
> definition="org.eclipse.ui.internal.tweaklets.WorkbenchImplementation"
> description="Customized Detached View"
> id="id1"
> implementation="tweaklets.WorkbenchImplementation"
> name="Customized Detached View">
> </tweaklet>
> </extension>
>
>
>
>
> import java.lang.reflect.Field;
>
> import org.eclipse.jface.window.Window;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.ui.internal.ShellPool;
> import org.eclipse.ui.internal.WorkbenchWindow;
> import org.eclipse.ui.internal.tweaklets.Workbench3xImplementation;
>
> public class WorkbenchImplementation extends Workbench3xImplementation {
>
> @Override
> public WorkbenchWindow createWorkbenchWindow(int newWindowNumber) {
> // return super.createWorkbenchWindow(newWindowNumber);
> return new WorkbenchWindow(newWindowNumber) {
>
> @Override
> protected void configureShell(Shell shell) {
> super.configureShell(shell);
>
> try {
> Field field =
> WorkbenchWindow.class.getDeclaredField("detachedWindowShells");
> field.setAccessible(true);
> field.set(this, createShellPool(shell));
> } catch (Exception e) {
> }
> }
>
> };
> }
>
> protected ShellPool createShellPool(Shell shell) {
> // return new ShellPool(null, SWT.TOOL | SWT.TITLE | SWT.MAX |
> SWT.RESIZE | Window.getDefaultOrientation());
> return new ShellPool(null, SWT.NO_TRIM | Window.getDefaultOrientation());
> }
>
> }
>
>
>
> Any other better way?
>
>
>
>
> On 8/8/2011 2:30 PM, Leung Wang Hei wrote:
>> I got similar problem.
>>
>> Let's say I have 2 views(A,B) detached. View A on top of view B on top
>> of workbench shell.
>>
>> Question 1:
>> How to let user click at a view to make it on top?
>>
>> Question 2:
>> Now I use a window of other app, say, notepad, to cover view A.
>> Is it possible to let user just click at view A to flip it on top of the
>> notepad while keeping view B and the main behind notepad?
>>
>>
>>
>> On 8/7/2011 5:01 AM, Wim Jongman wrote:
>>> Please elaborate.
>>>
>>>
>>>> Currently once any of the detached views is brought up, all others
>>>> will be
>>> brought top top together with the main app window. Is there any way so
>>> that
>>> we can control them as if they were an ordinary window or dialog?
>>
Previous Topic:Dynamic menu contribution doesn't show up in a toolbar
Next Topic:Short Cut Menu - Adding Custom App
Goto Forum:
  


Current Time: Thu Aug 21 22:07:57 EDT 2014

Powered by FUDForum. Page generated in 0.02369 seconds