Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Problems creating Console in RCP applicaiton.
Problems creating Console in RCP applicaiton. [message #378490] Thu, 09 September 2004 09:12 Go to next message
Eclipse UserFriend
Originally posted by: dostick.apollo.lv

Hi,

There is no any articles/examples on how you may create and use the
Console in your RCP application.

Seems like this is what need to be done in order to create a Console:

I need an IConsoleView ViewPart that will display MessageConsole.
Apparently I need to register MessageConsole it in IConsoleManager to make
it appear in IConsoelView.
I can't find any reference to IConsoleManager in any plugin. Seems none of
Workbench components implements it.

Maybe it's all wrong that I am doing?

Maybe I should just drop it and try to make console using IViewPart and
some StyledText attached to it ?

Did anyone ever used Console in RCP application?

Thanks.
Re: Problems creating Console in RCP applicaiton. [message #378499 is a reply to message #378490] Thu, 09 September 2004 16:01 Go to previous messageGo to next message
Nick Edgar is currently offline Nick EdgarFriend
Messages: 439
Registered: July 2009
Senior Member
The console view and API are defined in the org.eclipse.ui.console plug-in,
so you'll need to include this plug-in and its prerequisites in your RCP
app.

You can show the console view using:
IWorkbenchPage page = ...;
IConsoleView consoleView = page.showView(IConsoleConstants.ID_CONSOLE_VIEW);

Like the properties and outline views, the console view has separate pages
within it for different consoles. For example, Debug adds one console for
each process, and CVS adds one too. Consoles are added programmatically,
not via extension point.
To add your own console:
- create a new MessageConsole:
- MessageConsole myConsole = new MessageConsole("My Console", null);
- register it with the console manager:
ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew IConsole[]
{ myConsole });

To show a console in an existing console view:
consoleView.display(myConsole);

There's also a convenience method for showing a console, opening the console
view in the active window if necessary:
ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);

Note that the console must have already been added to the manager before
showing it (in both the previous snippets).

To write to a message console, use:
MessageConsoleStream stream = myConsole.newMessageStream(); // hang onto
this
stream.println("Hi there!");

HTH,
Nick

"Roman D" <dostick@apollo.lv> wrote in message
news:chp6pm$j7f$1@eclipse.org...
> Hi,
>
> There is no any articles/examples on how you may create and use the
> Console in your RCP application.
>
> Seems like this is what need to be done in order to create a Console:
>
> I need an IConsoleView ViewPart that will display MessageConsole.
> Apparently I need to register MessageConsole it in IConsoleManager to make
> it appear in IConsoelView.
> I can't find any reference to IConsoleManager in any plugin. Seems none of
> Workbench components implements it.
>
> Maybe it's all wrong that I am doing?
>
> Maybe I should just drop it and try to make console using IViewPart and
> some StyledText attached to it ?
>
> Did anyone ever used Console in RCP application?
>
> Thanks.
>
Re: Problems creating Console in RCP applicaiton. [message #378905 is a reply to message #378499] Fri, 10 September 2004 00:58 Go to previous messageGo to next message
Ed Burnette is currently offline Ed BurnetteFriend
Messages: 279
Registered: July 2009
Senior Member
Is there a way to have different console pages have different wigetry? I
have a case now where the program I'm launching has two output streams, one
is plain text and one is HTML format. I could use the console for both if I
could make a console page that contains a Browser widget.

"Nick Edgar" <nick_edgar@_no.spam.please_.ca.ibm.com> wrote in message
news:chpuho$ss$1@eclipse.org...
Like the properties and outline views, the console view has separate pages
within it for different consoles. For example, Debug adds one console for
each process, and CVS adds one too. Consoles are added programmatically,
not via extension point.
more problems [message #378909 is a reply to message #378499] Fri, 10 September 2004 09:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dostick.apollo.lv

Thank you for the answer!
I have following problems.

1. to get IWorkbenchPage I do
IWorkbenchPage page =
MyPlugin.getInstance().getWorkbench().getActiveWorkbenchWind ow().getActivePage();
I couldn't find any other way to get it.
however, it doesn't throw any exception but page is null :(

2. Expression;
IConsoleView consoleView =
page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
is invalid because page.showView returns IViewPart.
casting IViewPart to IConsoleView produces NullPointerException.

Any other ways around?
Thanks.


Nick Edgar wrote:

> The console view and API are defined in the org.eclipse.ui.console plug-in,
> so you'll need to include this plug-in and its prerequisites in your RCP
> app.

> You can show the console view using:
> IWorkbenchPage page = ...;
> IConsoleView consoleView = page.showView(IConsoleConstants.ID_CONSOLE_VIEW);

> Like the properties and outline views, the console view has separate pages
> within it for different consoles. For example, Debug adds one console for
> each process, and CVS adds one too. Consoles are added programmatically,
> not via extension point.
> To add your own console:
> - create a new MessageConsole:
> - MessageConsole myConsole = new MessageConsole("My Console", null);
> - register it with the console manager:
> ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew IConsole[]
> { myConsole });

> To show a console in an existing console view:
> consoleView.display(myConsole);

> There's also a convenience method for showing a console, opening the console
> view in the active window if necessary:
> ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);

> Note that the console must have already been added to the manager before
> showing it (in both the previous snippets).

> To write to a message console, use:
> MessageConsoleStream stream = myConsole.newMessageStream(); // hang onto
> this
> stream.println("Hi there!");

> HTH,
> Nick

