Distinguishing Designer Context from Client Context

I’ve got a swing component that I have exposed to the vision module/designer through the normal mechanisms. So, I have the designerHook and BeanInfo classes. My object is available to drag and drop into the windows of my project in designer. So far, so good.

But, I have behavior/code in that java swing object that needs to know if I am running in designer or as part of the client exposed to the user. I have combed the javadocs and searched the forum, but am not seeing a way to get what I am after. I expect this is easy and I just missed it. I am strictly working in the java space here, no python.

I did come across this bit of python code on the forum that hints at what I might need to do.
if system.util.getSystemFlags() & system.util.DESIGNER_FLAG:

I think there is a simple and proper solution that I have just missed. I have a hack in my application that relies on a singleton, but would rather learn the right way to solve this problem. Thanks in advance.


I don’t know if there’s a right way that is sure to always work, but what I do is have my designer hook class create an instance of the the client hook class and divert methods to it that mimic client behavior. (The client hook is normally not called by the platform when starting the designer.) This allows my client scope objects to query the client hook class for platform info in either environment. (License enforcement, in particular.) You could add a default-false client hook variable that is set by the designer hook.

Thanks for the reply. I think I am doing something similar in my code. I am using the clientHook and the designerHook to initialize a static in my class. I use that static to drive the behavior later.