Author: snjeza
Date: 2011-10-15 16:40:57 -0400 (Sat, 15 Oct 2011)
New Revision: 35686
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/SoftwarePage.java
Log:
JBIDE-9368 Dashboard(s) for easy news aggregation, twitter and easy additional/3rd party
plugin installation and project template/creation
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-10-15
18:51:43 UTC (rev 35685)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-10-15
20:40:57 UTC (rev 35686)
@@ -62,6 +62,8 @@
*/
public class JBossCentralActivator extends AbstractUIPlugin {
+ private static final String JBOSS_DISCOVERY_DIRECTORY =
"jboss.discovery.directory";
+
public static final String JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML =
"http://download.jboss.org/jbosstools/examples/directory-3.3.0.xml";
public static final String ICON = "icon";
@@ -428,4 +430,11 @@
return bundleContext;
}
+ public static String getJBossDiscoveryDirectory() {
+ String directory = System.getProperty(JBOSS_DISCOVERY_DIRECTORY, null);
+ if (directory == null) {
+ return JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML;
+ }
+ return directory;
+ }
}
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java 2011-10-15
18:51:43 UTC (rev 35685)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java 2011-10-15
20:40:57 UTC (rev 35686)
@@ -10,12 +10,12 @@
************************************************************************************/
package org.jboss.tools.central;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.engine.IProfile;
-import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IStartup;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
/**
*
@@ -24,50 +24,52 @@
*/
public class ShowJBossCentral implements IStartup {
+ private static final String ORG_JBOSS_TOOLS_USAGE = "org.jboss.tools.usage";
+
@Override
public void earlyStartup() {
- boolean showJBossCentral =
JBossCentralActivator.getDefault().showJBossCentralOnStartup();
- IProvisioningAgent agent = (IProvisioningAgent)
JBossCentralActivator.getDefault().getService(IProvisioningAgent.SERVICE_NAME);
- IProfileRegistry profileRegistry = (IProfileRegistry)
agent.getService(IProfileRegistry.SERVICE_NAME);
- if (profileRegistry == null) {
- showJBossCentral = true;
- } else {
- IProfile profile = profileRegistry
- .getProfile(IProfileRegistry.SELF);
-
- if (profile != null) { // got NPE's when running in PDE
- String profileId = profile.getProfileId();
+ boolean showJBossCentral = JBossCentralActivator.getDefault()
+ .showJBossCentralOnStartup();
+ 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 savedId = prefs.get(JBossCentralActivator.PROFILE_ID,
- null);
- if (savedId == null || !savedId.equals(profileId)) {
- prefs.put(JBossCentralActivator.PROFILE_ID, profileId);
+ 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();
+ versionString = version.toString();
+ savedVersion = prefs.get(
+ JBossCentralActivator.PLUGIN_ID, "");
+ if (!savedVersion.equals(versionString)) {
+ showJBossCentral = true;
+ prefs.put(JBossCentralActivator.PLUGIN_ID, versionString);
+ }
+ }
}
- long timestamp = profile.getTimestamp();
- long savedTimestamp = prefs.getLong(
- JBossCentralActivator.PROFILE_TIMESTAMP, -1);
- if (timestamp != savedTimestamp) {
- prefs.putLong(JBossCentralActivator.PROFILE_TIMESTAMP,
- timestamp);
- showJBossCentral = true;
- }
- } else {
- // TODO: Not sure what is supposed to happen here if profile doesn't exist ?
}
}
if (!showJBossCentral) {
return;
}
Display.getDefault().asyncExec(new Runnable() {
-
+
@Override
public void run() {
JBossCentralActivator.getJBossCentralEditor();
}
});
-
}
}
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java 2011-10-15
18:51:43 UTC (rev 35685)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java 2011-10-15
20:40:57 UTC (rev 35686)
@@ -196,6 +196,8 @@
private void addDescription(ProjectFix projectFix) {
FormText fixDescriptionText = toolkit.createFormText(fixesComposite, true);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ fixDescriptionText.setLayoutData(gd);
StringBuffer buffer = new StringBuffer();
buffer.append(JBossCentralActivator.FORM_START_TAG);
buffer.append("<img href=\"image\"/> ");
@@ -215,6 +217,8 @@
protected void addRuntimeFixActions(ProjectFix projectFix) {
Button install = toolkit.createButton(fixesComposite, "Install", SWT.PUSH);
+ GridData gd = new GridData(SWT.FILL, SWT.END, false, false);
+ install.setLayoutData(gd);
ToolTip tooltip = new DescriptionToolTip(install, "JBoss Runtime
Detection");
tooltip.activate();
//install.setImage(JBossCentralActivator.getDefault().getImage("/icons/search_local.png"));
@@ -237,6 +241,8 @@
if (downloadRuntime != null) {
haveDownloadId = true;
Button download = toolkit.createButton(fixesComposite, "Download and
Install...", SWT.PUSH);
+ gd = new GridData(SWT.FILL, SWT.END, false, false);
+ download.setLayoutData(gd);
ToolTip tip = new DescriptionToolTip(download, "Download and install " +
downloadRuntime.getName());
tip.activate();
//download.setImage(JBossCentralActivator.getDefault().getImage("/icons/repository-submit.gif"));
@@ -312,7 +318,7 @@
connectorDiscovery.getDiscoveryStrategies().add(new BundleDiscoveryStrategy());
RemoteBundleDiscoveryStrategy remoteDiscoveryStrategy = new
RemoteBundleDiscoveryStrategy();
- remoteDiscoveryStrategy.setDirectoryUrl(JBossCentralActivator.JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML);
+ remoteDiscoveryStrategy.setDirectoryUrl(JBossCentralActivator.getJBossDiscoveryDirectory());
connectorDiscovery.getDiscoveryStrategies().add(remoteDiscoveryStrategy);
connectorDiscovery.setEnvironment(JBossCentralActivator.getEnvironment());
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/SoftwarePage.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/SoftwarePage.java 2011-10-15
18:51:43 UTC (rev 35685)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/SoftwarePage.java 2011-10-15
20:40:57 UTC (rev 35686)
@@ -123,7 +123,7 @@
discoveryViewer = new DiscoveryViewer(getSite(), this);
discoveryViewer.setShowConnectorDescriptorKindFilter(false);
discoveryViewer.setShowInstalledFilterEnabled(true);
- discoveryViewer.setDirectoryUrl(JBossCentralActivator.JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML);
+ discoveryViewer.setDirectoryUrl(JBossCentralActivator.getJBossDiscoveryDirectory());
discoveryViewer.createControl(pageBook);
discoveryViewer.setEnvironment(getEnvironment());
discoveryViewer.addFilter(new ViewerFilter() {