Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

How to check if Plugin is already activated?
 Post subject: How to check if Plugin is already activated? Post rating: 0   New post Posted: Sun 29 Dec, 2019, 19:49 

User rating: 3
Joined: Fri 15 Nov, 2019, 12:54
Posts: 16
Location: Poland,
Hi,

I've implemented simple plugin, which has to be assigned to last activated chart and creates widget on that chart.

What is the proper (and simplest) way to check, if there is an instance of my plugin class already activated and assigned to the chart?
When the plugin is activated second time on the same chart I want to cancel further processing. Or even better - to prevent creating second instance of the plugin.


I've tried to use static attribute (set od IChart) to save charts with widget activated, but it seems to every instance be created "separate" from other instances.

Regards,
Marcin


 
 Post subject: Re: How to check if Plugin is already activated? Post rating: 0   New post Posted: Wed 19 Feb, 2020, 11:15 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Hello.

Plugin can try to find widget which was added by another instance of plugin and stop itself if widget already exists on chart.
Use this method from IChart interface:

/**
* Returns <code>IChartObject</code> instance by key if any exist on this panel.
*
* @param chartObjectKey unique id
* @return IChartObject or null if no object was found by specified key
*/
IChartObject get(String chartObjectKey);
To stop plugin use IContext.stop() method

Kind regards, Support Team.


 

Jump to:  

  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com