Fixes issue #591 "Menu items randomly appear in the configuration panel" (for now).

cusax-fix
Lyubomir Marinov 17 years ago
parent b4be51c2f7
commit dbe1f3daa3

@ -681,6 +681,8 @@
<!-- add some eventual profiler args --> <!-- add some eventual profiler args -->
<jvmarg line="${profiler.args} ${jvmarg.line}"/> <jvmarg line="${profiler.args} ${jvmarg.line}"/>
<sysproperty key="apple.laf.useScreenMenuBar" value="true" />
</java> </java>
</target> </target>

@ -41,27 +41,27 @@ public ConfigFormList(ConfigurationFrame configFrame)
.createLineBorder(Constants.BORDER_COLOR)); .createLineBorder(Constants.BORDER_COLOR));
} }
/**
* Inserts a new <tt>ConfigurationForm</tt> to this list at the desired
* index.
* @param configForm The <tt>ConfigurationForm</tt> to add.
* @param index the index indicating the order of the configuration forms.
*/
public void addConfigForm(ConfigFormDescriptor configForm, int index)
{
if(index <= listModel.getSize())
listModel.add(index, configForm);
else
listModel.addElement(configForm);
}
/** /**
* Adds a new <tt>ConfigurationForm</tt> to this list. * Adds a new <tt>ConfigurationForm</tt> to this list.
* @param configForm The <tt>ConfigurationForm</tt> to add. * @param configForm The <tt>ConfigurationForm</tt> to add.
*/ */
public void addConfigForm(ConfigFormDescriptor configForm) public void addConfigForm(ConfigurationForm configForm)
{ {
listModel.addElement(configForm); if (configForm == null)
throw new IllegalArgumentException("configForm");
int i = 0;
int count = listModel.size();
int configFormIndex = configForm.getIndex();
for (; i < count; i++)
{
ConfigFormDescriptor descriptor
= (ConfigFormDescriptor) listModel.get(i);
if (configFormIndex < descriptor.getConfigForm().getIndex())
break;
}
listModel.add(i, new ConfigFormDescriptor(configForm));
} }
/** /**
@ -70,13 +70,19 @@ public void addConfigForm(ConfigFormDescriptor configForm)
*/ */
public void removeConfigForm(ConfigurationForm configForm) public void removeConfigForm(ConfigurationForm configForm)
{ {
for(int i = 0; i < listModel.getSize(); i ++) for(int count = listModel.getSize(), i = count - 1; i >= 0; i--)
{ {
ConfigFormDescriptor descriptor ConfigFormDescriptor descriptor
= (ConfigFormDescriptor) listModel.get(i); = (ConfigFormDescriptor) listModel.get(i);
if(descriptor.getConfigForm().equals(configForm)) if(descriptor.getConfigForm().equals(configForm))
listModel.removeElement(descriptor); {
listModel.remove(i);
/*
* TODO We may just consider not allowing duplicates on addition
* and then break here.
*/
}
} }
} }