> "Roman D" <dostick@apollo.lv> wrote in message
> news:chp6pm$j7f$1@eclipse.org...
> > Hi,
> >
> > There is no any articles/examples on how you may create and use the
> > Console in your RCP application.
> >
> > Seems like this is what need to be done in order to create a Console:
> >
> > I need an IConsoleView ViewPart that will display MessageConsole.
> > Apparently I need to register MessageConsole it in IConsoleManager to make
> > it appear in IConsoelView.
> > I can't find any reference to IConsoleManager in any plugin. Seems none of
> > Workbench components implements it.
> >
> > Maybe it's all wrong that I am doing?
> >
> > Maybe I should just drop it and try to make console using IViewPart and
> > some StyledText attached to it ?
> >
> > Did anyone ever used Console in RCP application?
> >
> > Thanks.
> >
Re: Problems creating Console in RCP applicaiton. [message #378917 is a reply to message #378905] Fri, 10 September 2004 11:27 Go to previous messageGo to next message
Nick Edgar is currently offline Nick EdgarFriend
Messages: 439
Registered: July 2009
Senior Member
Yes, you can make your own subclass of AbstractConsole. For example, the
debug UI defines its own ProcessConsole.

You need to implement createPage to return an IPageBookViewPage that does
the real work.

Nick

"Ed Burnette" <ed.burnette@sas.com> wrote in message
news:chqtvt$gou$1@eclipse.org...
> Is there a way to have different console pages have different wigetry? I
> have a case now where the program I'm launching has two output streams,
one
> is plain text and one is HTML format. I could use the console for both if
I
> could make a console page that contains a Browser widget.
>
> "Nick Edgar" <nick_edgar@_no.spam.please_.ca.ibm.com> wrote in message
> news:chpuho$ss$1@eclipse.org...
> Like the properties and outline views, the console view has separate pages
> within it for different consoles. For example, Debug adds one console for
> each process, and CVS adds one too. Consoles are added programmatically,
> not via extension point.
>
>
>
Re: more problems [message #378918 is a reply to message #378909] Fri, 10 September 2004 11:30 Go to previous messageGo to next message
Nick Edgar is currently offline Nick EdgarFriend
Messages: 439
Registered: July 2009
Senior Member
Where are you calling this from? You should be able to determine the page
from the containing context of your workbench extension. For example, views
and editors can get this from their site.

The NPE is probably due to the null page. showView does not return null.
It will throw PartInitException if it fails.

Nick

"Roman D" <dostick@apollo.lv> wrote in message
news:chrrqr$qm4$1@eclipse.org...
>
> Thank you for the answer!
> I have following problems.
>
> 1. to get IWorkbenchPage I do
> IWorkbenchPage page =
>
MyPlugin.getInstance().getWorkbench().getActiveWorkbenchWind ow().getActivePa
ge();
> I couldn't find any other way to get it.
> however, it doesn't throw any exception but page is null :(
>
> 2. Expression;
> IConsoleView consoleView =
> page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> is invalid because page.showView returns IViewPart.
> casting IViewPart to IConsoleView produces NullPointerException.
>
> Any other ways around?
> Thanks.
>
>
> Nick Edgar wrote:
>
> > The console view and API are defined in the org.eclipse.ui.console
plug-in,
> > so you'll need to include this plug-in and its prerequisites in your RCP
> > app.
>
> > You can show the console view using:
> > IWorkbenchPage page = ...;
> > IConsoleView consoleView =
page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
>
> > Like the properties and outline views, the console view has separate
pages
> > within it for different consoles. For example, Debug adds one console
for
> > each process, and CVS adds one too. Consoles are added
programmatically,
> > not via extension point.
> > To add your own console:
> > - create a new MessageConsole:
> > - MessageConsole myConsole = new MessageConsole("My Console", null);
> > - register it with the console manager:
> > ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew
IConsole[]
> > { myConsole });
>
> > To show a console in an existing console view:
> > consoleView.display(myConsole);
>
> > There's also a convenience method for showing a console, opening the
console
> > view in the active window if necessary:
> >
ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);
>
> > Note that the console must have already been added to the manager before
> > showing it (in both the previous snippets).
>
> > To write to a message console, use:
> > MessageConsoleStream stream = myConsole.newMessageStream(); // hang
onto
> > this
> > stream.println("Hi there!");
>
> > HTH,
> > Nick
>
> > "Roman D" <dostick@apollo.lv> wrote in message
> > news:chp6pm$j7f$1@eclipse.org...
> > > Hi,
> > >
> > > There is no any articles/examples on how you may create and use the
> > > Console in your RCP application.
> > >
> > > Seems like this is what need to be done in order to create a Console:
> > >
> > > I need an IConsoleView ViewPart that will display MessageConsole.
> > > Apparently I need to register MessageConsole it in IConsoleManager to
make
> > > it appear in IConsoelView.
> > > I can't find any reference to IConsoleManager in any plugin. Seems
none of
> > > Workbench components implements it.
> > >
> > > Maybe it's all wrong that I am doing?
> > >
> > > Maybe I should just drop it and try to make console using IViewPart
and
> > > some StyledText attached to it ?
> > >
> > > Did anyone ever used Console in RCP application?
> > >
> > > Thanks.
> > >
>
>
Re: more problems [message #378920 is a reply to message #378918] Fri, 10 September 2004 11:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dostick.apollo.lv

I call this from class that extends IPerspectiveFactory , in
createInitialLayout() method. I can't get page reference from there.
This class is extending point org.eclipse.ui.perspectives.


Roman.



Nick Edgar wrote:

> Where are you calling this from? You should be able to determine the page
> from the containing context of your workbench extension. For example, views
> and editors can get this from their site.

> The NPE is probably due to the null page. showView does not return null.
> It will throw PartInitException if it fails.

> Nick

> "Roman D" <dostick@apollo.lv> wrote in message
> news:chrrqr$qm4$1@eclipse.org...
> >
> > Thank you for the answer!
> > I have following problems.
> >
> > 1. to get IWorkbenchPage I do
> > IWorkbenchPage page =
> >
> MyPlugin.getInstance().getWorkbench().getActiveWorkbenchWind ow().getActivePa
> ge();
> > I couldn't find any other way to get it.
> > however, it doesn't throw any exception but page is null :(
> >
> > 2. Expression;
> > IConsoleView consoleView =
> > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > is invalid because page.showView returns IViewPart.
> > casting IViewPart to IConsoleView produces NullPointerException.
> >
> > Any other ways around?
> > Thanks.
> >
> >
> > Nick Edgar wrote:
> >
> > > The console view and API are defined in the org.eclipse.ui.console
> plug-in,
> > > so you'll need to include this plug-in and its prerequisites in your RCP
> > > app.
> >
> > > You can show the console view using:
> > > IWorkbenchPage page = ...;
> > > IConsoleView consoleView =
> page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> >
> > > Like the properties and outline views, the console view has separate
> pages
> > > within it for different consoles. For example, Debug adds one console
> for
> > > each process, and CVS adds one too. Consoles are added
> programmatically,
> > > not via extension point.
> > > To add your own console:
> > > - create a new MessageConsole:
> > > - MessageConsole myConsole = new MessageConsole("My Console", null);
> > > - register it with the console manager:
> > > ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew
> IConsole[]
> > > { myConsole });
> >
> > > To show a console in an existing console view:
> > > consoleView.display(myConsole);
> >
> > > There's also a convenience method for showing a console, opening the
> console
> > > view in the active window if necessary:
> > >
> ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);
> >
> > > Note that the console must have already been added to the manager before
> > > showing it (in both the previous snippets).
> >
> > > To write to a message console, use:
> > > MessageConsoleStream stream = myConsole.newMessageStream(); // hang
> onto
> > > this
> > > stream.println("Hi there!");
> >
> > > HTH,
> > > Nick
> >
> > > "Roman D" <dostick@apollo.lv> wrote in message
> > > news:chp6pm$j7f$1@eclipse.org...
> > > > Hi,
> > > >
> > > > There is no any articles/examples on how you may create and use the
> > > > Console in your RCP application.
> > > >
> > > > Seems like this is what need to be done in order to create a Console:
> > > >
> > > > I need an IConsoleView ViewPart that will display MessageConsole.
> > > > Apparently I need to register MessageConsole it in IConsoleManager to
> make
> > > > it appear in IConsoelView.
> > > > I can't find any reference to IConsoleManager in any plugin. Seems
> none of
> > > > Workbench components implements it.
> > > >
> > > > Maybe it's all wrong that I am doing?
> > > >
> > > > Maybe I should just drop it and try to make console using IViewPart
> and
> > > > some StyledText attached to it ?
> > > >
> > > > Did anyone ever used Console in RCP application?
> > > >
> > > > Thanks.
> > > >
> >
> >
Re: more problems [message #378923 is a reply to message #378920] Fri, 10 September 2004 11:58 Go to previous messageGo to next message
Nick Edgar is currently offline Nick EdgarFriend
Messages: 439
Registered: July 2009
Senior Member
The page is not given to the perspective factory. The idea of the
perspective factory is to define the initial layout for a perspective via
the IPageLayout that it's passed. It shouldn't try to directly access the
page, which is still in the process of construction in the case of the
initial perspective.

Try the following. Instead of trying to reach for the page and use
showView, simply add the console view to your perspective.
For example:
layout.addView(IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.BOTTOM, .5f,
IPageLayout.ID_EDITOR_AREA);

You'll also need to add your IConsole to the console manager as described
previously. If it's the only console added to the manager, then it will
show by default in the console view. Since you will likely want to reuse
the same IConsole for different instances of the console view (a different
view instance will be used in different windows), creating and adding the
console would best be done via lazy creation in the plugin class (don't do
it during plugin startup). You could request the console, forcing it to be
created, from the perspective factory, but you wouldn't actually use it at
that point.

Nick

"Roman D" <dostick@apollo.lv> wrote in message
news:chs3k3$7i3$1@eclipse.org...
>
> I call this from class that extends IPerspectiveFactory , in
> createInitialLayout() method. I can't get page reference from there.
> This class is extending point org.eclipse.ui.perspectives.
>
>
> Roman.
>
>
>
> Nick Edgar wrote:
>
> > Where are you calling this from? You should be able to determine the
page
> > from the containing context of your workbench extension. For example,
views
> > and editors can get this from their site.
>
> > The NPE is probably due to the null page. showView does not return
null.
> > It will throw PartInitException if it fails.
>
> > Nick
>
> > "Roman D" <dostick@apollo.lv> wrote in message
> > news:chrrqr$qm4$1@eclipse.org...
> > >
> > > Thank you for the answer!
> > > I have following problems.
> > >
> > > 1. to get IWorkbenchPage I do
> > > IWorkbenchPage page =
> > >
> >
MyPlugin.getInstance().getWorkbench().getActiveWorkbenchWind ow().getActivePa
> > ge();
> > > I couldn't find any other way to get it.
> > > however, it doesn't throw any exception but page is null :(
> > >
> > > 2. Expression;
> > > IConsoleView consoleView =
> > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > is invalid because page.showView returns IViewPart.
> > > casting IViewPart to IConsoleView produces NullPointerException.
> > >
> > > Any other ways around?
> > > Thanks.
> > >
> > >
> > > Nick Edgar wrote:
> > >
> > > > The console view and API are defined in the org.eclipse.ui.console
> > plug-in,
> > > > so you'll need to include this plug-in and its prerequisites in your
RCP
> > > > app.
> > >
> > > > You can show the console view using:
> > > > IWorkbenchPage page = ...;
> > > > IConsoleView consoleView =
> > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > >
> > > > Like the properties and outline views, the console view has separate
> > pages
> > > > within it for different consoles. For example, Debug adds one
console
> > for
> > > > each process, and CVS adds one too. Consoles are added
> > programmatically,
> > > > not via extension point.
> > > > To add your own console:
> > > > - create a new MessageConsole:
> > > > - MessageConsole myConsole = new MessageConsole("My Console", null);
> > > > - register it with the console manager:
> > > > ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew
> > IConsole[]
> > > > { myConsole });
> > >
> > > > To show a console in an existing console view:
> > > > consoleView.display(myConsole);
> > >
> > > > There's also a convenience method for showing a console, opening the
> > console
> > > > view in the active window if necessary:
> > > >
> >
ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);
> > >
> > > > Note that the console must have already been added to the manager
before
> > > > showing it (in both the previous snippets).
> > >
> > > > To write to a message console, use:
> > > > MessageConsoleStream stream = myConsole.newMessageStream(); // hang
> > onto
> > > > this
> > > > stream.println("Hi there!");
> > >
> > > > HTH,
> > > > Nick
> > >
> > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > news:chp6pm$j7f$1@eclipse.org...
> > > > > Hi,
> > > > >
> > > > > There is no any articles/examples on how you may create and use
the
> > > > > Console in your RCP application.
> > > > >
> > > > > Seems like this is what need to be done in order to create a
Console:
> > > > >
> > > > > I need an IConsoleView ViewPart that will display MessageConsole.
> > > > > Apparently I need to register MessageConsole it in IConsoleManager
to
> > make
> > > > > it appear in IConsoelView.
> > > > > I can't find any reference to IConsoleManager in any plugin. Seems
> > none of
> > > > > Workbench components implements it.
> > > > >
> > > > > Maybe it's all wrong that I am doing?
> > > > >
> > > > > Maybe I should just drop it and try to make console using
IViewPart
> > and
> > > > > some StyledText attached to it ?
> > > > >
> > > > > Did anyone ever used Console in RCP application?
> > > > >
> > > > > Thanks.
> > > > >
> > >
> > >
>
>
Re: more problems [message #378926 is a reply to message #378923] Fri, 10 September 2004 12:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dostick.apollo.lv

Thank you!
that actually worked. The simplest approach is the best :)

