Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » programming for eclipse -debug console option
programming for eclipse -debug console option [message #327452] Mon, 21 April 2008 01:15 Go to next message
Eclipse UserFriend
Originally posted by: hos.prashne.com

I am creating an Eclipse RCP application.
When I create the .exe, I would want to run it from the command prompt
with the "-debug" option to show some extra features on the application.
Only the programmer knows this option.

When the user opens the application, these options should not be shown.

Is there was way where the programmer can check for the "-debug" option
being set and handle it accordingly in the code?
Re: programming for eclipse -debug console option [message #327454 is a reply to message #327452] Mon, 21 April 2008 03:17 Go to previous messageGo to next message
Eclipse UserFriend
Platform.inDebugMode();

--

- Prakash

Eclipse Tips: http://blog.cypal-solutions.com
Eclipse Search: http://www.cypal.in/eclipsesearch


Hosa wrote:
> I am creating an Eclipse RCP application. When I create the .exe, I
> would want to run it from the command prompt with the "-debug" option to
> show some extra features on the application. Only the programmer knows
> this option.
>
> When the user opens the application, these options should not be shown.
>
> Is there was way where the programmer can check for the "-debug" option
> being set and handle it accordingly in the code?
>
Re: programming for eclipse -debug console option [message #327457 is a reply to message #327454] Mon, 21 April 2008 04:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hos.prashne.com

Hi Prakash,

Thanks for the quick reply.
My eclipse RCP application consists of plug-ins I created using SWT and
JFace components. So when i added -

if(Platform.inDebugMode()){
System.out.println("My plugin is doing something");
}

The tests for these UI components in the plug-in is throwing an exeption
because the eclipse platform is initialized in the main eclipse component
of my project -

java.lang.NullPointerException
at org.eclipse.core.runtime.Platform.inDebugMode(Platform.java: 1515)


Is there anyway I can get rid of these exceptions when I am testing the
plug-ins before integrating them to the app?
Re: programming for eclipse -debug console option [message #327458 is a reply to message #327457] Mon, 21 April 2008 04:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hos.kfmd.com

Even when I used

if(Activator.getDefault().isDebugging()){
System.out.println("My plugin is doing something");
}

Its throwing me an exception -Exception in thread "main"
java.lang.NullPointerException
Re: programming for eclipse -debug console option [message #327460 is a reply to message #327457] Mon, 21 April 2008 12:56 Go to previous messageGo to next message
Eclipse UserFriend
Check out how it is done in JFace.
org.eclipse.ui.internal.JFaceUtil.initializeJFace()

Basically JFace provides an Policy object that has the variables like
Policy.DEBUG and/or Policy.TRACE_ACTIONS. When run within eclipse, the
options are set from the debug file from one of the plugins. You could
also set them programmatically for running outside of eclipse if needed.

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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Re: programming for eclipse -debug console option [message #327484 is a reply to message #327460] Tue, 22 April 2008 01:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ho.kks.com

Hi Paul,

It has the following code:

if ("true".equalsIgnoreCase(Platform.getDebugOption("/debug"))) {

to check whether its in Debug mode before checking the Policy object.
So, I am not sure this will help.


Paul Webster wrote:

> Check out how it is done in JFace.
> org.eclipse.ui.internal.JFaceUtil.initializeJFace()

> Basically JFace provides an Policy object that has the variables like
> Policy.DEBUG and/or Policy.TRACE_ACTIONS. When run within eclipse, the
> options are set from the debug file from one of the plugins. You could
> also set them programmatically for running outside of eclipse if needed.

> PW
Re: programming for eclipse -debug console option [message #327526 is a reply to message #327484] Wed, 23 April 2008 10:49 Go to previous message
Eclipse UserFriend
Hosa wrote:
>
> Hi Paul,
>
> It has the following code:
>
> if ("true".equalsIgnoreCase(Platform.getDebugOption("/debug"))) {
> to check whether its in Debug mode before checking the Policy object.
> So, I am not sure this will help.

Sorry, my point was you can use Policy.DEBUG, Policy.TRACE_WHATEVER in
your code. If you are in eclipse, set them using
Platform.getDebugOption(*). If you are not in eclipse, set them
programmatically some other way. That's how JFace needs to work, since
it can run as a bundle or as a java library.

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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Previous Topic:Eclipse classpath variables programmatically
Next Topic:Label refresh
Goto Forum:
  


Current Time: Wed May 07 14:34:54 EDT 2025

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

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

Back to the top