How to detect in an AbstractVisionComponent is we are in preview or design mode.
How to be notified that the mode has changed ?
I’ve only found onStartup/onShutdown when the component is created/destroyed.
Did you try to check what Connection Mode you were in? From the com.inductiveautomation.ignition.client.gateway_interface.GatewayConnection javadoc, you probably need to look at the method getConnectionMode. If this is working, you might be able to register your own PropertyChangeListener or ConnectionListener, but it is not completely obvious from the documentation what events you’ll get, so might need to listen to all property changes initially and then filter out the one you don’t need. You can access the GatewayConnection through the static method GatewayConnectionManager.getInstance…
Hopefully this will work for you.
Cheers
Nicolas
In case anyone else trying to figure it out stumbles across this post, this worked for me:
import com.inductiveautomation.factorypmi.application.FPMISystem;
if (FPMISystem.Mode.DESIGN == FPMISystem.getMode())
…