Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » newbie: display a form
newbie: display a form [message #336903] Sat, 11 July 2009 10:04 Go to next message
Eclipse UserFriend
Originally posted by: yoduderoo.netscape.net

Hi,
How do I programmatically display an Eclipse form? Not programmatically
create one - there are already some good articles for that in the web.
But how do I get one to display programmatically, ie, not declaratively?

Concretely, I have programmed a wizard which imports data into my app.
Works fine. Additionally, I would like to display a non-editable Eclipse
form which reports some stats on the completed import action. I imagine
I would launch this form, like the import code, in the performFinish()
method of my wizard.

How do I do that?

Thanks,y
Re: newbie: display a form [message #336905 is a reply to message #336903] Sat, 11 July 2009 22:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: t.volland.web.de

Hi Yo,

your form should be inside an Eclipse view, i.e. your form's class
extends ViewPart. So, try to show the Eclipse view by calling:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView(viewId);

The viewId argument is the id of the view you defined in the
plugin.xml-file.

Regards,

Thorsten


Yo schrieb:
> Hi,
> How do I programmatically display an Eclipse form? Not programmatically
> create one - there are already some good articles for that in the web.
> But how do I get one to display programmatically, ie, not declaratively?
>
> Concretely, I have programmed a wizard which imports data into my app.
> Works fine. Additionally, I would like to display a non-editable Eclipse
> form which reports some stats on the completed import action. I imagine
> I would launch this form, like the import code, in the performFinish()
> method of my wizard.
>
> How do I do that?
>
> Thanks,y
Re: newbie: display a form [message #336907 is a reply to message #336905] Sun, 12 July 2009 19:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yoduderoo.netscape.net

Hi Thorsten,

getActiveWorkbenchWindow() returns null.
Is this because my app is a RCP?
Is there an alternative to getActiveWorkbenchWindow() ?

Thanks for helping this noob!
-Yo

Thorsten Volland wrote:
> Hi Yo,
>
> your form should be inside an Eclipse view, i.e. your form's class
> extends ViewPart. So, try to show the Eclipse view by calling:
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView(viewId);
>
> The viewId argument is the id of the view you defined in the
> plugin.xml-file.
>
> Regards,
>
> Thorsten
>
>
> Yo schrieb:
>> Hi,
>> How do I programmatically display an Eclipse form? Not programmatically
>> create one - there are already some good articles for that in the web.
>> But how do I get one to display programmatically, ie, not declaratively?
>>
>> Concretely, I have programmed a wizard which imports data into my app.
>> Works fine. Additionally, I would like to display a non-editable Eclipse
>> form which reports some stats on the completed import action. I imagine
>> I would launch this form, like the import code, in the performFinish()
>> method of my wizard.
>>
>> How do I do that?
>>
>> Thanks,y
Re: newbie: display a form [message #336908 is a reply to message #336907] Sun, 12 July 2009 20:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yoduderoo.netscape.net

Hi,
I now get a non-null workbench window and display the form. Yay.

However, the form appears in the bottom window (ie, where "Errors",
"Problems" typically appear).

I would like the form to appear in the editor window, although the form
is not editable. This possible?

Fyi, below is the code I used to obtain the active window.
Thanks,yo

IWorkbenchWindow win =
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (win == null) {
win = PlatformUI.getWorkbench().getWorkbenchWindows()[0];
}


Yo wrote:
> Hi Thorsten,
>
> getActiveWorkbenchWindow() returns null.
> Is this because my app is a RCP?
> Is there an alternative to getActiveWorkbenchWindow() ?
>
> Thanks for helping this noob!
> -Yo
>
> Thorsten Volland wrote:
>> Hi Yo,
>>
>> your form should be inside an Eclipse view, i.e. your form's class
>> extends ViewPart. So, try to show the Eclipse view by calling:
>>
>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView(viewId);
>>
>>
>> The viewId argument is the id of the view you defined in the
>> plugin.xml-file.
>>
>> Regards,
>>
>> Thorsten
>>
>>
>> Yo schrieb:
>>> Hi,
>>> How do I programmatically display an Eclipse form? Not programmatically
>>> create one - there are already some good articles for that in the web.
>>> But how do I get one to display programmatically, ie, not declaratively?
>>>
>>> Concretely, I have programmed a wizard which imports data into my app.
>>> Works fine. Additionally, I would like to display a non-editable Eclipse
>>> form which reports some stats on the completed import action. I imagine
>>> I would launch this form, like the import code, in the performFinish()
>>> method of my wizard.
>>>
>>> How do I do that?
>>>
>>> Thanks,y
Re: newbie: display a form [message #336910 is a reply to message #336908] Mon, 13 July 2009 08:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: t.volland.web.de

Hi,

you can define in plugin.xml where your view appears. To achieve this,
you have to create a PerspectiveExtension, i.e. open your plugin.xml, go
to the Extensions tab, choose "Add..." and select
"org.eclipse.ui.perspectiveExtensions" if you do not already have this
extension in your list. The targetId is the id of the perspective which
you want to extent with your view. You can choose "*" if this shall not
be restricted to one perspective. You can also use the browse-button to
get a list of available perspectives.

From the context menu of the perspective extension choose "Add..." ->
"view". The id is the id of your view (as above you can use the
browse-button). Choose "stack" als relationship. Choose
"org.eclipse.ui.editorss" als relative. This should place your view in
the editor area.

You can also take a look in this great tutorial:
http://www.vogella.de/articles/RichClientPlatform/article.ht ml#views
In section 7.3 is described, what I tried to explain.

Good luck!

Regards,
Thorsten


Yo schrieb:
> Hi,
> I now get a non-null workbench window and display the form. Yay.
>
> However, the form appears in the bottom window (ie, where "Errors",
> "Problems" typically appear).
>
> I would like the form to appear in the editor window, although the form
> is not editable. This possible?
>
> Fyi, below is the code I used to obtain the active window.
> Thanks,yo
>
> IWorkbenchWindow win =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow();
> if (win == null) {
> win = PlatformUI.getWorkbench().getWorkbenchWindows()[0];
> }
>
>
> Yo wrote:
>> Hi Thorsten,
>>
>> getActiveWorkbenchWindow() returns null.
>> Is this because my app is a RCP?
>> Is there an alternative to getActiveWorkbenchWindow() ?
>>
>> Thanks for helping this noob!
>> -Yo
>>
>> Thorsten Volland wrote:
>>> Hi Yo,
>>>
>>> your form should be inside an Eclipse view, i.e. your form's class
>>> extends ViewPart. So, try to show the Eclipse view by calling:
>>>
>>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView(viewId);
>>>
>>>
>>> The viewId argument is the id of the view you defined in the
>>> plugin.xml-file.
>>>
>>> Regards,
>>>
>>> Thorsten
>>>
>>>
>>> Yo schrieb:
>>>> Hi,
>>>> How do I programmatically display an Eclipse form? Not programmatically
>>>> create one - there are already some good articles for that in the web.
>>>> But how do I get one to display programmatically, ie, not
>>>> declaratively?
>>>>
>>>> Concretely, I have programmed a wizard which imports data into my app.
>>>> Works fine. Additionally, I would like to display a non-editable
>>>> Eclipse
>>>> form which reports some stats on the completed import action. I imagine
>>>> I would launch this form, like the import code, in the performFinish()
>>>> method of my wizard.
>>>>
>>>> How do I do that?
>>>>
>>>> Thanks,y
Re: newbie: display a form [message #336921 is a reply to message #336910] Tue, 14 July 2009 07:16 Go to previous message
Eclipse UserFriend
Originally posted by: yoduderoo.netscape.net

Hi Thorsten,
I really appreciate your help.

I did as you suggested but was not quite there yet. Then I added the
following to my perspective factory and things worked:

public void createInitialLayout(IPageLayout layout) {
// ...

// import results
layout.addPlaceholder(MY_VIEWID,
IPageLayout.TOP,
0.60f,
IPageLayout.ID_EDITOR_AREA);

// ...
}

Thanks very, very much!
Yo

Thorsten Volland wrote:
> Hi,
>
> you can define in plugin.xml where your view appears. To achieve this,
> you have to create a PerspectiveExtension, i.e. open your plugin.xml, go
> to the Extensions tab, choose "Add..." and select
> "org.eclipse.ui.perspectiveExtensions" if you do not already have this
> extension in your list. The targetId is the id of the perspective which
> you want to extent with your view. You can choose "*" if this shall not
> be restricted to one perspective. You can also use the browse-button to
> get a list of available perspectives.
>
> From the context menu of the perspective extension choose "Add..." ->
> "view". The id is the id of your view (as above you can use the
> browse-button). Choose "stack" als relationship. Choose
> "org.eclipse.ui.editorss" als relative. This should place your view in
> the editor area.
>
> You can also take a look in this great tutorial:
> http://www.vogella.de/articles/RichClientPlatform/article.ht ml#views
> In section 7.3 is described, what I tried to explain.
>
> Good luck!
>
> Regards,
> Thorsten
>
>
> Yo schrieb:
>> Hi,
>> I now get a non-null workbench window and display the form. Yay.
>>
>> However, the form appears in the bottom window (ie, where "Errors",
>> "Problems" typically appear).
>>
>> I would like the form to appear in the editor window, although the form
>> is not editable. This possible?
>>
>> Fyi, below is the code I used to obtain the active window.
>> Thanks,yo
>>
>> IWorkbenchWindow win =
>> PlatformUI.getWorkbench().getActiveWorkbenchWindow();
>> if (win == null) {
>> win = PlatformUI.getWorkbench().getWorkbenchWindows()[0];
>> }
>>
>>
>> Yo wrote:
>>> Hi Thorsten,
>>>
>>> getActiveWorkbenchWindow() returns null.
>>> Is this because my app is a RCP?
>>> Is there an alternative to getActiveWorkbenchWindow() ?
>>>
>>> Thanks for helping this noob!
>>> -Yo
>>>
>>> Thorsten Volland wrote:
>>>> Hi Yo,
>>>>
>>>> your form should be inside an Eclipse view, i.e. your form's class
>>>> extends ViewPart. So, try to show the Eclipse view by calling:
>>>>
>>>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView(viewId);
>>>>
>>>>
>>>> The viewId argument is the id of the view you defined in the
>>>> plugin.xml-file.
>>>>
>>>> Regards,
>>>>
>>>> Thorsten
>>>>
>>>>
>>>> Yo schrieb:
>>>>> Hi,
>>>>> How do I programmatically display an Eclipse form? Not programmatically
>>>>> create one - there are already some good articles for that in the web.
>>>>> But how do I get one to display programmatically, ie, not
>>>>> declaratively?
>>>>>
>>>>> Concretely, I have programmed a wizard which imports data into my app.
>>>>> Works fine. Additionally, I would like to display a non-editable
>>>>> Eclipse
>>>>> form which reports some stats on the completed import action. I imagine
>>>>> I would launch this form, like the import code, in the performFinish()
>>>>> method of my wizard.
>>>>>
>>>>> How do I do that?
>>>>>
>>>>> Thanks,y
Previous Topic:newbie: tiny red square appears next to project icon
Next Topic:[CommonNavigator] save selection in a memento?
Goto Forum:
  


Current Time: Thu Mar 28 13:16:33 GMT 2024

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

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

Back to the top