Index: /home/lneterda/workspace2/net.sourceforge.eclipsetrader.core/plugin.xml =================================================================== --- /home/lneterda/workspace2/net.sourceforge.eclipsetrader.core/plugin.xml (revision 525) +++ /home/lneterda/workspace2/net.sourceforge.eclipsetrader.core/plugin.xml (working copy) @@ -8,6 +8,7 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + + + + + + + + + Index: /home/lneterda/workspace2/net.sourceforge.eclipsetrader.core/src/net/sourceforge/eclipsetrader/core/CorePlugin.java =================================================================== --- /home/lneterda/workspace2/net.sourceforge.eclipsetrader.core/src/net/sourceforge/eclipsetrader/core/CorePlugin.java (revision 525) +++ /home/lneterda/workspace2/net.sourceforge.eclipsetrader.core/src/net/sourceforge/eclipsetrader/core/CorePlugin.java (working copy) @@ -61,6 +61,7 @@ public static final String ACCOUNT_PROVIDERS_EXTENSION_POINT = PLUGIN_ID + ".accountProviders"; //$NON-NLS-1$ public static final String LABEL_PROVIDERS_EXTENSION_POINT = PLUGIN_ID + ".viewLabelProviders"; //$NON-NLS-1$ public static final String LOGGER_PREFERENCES_EXTENSION_POINT = PLUGIN_ID + ".loggingPreferences"; //$NON-NLS-1$ + public static final String REPOSITORY_PREFERENCES_EXTENSION_POINT = PLUGIN_ID + ".customRepository"; //$NON-NLS-1$ public static final String FEED_RUNNING = "FEED_RUNNING"; //$NON-NLS-1$ public static final String PREFS_ENABLE_HTTP_PROXY = "ENABLE_HTTP_PROXY"; //$NON-NLS-1$ public static final String PREFS_PROXY_HOST_ADDRESS = "PROXY_HOST_ADDRESS"; //$NON-NLS-1$ @@ -241,22 +242,40 @@ return plugin; } - public static Repository getRepository() - { - if (repository == null) - { - try - { - Class clazz = Class.forName("net.sourceforge.eclipsetrader.core.RepositoryImpl"); - repository = (Repository)clazz.newInstance(); - } - catch (Exception e) - { - repository = new XMLRepository(); - } - } - return repository; - } + public static Repository getRepository() { + if (repository == null) { + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IExtensionPoint extensionPoint = registry + .getExtensionPoint(CorePlugin.REPOSITORY_PREFERENCES_EXTENSION_POINT); + IConfigurationElement[] members = extensionPoint + .getConfigurationElements(); + if (members.length > 0) { + IConfigurationElement element = members[0]; + if (element.getName().equals("repository")) { + if (element.getAttribute("value") != null) { + try { + Object ooo = element + .createExecutableExtension("value"); + repository = (Repository) ooo; + } catch (Exception e) { + repository = new XMLRepository(); + } + } + } + } + + if (repository == null) { + try { + Class clazz = Class + .forName("net.sourceforge.eclipsetrader.core.RepositoryImpl"); + repository = (Repository) clazz.newInstance(); + } catch (Exception e) { + repository = new XMLRepository(); + } + } + } + return repository; + } /** * Returns an image descriptor for the image file at the given