How can I instantiate ConsoleViewer to be able to customize it?
If I want to make it non-closeable , for example.
With this apporoach it's created and added through
IConsoleConstants.ID_CONSOLE_VIEW and there's no way to access it.

Thanks.


Nick Edgar wrote:

> The page is not given to the perspective factory. The idea of the
> perspective factory is to define the initial layout for a perspective via
> the IPageLayout that it's passed. It shouldn't try to directly access the
> page, which is still in the process of construction in the case of the
> initial perspective.

> Try the following. Instead of trying to reach for the page and use
> showView, simply add the console view to your perspective.
> For example:
> layout.addView(IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.BOTTOM, .5f,
> IPageLayout.ID_EDITOR_AREA);

> You'll also need to add your IConsole to the console manager as described
> previously. If it's the only console added to the manager, then it will
> show by default in the console view. Since you will likely want to reuse
> the same IConsole for different instances of the console view (a different
> view instance will be used in different windows), creating and adding the
> console would best be done via lazy creation in the plugin class (don't do
> it during plugin startup). You could request the console, forcing it to be
> created, from the perspective factory, but you wouldn't actually use it at
> that point.

> Nick

> "Roman D" <dostick@apollo.lv> wrote in message
> news:chs3k3$7i3$1@eclipse.org...
> >
> > I call this from class that extends IPerspectiveFactory , in
> > createInitialLayout() method. I can't get page reference from there.
> > This class is extending point org.eclipse.ui.perspectives.
> >
> >
> > Roman.
> >
> >
> >
> > Nick Edgar wrote:
> >
> > > Where are you calling this from? You should be able to determine the
> page
> > > from the containing context of your workbench extension. For example,
> views
> > > and editors can get this from their site.
> >
> > > The NPE is probably due to the null page. showView does not return
> null.
> > > It will throw PartInitException if it fails.
> >
> > > Nick
> >
> > > "Roman D" <dostick@apollo.lv> wrote in message
> > > news:chrrqr$qm4$1@eclipse.org...
> > > >
> > > > Thank you for the answer!
> > > > I have following problems.
> > > >
> > > > 1. to get IWorkbenchPage I do
> > > > IWorkbenchPage page =
> > > >
> > >
> MyPlugin.getInstance().getWorkbench().getActiveWorkbenchWind ow().getActivePa
> > > ge();
> > > > I couldn't find any other way to get it.
> > > > however, it doesn't throw any exception but page is null :(
> > > >
> > > > 2. Expression;
> > > > IConsoleView consoleView =
> > > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > > is invalid because page.showView returns IViewPart.
> > > > casting IViewPart to IConsoleView produces NullPointerException.
> > > >
> > > > Any other ways around?
> > > > Thanks.
> > > >
> > > >
> > > > Nick Edgar wrote:
> > > >
> > > > > The console view and API are defined in the org.eclipse.ui.console
> > > plug-in,
> > > > > so you'll need to include this plug-in and its prerequisites in your
> RCP
> > > > > app.
> > > >
> > > > > You can show the console view using:
> > > > > IWorkbenchPage page = ...;
> > > > > IConsoleView consoleView =
> > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > >
> > > > > Like the properties and outline views, the console view has separate
> > > pages
> > > > > within it for different consoles. For example, Debug adds one
> console
> > > for
> > > > > each process, and CVS adds one too. Consoles are added
> > > programmatically,
> > > > > not via extension point.
> > > > > To add your own console:
> > > > > - create a new MessageConsole:
> > > > > - MessageConsole myConsole = new MessageConsole("My Console", null);
> > > > > - register it with the console manager:
> > > > > ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew
> > > IConsole[]
> > > > > { myConsole });
> > > >
> > > > > To show a console in an existing console view:
> > > > > consoleView.display(myConsole);
> > > >
> > > > > There's also a convenience method for showing a console, opening the
> > > console
> > > > > view in the active window if necessary:
> > > > >
> > >
> ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);
> > > >
> > > > > Note that the console must have already been added to the manager
> before
> > > > > showing it (in both the previous snippets).
> > > >
> > > > > To write to a message console, use:
> > > > > MessageConsoleStream stream = myConsole.newMessageStream(); // hang
> > > onto
> > > > > this
> > > > > stream.println("Hi there!");
> > > >
> > > > > HTH,
> > > > > Nick
> > > >
> > > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > > news:chp6pm$j7f$1@eclipse.org...
> > > > > > Hi,
> > > > > >
> > > > > > There is no any articles/examples on how you may create and use
> the
> > > > > > Console in your RCP application.
> > > > > >
> > > > > > Seems like this is what need to be done in order to create a
> Console:
> > > > > >
> > > > > > I need an IConsoleView ViewPart that will display MessageConsole.
> > > > > > Apparently I need to register MessageConsole it in IConsoleManager
> to
> > > make
> > > > > > it appear in IConsoelView.
> > > > > > I can't find any reference to IConsoleManager in any plugin. Seems
> > > none of
> > > > > > Workbench components implements it.
> > > > > >
> > > > > > Maybe it's all wrong that I am doing?
> > > > > >
> > > > > > Maybe I should just drop it and try to make console using
> IViewPart
> > > and
> > > > > > some StyledText attached to it ?
> > > > > >
> > > > > > Did anyone ever used Console in RCP application?
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > >
> > > >
> >
> >
Re: more problems [message #378927 is a reply to message #378926] Fri, 10 September 2004 13:05 Go to previous messageGo to next message
Nick Edgar is currently offline Nick EdgarFriend
Messages: 439
Registered: July 2009
Senior Member
You can't obtain the actual view at this point, but you can mark its layout
as being non-closeable.
Use
layout.getViewLayout(IConsoleConstants.ID_CONSOLE_VIEW).setC loseable(false);

Nick

"Roman D" <dostick@apollo.lv> wrote in message
news:chs6jo$d1c$1@eclipse.org...
>
> Thank you!
> that actually worked. The simplest approach is the best :)
>
> How can I instantiate ConsoleViewer to be able to customize it?
> If I want to make it non-closeable , for example.
> With this apporoach it's created and added through
> IConsoleConstants.ID_CONSOLE_VIEW and there's no way to access it.
>
> Thanks.
>
>
> Nick Edgar wrote:
>
> > The page is not given to the perspective factory. The idea of the
> > perspective factory is to define the initial layout for a perspective
via
> > the IPageLayout that it's passed. It shouldn't try to directly access
the
> > page, which is still in the process of construction in the case of the
> > initial perspective.
>
> > Try the following. Instead of trying to reach for the page and use
> > showView, simply add the console view to your perspective.
> > For example:
> > layout.addView(IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.BOTTOM,
..5f,
> > IPageLayout.ID_EDITOR_AREA);
>
> > You'll also need to add your IConsole to the console manager as
described
> > previously. If it's the only console added to the manager, then it will
> > show by default in the console view. Since you will likely want to
reuse
> > the same IConsole for different instances of the console view (a
different
> > view instance will be used in different windows), creating and adding
the
> > console would best be done via lazy creation in the plugin class (don't
do
> > it during plugin startup). You could request the console, forcing it to
be
> > created, from the perspective factory, but you wouldn't actually use it
at
> > that point.
>
> > Nick
>
> > "Roman D" <dostick@apollo.lv> wrote in message
> > news:chs3k3$7i3$1@eclipse.org...
> > >
> > > I call this from class that extends IPerspectiveFactory , in
> > > createInitialLayout() method. I can't get page reference from there.
> > > This class is extending point org.eclipse.ui.perspectives.
> > >
> > >
> > > Roman.
> > >
> > >
> > >
> > > Nick Edgar wrote:
> > >
> > > > Where are you calling this from? You should be able to determine
the
> > page
> > > > from the containing context of your workbench extension. For
example,
> > views
> > > > and editors can get this from their site.
> > >
> > > > The NPE is probably due to the null page. showView does not return
> > null.
> > > > It will throw PartInitException if it fails.
> > >
> > > > Nick
> > >
> > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > news:chrrqr$qm4$1@eclipse.org...
> > > > >
> > > > > Thank you for the answer!
> > > > > I have following problems.
> > > > >
> > > > > 1. to get IWorkbenchPage I do
> > > > > IWorkbenchPage page =
> > > > >
> > > >
> >
MyPlugin.getInstance().getWorkbench().getActiveWorkbenchWind ow().getActivePa
> > > > ge();
> > > > > I couldn't find any other way to get it.
> > > > > however, it doesn't throw any exception but page is null :(
> > > > >
> > > > > 2. Expression;
> > > > > IConsoleView consoleView =
> > > > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > > > is invalid because page.showView returns IViewPart.
> > > > > casting IViewPart to IConsoleView produces NullPointerException.
> > > > >
> > > > > Any other ways around?
> > > > > Thanks.
> > > > >
> > > > >
> > > > > Nick Edgar wrote:
> > > > >
> > > > > > The console view and API are defined in the
org.eclipse.ui.console
> > > > plug-in,
> > > > > > so you'll need to include this plug-in and its prerequisites in
your
> > RCP
> > > > > > app.
> > > > >
> > > > > > You can show the console view using:
> > > > > > IWorkbenchPage page = ...;
> > > > > > IConsoleView consoleView =
> > > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > > >
> > > > > > Like the properties and outline views, the console view has
separate
> > > > pages
> > > > > > within it for different consoles. For example, Debug adds one
> > console
> > > > for
> > > > > > each process, and CVS adds one too. Consoles are added
> > > > programmatically,
> > > > > > not via extension point.
> > > > > > To add your own console:
> > > > > > - create a new MessageConsole:
> > > > > > - MessageConsole myConsole = new MessageConsole("My Console",
null);
> > > > > > - register it with the console manager:
> > > > > > ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew
> > > > IConsole[]
> > > > > > { myConsole });
> > > > >
> > > > > > To show a console in an existing console view:
> > > > > > consoleView.display(myConsole);
> > > > >
> > > > > > There's also a convenience method for showing a console, opening
the
> > > > console
> > > > > > view in the active window if necessary:
> > > > > >
> > > >
> >
ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);
> > > > >
> > > > > > Note that the console must have already been added to the
manager
> > before
> > > > > > showing it (in both the previous snippets).
> > > > >
> > > > > > To write to a message console, use:
> > > > > > MessageConsoleStream stream = myConsole.newMessageStream(); //
hang
> > > > onto
> > > > > > this
> > > > > > stream.println("Hi there!");
> > > > >
> > > > > > HTH,
> > > > > > Nick
> > > > >
> > > > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > > > news:chp6pm$j7f$1@eclipse.org...
> > > > > > > Hi,
> > > > > > >
> > > > > > > There is no any articles/examples on how you may create and
use
> > the
> > > > > > > Console in your RCP application.
> > > > > > >
> > > > > > > Seems like this is what need to be done in order to create a
> > Console:
> > > > > > >
> > > > > > > I need an IConsoleView ViewPart that will display
MessageConsole.
> > > > > > > Apparently I need to register MessageConsole it in
IConsoleManager
> > to
> > > > make
> > > > > > > it appear in IConsoelView.
> > > > > > > I can't find any reference to IConsoleManager in any plugin.
Seems
> > > > none of
> > > > > > > Workbench components implements it.
> > > > > > >
> > > > > > > Maybe it's all wrong that I am doing?
> > > > > > >
> > > > > > > Maybe I should just drop it and try to make console using
> > IViewPart
> > > > and
> > > > > > > some StyledText attached to it ?
> > > > > > >
> > > > > > > Did anyone ever used Console in RCP application?
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > >
> > > > >
> > >
> > >
>
>
than kyou. [message #378930 is a reply to message #378927] Fri, 10 September 2004 13:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dostick.apollo.lv

Thank you!

Why not make this into small article for eclipse.org website?
While building RCP application I quite a few cases like this, when API
documentation doesn't really help. There is a lot of stuff that could be
made into tutorials/articles.




Nick Edgar wrote:

> You can't obtain the actual view at this point, but you can mark its layout
> as being non-closeable.
> Use
> layout.getViewLayout(IConsoleConstants.ID_CONSOLE_VIEW).setC loseable(false);

> Nick

> "Roman D" <dostick@apollo.lv> wrote in message
> news:chs6jo$d1c$1@eclipse.org...
> >
> > Thank you!
> > that actually worked. The simplest approach is the best :)
> >
> > How can I instantiate ConsoleViewer to be able to customize it?
> > If I want to make it non-closeable , for example.
> > With this apporoach it's created and added through
> > IConsoleConstants.ID_CONSOLE_VIEW and there's no way to access it.
> >
> > Thanks.
> >
> >
> > Nick Edgar wrote:
> >
> > > The page is not given to the perspective factory. The idea of the
> > > perspective factory is to define the initial layout for a perspective
> via
> > > the IPageLayout that it's passed. It shouldn't try to directly access
> the
> > > page, which is still in the process of construction in the case of the
> > > initial perspective.
> >
> > > Try the following. Instead of trying to reach for the page and use
> > > showView, simply add the console view to your perspective.
> > > For example:
> > > layout.addView(IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.BOTTOM,
> ..5f,
> > > IPageLayout.ID_EDITOR_AREA);
> >
> > > You'll also need to add your IConsole to the console manager as
> described
> > > previously. If it's the only console added to the manager, then it will
> > > show by default in the console view. Since you will likely want to
> reuse
> > > the same IConsole for different instances of the console view (a
> different
> > > view instance will be used in different windows), creating and adding
> the
> > > console would best be done via lazy creation in the plugin class (don't
> do
> > > it during plugin startup). You could request the console, forcing it to
> be
> > > created, from the perspective factory, but you wouldn't actually use it
> at
> > > that point.
> >
> > > Nick
> >
> > > "Roman D" <dostick@apollo.lv> wrote in message
> > > news:chs3k3$7i3$1@eclipse.org...
> > > >
> > > > I call this from class that extends IPerspectiveFactory , in
> > > > createInitialLayout() method. I can't get page reference from there.
> > > > This class is extending point org.eclipse.ui.perspectives.
> > > >
> > > >
> > > > Roman.
> > > >
> > > >
> > > >
> > > > Nick Edgar wrote:
> > > >
> > > > > Where are you calling this from? You should be able to determine
> the
> > > page
> > > > > from the containing context of your workbench extension. For
> example,
> > > views
> > > > > and editors can get this from their site.
> > > >
> > > > > The NPE is probably due to the null page. showView does not return
> > > null.
> > > > > It will throw PartInitException if it fails.
> > > >
> > > > > Nick
> > > >
> > > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > > news:chrrqr$qm4$1@eclipse.org...
> > > > > >
> > > > > > Thank you for the answer!
> > > > > > I have following problems.
> > > > > >
> > > > > > 1. to get IWorkbenchPage I do
> > > > > > IWorkbenchPage page =
> > > > > >
> > > > >
> > >
> MyPlugin.getInstance().getWorkbench().getActiveWorkbenchWind ow().getActivePa
> > > > > ge();
> > > > > > I couldn't find any other way to get it.
> > > > > > however, it doesn't throw any exception but page is null :(
> > > > > >
> > > > > > 2. Expression;
> > > > > > IConsoleView consoleView =
> > > > > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > > > > is invalid because page.showView returns IViewPart.
> > > > > > casting IViewPart to IConsoleView produces NullPointerException.
> > > > > >
> > > > > > Any other ways around?
> > > > > > Thanks.
> > > > > >
> > > > > >
> > > > > > Nick Edgar wrote:
> > > > > >
> > > > > > > The console view and API are defined in the
> org.eclipse.ui.console
> > > > > plug-in,
> > > > > > > so you'll need to include this plug-in and its prerequisites in
> your
> > > RCP
> > > > > > > app.
> > > > > >
> > > > > > > You can show the console view using:
> > > > > > > IWorkbenchPage page = ...;
> > > > > > > IConsoleView consoleView =
> > > > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > > > >
> > > > > > > Like the properties and outline views, the console view has
> separate
> > > > > pages
> > > > > > > within it for different consoles. For example, Debug adds one
> > > console
> > > > > for
> > > > > > > each process, and CVS adds one too. Consoles are added
> > > > > programmatically,
> > > > > > > not via extension point.
> > > > > > > To add your own console:
> > > > > > > - create a new MessageConsole:
> > > > > > > - MessageConsole myConsole = new MessageConsole("My Console",
> null);
> > > > > > > - register it with the console manager:
> > > > > > > ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew
> > > > > IConsole[]
> > > > > > > { myConsole });
> > > > > >
> > > > > > > To show a console in an existing console view:
> > > > > > > consoleView.display(myConsole);
> > > > > >
> > > > > > > There's also a convenience method for showing a console, opening
> the
> > > > > console
> > > > > > > view in the active window if necessary:
> > > > > > >
> > > > >
> > >
> ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);
> > > > > >
> > > > > > > Note that the console must have already been added to the
> manager
> > > before
> > > > > > > showing it (in both the previous snippets).
> > > > > >
> > > > > > > To write to a message console, use:
> > > > > > > MessageConsoleStream stream = myConsole.newMessageStream(); //
> hang
> > > > > onto
> > > > > > > this
> > > > > > > stream.println("Hi there!");
> > > > > >
> > > > > > > HTH,
> > > > > > > Nick
> > > > > >
> > > > > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > > > > news:chp6pm$j7f$1@eclipse.org...
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > There is no any articles/examples on how you may create and
> use
> > > the
> > > > > > > > Console in your RCP application.
> > > > > > > >
> > > > > > > > Seems like this is what need to be done in order to create a
> > > Console:
> > > > > > > >
> > > > > > > > I need an IConsoleView ViewPart that will display
> MessageConsole.
> > > > > > > > Apparently I need to register MessageConsole it in
> IConsoleManager
> > > to
> > > > > make
> > > > > > > > it appear in IConsoelView.
> > > > > > > > I can't find any reference to IConsoleManager in any plugin.
> Seems
> > > > > none of
> > > > > > > > Workbench components implements it.
> > > > > > > >
> > > > > > > > Maybe it's all wrong that I am doing?
> > > > > > > >
> > > > > > > > Maybe I should just drop it and try to make console using
> > > IViewPart
> > > > > and
> > > > > > > > some StyledText attached to it ?
> > > > > > > >
> > > > > > > > Did anyone ever used Console in RCP application?
> > > > > > > >
> > > > > > > > Thanks.
> > > > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> >
> >
Re: than kyou. [message #378933 is a reply to message #378930] Fri, 10 September 2004 14:56 Go to previous messageGo to next message
Nick Edgar is currently offline Nick EdgarFriend
Messages: 439
Registered: July 2009
Senior Member
The Debug team, who owns the console view, is aware of the lack of doc about
how to use it, and is working to rectify that.
I intend to add entries to the RCP FAQ about using the console view, and
also about marking views as non-closeable.

The RCP FAQ is available off of the RCP home page, but is currently pretty
minimal.
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-ui-home/rcp/index.html

Nick

"Roman D" <dostick@apollo.lv> wrote in message
news:chsad2$k3e$1@eclipse.org...
> Thank you!
>
> Why not make this into small article for eclipse.org website?
> While building RCP application I quite a few cases like this, when API
> documentation doesn't really help. There is a lot of stuff that could be
> made into tutorials/articles.
>
>
>
>
> Nick Edgar wrote:
>
> > You can't obtain the actual view at this point, but you can mark its
layout
> > as being non-closeable.
> > Use
> >
layout.getViewLayout(IConsoleConstants.ID_CONSOLE_VIEW).setC loseable(false);
>
> > Nick
>
> > "Roman D" <dostick@apollo.lv> wrote in message
> > news:chs6jo$d1c$1@eclipse.org...
> > >
> > > Thank you!
> > > that actually worked. The simplest approach is the best :)
> > >
> > > How can I instantiate ConsoleViewer to be able to customize it?
> > > If I want to make it non-closeable , for example.
> > > With this apporoach it's created and added through
> > > IConsoleConstants.ID_CONSOLE_VIEW and there's no way to access it.
> > >
> > > Thanks.
> > >
> > >
> > > Nick Edgar wrote:
> > >
> > > > The page is not given to the perspective factory. The idea of the
> > > > perspective factory is to define the initial layout for a
perspective
> > via
> > > > the IPageLayout that it's passed. It shouldn't try to directly
access
> > the
> > > > page, which is still in the process of construction in the case of
the
> > > > initial perspective.
> > >
> > > > Try the following. Instead of trying to reach for the page and use
> > > > showView, simply add the console view to your perspective.
> > > > For example:
> > > > layout.addView(IConsoleConstants.ID_CONSOLE_VIEW,
IPageLayout.BOTTOM,
> > ..5f,
> > > > IPageLayout.ID_EDITOR_AREA);
> > >
> > > > You'll also need to add your IConsole to the console manager as
> > described
> > > > previously. If it's the only console added to the manager, then it
will
> > > > show by default in the console view. Since you will likely want to
> > reuse
> > > > the same IConsole for different instances of the console view (a
> > different
> > > > view instance will be used in different windows), creating and
adding
> > the
> > > > console would best be done via lazy creation in the plugin class
(don't
> > do
> > > > it during plugin startup). You could request the console, forcing
it to
> > be
> > > > created, from the perspective factory, but you wouldn't actually use
it
> > at
> > > > that point.
> > >
> > > > Nick
> > >
> > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > news:chs3k3$7i3$1@eclipse.org...
> > > > >
> > > > > I call this from class that extends IPerspectiveFactory , in
> > > > > createInitialLayout() method. I can't get page reference from
there.
> > > > > This class is extending point org.eclipse.ui.perspectives.
> > > > >
> > > > >
> > > > > Roman.
> > > > >
> > > > >
> > > > >
> > > > > Nick Edgar wrote:
> > > > >
> > > > > > Where are you calling this from? You should be able to
determine
> > the
> > > > page
> > > > > > from the containing context of your workbench extension. For
> > example,
> > > > views
> > > > > > and editors can get this from their site.
> > > > >
> > > > > > The NPE is probably due to the null page. showView does not
return
> > > > null.
> > > > > > It will throw PartInitException if it fails.
> > > > >
> > > > > > Nick
> > > > >
> > > > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > > > news:chrrqr$qm4$1@eclipse.org...
> > > > > > >
> > > > > > > Thank you for the answer!
> > > > > > > I have following problems.
> > > > > > >
> > > > > > > 1. to get IWorkbenchPage I do
> > > > > > > IWorkbenchPage page =
> > > > > > >
> > > > > >
> > > >
> >
MyPlugin.getInstance().getWorkbench().getActiveWorkbenchWind ow().getActivePa
> > > > > > ge();
> > > > > > > I couldn't find any other way to get it.
> > > > > > > however, it doesn't throw any exception but page is null :(
> > > > > > >
> > > > > > > 2. Expression;
> > > > > > > IConsoleView consoleView =
> > > > > > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > > > > > is invalid because page.showView returns IViewPart.
> > > > > > > casting IViewPart to IConsoleView produces
NullPointerException.
> > > > > > >
> > > > > > > Any other ways around?
> > > > > > > Thanks.
> > > > > > >
> > > > > > >
> > > > > > > Nick Edgar wrote:
> > > > > > >
> > > > > > > > The console view and API are defined in the
> > org.eclipse.ui.console
> > > > > > plug-in,
> > > > > > > > so you'll need to include this plug-in and its prerequisites
in
> > your
> > > > RCP
> > > > > > > > app.
> > > > > > >
> > > > > > > > You can show the console view using:
> > > > > > > > IWorkbenchPage page = ...;
> > > > > > > > IConsoleView consoleView =
> > > > > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > > > > >
> > > > > > > > Like the properties and outline views, the console view has
> > separate
> > > > > > pages
> > > > > > > > within it for different consoles. For example, Debug adds
one
> > > > console
> > > > > > for
> > > > > > > > each process, and CVS adds one too. Consoles are added
> > > > > > programmatically,
> > > > > > > > not via extension point.
> > > > > > > > To add your own console:
> > > > > > > > - create a new MessageConsole:
> > > > > > > > - MessageConsole myConsole = new MessageConsole("My
Console",
> > null);
> > > > > > > > - register it with the console manager:
> > > > > > > >
ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew
> > > > > > IConsole[]
> > > > > > > > { myConsole });
> > > > > > >
> > > > > > > > To show a console in an existing console view:
> > > > > > > > consoleView.display(myConsole);
> > > > > > >
> > > > > > > > There's also a convenience method for showing a console,
opening
> > the
> > > > > > console
> > > > > > > > view in the active window if necessary:
> > > > > > > >
> > > > > >
> > > >
> >
ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);
> > > > > > >
> > > > > > > > Note that the console must have already been added to the
> > manager
> > > > before
> > > > > > > > showing it (in both the previous snippets).
> > > > > > >
> > > > > > > > To write to a message console, use:
> > > > > > > > MessageConsoleStream stream = myConsole.newMessageStream();
//
> > hang
> > > > > > onto
> > > > > > > > this
> > > > > > > > stream.println("Hi there!");
> > > > > > >
> > > > > > > > HTH,
> > > > > > > > Nick
> > > > > > >
> > > > > > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > > > > > news:chp6pm$j7f$1@eclipse.org...
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > There is no any articles/examples on how you may create
and
> > use
> > > > the
> > > > > > > > > Console in your RCP application.
> > > > > > > > >
> > > > > > > > > Seems like this is what need to be done in order to create
a
> > > > Console:
> > > > > > > > >
> > > > > > > > > I need an IConsoleView ViewPart that will display
> > MessageConsole.
> > > > > > > > > Apparently I need to register MessageConsole it in
> > IConsoleManager
> > > > to
> > > > > > make
> > > > > > > > > it appear in IConsoelView.
> > > > > > > > > I can't find any reference to IConsoleManager in any
plugin.
> > Seems
> > > > > > none of
> > > > > > > > > Workbench components implements it.
> > > > > > > > >
> > > > > > > > > Maybe it's all wrong that I am doing?
> > > > > > > > >
> > > > > > > > > Maybe I should just drop it and try to make console using
> > > > IViewPart
> > > > > > and
> > > > > > > > > some StyledText attached to it ?
> > > > > > > > >
> > > > > > > > > Did anyone ever used Console in RCP application?
> > > > > > > > >
> > > > > > > > > Thanks.
> > > > > > > > >
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > >
> > >
>
>
Re: than kyou. [message #378937 is a reply to message #378933] Fri, 10 September 2004 16:22 Go to previous message
Darin Swanson is currently offline Darin SwansonFriend
Messages: 2386
Registered: July 2009
Senior Member
Another great help for the committers is to log bug reports requesting FAQ
entries, doc, articles or tutorials that the community really feels would
help them out.

Patches to those bug reports with tutorials/articles/doc/FAQ entries are
greatly appreciated.

Darins

"Nick Edgar" <nick_edgar@_no.spam.please_.ca.ibm.com> wrote in message
news:chsf3u$tvi$1@eclipse.org...
> The Debug team, who owns the console view, is aware of the lack of doc
about
> how to use it, and is working to rectify that.
> I intend to add entries to the RCP FAQ about using the console view, and
> also about marking views as non-closeable.
>
> The RCP FAQ is available off of the RCP home page, but is currently pretty
> minimal.
>
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-ui-home/rcp/index.html
>
> Nick
>
> "Roman D" <dostick@apollo.lv> wrote in message
> news:chsad2$k3e$1@eclipse.org...
> > Thank you!
> >
> > Why not make this into small article for eclipse.org website?
> > While building RCP application I quite a few cases like this, when API
> > documentation doesn't really help. There is a lot of stuff that could be
> > made into tutorials/articles.
> >
> >
> >
> >
> > Nick Edgar wrote:
> >
> > > You can't obtain the actual view at this point, but you can mark its
> layout
> > > as being non-closeable.
> > > Use
> > >
>
layout.getViewLayout(IConsoleConstants.ID_CONSOLE_VIEW).setC loseable(false);
> >
> > > Nick
> >
> > > "Roman D" <dostick@apollo.lv> wrote in message
> > > news:chs6jo$d1c$1@eclipse.org...
> > > >
> > > > Thank you!
> > > > that actually worked. The simplest approach is the best :)
> > > >
> > > > How can I instantiate ConsoleViewer to be able to customize it?
> > > > If I want to make it non-closeable , for example.
> > > > With this apporoach it's created and added through
> > > > IConsoleConstants.ID_CONSOLE_VIEW and there's no way to access it.
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > Nick Edgar wrote:
> > > >
> > > > > The page is not given to the perspective factory. The idea of the
> > > > > perspective factory is to define the initial layout for a
> perspective
> > > via
> > > > > the IPageLayout that it's passed. It shouldn't try to directly
> access
> > > the
> > > > > page, which is still in the process of construction in the case of
> the
> > > > > initial perspective.
> > > >
> > > > > Try the following. Instead of trying to reach for the page and
use
> > > > > showView, simply add the console view to your perspective.
> > > > > For example:
> > > > > layout.addView(IConsoleConstants.ID_CONSOLE_VIEW,
> IPageLayout.BOTTOM,
> > > ..5f,
> > > > > IPageLayout.ID_EDITOR_AREA);
> > > >
> > > > > You'll also need to add your IConsole to the console manager as
> > > described
> > > > > previously. If it's the only console added to the manager, then
it
> will
> > > > > show by default in the console view. Since you will likely want
to
> > > reuse
> > > > > the same IConsole for different instances of the console view (a
> > > different
> > > > > view instance will be used in different windows), creating and
> adding
> > > the
> > > > > console would best be done via lazy creation in the plugin class
> (don't
> > > do
> > > > > it during plugin startup). You could request the console, forcing
> it to
> > > be
> > > > > created, from the perspective factory, but you wouldn't actually
use
> it
> > > at
> > > > > that point.
> > > >
> > > > > Nick
> > > >
> > > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > > news:chs3k3$7i3$1@eclipse.org...
> > > > > >
> > > > > > I call this from class that extends IPerspectiveFactory , in
> > > > > > createInitialLayout() method. I can't get page reference from
> there.
> > > > > > This class is extending point org.eclipse.ui.perspectives.
> > > > > >
> > > > > >
> > > > > > Roman.
> > > > > >
> > > > > >
> > > > > >
> > > > > > Nick Edgar wrote:
> > > > > >
> > > > > > > Where are you calling this from? You should be able to
> determine
> > > the
> > > > > page
> > > > > > > from the containing context of your workbench extension. For
> > > example,
> > > > > views
> > > > > > > and editors can get this from their site.
> > > > > >
> > > > > > > The NPE is probably due to the null page. showView does not
> return
> > > > > null.
> > > > > > > It will throw PartInitException if it fails.
> > > > > >
> > > > > > > Nick
> > > > > >
> > > > > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > > > > news:chrrqr$qm4$1@eclipse.org...
> > > > > > > >
> > > > > > > > Thank you for the answer!
> > > > > > > > I have following problems.
> > > > > > > >
> > > > > > > > 1. to get IWorkbenchPage I do
> > > > > > > > IWorkbenchPage page =
> > > > > > > >
> > > > > > >
> > > > >
> > >
>
MyPlugin.getInstance().getWorkbench().getActiveWorkbenchWind ow().getActivePa
> > > > > > > ge();
> > > > > > > > I couldn't find any other way to get it.
> > > > > > > > however, it doesn't throw any exception but page is null :(
> > > > > > > >
> > > > > > > > 2. Expression;
> > > > > > > > IConsoleView consoleView =
> > > > > > > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > > > > > > is invalid because page.showView returns IViewPart.
> > > > > > > > casting IViewPart to IConsoleView produces
> NullPointerException.
> > > > > > > >
> > > > > > > > Any other ways around?
> > > > > > > > Thanks.
> > > > > > > >
> > > > > > > >
> > > > > > > > Nick Edgar wrote:
> > > > > > > >
> > > > > > > > > The console view and API are defined in the
> > > org.eclipse.ui.console
> > > > > > > plug-in,
> > > > > > > > > so you'll need to include this plug-in and its
prerequisites
> in
> > > your
> > > > > RCP
> > > > > > > > > app.
> > > > > > > >
> > > > > > > > > You can show the console view using:
> > > > > > > > > IWorkbenchPage page = ...;
> > > > > > > > > IConsoleView consoleView =
> > > > > > > page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
> > > > > > > >
> > > > > > > > > Like the properties and outline views, the console view
has
> > > separate
> > > > > > > pages
> > > > > > > > > within it for different consoles. For example, Debug adds
> one
> > > > > console
> > > > > > > for
> > > > > > > > > each process, and CVS adds one too. Consoles are added
> > > > > > > programmatically,
> > > > > > > > > not via extension point.
> > > > > > > > > To add your own console:
> > > > > > > > > - create a new MessageConsole:
> > > > > > > > > - MessageConsole myConsole = new MessageConsole("My
> Console",
> > > null);
> > > > > > > > > - register it with the console manager:
> > > > > > > > >
> ConsolePlugin.getDefault().getConsoleManager().addConsoles(n ew
> > > > > > > IConsole[]
> > > > > > > > > { myConsole });
> > > > > > > >
> > > > > > > > > To show a console in an existing console view:
> > > > > > > > > consoleView.display(myConsole);
> > > > > > > >
> > > > > > > > > There's also a convenience method for showing a console,
> opening
> > > the
> > > > > > > console
> > > > > > > > > view in the active window if necessary:
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> ConsolePlugin.getDefault().getConsoleManager().showConsoleVi ew(myConsole);
> > > > > > > >
> > > > > > > > > Note that the console must have already been added to the
> > > manager
> > > > > before
> > > > > > > > > showing it (in both the previous snippets).
> > > > > > > >
> > > > > > > > > To write to a message console, use:
> > > > > > > > > MessageConsoleStream stream =
myConsole.newMessageStream();
> //
> > > hang
> > > > > > > onto
> > > > > > > > > this
> > > > > > > > > stream.println("Hi there!");
> > > > > > > >
> > > > > > > > > HTH,
> > > > > > > > > Nick
> > > > > > > >
> > > > > > > > > "Roman D" <dostick@apollo.lv> wrote in message
> > > > > > > > > news:chp6pm$j7f$1@eclipse.org...
> > > > > > > > > > Hi,
> > > > > > > > > >
> > > > > > > > > > There is no any articles/examples on how you may create
> and
> > > use
> > > > > the
> > > > > > > > > > Console in your RCP application.
> > > > > > > > > >
> > > > > > > > > > Seems like this is what need to be done in order to
create
> a
> > > > > Console:
> > > > > > > > > >
> > > > > > > > > > I need an IConsoleView ViewPart that will display
> > > MessageConsole.
> > > > > > > > > > Apparently I need to register MessageConsole it in
> > > IConsoleManager
> > > > > to
> > > > > > > make
> > > > > > > > > > it appear in IConsoelView.
> > > > > > > > > > I can't find any reference to IConsoleManager in any
> plugin.
> > > Seems
> > > > > > > none of
> > > > > > > > > > Workbench components implements it.
> > > > > > > > > >
> > > > > > > > > > Maybe it's all wrong that I am doing?
> > > > > > > > > >
> > > > > > > > > > Maybe I should just drop it and try to make console
using
> > > > > IViewPart
> > > > > > > and
> > > > > > > > > > some StyledText attached to it ?
> > > > > > > > > >
> > > > > > > > > > Did anyone ever used Console in RCP application?
> > > > > > > > > >
> > > > > > > > > > Thanks.
> > > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> >
> >
>
>
Previous Topic:a few number of files in only one editor
Next Topic:Need suggestions on adding dynamic menu items from secondary plug-in
Goto Forum:
  


Current Time: Tue Apr 23 13:25:08 GMT 2024

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

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

Back to the top