@ -111,11 +111,13 @@ public ConfigurationFrame(MainFrame mainFrame)
*/ */
public void addDefaultForms() public void addDefaultForms()
{ {
this addConfigurationForm(
.addConfigurationForm(new LazyConfigurationForm( new LazyConfigurationForm(
"net.java.sip.communicator.impl.gui.main.account.AccountsConfigurationPanel", "net.java.sip.communicator.impl.gui.main.account.AccountsConfigurationPanel",
getClass().getClassLoader(), "service.gui.icons.ACCOUNT_ICON", getClass().getClassLoader(),
"service.gui.ACCOUNTS", 1)); "service.gui.icons.ACCOUNT_ICON",
"service.gui.ACCOUNTS",
10));
} }
/** /**
@ -215,17 +217,7 @@ public void serviceChanged(ServiceEvent event)
*/ */
private void addConfigurationForm(ConfigurationForm configForm) private void addConfigurationForm(ConfigurationForm configForm)
{ {
ConfigFormDescriptor descriptor = new ConfigFormDescriptor(configForm); configList.addConfigForm(configForm);
if (descriptor != null)
{
int index = configForm.getIndex();
if (index > -1)
configList.addConfigForm(descriptor, index);
else
configList.addConfigForm(descriptor);
}
} }
/** /**

@ -69,8 +69,11 @@ public void start(BundleContext context)
context.registerService(ConfigurationForm.class.getName(), context.registerService(ConfigurationForm.class.getName(),
new LazyConfigurationForm( new LazyConfigurationForm(
"net.java.sip.communicator.impl.media.MediaConfigurationPanel", "net.java.sip.communicator.impl.media.MediaConfigurationPanel",
getClass().getClassLoader(), "plugin.mediaconfig.PLUGIN_ICON", getClass().getClassLoader(),
"impl.media.configform.TITLE"), null); "plugin.mediaconfig.PLUGIN_ICON",
"impl.media.configform.TITLE",
40),
null);
//we use the nist-sdp stack to make parse sdp and we need to set the //we use the nist-sdp stack to make parse sdp and we need to set the
//following property to make sure that it would accept java generated //following property to make sure that it would accept java generated

@ -51,8 +51,11 @@ public void start(BundleContext bc) throws Exception
ConfigurationForm.class.getName(), ConfigurationForm.class.getName(),
new LazyConfigurationForm( new LazyConfigurationForm(
"net.java.sip.communicator.plugin.autoaway.AutoAwayConfigurationPanel", "net.java.sip.communicator.plugin.autoaway.AutoAwayConfigurationPanel",
getClass().getClassLoader(), "plugin.autoaway.PLUGIN_ICON", getClass().getClassLoader(),
"plugin.autoaway.AUTO_STATUS"), null); "plugin.autoaway.PLUGIN_ICON",
"plugin.autoaway.AUTO_STATUS",
20),
null);
new Thread(new Runnable() new Thread(new Runnable()
{ {

@ -42,8 +42,10 @@ public void start(BundleContext bc) throws Exception
new LazyConfigurationForm( new LazyConfigurationForm(
"net.java.sip.communicator.plugin.generalconfig.GeneralConfigurationPanel", "net.java.sip.communicator.plugin.generalconfig.GeneralConfigurationPanel",
getClass().getClassLoader(), getClass().getClassLoader(),
"plugin.generalconfig.PLUGIN_ICON", "service.gui.GENERAL", "plugin.generalconfig.PLUGIN_ICON",
0), null); "service.gui.GENERAL",
0),
null);
logger.info("PREFERENCES PLUGIN... [REGISTERED]"); logger.info("PREFERENCES PLUGIN... [REGISTERED]");
} }

@ -45,7 +45,9 @@ public void start(BundleContext context)
"net.java.sip.communicator.plugin.keybindingchooser.KeybindingsConfigPanel", "net.java.sip.communicator.plugin.keybindingchooser.KeybindingsConfigPanel",
getClass().getClassLoader(), getClass().getClassLoader(),
"plugin.keybinding.PLUGIN_ICON", "plugin.keybinding.PLUGIN_ICON",
"plugin.keybindings.PLUGIN_NAME"), null); "plugin.keybindings.PLUGIN_NAME",
900),
null);
} }
/** /**

@ -79,8 +79,11 @@ public void start(BundleContext bundleContext) throws Exception
ConfigurationForm.class.getName(), ConfigurationForm.class.getName(),
new LazyConfigurationForm( new LazyConfigurationForm(
"net.java.sip.communicator.plugin.mailbox.MailboxConfigurationPanel", "net.java.sip.communicator.plugin.mailbox.MailboxConfigurationPanel",
getClass().getClassLoader(), "plugin.mailbox.PLUGIN_ICON", getClass().getClassLoader(),
"plugin.mailbox.MAILBOX"), null); "plugin.mailbox.PLUGIN_ICON",
"plugin.mailbox.MAILBOX",
500),
null);
logger.info("Mailbox plug-in...[STARTED]"); logger.info("Mailbox plug-in...[STARTED]");
} }

@ -42,7 +42,9 @@ public void start(BundleContext bc) throws Exception
"net.java.sip.communicator.plugin.notificationconfiguration.NotificationConfigurationPanel", "net.java.sip.communicator.plugin.notificationconfiguration.NotificationConfigurationPanel",
getClass().getClassLoader(), getClass().getClassLoader(),
"plugin.notificationconfig.PLUGIN_ICON", "plugin.notificationconfig.PLUGIN_ICON",
"service.gui.NOTIFICATIONS"), null); "service.gui.NOTIFICATIONS",
30),
null);
logger.trace("Notification Configuration: [ STARTED ]"); logger.trace("Notification Configuration: [ STARTED ]");
} }

@ -40,7 +40,9 @@ public void start(BundleContext bc) throws Exception
"net.java.sip.communicator.plugin.pluginmanager.PluginManagerPanel", "net.java.sip.communicator.plugin.pluginmanager.PluginManagerPanel",
getClass().getClassLoader(), getClass().getClassLoader(),
"plugin.pluginmanager.PLUGIN_ICON", "plugin.pluginmanager.PLUGIN_ICON",
"plugin.pluginmanager.PLUGINS"), null); "plugin.pluginmanager.PLUGINS",
1000),
null);
} }
/** /**

Loading…
Cancel
Save