Author: dgolovin
Date: 2011-12-14 19:03:25 -0500 (Wed, 14 Dec 2011)
New Revision: 37331
Modified:
branches/jbosstools-3.3.0.M5/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java
Log:
https://issues.jboss.org/browse/JBIDE-10466 - JBoss Central opens after startup even if
it is not set so
Snjezana's patch is applied to 3.3.0.M5 branch
Modified:
branches/jbosstools-3.3.0.M5/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java
===================================================================
---
branches/jbosstools-3.3.0.M5/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java 2011-12-14
21:01:00 UTC (rev 37330)
+++
branches/jbosstools-3.3.0.M5/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java 2011-12-15
00:03:25 UTC (rev 37331)
@@ -30,22 +30,17 @@
public void earlyStartup() {
boolean showJBossCentral = JBossCentralActivator.getDefault()
.showJBossCentralOnStartup();
+ IEclipsePreferences prefs = JBossCentralActivator.getDefault()
+ .getPreferences();
+ Bundle usage = Platform.getBundle(ORG_JBOSS_TOOLS_USAGE);
+ Bundle central = Platform.getBundle(JBossCentralActivator.PLUGIN_ID);
if (!showJBossCentral) {
- Bundle usage = Platform.getBundle(ORG_JBOSS_TOOLS_USAGE);
if (usage != null) {
Version version = usage.getVersion();
String versionString = version.toString();
- IEclipsePreferences prefs = JBossCentralActivator.getDefault()
- .getPreferences();
String savedVersion = prefs.get(ORG_JBOSS_TOOLS_USAGE, "");
- Bundle central = Platform
- .getBundle(JBossCentralActivator.PLUGIN_ID);
if (!savedVersion.equals(versionString)) {
showJBossCentral = true;
- prefs.put(ORG_JBOSS_TOOLS_USAGE, versionString);
- if (central != null) {
- prefs.put(JBossCentralActivator.PLUGIN_ID, central.getVersion().toString());
- }
} else {
if (central != null) {
version = central.getVersion();
@@ -54,15 +49,18 @@
JBossCentralActivator.PLUGIN_ID, "");
if (!savedVersion.equals(versionString)) {
showJBossCentral = true;
- prefs.put(JBossCentralActivator.PLUGIN_ID, versionString);
}
}
}
}
}
+ saveVersion(prefs, usage, ORG_JBOSS_TOOLS_USAGE);
+ saveVersion(prefs, central, JBossCentralActivator.PLUGIN_ID);
+
if (!showJBossCentral) {
return;
}
+
Display.getDefault().asyncExec(new Runnable() {
@Override
@@ -72,4 +70,16 @@
});
}
+ protected void saveVersion(IEclipsePreferences prefs, Bundle bundle, String preference)
{
+ if (bundle == null || prefs == null || preference == null) {
+ return;
+ }
+ Version version = bundle.getVersion();
+ String versionString = version.toString();
+ String savedVersion = prefs.get(preference, "");
+ if (!savedVersion.equals(versionString)) {
+ prefs.put(preference, versionString);
+ }
+ }
+
}