Author: snjeza
Date: 2011-09-13 17:22:29 -0400 (Tue, 13 Sep 2011)
New Revision: 34696
Added:
trunk/central/features/org.jboss.tools.central.feature/.project
trunk/central/features/org.jboss.tools.central.feature/build.properties
trunk/central/features/org.jboss.tools.central.feature/feature.properties
trunk/central/features/org.jboss.tools.central.feature/feature.xml
trunk/central/features/org.jboss.tools.central.feature/license.html
trunk/central/plugins/org.jboss.tools.central.discovery/.classpath
trunk/central/plugins/org.jboss.tools.central.discovery/.project
trunk/central/plugins/org.jboss.tools.central.discovery/.settings/
trunk/central/plugins/org.jboss.tools.central.discovery/.settings/org.eclipse.jdt.core.prefs
trunk/central/plugins/org.jboss.tools.central.discovery/META-INF/
trunk/central/plugins/org.jboss.tools.central.discovery/META-INF/MANIFEST.MF
trunk/central/plugins/org.jboss.tools.central.discovery/build.properties
trunk/central/plugins/org.jboss.tools.central.discovery/images/
trunk/central/plugins/org.jboss.tools.central.discovery/images/Thumbs.db
trunk/central/plugins/org.jboss.tools.central.discovery/images/egit_32.png
trunk/central/plugins/org.jboss.tools.central.discovery/images/m2e_32.gif
trunk/central/plugins/org.jboss.tools.central.discovery/images/redhat_48.png
trunk/central/plugins/org.jboss.tools.central.discovery/images/testng_16.gif
trunk/central/plugins/org.jboss.tools.central.discovery/images/testng_screenshot.png
trunk/central/plugins/org.jboss.tools.central.discovery/plugin.properties
trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml
trunk/central/plugins/org.jboss.tools.central/.classpath
trunk/central/plugins/org.jboss.tools.central/.project
trunk/central/plugins/org.jboss.tools.central/.settings/
trunk/central/plugins/org.jboss.tools.central/.settings/org.eclipse.jdt.core.prefs
trunk/central/plugins/org.jboss.tools.central/META-INF/
trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF
trunk/central/plugins/org.jboss.tools.central/about.html
trunk/central/plugins/org.jboss.tools.central/about.ini
trunk/central/plugins/org.jboss.tools.central/about.mappings
trunk/central/plugins/org.jboss.tools.central/about.properties
trunk/central/plugins/org.jboss.tools.central/bin/
trunk/central/plugins/org.jboss.tools.central/build.properties
trunk/central/plugins/org.jboss.tools.central/icons/
trunk/central/plugins/org.jboss.tools.central/icons/Thumbs.db
trunk/central/plugins/org.jboss.tools.central/icons/arrow-left-orange-9x8.gif
trunk/central/plugins/org.jboss.tools.central/icons/close_button.png
trunk/central/plugins/org.jboss.tools.central/icons/examples_wiz.gif
trunk/central/plugins/org.jboss.tools.central/icons/gettingStarted.png
trunk/central/plugins/org.jboss.tools.central/icons/jbds16.png
trunk/central/plugins/org.jboss.tools.central/icons/jboss.gif
trunk/central/plugins/org.jboss.tools.central/icons/jbossas7.png
trunk/central/plugins/org.jboss.tools.central/icons/jbosscorp_logo.png
trunk/central/plugins/org.jboss.tools.central/icons/jbosstools_icon16.png
trunk/central/plugins/org.jboss.tools.central/icons/jive-icon-accept-16x16.gif
trunk/central/plugins/org.jboss.tools.central/icons/jive-icon-working-16x16.gif
trunk/central/plugins/org.jboss.tools.central/icons/loader.gif
trunk/central/plugins/org.jboss.tools.central/icons/logo_rh_home.png
trunk/central/plugins/org.jboss.tools.central/icons/news.gif
trunk/central/plugins/org.jboss.tools.central/icons/news.png
trunk/central/plugins/org.jboss.tools.central/icons/newsLink.gif
trunk/central/plugins/org.jboss.tools.central/icons/preferences.gif
trunk/central/plugins/org.jboss.tools.central/icons/refresh.gif
trunk/central/plugins/org.jboss.tools.central/icons/repository-submit.gif
trunk/central/plugins/org.jboss.tools.central/icons/save.gif
trunk/central/plugins/org.jboss.tools.central/icons/seam16.png
trunk/central/plugins/org.jboss.tools.central/icons/search_local.png
trunk/central/plugins/org.jboss.tools.central/icons/software.png
trunk/central/plugins/org.jboss.tools.central/icons/star.png
trunk/central/plugins/org.jboss.tools.central/icons/tools.png
trunk/central/plugins/org.jboss.tools.central/icons/tools16.png
trunk/central/plugins/org.jboss.tools.central/icons/twitter.png
trunk/central/plugins/org.jboss.tools.central/icons/update.gif
trunk/central/plugins/org.jboss.tools.central/icons/wtp_server.gif
trunk/central/plugins/org.jboss.tools.central/jboss_about.png
trunk/central/plugins/org.jboss.tools.central/plugin.properties
trunk/central/plugins/org.jboss.tools.central/plugin.xml
trunk/central/plugins/org.jboss.tools.central/schema/
trunk/central/plugins/org.jboss.tools.central/schema/downloadJBossRuntimes.exsd
trunk/central/plugins/org.jboss.tools.central/schema/projectExamplesTutorials.exsd
trunk/central/plugins/org.jboss.tools.central/src/
trunk/central/plugins/org.jboss.tools.central/src/org/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/DownloadRuntime.java
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/actions/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/AbstractPreferencesHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/DownloadJBossAs701Handler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/FavoriteAtEclipseMarketplaceHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossCentralPreferencesHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossRuntimeDetectionPreferencesHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossSeamRuntimePreferencesHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/NewProjectExamplesWizardHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsHomeHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsTwitterHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenWithBrowserHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshDiscoveryHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossTwitterHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/ShowJBossCentralHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/WTPRuntimePreferencesHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/AbstractJBossCentralPage.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditorContributor.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditorInput.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/NewsToolTip.java
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/xpl/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/DiscoveryViewer.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/OverviewToolTip.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/preferences/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/preferences/JBossCentralPreferencePage.java
Log:
JBIDE-9368 Dashboard(s) for easy news aggregation, twitter and easy additional/3rd party
plugin installation and project template/creation
Added: trunk/central/features/org.jboss.tools.central.feature/.project
===================================================================
--- trunk/central/features/org.jboss.tools.central.feature/.project
(rev 0)
+++ trunk/central/features/org.jboss.tools.central.feature/.project 2011-09-13 21:22:29
UTC (rev 34696)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.central.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/central/features/org.jboss.tools.central.feature/build.properties
===================================================================
--- trunk/central/features/org.jboss.tools.central.feature/build.properties
(rev 0)
+++ trunk/central/features/org.jboss.tools.central.feature/build.properties 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ license.html,\
+ feature.properties
Added: trunk/central/features/org.jboss.tools.central.feature/feature.properties
===================================================================
--- trunk/central/features/org.jboss.tools.central.feature/feature.properties
(rev 0)
+++ trunk/central/features/org.jboss.tools.central.feature/feature.properties 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,54 @@
+###############################################################################
+# Copyright (c) 2008-2011 Red Hat, Inc. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+#
http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# JBoss by Red Hat - Initial implementation.
+##############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=JBoss Central
+
+# "providerName" property - name of the company that provides the feature
+providerName=JBoss by Red Hat
+
+# "updateSiteName" property - label for the update site
+updateSiteName=JBossTools Update Site
+
+# "description" property - description of the feature
+description=Extensions for Eclipse JDT tooling, provides features such as easily
connecting the debugger to remote Java application.
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=Copyright (c) 2008-2011 Red Hat, Inc. and others.\nAll rights reserved. This
program and the accompanying materials\n
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http\://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors\:\n\
+JBoss by Red Hat - Initial implementation.\n
+ ############### end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# START NON-TRANSLATABLE
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=Red Hat, Inc. licenses these features and plugins to you under \
+certain open source licenses (or aggregations of such licenses), which \
+in a particular case may include the Eclipse Public License, the GNU \
+Lesser General Public License, and/or certain other open source \
+licenses. For precise licensing details, consult the corresponding \
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive, \
+Raleigh NC 27606 USA.
+# END NON-TRANSLATABLE
+########### end of license property ##########################################
Added: trunk/central/features/org.jboss.tools.central.feature/feature.xml
===================================================================
--- trunk/central/features/org.jboss.tools.central.feature/feature.xml
(rev 0)
+++ trunk/central/features/org.jboss.tools.central.feature/feature.xml 2011-09-13 21:22:29
UTC (rev 34696)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.jboss.tools.central.feature"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%featureName"
+ plugin="org.jboss.tools.central">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.jboss.tools.central"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/central/features/org.jboss.tools.central.feature/license.html
===================================================================
--- trunk/central/features/org.jboss.tools.central.feature/license.html
(rev 0)
+++ trunk/central/features/org.jboss.tools.central.feature/license.html 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+
+<body>
+<p>Red Hat, Inc. licenses these features and plugins to you under
+certain open source licenses (or aggregations of such licenses), which
+in a particular case may include the Eclipse Public License, the GNU
+Lesser General Public License, and/or certain other open source
+licenses. For precise licensing details, consult the corresponding
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive,
+Raleigh NC 27606 USA.
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/central/plugins/org.jboss.tools.central/.classpath
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/.classpath (rev
0)
+++ trunk/central/plugins/org.jboss.tools.central/.classpath 2011-09-13 21:22:29 UTC (rev
34696)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/central/plugins/org.jboss.tools.central/.project
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/.project (rev
0)
+++ trunk/central/plugins/org.jboss.tools.central/.project 2011-09-13 21:22:29 UTC (rev
34696)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.central</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/central/plugins/org.jboss.tools.central/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/.settings/org.eclipse.jdt.core.prefs 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,8 @@
+#Sat Aug 20 14:25:17 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF 2011-09-13 21:22:29
UTC (rev 34696)
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.central; singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.central.JBossCentralActivator
+Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.jface.text;bundle-version="3.7.0",
+ org.eclipse.core.resources;bundle-version="3.7.0",
+ org.eclipse.ui.editors;bundle-version="3.7.0",
+ org.eclipse.ui.ide;bundle-version="3.7.0",
+ org.eclipse.ui.forms;bundle-version="3.5.100",
+ org.eclipse.ui.browser;bundle-version="3.3.100",
+ com.sun.syndication;bundle-version="0.9.0",
+ org.jdom;bundle-version="1.0.0",
+ org.apache.commons.lang;bundle-version="2.4.0",
+ org.jboss.tools.project.examples,
+ org.jboss.tools.runtime.core,
+ org.jboss.tools.runtime.ui,
+ org.eclipse.mylyn.commons.core;bundle-version="3.6.0",
+ org.eclipse.mylyn.discovery.ui;bundle-version="3.6.0",
+ org.eclipse.mylyn.discovery.core;bundle-version="3.6.0",
+ org.eclipse.mylyn.commons.ui;bundle-version="3.6.1"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Localization: plugin
+Bundle-Vendor: %BundleName
Added: trunk/central/plugins/org.jboss.tools.central/about.html
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/about.html (rev
0)
+++ trunk/central/plugins/org.jboss.tools.central/about.html 2011-09-13 21:22:29 UTC (rev
34696)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
+<title>JBoss Central</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>JBoss Central</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a
href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a
href="http://www.jboss.org/tools">JBoss Tools project
page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a
href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License
- Version 1.0</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/central/plugins/org.jboss.tools.central/about.ini
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/about.ini (rev
0)
+++ trunk/central/plugins/org.jboss.tools.central/about.ini 2011-09-13 21:22:29 UTC (rev
34696)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog
(translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=jboss_about.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which
the
+# welcome page is to be opened.
+# optional
+
+
+
Added: trunk/central/plugins/org.jboss.tools.central/about.mappings
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/about.mappings
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/about.mappings 2011-09-13 21:22:29 UTC
(rev 34696)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Added: trunk/central/plugins/org.jboss.tools.central/about.properties
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/about.properties
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/about.properties 2011-09-13 21:22:29 UTC
(rev 34696)
@@ -0,0 +1,2 @@
+blurb=JBoss Central\n\nVersion\: {featureVersion}\n\n(c) Copyright JBoss by Red Hat,
contributors and others 2004 - 2011. All rights reserved.\nVisit http\://jboss.org/tools
+
Added: trunk/central/plugins/org.jboss.tools.central/build.properties
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/build.properties
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/build.properties 2011-09-13 21:22:29 UTC
(rev 34696)
@@ -0,0 +1,13 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ plugin.properties,\
+ schema/,\
+ about.html,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ jboss_about.png
Added: trunk/central/plugins/org.jboss.tools.central/icons/Thumbs.db
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/Thumbs.db
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/arrow-left-orange-9x8.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central/icons/arrow-left-orange-9x8.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/close_button.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/close_button.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/examples_wiz.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/examples_wiz.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/gettingStarted.png
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central/icons/gettingStarted.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/jbds16.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/jbds16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/jboss.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/jboss.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/jbossas7.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/jbossas7.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/jbosscorp_logo.png
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central/icons/jbosscorp_logo.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/jbosstools_icon16.png
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central/icons/jbosstools_icon16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/jive-icon-accept-16x16.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central/icons/jive-icon-accept-16x16.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/jive-icon-working-16x16.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central/icons/jive-icon-working-16x16.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/loader.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/loader.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/logo_rh_home.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/logo_rh_home.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/news.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/news.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/news.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/news.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/newsLink.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/newsLink.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/preferences.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/preferences.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/refresh.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/refresh.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/repository-submit.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central/icons/repository-submit.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/save.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/save.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/seam16.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/seam16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/search_local.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/search_local.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/software.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/software.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/star.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/star.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/tools.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/tools.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/tools16.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/tools16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/twitter.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/twitter.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/update.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/update.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/wtp_server.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/wtp_server.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/jboss_about.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/jboss_about.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/plugin.properties
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/plugin.properties
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/plugin.properties 2011-09-13 21:22:29
UTC (rev 34696)
@@ -0,0 +1,5 @@
+#Properties file for org.jboss.tools.central
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Central
+DownloadJBossRuntimes = Download JBoss Runtimes
+ProjectExamplesTutorial = Project Examples Tutorial
Added: trunk/central/plugins/org.jboss.tools.central/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/plugin.xml (rev
0)
+++ trunk/central/plugins/org.jboss.tools.central/plugin.xml 2011-09-13 21:22:29 UTC (rev
34696)
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension-point id="downloadJBossRuntimes"
name="%DownloadJBossRuntimes"
schema="schema/downloadJBossRuntimes.exsd"/>
+ <extension-point id="projectExamplesTutorials"
name="%ProjectExamplesTutorial"
schema="schema/projectExamplesTutorials.exsd"/>
+
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="JBoss Central"
+ icon="icons/jboss.gif"
+
contributorClass="org.jboss.tools.central.editors.JBossCentralEditorContributor"
+ class="org.jboss.tools.central.editors.JBossCentralEditor"
+ id="org.jboss.tools.central.editors.JBossCentralEditor">
+ </editor>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup class="org.jboss.tools.central.ShowJBossCentral">
+ </startup>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.jboss.tools.common.model.ui.MainPreferencePage"
+
class="org.jboss.tools.central.preferences.JBossCentralPreferencePage"
+ id="org.jboss.tools.central.preferences.JBossCentralPreferencePage"
+ name="JBoss Central"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:help?before=group.intro">
+ <command
+ commandId="org.jboss.tools.central.show"
+ icon="icons/jboss.gif"
+ id="org.jboss.tools.central.show">
+ </command>
+
+ </menuContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+
defaultHandler="org.jboss.tools.central.actions.DownloadJBossAs701Handler"
+ name="Download and Install JBoss AS 7.0.1"
+ id="org.jboss.tools.central.downloadJBossAs701Handler">
+ </command>
+ <command
+
defaultHandler="org.jboss.tools.central.actions.ShowJBossCentralHandler"
+ name="JBoss Central"
+ id="org.jboss.tools.central.show">
+ </command>
+ <command
+
defaultHandler="org.jboss.tools.central.actions.OpenJBossToolsHomeHandler"
+ name="JBoss Tools Home"
+ id="org.jboss.tools.central.openJBossToolsHome">
+ </command>
+
+ <command
+ defaultHandler="org.jboss.tools.central.actions.OpenJBossNewsHandler"
+ name="News"
+ id="org.jboss.tools.central.openJBossNews">
+ </command>
+
+ <command
+
defaultHandler="org.jboss.tools.central.actions.RefreshJBossNewsHandler"
+ name="Refresh"
+ id="org.jboss.tools.central.refreshJBossNews">
+ </command>
+ <command
+
defaultHandler="org.jboss.tools.central.actions.RefreshDiscoveryHandler"
+ name="Refresh"
+ id="org.jboss.tools.central.refreshDiscovery">
+ </command>
+
+
+ <command
+
defaultHandler="org.jboss.tools.central.actions.OpenJBossToolsTwitterHandler"
+ name="Twitter"
+ id="org.jboss.tools.central.openJBossToolsTwitter">
+ </command>
+
+ <command
+
defaultHandler="org.jboss.tools.central.actions.NewProjectExamplesWizardHandler"
+ name="Project Examples Wizard"
+ id="org.jboss.tools.central.newProjectExamplesWizard">
+ </command>
+
+ <command
+
defaultHandler="org.jboss.tools.central.actions.FavoriteAtEclipseMarketplaceHandler"
+ name="Favorite this @ Eclipse Marketplace"
+ id="org.jboss.tools.central.favoriteAtEclipseMarketplace">
+ </command>
+
+ <command
+
defaultHandler="org.jboss.tools.central.actions.JBossCentralPreferencesHandler"
+ name="Preferences"
+ id="org.jboss.tools.central.preferences">
+ </command>
+
+ <command
+
defaultHandler="org.jboss.tools.central.actions.JBossRuntimeDetectionPreferencesHandler"
+ name="JBoss Runtime Detection"
+ id="org.jboss.tools.runtime.preferences">
+ </command>
+
+ <command
+
defaultHandler="org.jboss.tools.central.actions.JBossSeamRuntimePreferencesHandler"
+ name="JBoss Seam 2 Runtime Preferences"
+ id="org.jboss.tools.seam.runtime.preferences">
+ </command>
+
+
+ <command
+
defaultHandler="org.jboss.tools.central.actions.WTPRuntimePreferencesHandler"
+ name="WTP Runtime Preferences"
+ id="org.jboss.tools.wtp.runtime.preferences">
+ </command>
+
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.jboss.tools.central.downloadJBossAs701Handler"
+ icon="icons/jbossas7.png">
+ </image>
+ <image
+ commandId="org.jboss.tools.central.openJBossToolsHome"
+ icon="icons/jbosstools_icon16.png">
+ </image>
+ <image
+ commandId="org.jboss.tools.central.openJBossNews"
+ icon="icons/news.gif">
+ </image>
+ <image
+ commandId="org.jboss.tools.central.refreshJBossNews"
+ icon="icons/refresh.gif">
+ </image>
+ <image
+ commandId="org.jboss.tools.central.refreshDiscovery"
+ icon="icons/refresh.gif">
+ </image>
+
+ <image
+ commandId="org.jboss.tools.central.openJBossToolsTwitter"
+ icon="icons/twitter.png">
+ </image>
+ <image
+ commandId="org.jboss.tools.central.favoriteAtEclipseMarketplace"
+ icon="icons/star.png">
+ </image>
+ <image
+ commandId="org.jboss.tools.central.preferences"
+ icon="icons/preferences.gif">
+ </image>
+ <image
+ commandId="org.jboss.tools.runtime.preferences"
+ icon="icons/search_local.png">
+ </image>
+
+ <image
+ commandId="org.jboss.tools.wtp.runtime.preferences"
+ icon="icons/wtp_server.gif">
+ </image>
+
+ <image
+ commandId="org.jboss.tools.seam.runtime.preferences"
+ icon="icons/seam16.png">
+ </image>
+
+ <image
+ commandId="org.jboss.tools.central.newProjectExamplesWizard"
+ icon="icons/examples_wiz.gif">
+ </image>
+ </extension>
+ <extension
+ point="org.jboss.tools.central.downloadJBossRuntimes">
+ <runtime
+ id="org.jboss.tools.central.as.701"
+ name="JBoss AS 7.0.1 Everything (NOT Java EE6 Certified)"
+ version="7.0.1.Final"
+ size="68MB"
+
url="http://download.jboss.org/jbossas/7.0/jboss-as-7.0.1.Final/jbos...
+ <runtime
+ id="org.jboss.tools.central.seam.222"
+ name="JBoss Seam 2.2.2.Final"
+ version="2.2.2.Final"
+ size="113.2MB"
+
url="http://sourceforge.net/projects/jboss/files/JBoss%20Seam/2.2.2....
+ <runtime
+ id="org.jboss.tools.central.as.610"
+ name="JBoss AS 6.1.0"
+ version="6.1.0.Final"
+ size="183MB"
+
url="http://download.jboss.org/jbossas/6.1/jboss-as-distribution-6.1...
+
+ </extension>
+
+ <extension
+ point="org.jboss.tools.central.projectExamplesTutorials">
+ <tutorial
+ id="org.jboss.tools.central.booking22"
+ category="Seam"
+ name="booking22"
+ description="JBoss Seam 2 Booking Examples"
+ wtpRuntimes="org.jboss.tools.central.as.610"
+ seamRuntimes="org.jboss.tools.central.seam.222"
+ eclipseIU="org.testng.eclipse" />
+ </extension>
+
+</plugin>
Added: trunk/central/plugins/org.jboss.tools.central/schema/downloadJBossRuntimes.exsd
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/schema/downloadJBossRuntimes.exsd
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/schema/downloadJBossRuntimes.exsd 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,138 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.central"
xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.tools.central"
id="downloadJBossRuntimes" name="Download JBoss Runtimes"/>
+ </appinfo>
+ <documentation>
+ Downloads a new JBoss Runtime
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="runtime" minOccurs="1"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="runtime">
+ <complexType>
+ <attribute name="id" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="url" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="size" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 3.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ <extension
+ point="org.jboss.tools.central.downloadJBossRuntimes">
+
+</extension>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ JBoss by Red Hat
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/central/plugins/org.jboss.tools.central/schema/projectExamplesTutorials.exsd
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/schema/projectExamplesTutorials.exsd
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/schema/projectExamplesTutorials.exsd 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,143 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.central"
xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.tools.central"
id="projectExamplesTutorial" name="Project Examples Tutorial"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="tutorial" minOccurs="1"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="tutorial">
+ <complexType>
+ <sequence>
+ </sequence>
+ <attribute name="category" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="wtpRuntimes" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="seamRuntimes" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="eclipseIU" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/DownloadRuntime.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/DownloadRuntime.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/DownloadRuntime.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,88 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class DownloadRuntime {
+ private String name;
+ private String id;
+ private String version;
+ private String url;
+
+ public DownloadRuntime(String id, String name, String version, String url) {
+ super();
+ this.id = id;
+ this.name = name;
+ this.version = version;
+ this.url = url;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getVersion() {
+ return version;
+ }
+ public void setVersion(String version) {
+ this.version = version;
+ }
+ public String getUrl() {
+ return url;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DownloadRuntime other = (DownloadRuntime) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "DownloadRuntime [name=" + name + ", id=" + id + ",
version="
+ + version + ", url=" + url + "]";
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,279 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWebBrowser;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.eclipse.ui.internal.browser.WebBrowserPreference;
+import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.menus.CommandContributionItemParameter;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.services.IServiceLocator;
+import org.jboss.tools.central.editors.JBossCentralEditor;
+import org.jboss.tools.central.editors.JBossCentralEditorInput;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class JBossCentralActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.central";
//$NON-NLS-1$
+
+ public static final String DOWNLOAD_JBOSS_RUNTIMES_EXTENSION_ID =
"org.jboss.tools.central.downloadJBossRuntimes";
+
+ public static final String SHOW_JBOSS_CENTRAL_ON_STARTUP =
"showJBossCentralOnStartup";
+
+ public static final boolean SHOW_JBOSS_CENTRAL_ON_STARTUP_DEFAULT_VALUE = true;
+
+ private static final String JBDS_PRODUCT_PLUGIN_ID =
"com.jboss.jbds.product";
+
+ public static final String NEW_PROJECT_EXAMPLES_WIZARD_ID =
"org.jboss.tools.project.examples.wizard.NewProjectExamplesWizard";
+
+ public static final String NEWS_URL = "http://planet.jboss.org/view/all";
+
+ public static final String NEWS_ATOM_URL =
"http://planet.jboss.org/xml/all?type=atom";
+
+ public static final String FORM_END_TAG = "</p></form>";
+ public static final String FORM_START_TAG = "<form><p>";
+ public static final String CANCELED = FORM_START_TAG + "<span
color=\"header\" font=\"header\">Canceled.</span>" +
FORM_END_TAG;
+ public static final String LOADING = FORM_START_TAG + "<span
color=\"header\" font=\"header\">Loading...</span>" +
FORM_END_TAG;
+
+ public static final int MAX_FEEDS = 40;
+
+ private static final String NAME = "name"; //$NON-NLS-1$
+ private static final String ID = "id"; //$NON-NLS-1$
+ private static final String VERSION = "version"; //$NON-NLS-1$
+ private static final String URL = "url"; //$NON-NLS-1$
+
+ // The shared instance
+ private static JBossCentralActivator plugin;
+
+ private Map<String, DownloadRuntime> downloadRuntimes;
+
+ /**
+ * The constructor
+ */
+ public JBossCentralActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static JBossCentralActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public IEclipsePreferences getPreferences() {
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(PLUGIN_ID);
+ return prefs;
+ }
+
+ public void savePreferences() {
+ IEclipsePreferences prefs = getPreferences();
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ log(e);
+ }
+ }
+
+ public static void log(Exception e, String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ plugin.getLog().log(status);
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e
+ .getLocalizedMessage(), e);
+ plugin.getLog().log(status);
+ }
+
+ public static void log(String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message);
+ plugin.getLog().log(status);
+ }
+
+ public boolean showJBossCentralOnStartup() {
+ IEclipsePreferences prefs = JBossCentralActivator.getDefault().getPreferences();
+ return prefs.getBoolean(SHOW_JBOSS_CENTRAL_ON_STARTUP,
SHOW_JBOSS_CENTRAL_ON_STARTUP_DEFAULT_VALUE);
+ }
+
+ public static boolean isJBDS() {
+ Bundle bundle = Platform.getBundle(JBDS_PRODUCT_PLUGIN_ID);
+ return bundle != null;
+ }
+
+ public static void openUrl(String location, Shell shell) {
+ URL url = null;
+ try {
+ if (location != null) {
+ url = new URL(location);
+ }
+
+ if (WebBrowserPreference.getBrowserChoice() == WebBrowserPreference.EXTERNAL) {
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
+ .getBrowserSupport();
+ support.getExternalBrowser().openURL(url);
+ } else {
+ IWebBrowser browser = null;
+ int flags;
+ if (WorkbenchBrowserSupport.getInstance().isInternalWebBrowserAvailable()) {
+ flags = IWorkbenchBrowserSupport.AS_EDITOR
+ | IWorkbenchBrowserSupport.LOCATION_BAR
+ | IWorkbenchBrowserSupport.NAVIGATION_BAR;
+ } else {
+ flags = IWorkbenchBrowserSupport.AS_EXTERNAL
+ | IWorkbenchBrowserSupport.LOCATION_BAR
+ | IWorkbenchBrowserSupport.NAVIGATION_BAR;
+ }
+
+ String generatedId = JBossCentralActivator.PLUGIN_ID + System.currentTimeMillis();
+ browser = WorkbenchBrowserSupport.getInstance().createBrowser(flags, generatedId,
null, null);
+ browser.openURL(url);
+ }
+ } catch (PartInitException e) {
+ Status status = new Status(IStatus.ERROR,
+ JBossCentralActivator.PLUGIN_ID,
+ "Browser initialization failed");
+ JBossCentralActivator.getDefault().getLog().log(status);
+ MessageDialog.openError(shell, "Open Location",
+ status.getMessage());
+ } catch (MalformedURLException e) {
+ Status status = new Status(IStatus.ERROR,
+ JBossCentralActivator.PLUGIN_ID, "Invalid URL");
+ JBossCentralActivator.getDefault().getLog().log(status);
+ MessageDialog.openError(shell, "Open Location",
+ status.getMessage());
+ }
+ }
+
+ public Image getImage(ImageDescriptor imageDescriptor) {
+ ImageRegistry imageRegistry = getImageRegistry();
+ String id = getImageId(imageDescriptor);
+ Image image = imageRegistry.get(id);
+ if (image == null) {
+ image = imageDescriptor.createImage(true);
+ imageRegistry.put(id, image);
+ }
+ return image;
+ }
+
+ private String getImageId(ImageDescriptor imageDescriptor) {
+ return PLUGIN_ID + "/" + imageDescriptor.hashCode();
+ }
+
+ public static CommandContributionItem createContributionItem(IServiceLocator
serviceLocator, String commandId) {
+ CommandContributionItemParameter parameter = new CommandContributionItemParameter(
+ serviceLocator, commandId, commandId,
+ CommandContributionItem.STYLE_PUSH);
+ return new CommandContributionItem(parameter);
+ }
+
+ public static JBossCentralEditor getJBossCentralEditor() {
+ IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorInput input = JBossCentralEditorInput.INSTANCE;
+ try {
+ IEditorPart editor = page.openEditor(input, JBossCentralEditor.ID);
+ if (editor instanceof JBossCentralEditor) {
+ return (JBossCentralEditor) editor;
+ }
+ } catch (PartInitException e) {
+ JBossCentralActivator.log(e);
+ }
+ return null;
+ }
+
+ public Map<String, DownloadRuntime> getDownloadJBossRuntimes() {
+ if (downloadRuntimes == null) {
+ downloadRuntimes = new HashMap<String, DownloadRuntime>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry
+ .getExtensionPoint(DOWNLOAD_JBOSS_RUNTIMES_EXTENSION_ID);
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configurationElements = extension
+ .getConfigurationElements();
+ for (int j = 0; j < configurationElements.length; j++) {
+ IConfigurationElement configurationElement = configurationElements[j];
+ String name = configurationElement.getAttribute(NAME);
+ String id = configurationElement.getAttribute(ID);
+ String version = configurationElement.getAttribute(VERSION);
+ String url = configurationElement.getAttribute(URL);
+ DownloadRuntime downloadRuntime = new DownloadRuntime(id, name, version, url);
+ downloadRuntimes.put(id, downloadRuntime);
+ }
+ }
+ }
+ return downloadRuntimes;
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,39 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IStartup;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class ShowJBossCentral implements IStartup {
+
+ @Override
+ public void earlyStartup() {
+ boolean showJBossCentral =
JBossCentralActivator.getDefault().showJBossCentralOnStartup();
+ if (!showJBossCentral) {
+ return;
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ JBossCentralActivator.getJBossCentralEditor();
+ }
+ });
+
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/AbstractPreferencesHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/AbstractPreferencesHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/AbstractPreferencesHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,35 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+/**
+* @author snjeza
+*
+*/
+public abstract class AbstractPreferencesHandler extends AbstractHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell,
getPreferenceId(), null, null);
+ preferenceDialog.open();
+ return null;
+ }
+
+ public abstract String getPreferenceId();
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/DownloadJBossAs701Handler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/DownloadJBossAs701Handler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/DownloadJBossAs701Handler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,148 @@
+package org.jboss.tools.central.actions;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.central.DownloadRuntime;
+import org.jboss.tools.central.JBossCentralActivator;
+import org.jboss.tools.project.examples.ProjectExamplesActivator;
+import org.jboss.tools.project.examples.filetransfer.ECFExamplesTransport;
+import org.jboss.tools.runtime.core.JBossRuntimeLocator;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.RuntimePath;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
+import org.jboss.tools.runtime.ui.RuntimeUIActivator;
+
+public class DownloadJBossAs701Handler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final DownloadRuntime runtime =
JBossCentralActivator.getDefault().getDownloadJBossRuntimes().get(getId());
+ if (runtime == null) {
+ JBossCentralActivator.log("Invalid runtime");
+ }
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ DirectoryDialog dialog = new DirectoryDialog(shell);
+ dialog.setMessage("Select installation directory.");
+ //dialog.setFilterPath("");
+ final String selectedDirectory = dialog.open();
+ if (selectedDirectory != null) {
+ Job job = new Job("Download '" + runtime.getName() + "'
...") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ return downloadAndInstall(runtime, selectedDirectory, monitor);
+ }
+ };
+ job.setUser(true);
+ job.schedule();
+ }
+
+ return null;
+ }
+
+ protected IStatus downloadAndInstall(DownloadRuntime runtime,
+ String selectedDirectory, IProgressMonitor monitor) {
+ FileInputStream in = null;
+ OutputStream out = null;
+ try {
+ File file = File.createTempFile("JBossRuntime", "tmp");
+ file.deleteOnExit();
+ out = new BufferedOutputStream(
+ new FileOutputStream(file));
+ URL url = new URL(runtime.getUrl());
+ String name = url.getPath();
+ int slashIdx = name.lastIndexOf('/');
+ if (slashIdx >= 0)
+ name = name.substring(slashIdx + 1);
+
+ IStatus result = ECFExamplesTransport.getInstance().download(name,
+ url.toExternalForm(), out, monitor);
+ out.flush();
+ out.close();
+ File directory = new File(selectedDirectory);
+ directory.mkdirs();
+ if (!directory.isDirectory()) {
+ JBossCentralActivator.getDefault().getLog().log(result);
+ // FIXME
+ return Status.CANCEL_STATUS;
+ }
+ ProjectExamplesActivator.extractZipFile(file, directory, monitor);
+ if (!result.isOK()) {
+ JBossCentralActivator.getDefault().getLog().log(result);
+ // FIXME
+ return Status.CANCEL_STATUS;
+ }
+ createRuntimes(selectedDirectory, monitor);
+ } catch (IOException e) {
+ JBossCentralActivator.log(e);
+ // FIXME
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ private String getId() {
+ return "org.jboss.tools.central.as.701";
+ }
+
+ private static void createRuntimes(String directory, IProgressMonitor monitor) {
+ JBossRuntimeLocator locator = new JBossRuntimeLocator();
+ Set<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault()
+ .getRuntimePaths();
+ RuntimePath newPath = new RuntimePath(directory);
+ runtimePaths.add(newPath);
+ for (RuntimePath runtimePath : runtimePaths) {
+ List<ServerDefinition> serverDefinitions = locator
+ .searchForRuntimes(runtimePath.getPath(),
+ monitor);
+ runtimePath.getServerDefinitions().clear();
+ for (ServerDefinition serverDefinition : serverDefinitions) {
+ serverDefinition.setRuntimePath(runtimePath);
+ }
+ runtimePath.getServerDefinitions().addAll(serverDefinitions);
+ }
+ List<ServerDefinition> serverDefinitions = RuntimeUIActivator
+ .getDefault().getServerDefinitions();
+ Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+ .getRuntimeDetectors();
+ for (IRuntimeDetector detector : detectors) {
+ if (detector.isEnabled()) {
+ detector.initializeRuntimes(serverDefinitions);
+ }
+ }
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/FavoriteAtEclipseMarketplaceHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/FavoriteAtEclipseMarketplaceHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/FavoriteAtEclipseMarketplaceHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,10 @@
+package org.jboss.tools.central.actions;
+
+public class FavoriteAtEclipseMarketplaceHandler extends OpenWithBrowserHandler {
+
+ @Override
+ public String getLocation() {
+ return "http://marketplace.eclipse.org/node/15557";
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossCentralPreferencesHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossCentralPreferencesHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossCentralPreferencesHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,25 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.actions;
+
+
+/**
+* @author snjeza
+*
+*/
+public class JBossCentralPreferencesHandler extends AbstractPreferencesHandler {
+
+ @Override
+ public String getPreferenceId() {
+ return "org.jboss.tools.central.preferences.JBossCentralPreferencePage";
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossRuntimeDetectionPreferencesHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossRuntimeDetectionPreferencesHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossRuntimeDetectionPreferencesHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,24 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.actions;
+
+
+/**
+* @author snjeza
+*
+*/
+public class JBossRuntimeDetectionPreferencesHandler extends AbstractPreferencesHandler
{
+
+ @Override
+ public String getPreferenceId() {
+ return "org.jboss.tools.runtime.preferences.RuntimePreferencePage";
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossSeamRuntimePreferencesHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossSeamRuntimePreferencesHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/JBossSeamRuntimePreferencesHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,24 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.actions;
+
+
+/**
+* @author snjeza
+*
+*/
+public class JBossSeamRuntimePreferencesHandler extends AbstractPreferencesHandler {
+
+ @Override
+ public String getPreferenceId() {
+ return "org.jboss.tools.common.model.ui.seam";
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/NewProjectExamplesWizardHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/NewProjectExamplesWizardHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/NewProjectExamplesWizardHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,58 @@
+package org.jboss.tools.central.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.jboss.tools.central.JBossCentralActivator;
+
+public class NewProjectExamplesWizardHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint =
extensionRegistry.getExtensionPoint("org.eclipse.ui.newWizards");
+ IExtension[] extensions = extensionPoint.getExtensions();
+
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] elements = extension
+ .getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ String id = element.getAttribute("id");
+ if (JBossCentralActivator.NEW_PROJECT_EXAMPLES_WIZARD_ID.equals(id)) {
+ try {
+ Object object = WorkbenchPlugin.createExtension(element, "class");
+ if (object instanceof INewWizard) {
+ INewWizard wizard = (INewWizard)object;
+ IWorkbenchPartSite site =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().getActivePart().getSite();
+ ISelection selection = site.getSelectionProvider().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection)
selection);
+ }
+ WizardDialog dialog = new WizardDialog(site.getShell(), wizard);
+ dialog.open();
+ }
+ } catch (CoreException e) {
+ JBossCentralActivator.log(e);
+ }
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossNewsHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,12 @@
+package org.jboss.tools.central.actions;
+
+import org.jboss.tools.central.JBossCentralActivator;
+
+public class OpenJBossNewsHandler extends OpenWithBrowserHandler {
+
+ @Override
+ public String getLocation() {
+ return JBossCentralActivator.NEWS_URL;
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsHomeHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsHomeHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsHomeHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,10 @@
+package org.jboss.tools.central.actions;
+
+public class OpenJBossToolsHomeHandler extends OpenWithBrowserHandler {
+
+ @Override
+ public String getLocation() {
+ return "http://jboss.org/tools";
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsTwitterHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsTwitterHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsTwitterHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,10 @@
+package org.jboss.tools.central.actions;
+
+public class OpenJBossToolsTwitterHandler extends OpenWithBrowserHandler {
+
+ @Override
+ public String getLocation() {
+ return "http://twitter.com/#!/jbosstools";
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenWithBrowserHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenWithBrowserHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenWithBrowserHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,47 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.central.JBossCentralActivator;
+
+/**
+* @author snjeza
+*
+*/
+public abstract class OpenWithBrowserHandler extends AbstractHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ JBossCentralActivator.openUrl(getLocation(), getShell());
+ return null;
+ }
+
+ public abstract String getLocation();
+
+ private static Shell getShell() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null) {
+ IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ if (windows.length > 0) {
+ return windows[0].getShell();
+ }
+ } else {
+ return window.getShell();
+ }
+
+ return null;
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshDiscoveryHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshDiscoveryHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshDiscoveryHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,19 @@
+package org.jboss.tools.central.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.central.jobs.RefreshDiscoveryJob;
+
+public class RefreshDiscoveryHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (RefreshDiscoveryJob.INSTANCE.getState() == Job.NONE) {
+ RefreshDiscoveryJob.INSTANCE.schedule();
+ }
+ return null;
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossNewsHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,19 @@
+package org.jboss.tools.central.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.central.jobs.RefreshNewsJob;
+
+public class RefreshJBossNewsHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (RefreshNewsJob.INSTANCE.getState() == Job.NONE) {
+ RefreshNewsJob.INSTANCE.schedule();
+ }
+ return null;
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossTwitterHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossTwitterHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossTwitterHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,15 @@
+package org.jboss.tools.central.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+public class RefreshJBossTwitterHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/ShowJBossCentralHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/ShowJBossCentralHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/ShowJBossCentralHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,29 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.jboss.tools.central.JBossCentralActivator;
+
+/**
+* @author snjeza
+*
+*/
+public class ShowJBossCentralHandler extends AbstractHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ JBossCentralActivator.getJBossCentralEditor();
+ return null;
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/WTPRuntimePreferencesHandler.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/WTPRuntimePreferencesHandler.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/WTPRuntimePreferencesHandler.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,25 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.actions;
+
+
+/**
+* @author snjeza
+*
+*/
+public class WTPRuntimePreferencesHandler extends AbstractPreferencesHandler {
+
+ @Override
+ public String getPreferenceId() {
+ return "org.eclipse.wst.server.ui.runtime.preferencePage";
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/AbstractJBossCentralPage.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/AbstractJBossCentralPage.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/AbstractJBossCentralPage.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,50 @@
+package org.jboss.tools.central.editors;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+public class AbstractJBossCentralPage extends FormPage {
+
+ public static final String ID_PREFIX = "org.jboss.tools.central.editors.";
+
+ public AbstractJBossCentralPage(FormEditor editor, String id, String title) {
+ super(editor, id, title);
+ }
+
+ protected Section createSection(FormToolkit toolkit, Composite composite, String title,
int style) {
+ Section section = toolkit.createSection(composite, style);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(section);
+ section.setText(title);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ section.setLayout(layout);
+ return section;
+ }
+
+ protected Composite createComposite(FormToolkit toolkit, Composite body) {
+ Composite composite = toolkit.createComposite(body, SWT.NONE);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+ return composite;
+ }
+
+ protected Display getDisplay() {
+ Display display = Display.getCurrent();
+ if (display == null) {
+ display = Display.getDefault();
+ }
+ return display;
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,742 @@
+package org.jboss.tools.central.editors;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IContributor;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.ScrolledPageBook;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.ide.IDEActionFactory;
+import org.eclipse.ui.internal.forms.widgets.FormFonts;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.central.JBossCentralActivator;
+import org.jboss.tools.central.jobs.RefreshNewsJob;
+import org.jboss.tools.central.model.NewsEntry;
+import org.osgi.framework.Bundle;
+
+public class GettingStartedPage extends AbstractJBossCentralPage {
+
+ private static final String CLASS_ATTRIBUTE = "class";
+ public static final String ID = ID_PREFIX + "GettingStartedPage";
+
+ protected static final long TIME_DELAY = 2000L;
+ private IWorkbenchAction newWizardDropDownAction;
+ private ScrolledForm form;
+ private PageBook newsPageBook;
+ private Image loaderImage;
+ private Image newsImage;
+ private ScrolledComposite scrollComposite;
+ private static Font authorFont;
+ private Font linkFont;
+ private RefreshJobChangeListener refreshJobChangeListener;
+ private FormText newsNoteText;
+ private FormText newsLoadingText;
+ private FormText newsExceptionText;
+ private Composite newsComposite;
+ private FormToolkit toolkit;
+ private ScrolledComposite tutorialScrollComposite;
+ private PageBook tutorialPageBook;
+
+ public GettingStartedPage(FormEditor editor) {
+ super(editor, ID, "Getting Started");
+ }
+
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ toolkit = managedForm.getToolkit();
+ form = managedForm.getForm();
+
+ Composite body = form.getBody();
+ GridLayout gridLayout = new GridLayout(2, true);
+ gridLayout.horizontalSpacing = 7;
+ body.setLayout(gridLayout);
+ toolkit.paintBordersFor(body);
+
+ Composite left = createComposite(toolkit, body);
+ createTutorialsSection(toolkit, left);
+ createProjectsSection(toolkit, left);
+ createDocumentationSection(toolkit, left);
+ toolkit.paintBordersFor(left);
+
+ Composite right = createComposite(toolkit, body);
+ createNewsSection(toolkit, right);
+ toolkit.paintBordersFor(right);
+
+ super.createFormContent(managedForm);
+ form.redraw();
+ form.reflow(true);
+ }
+
+ private void createNewsSection(FormToolkit toolkit, Composite parent) {
+ final Section news = toolkit.createSection(parent,
ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED);
+ news.setText("News");
+ news.setLayout(new GridLayout());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+ gd.widthHint = 350;
+ gd.heightHint = 100;
+ news.setLayoutData(gd);
+ linkFont = news.getFont();
+ createNewsToolbar(toolkit, news);
+
+ scrollComposite = new ScrolledComposite(news, SWT.V_SCROLL);
+ gd =new GridData(SWT.FILL, SWT.FILL, false, false);
+ scrollComposite.setLayoutData(gd);
+ scrollComposite.setLayout(new GridLayout());
+
+ newsPageBook = new PageBook(scrollComposite, SWT.WRAP);
+ gd =new GridData(SWT.FILL, SWT.FILL, false, false);
+ newsPageBook.setLayoutData(gd);
+
+ scrollComposite.setContent(newsPageBook);
+ scrollComposite.setExpandVertical(true);
+ scrollComposite.setExpandHorizontal(true);
+ scrollComposite.addControlListener(new ControlAdapter() {
+ public void controlResized(ControlEvent e) {
+ recomputeScrollComposite(scrollComposite, newsPageBook);
+ }
+ });
+
+ newsNoteText = createNewsNoteText(toolkit);
+ newsLoadingText = createLoadingText(toolkit);
+ newsExceptionText = createExceptionText(toolkit);
+
+ form.addControlListener(new ControlAdapter() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ GridData gridData = (GridData) scrollComposite.getLayoutData();
+ Point size = form.getSize();
+ gridData.heightHint = size.y - 55;
+ gridData.widthHint = size.x/2 - 10;
+ gridData.grabExcessVerticalSpace = true;
+
+ gridData = (GridData) news.getLayoutData();
+ gridData.heightHint = size.y - 40;
+ gridData.widthHint = size.x/2 - 5;
+ gridData.grabExcessVerticalSpace = false;
+ form.reflow(true);
+ form.redraw();
+ recomputeScrollComposite(scrollComposite, newsPageBook);
+ }
+ });
+
+ news.setClient(scrollComposite);
+ showLoading();
+ newsPageBook.pack(true);
+ RefreshNewsJob refreshNewsJob = RefreshNewsJob.INSTANCE;
+ refreshJobChangeListener = new RefreshJobChangeListener();
+ refreshNewsJob.addJobChangeListener(refreshJobChangeListener);
+ refreshNewsJob.schedule();
+ }
+
+ private FormText createExceptionText(FormToolkit toolkit) {
+ FormText formText = toolkit.createFormText(newsPageBook, true);
+ GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false);
+ formText.setLayoutData(gd);
+ return formText;
+ }
+
+ private FormText createLoadingText(FormToolkit toolkit) {
+ FormText formText = toolkit.createFormText(newsPageBook, true);
+ GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false);
+ formText.setLayoutData(gd);
+ String text = JBossCentralActivator.FORM_START_TAG +
+ "<img href=\"image\"/> <b>Refreshing...</b>" +
+ JBossCentralActivator.FORM_END_TAG;
+ formText.setText(text, true, false);
+ Image image = getLoaderImage();
+ formText.setImage("image", image);
+ return formText;
+ }
+
+ private FormText createNewsNoteText(FormToolkit toolkit) {
+ FormText formText = toolkit.createFormText(newsPageBook, true);
+ GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false);
+ formText.setLayoutData(gd);
+ formText.setText("<form><p>" +
+ "<img href=\"image\"/>" +
+ " No entries found." +
+ "Check your internet connection and " +
+ "<a href=\"networkConnections\">Window > Preferences >
General > Network Connections</a> " +
+ "preferences" +
+ "</p></form>",
+ true, false);
+
+ Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
+
+ formText.setImage("image", image);
+ formText.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ if ("networkConnections".equals(e.data)) {
+ PreferenceDialog dialog = PreferencesUtil
+ .createPreferenceDialogOn(null,
+ "org.eclipse.ui.net.NetPreferences", null,
+ null);
+ dialog.open();
+ }
+ }
+ });
+ return formText;
+ }
+
+ private void createNewsToolbar(FormToolkit toolkit, Section section) {
+ Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
+ RowLayout rowLayout = new RowLayout();
+ rowLayout.marginTop = 0;
+ rowLayout.marginBottom = 0;
+ headerComposite.setLayout(rowLayout);
+ headerComposite.setBackground(null);
+
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
+ toolBarManager.createControl(headerComposite);
+
+ CommandContributionItem item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.central.openJBossNews");
+ toolBarManager.add(item);
+
+ item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.central.refreshJBossNews");
+ toolBarManager.add(item);
+
+ toolBarManager.update(true);
+
+ section.setTextClient(headerComposite);
+ }
+
+ private void createTutorialsSection(FormToolkit toolkit, Composite parent) {
+ final Section tutorials = toolkit.createSection(parent,
ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED);
+ tutorials.setText("Project Examples");
+ tutorials.setLayout(new GridLayout());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+ gd.widthHint = 350;
+ gd.heightHint = 200;
+ tutorials.setLayoutData(gd);
+
+ createTutorialsToolbar(toolkit, tutorials);
+
+ tutorialScrollComposite = new ScrolledComposite(tutorials, SWT.V_SCROLL);
+ gd =new GridData(SWT.FILL, SWT.FILL, false, false);
+ tutorialScrollComposite.setLayoutData(gd);
+ tutorialScrollComposite.setLayout(new GridLayout());
+ toolkit.adapt(tutorialScrollComposite);
+
+ tutorialPageBook = new PageBook(tutorialScrollComposite, SWT.WRAP);
+ gd =new GridData(SWT.FILL, SWT.FILL, false, false);
+ tutorialPageBook.setLayoutData(gd);
+
+ tutorialScrollComposite.setContent(tutorialPageBook);
+ tutorialScrollComposite.setExpandVertical(true);
+ tutorialScrollComposite.setExpandHorizontal(true);
+ tutorialScrollComposite.addControlListener(new ControlAdapter() {
+ public void controlResized(ControlEvent e) {
+ recomputeScrollComposite(tutorialScrollComposite, tutorialPageBook);
+ }
+ });
+
+ Composite tutorialComposite = toolkit.createComposite(tutorialPageBook, SWT.NONE);
+ tutorialComposite.setLayout(new GridLayout());
+ gd =new GridData(SWT.FILL, SWT.FILL, true, true);
+ tutorialComposite.setLayoutData(gd);
+
+// ExpandableComposite seam2Category =
toolkit.createExpandableComposite(tutorialComposite,
ExpandableComposite.TITLE_BAR|ExpandableComposite.CLIENT_INDENT|ExpandableComposite.TWISTIE);
+// seam2Category.setText("Seam 2");
+// gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+// seam2Category.setLayoutData(gd);
+// seam2Category.setLayout(new GridLayout());
+
+ //newsLoadingText = createLoadingText(toolkit);
+
+ form.addControlListener(new ControlAdapter() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ GridData gridData = (GridData) tutorialScrollComposite.getLayoutData();
+ Point size = form.getSize();
+ //gridData.heightHint = size.y - 55;
+ gridData.widthHint = size.x/2 - 10;
+ gridData.grabExcessVerticalSpace = true;
+
+ gridData = (GridData) tutorials.getLayoutData();
+ //gridData.heightHint = size.y - 40;
+ gridData.widthHint = size.x/2 - 5;
+ gridData.grabExcessVerticalSpace = false;
+ form.reflow(true);
+ form.redraw();
+ recomputeScrollComposite(tutorialScrollComposite, tutorialPageBook);
+ }
+ });
+
+ tutorials.setClient(tutorialScrollComposite);
+ tutorialPageBook.showPage(tutorialComposite);
+ form.reflow(true);
+ form.redraw();
+ }
+
+ private void createTutorialsToolbar(FormToolkit toolkit, Section section) {
+ Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
+ RowLayout rowLayout = new RowLayout();
+ rowLayout.marginTop = 0;
+ rowLayout.marginBottom = 0;
+ headerComposite.setLayout(rowLayout);
+ headerComposite.setBackground(null);
+
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
+ toolBarManager.createControl(headerComposite);
+
+ CommandContributionItem item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.central.newProjectExamplesWizard");
+ toolBarManager.add(item);
+
+ item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.runtime.preferences");
+ toolBarManager.add(item);
+
+ item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.seam.runtime.preferences");
+ toolBarManager.add(item);
+
+ item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.wtp.runtime.preferences");
+ toolBarManager.add(item);
+
+ item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.central.downloadJBossAs701Handler");
+ toolBarManager.add(item);
+
+ toolBarManager.update(true);
+
+ section.setTextClient(headerComposite);
+ }
+
+ public void createProjectsSection(FormToolkit toolkit, Composite parent) {
+ Section projects = createSection(toolkit, parent, "Create Projects",
ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE);
+
+ Composite headerComposite = toolkit.createComposite(projects, SWT.NONE);
+ RowLayout rowLayout = new RowLayout();
+ rowLayout.marginTop = 0;
+ rowLayout.marginBottom = 0;
+ headerComposite.setLayout(rowLayout);
+ headerComposite.setBackground(null);
+
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
+ toolBarManager.createControl(headerComposite);
+
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ newWizardDropDownAction = IDEActionFactory.NEW_WIZARD_DROP_DOWN
+ .create(window);
+ toolBarManager.add(newWizardDropDownAction);
+ toolBarManager.update(true);
+
+ projects.setTextClient(headerComposite);
+
+ Composite composite = toolkit.createComposite(projects);
+ GridLayout layout = new GridLayout(2, true);
+ layout.horizontalSpacing = 10;
+ composite.setLayout(layout);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
+
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint =
extensionRegistry.getExtensionPoint("org.eclipse.ui.newWizards");
+ IExtension[] extensions = extensionPoint.getExtensions();
+
+ List<String> wizardIDs = new ArrayList<String>();
+
wizardIDs.add("org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard");
+ wizardIDs.add("org.jboss.tools.seam.ui.wizards.SeamProjectWizard");
+ wizardIDs.add("org.eclipse.m2e.core.wizards.Maven2ProjectWizard");
+ wizardIDs.add(JBossCentralActivator.NEW_PROJECT_EXAMPLES_WIZARD_ID);
+
+ List<String> createdIDs = new ArrayList<String>();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] elements = extension
+ .getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ String id = element.getAttribute("id");
+ if (wizardIDs.contains(id) && !createdIDs.contains(id)) {
+ createProjectLink(toolkit, composite, element);
+ createdIDs.add(id);
+ }
+ }
+ }
+ projects.setClient(composite);
+ }
+
+ private void createProjectLink(FormToolkit toolkit, Composite composite,
+ final IConfigurationElement element) {
+ if (element == null) {
+ return;
+ }
+ String name = element.getAttribute("name");
+ String id = element.getAttribute("id");
+ if (name == null || id == null) {
+ return;
+ }
+ String iconPath = element.getAttribute("icon");
+ Image image = null;
+ if (iconPath != null) {
+ IContributor contributor = element.getContributor();
+ String pluginId = contributor.getName();
+ ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId,
iconPath);
+ if (imageDescriptor != null) {
+ image = JBossCentralActivator.getDefault().getImage(imageDescriptor);
+ }
+ }
+ ImageHyperlink link = toolkit.createImageHyperlink(composite, SWT.NONE);
+ link.setText(name);
+ if (image != null) {
+ link.setImage(image);
+ }
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(link);
+ link.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ try {
+ Object object = createExtension(element);
+ if (object instanceof INewWizard) {
+ INewWizard wizard = (INewWizard)object;
+ ISelection selection = getSite().getSelectionProvider().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection) selection);
+ }
+ WizardDialog dialog = new WizardDialog(getSite().getShell(), wizard);
+ dialog.open();
+ }
+ } catch (CoreException e1) {
+ JBossCentralActivator.log(e1);
+ }
+ }
+
+ });
+ }
+
+ public static Object createExtension(final IConfigurationElement element) throws
CoreException {
+ if (element == null) {
+ return null;
+ }
+ try {
+ Bundle bundle = Platform.getBundle(element.getContributor().getName());
+ if (isActive(bundle)) {
+ return element.createExecutableExtension(CLASS_ATTRIBUTE);
+ }
+ final Object[] ret = new Object[1];
+ final CoreException[] exc = new CoreException[1];
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ try {
+ ret[0] = element
+ .createExecutableExtension(CLASS_ATTRIBUTE);
+ } catch (CoreException e) {
+ exc[0] = e;
+ }
+ }
+ });
+ if (exc[0] != null) {
+ throw exc[0];
+ }
+ return ret[0];
+ } catch (InvalidRegistryObjectException e) {
+ throw new CoreException(new Status(IStatus.ERROR, JBossCentralActivator.PLUGIN_ID,
+ IStatus.ERROR, "Cannot create extension" ,e));
+ }
+ }
+
+ private static boolean isActive(Bundle bundle) {
+ if (bundle == null) {
+ return false;
+ }
+ return bundle.getState() == Bundle.ACTIVE;
+ }
+
+ public void createDocumentationSection(FormToolkit toolkit, Composite parent) {
+ Section documentation = createSection(toolkit, parent, "Documentation",
ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE);
+
+ Composite composite = toolkit.createComposite(documentation);
+ GridLayout layout = new GridLayout(2, true);
+ layout.horizontalSpacing = 30;
+ composite.setLayout(layout);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
+
+ addHyperlink(toolkit, composite, "New and Noteworthy",
"http://docs.jboss.org/tools/whatsnew/");
+ addHyperlink(toolkit, composite, "User Forum",
"http://community.jboss.org/en/tools?view=discussions");
+
+ addHyperlink(toolkit, composite, "Reference",
"http://docs.jboss.org/tools/latest/");
+ addHyperlink(toolkit, composite, "Developer Forum",
"http://community.jboss.org/en/tools/dev?view=discussions");
+
+ addHyperlink(toolkit, composite, "FAQ",
"http://www.jboss.org/tools/docs/faq");
+ addHyperlink(toolkit, composite, "Wiki",
"http://community.jboss.org/wiki/JBossTools");
+
+ addHyperlink(toolkit, composite, "Screencasts",
"http://docs.jboss.org/tools/movies/");
+ addHyperlink(toolkit, composite, "Issue Tracker",
"https://issues.jboss.org/browse/JBIDE");
+
+
+ documentation.setClient(composite);
+ }
+
+ private void addHyperlink(FormToolkit toolkit, Composite composite, String text, final
String url) {
+ Hyperlink link = toolkit.createHyperlink(composite,
+ text, SWT.NONE);
+ GridDataFactory.fillDefaults().applyTo(link);
+ link.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ JBossCentralActivator.openUrl(url, getSite().getShell());
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ newWizardDropDownAction.dispose();
+ newWizardDropDownAction = null;
+ if (loaderImage != null) {
+ loaderImage.dispose();
+ loaderImage = null;
+ }
+ if (newsImage != null) {
+ newsImage.dispose();
+ newsImage = null;
+ }
+ if (refreshJobChangeListener != null) {
+ RefreshNewsJob.INSTANCE.removeJobChangeListener(refreshJobChangeListener);
+ refreshJobChangeListener = null;
+ }
+ super.dispose();
+ }
+
+ public boolean showLoading() {
+ if (newsPageBook.isDisposed()) {
+ return false;
+ }
+ Display display = getDisplay();
+ display.syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ newsPageBook.showPage(newsLoadingText);
+ form.reflow(true);
+ form.redraw();
+ recomputeScrollComposite(scrollComposite, newsPageBook);
+ }
+ });
+
+ return true;
+ }
+
+ private Image getLoaderImage() {
+ if (loaderImage == null) {
+ loaderImage =
JBossCentralActivator.imageDescriptorFromPlugin(JBossCentralActivator.PLUGIN_ID,
"/icons/loader.gif").createImage();
+ }
+ return loaderImage;
+ }
+
+ private Image getNewsImage() {
+ if (newsImage == null) {
+ newsImage =
JBossCentralActivator.imageDescriptorFromPlugin(JBossCentralActivator.PLUGIN_ID,
"/icons/newsLink.gif").createImage();
+ }
+ return newsImage;
+ }
+
+ private void recomputeScrollComposite(ScrolledComposite composite, PageBook pageBook) {
+ Rectangle r = composite.getClientArea();
+ composite.setMinSize(pageBook.computeSize(r.width, SWT.DEFAULT));
+ }
+
+ public void showNote() {
+ if (newsPageBook.isDisposed()) {
+ return;
+ }
+ Display display = getDisplay();
+ display.syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ newsPageBook.showPage(newsNoteText);
+ form.reflow(true);
+ form.redraw();
+ recomputeScrollComposite(scrollComposite, newsPageBook);
+ }
+ });
+ }
+
+ private Font getAuthorFont(Display display) {
+ if (authorFont == null) {
+ Font font = JFaceResources.getDefaultFont();
+ authorFont = FormFonts.getInstance().getBoldFont(display, font);
+ }
+ return authorFont;
+ }
+
+ private Font getLinkFont(Display display) {
+ if (linkFont == null) {
+ linkFont = JFaceResources.getDefaultFont();
+ }
+ return linkFont;
+ }
+
+
+ private void showException(Exception e) {
+ JBossCentralActivator.log(e);
+ String text = JBossCentralActivator.FORM_START_TAG +
+ "<img href=\"image\"/> " +
+ e.getMessage() +
+ JBossCentralActivator.FORM_END_TAG;
+ newsExceptionText.setText(text, true, false);
+ Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
+ newsExceptionText.setImage("image", image);
+ newsPageBook.showPage(newsExceptionText);
+ }
+
+ public void refresh() {
+ RefreshNewsJob job = RefreshNewsJob.INSTANCE;
+ if (job.getException() != null) {
+ showException(job.getException());
+ return;
+ }
+ List<NewsEntry> entries = job.getEntries();
+ if (entries == null || entries.size() == 0) {
+ showNote();
+ return;
+ }
+ showNews(entries);
+ }
+
+ private void showNews(List<NewsEntry> entries) {
+ int i = 0;
+ if (newsComposite != null && !newsComposite.isDisposed()) {
+ newsComposite.dispose();
+ }
+ newsComposite = toolkit.createComposite(newsPageBook, SWT.NONE);
+ newsComposite.setLayout(new GridLayout());
+ GridData gd =new GridData(SWT.FILL, SWT.FILL, true, true);
+ newsComposite.setLayoutData(gd);
+
+ for (final NewsEntry entry:entries) {
+ if (i++ > JBossCentralActivator.MAX_FEEDS) {
+ return;
+ }
+ String text = entry.getFormString();
+ final FormText formText = toolkit.createFormText(newsComposite, true);
+ formText.setText(text, true, true);
+ Display display = Display.getCurrent();
+ formText.setFont(getLinkFont(display));
+ formText.setFont("default", JFaceResources.getDefaultFont());
+ Font boldFont = getAuthorFont(display);
+ formText.setFont("author", boldFont);
+ formText.setImage("image", getNewsImage());
+ if (entry.getDescription() != null && !entry.getDescription().isEmpty()) {
+ ToolTip toolTip = new NewsToolTip(formText, entry.getDescription());
+ toolTip.activate();
+
+ }
+ formText.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ Object link = e.data;
+ if (link instanceof String) {
+ Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+ JBossCentralActivator.openUrl((String) link, shell);
+ }
+ }
+ });
+
+ }
+ newsPageBook.showPage(newsComposite);
+ form.reflow(true);
+ form.redraw();
+ recomputeScrollComposite(scrollComposite, newsPageBook);
+ }
+
+ private class RefreshJobChangeListener implements IJobChangeListener {
+
+ @Override
+ public void aboutToRun(IJobChangeEvent event) {
+
+ }
+
+ @Override
+ public void awake(IJobChangeEvent event) {
+
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ refresh();
+ }
+ });
+
+ }
+
+ @Override
+ public void running(IJobChangeEvent event) {
+
+ }
+
+ @Override
+ public void scheduled(IJobChangeEvent event) {
+ RefreshNewsJob.INSTANCE.setException(null);
+ showLoading();
+ }
+
+ @Override
+ public void sleeping(IJobChangeEvent event) {
+
+ }
+
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,216 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.editors;
+
+
+import javax.tools.Tool;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.SharedHeaderFormEditor;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.jboss.tools.central.JBossCentralActivator;
+import org.jboss.tools.central.jobs.RefreshNewsJob;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class JBossCentralEditor extends SharedHeaderFormEditor {
+
+ private static final String JBOSS_TOOLS_CENTRAL = "JBoss Tools Central";
+
+ public static final String ID =
"org.jboss.tools.central.editors.JBossCentralEditor";
+
+ private static final String JBDS_CENTRAL = "JBoss Developer Studio Central";
+
+ private GettingStartedPage gettingStartedPage;
+
+ private SoftwarePage softwarePage;
+
+ private Image headerImage;
+ private Image gettingStartedImage;
+ private Image softwareImage;
+
+ public JBossCentralEditor() {
+ super();
+ }
+
+ public void dispose() {
+ if (headerImage != null) {
+ headerImage.dispose();
+ headerImage = null;
+ }
+ if (gettingStartedImage != null) {
+ gettingStartedImage.dispose();
+ gettingStartedImage = null;
+ }
+ if (softwareImage != null) {
+ softwareImage.dispose();
+ softwareImage = null;
+ }
+ RefreshNewsJob.INSTANCE.cancel();
+ super.dispose();
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+
+ }
+
+ public void doSaveAs() {
+
+ }
+
+ /**
+ * The <code>MultiPageEditorExample</code> implementation of this method
+ * checks that the input is an instance of <code>IFileEditorInput</code>.
+ */
+ public void init(IEditorSite site, IEditorInput editorInput)
+ throws PartInitException {
+ if (!(editorInput instanceof JBossCentralEditorInput))
+ throw new PartInitException("Invalid Input: Must be
JBossCentralEditorInput");
+ super.init(site, editorInput);
+ if (JBossCentralActivator.isJBDS()) {
+ setPartName(JBDS_CENTRAL);
+ } else {
+ setPartName(JBOSS_TOOLS_CENTRAL);
+ }
+ }
+ /* (non-Javadoc)
+ * Method declared on IEditorPart.
+ */
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ @Override
+ protected void addPages() {
+ try {
+ gettingStartedPage = new GettingStartedPage(this);
+ int index = addPage(gettingStartedPage);
+ if (gettingStartedImage == null) {
+ gettingStartedImage =
JBossCentralActivator.getImageDescriptor("/icons/gettingStarted.png").createImage();
+ }
+ setPageImage(index, gettingStartedImage);
+
+ softwarePage = new SoftwarePage(this);
+ index = addPage(softwarePage);
+ if (softwareImage == null) {
+ softwareImage =
JBossCentralActivator.getImageDescriptor("/icons/software.png").createImage();
+ }
+ setPageImage(index, softwareImage);
+
+ } catch (PartInitException e) {
+ JBossCentralActivator.log(e, "Error adding page");
+ }
+ }
+
+ @Override
+ public boolean isDirty() {
+ return false;
+ }
+
+ @Override
+ protected void createHeaderContents(IManagedForm headerForm) {
+ ScrolledForm form = headerForm.getForm();
+ if (JBossCentralActivator.isJBDS()) {
+ form.setText(JBDS_CENTRAL);
+ form.setToolTipText(JBDS_CENTRAL);
+ } else {
+ form.setText(JBOSS_TOOLS_CENTRAL);
+ form.setToolTipText(JBOSS_TOOLS_CENTRAL);
+ }
+ form.setImage(getHeaderImage());
+ getToolkit().decorateFormHeading(form.getForm());
+
+ Composite headerComposite = getToolkit().createComposite(form.getForm().getHead(),
SWT.NONE);
+ headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ headerComposite.setLayout(new GridLayout(2, false));
+ headerComposite.setBackground(null);
+
+ Button showOnStartup = getToolkit().createButton(headerComposite, "Show on
Startup", SWT.CHECK);
+
+// Text searchControl = getToolkit().createText(headerComposite, "",
SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
+// searchControl.setMessage("Search");
+// GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+// gd.widthHint = 150;
+// searchControl.setLayoutData(gd);
+
+ showOnStartup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ showOnStartup.setBackground(null);
+ showOnStartup.setSelection(JBossCentralActivator.getDefault().showJBossCentralOnStartup());
+ showOnStartup.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IEclipsePreferences preferences =
JBossCentralActivator.getDefault().getPreferences();
+ boolean showOnStartup =
preferences.getBoolean(JBossCentralActivator.SHOW_JBOSS_CENTRAL_ON_STARTUP,
JBossCentralActivator.SHOW_JBOSS_CENTRAL_ON_STARTUP_DEFAULT_VALUE);
+ preferences.putBoolean(JBossCentralActivator.SHOW_JBOSS_CENTRAL_ON_STARTUP,
!showOnStartup);
+ JBossCentralActivator.getDefault().savePreferences();
+ }
+
+ });
+
+ form.getForm().setHeadClient(headerComposite);
+
+ IToolBarManager toolbar = form.getToolBarManager();
+ CommandContributionItem item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.central.openJBossToolsHome");
+ toolbar.add(item);
+
+ item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.central.favoriteAtEclipseMarketplace");
+ toolbar.add(item);
+
+ item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.central.preferences");
+ toolbar.add(item);
+
+ item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.central.openJBossToolsTwitter");
+ toolbar.add(item);
+
+ toolbar.update(true);
+ }
+
+ private Image getHeaderImage() {
+ if (headerImage == null) {
+ if (JBossCentralActivator.isJBDS()) {
+ headerImage =
JBossCentralActivator.getImageDescriptor("/icons/jbds16.png").createImage();
+ } else {
+ headerImage =
JBossCentralActivator.getImageDescriptor("/icons/jboss.gif").createImage();
+ }
+ }
+ return headerImage;
+ }
+
+ public GettingStartedPage getGettingStartedPage() {
+ return gettingStartedPage;
+ }
+
+ public SoftwarePage getSoftwarePage() {
+ return softwarePage;
+ }
+
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditorContributor.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditorContributor.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditorContributor.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,93 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.editors;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.ide.IDEActionFactory;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class JBossCentralEditorContributor extends MultiPageEditorActionBarContributor {
+ private IEditorPart activeEditorPart;
+
+ public JBossCentralEditorContributor() {
+ super();
+ }
+ /**
+ * Returns the action registed with the given text editor.
+ * @return IAction or null if editor is null.
+ */
+ protected IAction getAction(ITextEditor editor, String actionID) {
+ return (editor == null ? null : editor.getAction(actionID));
+ }
+ /* (non-JavaDoc)
+ * Method declared in AbstractMultiPageEditorActionBarContributor.
+ */
+
+ public void setActivePage(IEditorPart part) {
+ if (activeEditorPart == part)
+ return;
+
+ activeEditorPart = part;
+
+ IActionBars actionBars = getActionBars();
+ if (actionBars != null) {
+
+ ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
+
+ actionBars.setGlobalActionHandler(
+ ActionFactory.DELETE.getId(),
+ getAction(editor, ITextEditorActionConstants.DELETE));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.UNDO.getId(),
+ getAction(editor, ITextEditorActionConstants.UNDO));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.REDO.getId(),
+ getAction(editor, ITextEditorActionConstants.REDO));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.CUT.getId(),
+ getAction(editor, ITextEditorActionConstants.CUT));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.COPY.getId(),
+ getAction(editor, ITextEditorActionConstants.COPY));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.PASTE.getId(),
+ getAction(editor, ITextEditorActionConstants.PASTE));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.SELECT_ALL.getId(),
+ getAction(editor, ITextEditorActionConstants.SELECT_ALL));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.FIND.getId(),
+ getAction(editor, ITextEditorActionConstants.FIND));
+ actionBars.setGlobalActionHandler(
+ IDEActionFactory.BOOKMARK.getId(),
+ getAction(editor, IDEActionFactory.BOOKMARK.getId()));
+ actionBars.updateActionBars();
+ }
+ }
+
+ public void contributeToMenu(IMenuManager manager) {
+ }
+
+ public void contributeToToolBar(IToolBarManager manager) {
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditorInput.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditorInput.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditorInput.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,57 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.editors;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class JBossCentralEditorInput implements IEditorInput {
+
+ public static final JBossCentralEditorInput INSTANCE = new JBossCentralEditorInput();
+
+ @Override
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
+ return null;
+ }
+
+ @Override
+ public boolean exists() {
+ return true;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return "JBoss Tools Central";
+ }
+
+
+ @Override
+ public String getToolTipText() {
+ return "JBoss Tools Central";
+ }
+
+ @Override
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/NewsToolTip.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/NewsToolTip.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/NewsToolTip.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,156 @@
+package org.jboss.tools.central.editors;
+
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormText;
+
+public class NewsToolTip extends ToolTip {
+
+ private String toolText;
+ private static Shell CURRENT_TOOLTIP;
+ private Label hintLabel;
+ private FormText formText;
+ private int x;
+ private int y;
+ private boolean focused = false;
+
+ private MouseMoveListener mouseMoveListener = new MouseMoveListener() {
+ public void mouseMove(MouseEvent e) {
+ x = e.x;
+ y = e.y;
+ }
+ };
+ private Listener keyListener = new Listener() {
+
+ @Override
+ public void handleEvent(Event e) {
+ if (e == null)
+ return;
+ if (e.keyCode == SWT.ESC) {
+ if (CURRENT_TOOLTIP != null) {
+ CURRENT_TOOLTIP.dispose();
+ CURRENT_TOOLTIP = null;
+ }
+ activate();
+ focused = false;
+ }
+ if (e.keyCode == SWT.F2) {
+ if (CURRENT_TOOLTIP == null) {
+ deactivate();
+ hide();
+ }
+ focused = true;
+ createFocusedTooltip(NewsToolTip.this.formText);
+ }
+ }
+ };
+
+ public NewsToolTip(FormText formText, String toolText) {
+ super(formText);
+ this.toolText = toolText;
+ this.formText = formText;
+ setShift(new Point(10, 3));
+ setPopupDelay(400);
+ setHideOnMouseDown(true);
+ }
+
+ public void createFocusedTooltip(final Control control) {
+ final Shell stickyTooltip = new Shell(control.getShell(), SWT.ON_TOP | SWT.TOOL
+ | SWT.NO_FOCUS);
+ stickyTooltip.setLayout(new GridLayout());
+ stickyTooltip.setBackground(stickyTooltip.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+
+ control.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ Event event = new Event();
+ event.x = x;
+ event.y = y;
+ event.widget = control;
+
+ createToolTipContentArea(event, stickyTooltip);
+ stickyTooltip.pack();
+
+ stickyTooltip.setLocation(stickyTooltip.getDisplay().getCursorLocation());
+ hintLabel.setText("Press 'ESC' to Hide.");
+ stickyTooltip.setVisible(true);
+ }
+ });
+ CURRENT_TOOLTIP = stickyTooltip;
+ }
+
+ @Override
+ protected Composite createToolTipContentArea(Event event, Composite parent) {
+ if (!focused) {
+ formText.setFocus();
+ }
+ formText.addMouseMoveListener(mouseMoveListener);
+ formText.addListener(SWT.KeyDown, keyListener);
+
+ parent.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ if (formText != null && !formText.isDisposed()) {
+ formText.removeMouseMoveListener(mouseMoveListener);
+ formText.removeListener(SWT.KeyDown, keyListener);
+ }
+
+ }
+ });
+
+
+ parent.setLayout(new GridLayout());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ parent.setLayoutData(gd);
+
+ Browser browser = new Browser(parent, SWT.NONE);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.heightHint = 250;
+ gd.widthHint = 400;
+ browser.setLayoutData(gd);
+ browser.setText(toolText);
+
+ hintLabel = new Label(parent, SWT.NONE);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ hintLabel.setLayoutData(gd);
+ hintLabel.setAlignment(SWT.RIGHT);
+ hintLabel.setBackground(parent.getDisplay().getSystemColor(
+ SWT.COLOR_INFO_BACKGROUND));
+ hintLabel.setText("Press 'F2' for Focus.");
+ hintLabel.setForeground(parent.getDisplay().getSystemColor(
+ SWT.COLOR_DARK_GRAY));
+
+ final Font font;
+ Display display = parent.getDisplay();
+ FontData[] fd = parent.getFont().getFontData();
+ int size2 = fd.length;
+ for (int i = 0; i < size2; i++)
+ fd[i].setHeight(7);
+ font = new Font(display, fd);
+ parent.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ font.dispose();
+ }
+ });
+ hintLabel.setFont(font);
+ return parent;
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/SoftwarePage.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,389 @@
+package org.jboss.tools.central.editors;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.mylyn.commons.core.DelegatingProgressMonitor;
+import org.eclipse.mylyn.internal.discovery.core.model.DiscoveryConnector;
+import org.eclipse.mylyn.internal.discovery.ui.DiscoveryUi;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.part.PageBook;
+import org.jboss.tools.central.JBossCentralActivator;
+import org.jboss.tools.central.editors.xpl.DiscoveryViewer;
+import org.jboss.tools.central.jobs.RefreshDiscoveryJob;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+public class SoftwarePage extends AbstractJBossCentralPage implements IRunnableContext {
+
+ private static final String JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML =
"https://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/discovery/directory-3.3.0.xml";
+ public static final String ID = ID_PREFIX + "SoftwarePage";
+
+ private Dictionary<Object, Object> environment;
+ private ScrolledForm form;
+ private IProgressMonitor monitor;
+ private PageBook pageBook;
+ private Image loaderImage;
+ private FormText loadingText;
+ private Composite featureComposite;
+ private DiscoveryViewer discoveryViewer;
+ private RefreshJobChangeListener refreshJobChangeListener;
+ private InstallAction installAction;
+
+ public SoftwarePage(FormEditor editor) {
+ super(editor, ID, "Software/Update");
+ monitor = new DelegatingProgressMonitor();
+ }
+
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ FormToolkit toolkit = managedForm.getToolkit();
+ form = managedForm.getForm();
+
+ Composite body = form.getBody();
+ GridLayout gridLayout = new GridLayout(1, true);
+ gridLayout.horizontalSpacing = 7;
+ body.setLayout(gridLayout);
+ toolkit.paintBordersFor(body);
+
+ Composite left = createComposite(toolkit, body);
+ createFeaturesSection(toolkit, left);
+ toolkit.paintBordersFor(left);
+
+ //Composite right = createComposite(toolkit, body);
+ //Section toInstall = createSection(toolkit, right, "To install",
ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED);
+
+ //toolkit.paintBordersFor(right);
+
+ super.createFormContent(managedForm);
+
+ }
+
+ protected void createFeaturesSection(FormToolkit toolkit, Composite parent) {
+ final Section features = toolkit.createSection(parent,
ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED);
+ features.setText("Features Available");
+ features.setLayout(new GridLayout());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = 350;
+ //gd.heightHint = 100;
+ features.setLayoutData(gd);
+
+ createFeaturesToolbar(toolkit, features);
+
+ featureComposite = toolkit.createComposite(features);
+ gd =new GridData(SWT.FILL, SWT.FILL, true, true);
+ featureComposite.setLayoutData(gd);
+ featureComposite.setLayout(new GridLayout());
+
+ pageBook = new PageBook(featureComposite, SWT.NONE);
+ gd =new GridData(SWT.FILL, SWT.FILL, true, true);
+ pageBook.setLayoutData(gd);
+
+ discoveryViewer = new DiscoveryViewer(getSite(), this);
+ discoveryViewer.setShowConnectorDescriptorKindFilter(false);
+ discoveryViewer.setShowInstalledFilterEnabled(true);
+ discoveryViewer.setDirectoryUrl(JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML);
+ discoveryViewer.createControl(pageBook);
+ discoveryViewer.setEnvironment(getEnvironment());
+ discoveryViewer.addFilter(new ViewerFilter() {
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ DiscoveryConnector connector = (DiscoveryConnector)element;
+ //System.out.println(connector.getId());
+ if
(connector.getId().equals("org.eclipse.mylyn.discovery.tests.connectorDescriptor1")
||
+ connector.getId().equals("org.eclipse.mylyn.discovery.test1") ||
+ connector.getId().equals("org.eclipse.mylyn.discovery.2tests") ||
+ connector.getId().equals("org.eclipse.mylyn.trac") ) {
+ //System.out.println("filtered " + connector.getId());
+ return false;
+ }
+ return true;
+ }
+ });
+
+ Control discoveryControl = discoveryViewer.getControl();
+ adapt(toolkit, discoveryControl);
+ if (discoveryControl instanceof Composite) {
+ ((Composite) discoveryControl).setLayout(new GridLayout());
+ }
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ discoveryControl.setLayoutData(gd);
+
+ discoveryViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ installAction.setEnabled(discoveryViewer.getInstallableConnectors().size() > 0);
+ }
+ });
+
+ loadingText = createLoadingText(toolkit);
+
+ form.addControlListener(new ControlAdapter() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ GridData gridData = (GridData) featureComposite.getLayoutData();
+ Point size = form.getSize();
+ gridData.heightHint = size.y - 25;
+ gridData.widthHint = size.x - 25;
+ gridData.grabExcessVerticalSpace = true;
+
+ gridData = (GridData) features.getLayoutData();
+ gridData.heightHint = size.y - 20;
+ gridData.widthHint = size.x - 20;
+ gridData.grabExcessVerticalSpace = false;
+ form.reflow(true);
+ form.redraw();
+ }
+ });
+
+
+ features.setClient(featureComposite);
+ showLoading();
+ pageBook.pack(true);
+
+ RefreshDiscoveryJob refreshDiscoveryJob = RefreshDiscoveryJob.INSTANCE;
+ refreshJobChangeListener = new RefreshJobChangeListener();
+ refreshDiscoveryJob.addJobChangeListener(refreshJobChangeListener);
+ refreshDiscoveryJob.schedule();
+
+ }
+
+ private void createFeaturesToolbar(FormToolkit toolkit, Section section) {
+ Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
+ RowLayout rowLayout = new RowLayout();
+ rowLayout.marginTop = 0;
+ rowLayout.marginBottom = 0;
+ headerComposite.setLayout(rowLayout);
+ headerComposite.setBackground(null);
+
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
+ toolBarManager.createControl(headerComposite);
+
+ installAction = new InstallAction();
+ installAction.setEnabled(false);
+ toolBarManager.add(installAction);
+
+ toolBarManager.add(new CheckForUpdatesAction());
+
+ CommandContributionItem item = JBossCentralActivator.createContributionItem(getSite(),
"org.jboss.tools.central.refreshDiscovery");
+ toolBarManager.add(item);
+
+ toolBarManager.update(true);
+
+ section.setTextClient(headerComposite);
+ }
+
+ private FormText createLoadingText(FormToolkit toolkit) {
+ FormText formText = toolkit.createFormText(pageBook, true);
+ GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false);
+ formText.setLayoutData(gd);
+ String text = JBossCentralActivator.FORM_START_TAG +
+ "<img href=\"image\"/> <b>Refreshing...</b>" +
+ JBossCentralActivator.FORM_END_TAG;
+ formText.setText(text, true, false);
+ Image image = getLoaderImage();
+ formText.setImage("image", image);
+ return formText;
+ }
+ private void adapt(FormToolkit toolkit, Control control) {
+; toolkit.adapt(control, true, true);
+ if (control instanceof Composite) {
+ Control[] children = ((Composite) control).getChildren();
+ for (Control c:children) {
+ adapt(toolkit, c);
+ }
+ }
+ }
+
+ private Dictionary<Object, Object> getEnvironment() {
+ if (environment == null) {
+ environment = new Hashtable<Object, Object>(System.getProperties());
+
+ Bundle bundle = Platform.getBundle("org.jboss.tools.central"); //$NON-NLS-1$
+ Version version = bundle.getVersion();
+ environment.put("org.jboss.tools.central.version", version.toString());
//$NON-NLS-1$
+ environment.put("org.jboss.tools.central.version.major", version.getMajor());
//$NON-NLS-1$
+ environment.put("org.jboss.tools.central.version.minor", version.getMinor());
//$NON-NLS-1$
+ environment.put("org.jboss.tools.central.version.micro", version.getMicro());
//$NON-NLS-1$
+ }
+ return environment;
+ }
+
+ @Override
+ public void run(boolean fork, boolean cancelable,
+ IRunnableWithProgress runnable) throws InvocationTargetException,
+ InterruptedException {
+ ModalContext.run(runnable, fork, monitor, getDisplay());
+ }
+
+ public boolean showLoading() {
+ if (pageBook.isDisposed()) {
+ return false;
+ }
+ Display display = getDisplay();
+ display.syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ pageBook.showPage(loadingText);
+ form.reflow(true);
+ form.redraw();
+ }
+ });
+
+ return true;
+ }
+
+ public boolean refresh() {
+ if (pageBook == null || pageBook.isDisposed() || discoveryViewer == null ||
discoveryViewer.getControl() == null) {
+ return false;
+ }
+ Display display = getDisplay();
+ display.syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ pageBook.showPage(discoveryViewer.getControl());
+ form.reflow(true);
+ form.redraw();
+ }
+ });
+
+ return true;
+ }
+
+ private Image getLoaderImage() {
+ if (loaderImage == null) {
+ loaderImage =
JBossCentralActivator.imageDescriptorFromPlugin(JBossCentralActivator.PLUGIN_ID,
"/icons/loader.gif").createImage();
+ }
+ return loaderImage;
+ }
+
+ @Override
+ public void dispose() {
+ if (loaderImage != null) {
+ loaderImage.dispose();
+ loaderImage = null;
+ }
+ if (refreshJobChangeListener != null) {
+ RefreshDiscoveryJob.INSTANCE.removeJobChangeListener(refreshJobChangeListener);
+ refreshJobChangeListener = null;
+ }
+ super.dispose();
+ }
+
+ public DiscoveryViewer getDiscoveryViewer() {
+ return discoveryViewer;
+ }
+
+ private class RefreshJobChangeListener implements IJobChangeListener {
+
+ @Override
+ public void aboutToRun(IJobChangeEvent event) {
+
+ }
+
+ @Override
+ public void awake(IJobChangeEvent event) {
+
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ refresh();
+ }
+ });
+
+ }
+
+ @Override
+ public void running(IJobChangeEvent event) {
+
+ }
+
+ @Override
+ public void scheduled(IJobChangeEvent event) {
+ showLoading();
+ }
+
+ @Override
+ public void sleeping(IJobChangeEvent event) {
+
+ }
+
+ }
+
+ private class InstallAction extends Action {
+
+ public InstallAction() {
+ super("Install",
JBossCentralActivator.imageDescriptorFromPlugin(JBossCentralActivator.PLUGIN_ID,
"/icons/repository-submit.gif"));
+ }
+
+ @Override
+ public void run() {
+ DiscoveryUi.install(discoveryViewer.getInstallableConnectors(), SoftwarePage.this);
+ }
+
+ }
+
+ private class CheckForUpdatesAction extends Action {
+
+ public CheckForUpdatesAction() {
+ super("Check for Updates",
JBossCentralActivator.imageDescriptorFromPlugin(JBossCentralActivator.PLUGIN_ID,
"/icons/update.gif"));
+ }
+
+ @Override
+ public void run() {
+ IHandlerService handlerService = (IHandlerService)
getSite().getService(IHandlerService.class);
+ try {
+
handlerService.executeCommand("org.eclipse.equinox.p2.ui.sdk.update", new
Event());
+ }
+ catch (Exception e) {
+ JBossCentralActivator.log(e);
+ }
+ }
+
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/DiscoveryViewer.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/DiscoveryViewer.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/DiscoveryViewer.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,1566 @@
+package org.jboss.tools.central.editors.xpl;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ColorRegistry;
+import org.eclipse.jface.resource.FontDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.mylyn.internal.discovery.core.model.AbstractDiscoverySource;
+import org.eclipse.mylyn.internal.discovery.core.model.BundleDiscoveryStrategy;
+import org.eclipse.mylyn.internal.discovery.core.model.ConnectorDescriptor;
+import org.eclipse.mylyn.internal.discovery.core.model.ConnectorDescriptorKind;
+import org.eclipse.mylyn.internal.discovery.core.model.ConnectorDiscovery;
+import org.eclipse.mylyn.internal.discovery.core.model.DiscoveryCategory;
+import org.eclipse.mylyn.internal.discovery.core.model.DiscoveryConnector;
+import org.eclipse.mylyn.internal.discovery.core.model.Icon;
+import org.eclipse.mylyn.internal.discovery.core.model.Overview;
+import org.eclipse.mylyn.internal.discovery.core.model.RemoteBundleDiscoveryStrategy;
+import org.eclipse.mylyn.internal.discovery.core.util.DiscoveryCategoryComparator;
+import org.eclipse.mylyn.internal.discovery.core.util.DiscoveryConnectorComparator;
+import org.eclipse.mylyn.internal.discovery.ui.DiscoveryImages;
+import org.eclipse.mylyn.internal.discovery.ui.DiscoveryUi;
+import org.eclipse.mylyn.internal.discovery.ui.wizards.ConnectorDiscoveryWizard;
+import org.eclipse.mylyn.internal.discovery.ui.wizards.Messages;
+import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
+import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
+import org.eclipse.mylyn.internal.provisional.commons.ui.GradientCanvas;
+import org.eclipse.mylyn.internal.provisional.commons.ui.SelectionProviderAdapter;
+import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.ACC;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleControlAdapter;
+import org.eclipse.swt.accessibility.AccessibleControlEvent;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.MouseTrackListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Resource;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.progress.WorkbenchJob;
+import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.ui.themes.IThemeManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * The main wizard page that allows users to select connectors that they wish to
install.
+ *
+ * @author David Green
+ * @author Steffen Pingel
+ */
+public class DiscoveryViewer {
+
+ public class ConnectorBorderPaintListener implements PaintListener {
+ public void paintControl(PaintEvent e) {
+ Composite composite = (Composite) e.widget;
+ Rectangle bounds = composite.getBounds();
+ GC gc = e.gc;
+ gc.setLineStyle(SWT.LINE_DOT);
+ gc.drawLine(bounds.x, bounds.y, bounds.x + bounds.width, bounds.y);
+ }
+ }
+
+ private class ConnectorDescriptorItemUi implements PropertyChangeListener, Runnable {
+ private final DiscoveryConnector connector;
+
+ private final Button checkbox;
+
+ private final Label iconLabel;
+
+ private final Label nameLabel;
+
+ private ToolItem infoButton;
+
+ private final Link providerLabel;
+
+ private final Label description;
+
+ private final Composite checkboxContainer;
+
+ private final Composite connectorContainer;
+
+ private final Display display;
+
+ private Image iconImage;
+
+// private Image warningIconImage;
+
+ public ConnectorDescriptorItemUi(final DiscoveryConnector connector, Composite
categoryChildrenContainer,
+ Color background) {
+ display = categoryChildrenContainer.getDisplay();
+ this.connector = connector;
+ connector.addPropertyChangeListener(this);
+
+ connectorContainer = new Composite(categoryChildrenContainer, SWT.NULL);
+
+ configureLook(connectorContainer, background);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(connectorContainer);
+ GridLayout layout = new GridLayout(4, false);
+ layout.marginLeft = 7;
+ layout.marginTop = 2;
+ layout.marginBottom = 2;
+ connectorContainer.setLayout(layout);
+
+ checkboxContainer = new Composite(connectorContainer, SWT.NULL);
+ configureLook(checkboxContainer, background);
+ GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.BEGINNING).span(1,
2).applyTo(checkboxContainer);
+ GridLayoutFactory.fillDefaults().spacing(1,
1).numColumns(2).applyTo(checkboxContainer);
+
+ checkbox = new Button(checkboxContainer, SWT.CHECK);
+ checkbox.setText(" "); //$NON-NLS-1$
+ // help UI tests
+ checkbox.setData("connectorId", connector.getId()); //$NON-NLS-1$
+ checkbox.setVisible(connector.isInstallable());
+ configureLook(checkbox, background);
+ checkbox.setSelection(installableConnectors.contains(connector));
+ checkbox.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusGained(FocusEvent e) {
+ bodyScrolledComposite.showControl(connectorContainer);
+ }
+ });
+
+ GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(checkbox);
+
+ iconLabel = new Label(checkboxContainer, SWT.NULL);
+ configureLook(iconLabel, background);
+ GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(iconLabel);
+
+ if (connector.getIcon() != null) {
+ iconImage = computeIconImage(connector.getSource(), connector.getIcon(), 32, false);
+ if (iconImage != null) {
+ iconLabel.setImage(iconImage);
+ }
+ }
+
+ nameLabel = new Label(connectorContainer, SWT.NULL);
+ configureLook(nameLabel, background);
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.BEGINNING,
SWT.CENTER).applyTo(nameLabel);
+ nameLabel.setFont(h2Font);
+ if (connector.isInstalled()) {
+ nameLabel.setText(NLS.bind(Messages.DiscoveryViewer_X_installed,
connector.getName()));
+ } else {
+ nameLabel.setText(connector.getName());
+ }
+
+ providerLabel = new Link(connectorContainer, SWT.RIGHT);
+ configureLook(providerLabel, background);
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(providerLabel);
+ if (connector.getCertification() != null) {
+ providerLabel.setText(NLS.bind(Messages.DiscoveryViewer_Certification_Label0,
+ new String[] { connector.getProvider(), connector.getLicense(),
+ connector.getCertification().getName() }));
+ if (connector.getCertification().getUrl() != null) {
+ providerLabel.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ WorkbenchUtil.openUrl(connector.getCertification().getUrl(),
+ IWorkbenchBrowserSupport.AS_EXTERNAL);
+ }
+ });
+ }
+ Overview overview = new Overview();
+ overview.setSummary(connector.getCertification().getDescription());
+ overview.setUrl(connector.getCertification().getUrl());
+ Image image = computeIconImage(connector.getSource(),
connector.getCertification().getIcon(), 48, true);
+ hookTooltip(providerLabel, providerLabel, connectorContainer, providerLabel,
connector.getSource(),
+ overview, image);
+ } else {
+ providerLabel.setText(NLS.bind(Messages.ConnectorDiscoveryWizardMainPage_provider_and_license,
+ connector.getProvider(), connector.getLicense()));
+ }
+
+ if (hasTooltip(connector)) {
+ ToolBar toolBar = new ToolBar(connectorContainer, SWT.FLAT);
+ toolBar.setBackground(background);
+
+ infoButton = new ToolItem(toolBar, SWT.PUSH);
+ infoButton.setImage(infoImage);
+ infoButton.setToolTipText(Messages.ConnectorDiscoveryWizardMainPage_tooltip_showOverview);
+ hookTooltip(toolBar, infoButton, connectorContainer, nameLabel,
connector.getSource(),
+ connector.getOverview(), null);
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(toolBar);
+ } else {
+ Label label = new Label(connectorContainer, SWT.NULL);
+ label.setText(" "); //$NON-NLS-1$
+ configureLook(label, background);
+ }
+
+ description = new Label(connectorContainer, SWT.NULL | SWT.WRAP);
+ configureLook(description, background);
+
+ GridDataFactory.fillDefaults().grab(true, false).span(3, 1).hint(100,
SWT.DEFAULT).applyTo(description);
+ String descriptionText = connector.getDescription();
+ int maxDescriptionLength = 162;
+ if (descriptionText.length() > maxDescriptionLength) {
+ descriptionText = descriptionText.substring(0, maxDescriptionLength);
+ }
+ description.setText(descriptionText.replaceAll("(\\r\\n)|\\n|\\r", "
")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // always disabled color to make it less prominent
+ providerLabel.setForeground(colorDisabled);
+
+ checkbox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ boolean selected = checkbox.getSelection();
+ maybeModifySelection(selected);
+ }
+ });
+ MouseListener connectorItemMouseListener = new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ boolean selected = !checkbox.getSelection();
+ if (maybeModifySelection(selected)) {
+ checkbox.setSelection(selected);
+ }
+ }
+ };
+ checkboxContainer.addMouseListener(connectorItemMouseListener);
+ connectorContainer.addMouseListener(connectorItemMouseListener);
+ iconLabel.addMouseListener(connectorItemMouseListener);
+ nameLabel.addMouseListener(connectorItemMouseListener);
+ // the provider has clickable links
+ //providerLabel.addMouseListener(connectorItemMouseListener);
+ description.addMouseListener(connectorItemMouseListener);
+ }
+
+ protected boolean maybeModifySelection(boolean selected) {
+ if (selected) {
+ if (connector.isInstalled()) {
+ MessageDialog.openWarning(shellProvider.getShell(),
+ Messages.DiscoveryViewer_Install_Connector_Title,
+ NLS.bind(Messages.DiscoveryViewer_Already_installed_Error, connector.getName()));
+ return false;
+ }
+ if (!connector.isInstallable()) {
+ if (connector.getInstallMessage() != null) {
+ MessageDialog.openInformation(shellProvider.getShell(),
+ Messages.DiscoveryViewer_Install_Connector_Title,
connector.getInstallMessage());
+ }
+ return false;
+ }
+ if (connector.getAvailable() != null && !connector.getAvailable()) {
+ MessageDialog.openWarning(shellProvider.getShell(),
+ Messages.ConnectorDiscoveryWizardMainPage_warningTitleConnectorUnavailable,
NLS.bind(
+ Messages.ConnectorDiscoveryWizardMainPage_warningMessageConnectorUnavailable,
+ connector.getName()));
+ return false;
+ }
+ }
+ DiscoveryViewer.this.modifySelection(connector, selected);
+ return true;
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ display.asyncExec(this);
+ }
+
+ public void run() {
+ if (!connectorContainer.isDisposed()) {
+ updateAvailability();
+ }
+ }
+
+ public void updateAvailability() {
+ boolean enabled = !connector.isInstalled()
+ && (connector.getAvailable() == null || connector.getAvailable());
+
+ checkbox.setEnabled(enabled);
+ nameLabel.setEnabled(enabled);
+ providerLabel.setEnabled(enabled);
+ description.setEnabled(enabled);
+ Color foreground;
+ if (enabled) {
+ foreground = connectorContainer.getForeground();
+ } else {
+ foreground = colorDisabled;
+ }
+ nameLabel.setForeground(foreground);
+ description.setForeground(foreground);
+
+ if (iconImage != null) {
+// boolean unavailable = !enabled && connector.getAvailable() != null;
+// if (unavailable) {
+// if (warningIconImage == null) {
+// warningIconImage = new DecorationOverlayIcon(iconImage,
DiscoveryImages.OVERLAY_WARNING_32,
+// IDecoration.BOTTOM_RIGHT).createImage();
+// disposables.add(warningIconImage);
+// }
+// iconLabel.setImage(warningIconImage);
+// } else if (warningIconImage != null) {
+ iconLabel.setImage(iconImage);
+// }
+ }
+ }
+ }
+
+ // e3.5 replace with SWT.ICON_CANCEL
+ public static final int ICON_CANCEL = 1 << 8;
+
+ private static final int MINIMUM_HEIGHT = 100;
+
+ private static boolean useNativeSearchField(Composite composite) {
+ if (useNativeSearchField == null) {
+ useNativeSearchField = Boolean.FALSE;
+ Text testText = null;
+ try {
+ testText = new Text(composite, SWT.SEARCH | ICON_CANCEL);
+ useNativeSearchField = new Boolean((testText.getStyle() & ICON_CANCEL) != 0);
+ } finally {
+ if (testText != null) {
+ testText.dispose();
+ }
+ }
+
+ }
+ return useNativeSearchField;
+ }
+
+ private boolean showConnectorDescriptorKindFilter;
+
+ private boolean showConnectorDescriptorTextFilter;
+
+ private static final String COLOR_WHITE = "white"; //$NON-NLS-1$
+
+ private static final String COLOR_DARK_GRAY = "DarkGray"; //$NON-NLS-1$
+
+ private static Boolean useNativeSearchField;
+
+ private final List<ConnectorDescriptor> installableConnectors = new
ArrayList<ConnectorDescriptor>();
+
+ private volatile ConnectorDiscovery discovery;
+
+ private Composite body;
+
+ private final List<Resource> disposables;
+
+ private Font h2Font;
+
+ private Font h1Font;
+
+ private Color colorWhite;
+
+ private Text filterText;
+
+ private WorkbenchJob refreshJob;
+
+ private String previousFilterText = ""; //$NON-NLS-1$
+
+ private Pattern filterPattern;
+
+ private Label clearFilterTextControl;
+
+ private Set<String> installedFeatures;
+
+ private Image infoImage;
+
+ private Cursor handCursor;
+
+ private Color colorCategoryGradientStart;
+
+ private Color colorCategoryGradientEnd;
+
+ private Color colorDisabled;
+
+ private ScrolledComposite bodyScrolledComposite;
+
+ private boolean verifyUpdateSiteAvailability;
+
+ private final Map<ConnectorDescriptorKind, Boolean>
connectorDescriptorKindToVisibility = new HashMap<ConnectorDescriptorKind,
Boolean>();
+
+ {
+ for (ConnectorDescriptorKind kind : ConnectorDescriptorKind.values()) {
+ connectorDescriptorKindToVisibility.put(kind, true);
+ }
+ }
+
+ private Dictionary<Object, Object> environment;
+
+ private boolean complete;
+
+ private final IRunnableContext context;
+
+ private final IShellProvider shellProvider;
+
+ private Control control;
+
+ private String directoryUrl;
+
+ private final SelectionProviderAdapter selectionProvider;
+
+ private List<DiscoveryConnector> allConnectors;
+
+ private int minimumHeight;
+
+ private final List<ViewerFilter> filters = new ArrayList<ViewerFilter>();
+
+ private boolean showInstalledFilterEnabled;
+
+ private boolean showInstalled;
+
+ public DiscoveryViewer(IShellProvider shellProvider, IRunnableContext context) {
+ this.shellProvider = shellProvider;
+ this.context = context;
+ this.selectionProvider = new SelectionProviderAdapter();
+ this.allConnectors = Collections.emptyList();
+ this.disposables = new ArrayList<Resource>();
+ setShowConnectorDescriptorKindFilter(true);
+ setShowConnectorDescriptorTextFilter(true);
+ setMinimumHeight(MINIMUM_HEIGHT);
+ createEnvironment();
+ setComplete(false);
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionProvider.addSelectionChangedListener(listener);
+ }
+
+ private void clearDisposables() {
+ disposables.clear();
+ h1Font = null;
+ h2Font = null;
+ infoImage = null;
+ handCursor = null;
+ colorCategoryGradientStart = null;
+ colorCategoryGradientEnd = null;
+ }
+
+ private void clearFilterText() {
+ filterText.setText(""); //$NON-NLS-1$
+ filterTextChanged();
+ }
+
+ private Image computeIconImage(AbstractDiscoverySource discoverySource, Icon icon, int
dimension, boolean fallback) {
+ String imagePath;
+ switch (dimension) {
+ case 64:
+ imagePath = icon.getImage64();
+ if (imagePath != null || !fallback) {
+ break;
+ }
+ case 48:
+ imagePath = icon.getImage48();
+ if (imagePath != null || !fallback) {
+ break;
+ }
+ case 32:
+ imagePath = icon.getImage32();
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
+ if (imagePath != null && imagePath.length() > 0) {
+ URL resource = discoverySource.getResource(imagePath);
+ if (resource != null) {
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(resource);
+ Image image = descriptor.createImage();
+ if (image != null) {
+ disposables.add(image);
+ return image;
+ }
+ }
+ }
+ return null;
+ }
+
+ private IStatus computeStatus(InvocationTargetException e, String message) {
+ Throwable cause = e.getCause();
+ IStatus statusCause;
+ if (cause instanceof CoreException) {
+ statusCause = ((CoreException) cause).getStatus();
+ } else {
+ statusCause = new Status(IStatus.ERROR, DiscoveryUi.ID_PLUGIN, cause.getMessage(),
cause);
+ }
+ if (statusCause.getMessage() != null) {
+ message = NLS.bind(Messages.ConnectorDiscoveryWizardMainPage_message_with_cause,
message,
+ statusCause.getMessage());
+ }
+ IStatus status = new MultiStatus(DiscoveryUi.ID_PLUGIN, 0, new IStatus[] { statusCause
}, message, cause);
+ return status;
+ }
+
+ private void configureLook(Control control, Color background) {
+ control.setBackground(background);
+ }
+
+ /**
+ * cause the UI to respond to a change in visibility filters
+ *
+ * @see #setVisibility(ConnectorDescriptorKind, boolean)
+ */
+ public void connectorDescriptorKindVisibilityUpdated() {
+ createBodyContents();
+ }
+
+ public void createBodyContents() {
+ // remove any existing contents
+ for (Control child : body.getChildren()) {
+ child.dispose();
+ }
+ clearDisposables();
+ allConnectors = new ArrayList<DiscoveryConnector>();
+ initializeCursors();
+ initializeImages();
+ initializeFonts();
+ initializeColors();
+
+ GridLayoutFactory.fillDefaults().applyTo(body);
+
+ bodyScrolledComposite = new ScrolledComposite(body, SWT.H_SCROLL | SWT.V_SCROLL |
SWT.BORDER);
+
+ configureLook(bodyScrolledComposite, colorWhite);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(bodyScrolledComposite);
+
+ final Composite scrolledContents = new Composite(bodyScrolledComposite, SWT.NONE);
+ configureLook(scrolledContents, colorWhite);
+ scrolledContents.setRedraw(false);
+ try {
+ createDiscoveryContents(scrolledContents);
+ } finally {
+ scrolledContents.layout(true);
+ scrolledContents.setRedraw(true);
+ }
+ Point size = scrolledContents.computeSize(body.getSize().x, SWT.DEFAULT, true);
+ scrolledContents.setSize(size);
+
+ bodyScrolledComposite.setExpandHorizontal(true);
+ bodyScrolledComposite.setMinWidth(100);
+ bodyScrolledComposite.setExpandVertical(true);
+ bodyScrolledComposite.setMinHeight(1);
+
+ bodyScrolledComposite.addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(ControlEvent e) {
+ // XXX small offset in case list has a scroll bar
+ Point size = scrolledContents.computeSize(body.getSize().x - 20, SWT.DEFAULT, true);
+ scrolledContents.setSize(size);
+ bodyScrolledComposite.setMinHeight(size.y);
+ }
+ });
+
+ bodyScrolledComposite.setContent(scrolledContents);
+
+ Dialog.applyDialogFont(body);
+ // we've changed it so it needs to know
+ body.layout(true);
+ }
+
+ private Label createClearFilterTextControl(Composite filterContainer, final Text
filterText) {
+ final Image inactiveImage = CommonImages.FIND_CLEAR_DISABLED.createImage();
+ final Image activeImage = CommonImages.FIND_CLEAR.createImage();
+ final Image pressedImage = new Image(filterContainer.getDisplay(), activeImage,
SWT.IMAGE_GRAY);
+
+ final Label clearButton = new Label(filterContainer, SWT.NONE);
+ clearButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ clearButton.setImage(inactiveImage);
+ clearButton.setToolTipText(Messages.ConnectorDiscoveryWizardMainPage_clearButton_toolTip);
+ clearButton.setBackground(filterContainer.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ clearButton.addMouseListener(new MouseAdapter() {
+ private MouseMoveListener fMoveListener;
+
+ private boolean isMouseInButton(MouseEvent e) {
+ Point buttonSize = clearButton.getSize();
+ return 0 <= e.x && e.x < buttonSize.x && 0 <= e.y &&
e.y < buttonSize.y;
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ clearButton.setImage(pressedImage);
+ fMoveListener = new MouseMoveListener() {
+ private boolean fMouseInButton = true;
+
+ public void mouseMove(MouseEvent e) {
+ boolean mouseInButton = isMouseInButton(e);
+ if (mouseInButton != fMouseInButton) {
+ fMouseInButton = mouseInButton;
+ clearButton.setImage(mouseInButton ? pressedImage : inactiveImage);
+ }
+ }
+ };
+ clearButton.addMouseMoveListener(fMoveListener);
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ if (fMoveListener != null) {
+ clearButton.removeMouseMoveListener(fMoveListener);
+ fMoveListener = null;
+ boolean mouseInButton = isMouseInButton(e);
+ clearButton.setImage(mouseInButton ? activeImage : inactiveImage);
+ if (mouseInButton) {
+ clearFilterText();
+ filterText.setFocus();
+ }
+ }
+ }
+ });
+ clearButton.addMouseTrackListener(new MouseTrackListener() {
+ public void mouseEnter(MouseEvent e) {
+ clearButton.setImage(activeImage);
+ }
+
+ public void mouseExit(MouseEvent e) {
+ clearButton.setImage(inactiveImage);
+ }
+
+ public void mouseHover(MouseEvent e) {
+ }
+ });
+ clearButton.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ inactiveImage.dispose();
+ activeImage.dispose();
+ pressedImage.dispose();
+ }
+ });
+ clearButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = Messages.ConnectorDiscoveryWizardMainPage_clearButton_accessibleListener;
+ }
+ });
+ clearButton.getAccessible().addAccessibleControlListener(new AccessibleControlAdapter()
{
+ @Override
+ public void getRole(AccessibleControlEvent e) {
+ e.detail = ACC.ROLE_PUSHBUTTON;
+ }
+ });
+ return clearButton;
+ }
+
+ public void createControl(Composite parent) {
+ createRefreshJob();
+
+ Composite container = new Composite(parent, SWT.NULL);
+ container.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ refreshJob.cancel();
+ if (disposables != null) {
+ for (Resource resource : disposables) {
+ resource.dispose();
+ }
+ clearDisposables();
+ }
+ if (discovery != null) {
+ discovery.dispose();
+ }
+ }
+ });
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ container.setLayout(layout);
+ //
+ { // header
+ Composite header = new Composite(container, SWT.NULL);
+ GridLayoutFactory.fillDefaults().applyTo(header);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(header);
+
+ // TODO: refresh button?
+ if (isShowConnectorDescriptorKindFilter() || isShowConnectorDescriptorTextFilter()) {
+ Composite filterContainer = new Composite(header, SWT.NULL);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(filterContainer);
+
+ Label label = new Label(filterContainer, SWT.NULL);
+ label.setText(Messages.ConnectorDiscoveryWizardMainPage_filterLabel);
+
+ if (isShowConnectorDescriptorTextFilter()) {
+ Composite textFilterContainer;
+ boolean nativeSearch = useNativeSearchField(header);
+ if (nativeSearch) {
+ textFilterContainer = new Composite(filterContainer, SWT.NULL);
+ } else {
+ textFilterContainer = new Composite(filterContainer, SWT.BORDER);
+ textFilterContainer.setBackground(header.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ }
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(textFilterContainer);
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(textFilterContainer);
+
+ if (nativeSearch) {
+ filterText = new Text(textFilterContainer, SWT.SINGLE | SWT.BORDER | SWT.SEARCH |
ICON_CANCEL);
+ } else {
+ filterText = new Text(textFilterContainer, SWT.SINGLE);
+ }
+
+ filterText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ filterTextChanged();
+ }
+ });
+ if (nativeSearch) {
+ filterText.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ if (e.detail == ICON_CANCEL) {
+ clearFilterText();
+ }
+ }
+ });
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(filterText);
+ } else {
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(filterText);
+ clearFilterTextControl = createClearFilterTextControl(textFilterContainer,
filterText);
+ clearFilterTextControl.setVisible(false);
+ }
+ }
+
+ if (isShowInstalledFilterEnabled()) {
+ final Button checkbox = new Button(filterContainer, SWT.CHECK);
+ checkbox.setSelection(false);
+ checkbox.setText(Messages.DiscoveryViewer_Show_Installed);
+ checkbox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ setShowInstalled(checkbox.getSelection());
+ }
+ });
+ }
+
+ if (isShowConnectorDescriptorKindFilter()) { // filter
+ // buttons
+
+ for (final ConnectorDescriptorKind kind : ConnectorDescriptorKind.values()) {
+ final Button checkbox = new Button(filterContainer, SWT.CHECK);
+ checkbox.setSelection(isVisible(kind));
+ checkbox.setText(getFilterLabel(kind));
+ checkbox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ boolean selection = checkbox.getSelection();
+ setVisibility(kind, selection);
+ connectorDescriptorKindVisibilityUpdated();
+ }
+ });
+ }
+ }
+
+ GridLayoutFactory.fillDefaults()
+ .numColumns(filterContainer.getChildren().length)
+ .applyTo(filterContainer);
+ }
+
+ }
+ { // container
+ body = new Composite(container, SWT.NULL);
+ GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT,
minimumHeight).applyTo(body);
+ }
+ Dialog.applyDialogFont(container);
+ setControl(container);
+ }
+
+ public void setMinimumHeight(int minimumHeight) {
+ this.minimumHeight = minimumHeight;
+ if (body != null) {
+ GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT,
minimumHeight).applyTo(body);
+ }
+ }
+
+ public static int getMinimumHeight() {
+ return MINIMUM_HEIGHT;
+ }
+
+ private void createDiscoveryContents(Composite container) {
+
+ Color background = container.getBackground();
+
+ if (discovery == null || isEmpty(discovery)) {
+ GridLayoutFactory.fillDefaults().margins(5, 5).applyTo(container);
+
+ boolean atLeastOneKindFiltered = false;
+ for (ConnectorDescriptorKind kind : ConnectorDescriptorKind.values()) {
+ if (!isVisible(kind)) {
+ atLeastOneKindFiltered = true;
+ break;
+ }
+ }
+ Control helpTextControl;
+ if (filterPattern != null) {
+ Link link = new Link(container, SWT.WRAP);
+
+ link.setFont(container.getFont());
+ link.setText(Messages.ConnectorDiscoveryWizardMainPage_noMatchingItems_withFilterText);
+ link.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ clearFilterText();
+ filterText.setFocus();
+ }
+ });
+ helpTextControl = link;
+ } else {
+ Label helpText = new Label(container, SWT.WRAP);
+ helpText.setFont(container.getFont());
+ if (atLeastOneKindFiltered) {
+ helpText.setText(Messages.ConnectorDiscoveryWizardMainPage_noMatchingItems_filteredType);
+ } else {
+ helpText.setText(Messages.ConnectorDiscoveryWizardMainPage_noMatchingItems_noFilter);
+ }
+ helpTextControl = helpText;
+ }
+ configureLook(helpTextControl, background);
+ GridDataFactory.fillDefaults().grab(true, false).hint(100,
SWT.DEFAULT).applyTo(helpTextControl);
+ } else {
+ GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(container);
+
+ List<DiscoveryCategory> categories = new
ArrayList<DiscoveryCategory>(discovery.getCategories());
+ Collections.sort(categories, new DiscoveryCategoryComparator());
+
+ Composite categoryChildrenContainer = null;
+ for (DiscoveryCategory category : categories) {
+ if (isEmpty(category)) {
+ // don't add empty categories
+ continue;
+ }
+ { // category header
+ final GradientCanvas categoryHeaderContainer = new GradientCanvas(container,
SWT.NONE);
+ categoryHeaderContainer.setSeparatorVisible(true);
+ categoryHeaderContainer.setSeparatorAlignment(SWT.TOP);
+ categoryHeaderContainer.setBackgroundGradient(new Color[] {
colorCategoryGradientStart,
+ colorCategoryGradientEnd }, new int[] { 100 }, true);
+ categoryHeaderContainer.putColor(IFormColors.H_BOTTOM_KEYLINE1,
colorCategoryGradientStart);
+ categoryHeaderContainer.putColor(IFormColors.H_BOTTOM_KEYLINE2,
colorCategoryGradientEnd);
+
+ GridDataFactory.fillDefaults().span(2, 1).applyTo(categoryHeaderContainer);
+ GridLayoutFactory.fillDefaults()
+ .numColumns(3)
+ .margins(5, 5)
+ .equalWidth(false)
+ .applyTo(categoryHeaderContainer);
+
+ Label iconLabel = new Label(categoryHeaderContainer, SWT.NULL);
+ if (category.getIcon() != null) {
+ Image image = computeIconImage(category.getSource(), category.getIcon(), 48,
true);
+ if (image != null) {
+ iconLabel.setImage(image);
+ }
+ }
+ iconLabel.setBackground(null);
+ GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.BEGINNING).span(1,
2).applyTo(iconLabel);
+
+ Label nameLabel = new Label(categoryHeaderContainer, SWT.NULL);
+ nameLabel.setFont(h1Font);
+ nameLabel.setText(category.getName());
+ nameLabel.setBackground(null);
+
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(nameLabel);
+ if (hasTooltip(category)) {
+ ToolBar toolBar = new ToolBar(categoryHeaderContainer, SWT.FLAT);
+ toolBar.setBackground(null);
+ ToolItem infoButton = new ToolItem(toolBar, SWT.PUSH);
+ infoButton.setImage(infoImage);
+ infoButton.setToolTipText(Messages.ConnectorDiscoveryWizardMainPage_tooltip_showOverview);
+ hookTooltip(toolBar, infoButton, categoryHeaderContainer, nameLabel,
category.getSource(),
+ category.getOverview(), null);
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(toolBar);
+ } else {
+ new Label(categoryHeaderContainer, SWT.NULL).setText(" "); //$NON-NLS-1$
+ }
+ Label description = new Label(categoryHeaderContainer, SWT.WRAP);
+ GridDataFactory.fillDefaults()
+ .grab(true, false)
+ .span(2, 1)
+ .hint(100, SWT.DEFAULT)
+ .applyTo(description);
+ description.setBackground(null);
+ description.setText(category.getDescription());
+ }
+
+ categoryChildrenContainer = new Composite(container, SWT.NULL);
+ configureLook(categoryChildrenContainer, background);
+ GridDataFactory.fillDefaults().span(2, 1).grab(true,
false).applyTo(categoryChildrenContainer);
+ GridLayoutFactory.fillDefaults().spacing(0, 0).applyTo(categoryChildrenContainer);
+
+ int numChildren = 0;
+ List<DiscoveryConnector> connectors = new
ArrayList<DiscoveryConnector>(category.getConnectors());
+ Collections.sort(connectors, new DiscoveryConnectorComparator(category));
+ for (final DiscoveryConnector connector : connectors) {
+ if (isFiltered(connector)) {
+ continue;
+ }
+
+ if (++numChildren > 1) {
+ // a separator between connector descriptors
+ Composite border = new Composite(categoryChildrenContainer, SWT.NULL);
+ GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT,
1).applyTo(border);
+ GridLayoutFactory.fillDefaults().applyTo(border);
+ border.addPaintListener(new ConnectorBorderPaintListener());
+ }
+
+ ConnectorDescriptorItemUi itemUi = new ConnectorDescriptorItemUi(connector,
+ categoryChildrenContainer, background);
+ itemUi.updateAvailability();
+ allConnectors.add(connector);
+ }
+ }
+ // last one gets a border
+ Composite border = new Composite(categoryChildrenContainer, SWT.NULL);
+ GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT,
1).applyTo(border);
+ GridLayoutFactory.fillDefaults().applyTo(border);
+ border.addPaintListener(new ConnectorBorderPaintListener());
+ }
+ container.layout(true);
+ container.redraw();
+ }
+
+ private void createEnvironment() {
+ environment = new Hashtable<Object, Object>(System.getProperties());
+ // add the installed Mylyn version to the environment so that we can
+ // have
+ // connectors that are filtered based on version of Mylyn
+ Bundle bundle = Platform.getBundle("org.eclipse.mylyn.tasks.core");
//$NON-NLS-1$
+ String versionString = (String) bundle.getHeaders().get("Bundle-Version");
//$NON-NLS-1$
+ if (versionString != null) {
+ Version version = new Version(versionString);
+ environment.put("org.eclipse.mylyn.version", version.toString());
//$NON-NLS-1$
+ environment.put("org.eclipse.mylyn.version.major", version.getMajor());
//$NON-NLS-1$
+ environment.put("org.eclipse.mylyn.version.minor", version.getMinor());
//$NON-NLS-1$
+ environment.put("org.eclipse.mylyn.version.micro", version.getMicro());
//$NON-NLS-1$
+ }
+ }
+
+ protected Pattern createPattern(String filterText) {
+ if (filterText == null || filterText.length() == 0) {
+ return null;
+ }
+ String regex = filterText;
+ regex.replace("\\", "\\\\").replace("?",
".").replace("*", ".*?"); //$NON-NLS-1$//$NON-NLS-2$
//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ return Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+ }
+
+ private void createRefreshJob() {
+ refreshJob = new WorkbenchJob("filter") { //$NON-NLS-1$
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (filterText.isDisposed()) {
+ return Status.CANCEL_STATUS;
+ }
+ String text = filterText.getText();
+ text = text.trim();
+
+ if (!previousFilterText.equals(text)) {
+ previousFilterText = text;
+ filterPattern = createPattern(previousFilterText);
+ if (clearFilterTextControl != null) {
+ clearFilterTextControl.setVisible(filterPattern != null);
+ }
+ createBodyContents();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ refreshJob.setSystem(true);
+ }
+
+ private void discoveryUpdated(final boolean wasCancelled) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ createBodyContents();
+ if (discovery != null && !wasCancelled) {
+ int categoryWithConnectorCount = 0;
+ for (DiscoveryCategory category : discovery.getCategories()) {
+ categoryWithConnectorCount += category.getConnectors().size();
+ }
+ if (categoryWithConnectorCount == 0) {
+ // nothing was discovered: notify the user
+ MessageDialog.openWarning(getShell(),
Messages.ConnectorDiscoveryWizardMainPage_noConnectorsFound,
+ Messages.ConnectorDiscoveryWizardMainPage_noConnectorsFound_description);
+ }
+ }
+ selectionProvider.setSelection(StructuredSelection.EMPTY);
+ }
+ });
+ }
+
+ private boolean filterMatches(String text) {
+ return text != null && filterPattern.matcher(text).find();
+ }
+
+ private void filterTextChanged() {
+ refreshJob.cancel();
+ refreshJob.schedule(200L);
+ }
+
+ public Control getControl() {
+ return control;
+ }
+
+ public String getDirectoryUrl() {
+ return directoryUrl;
+ }
+
+ public ConnectorDiscovery getDiscovery() {
+ return discovery;
+ }
+
+ /**
+ * the environment in which discovery should be performed.
+ *
+ * @see ConnectorDiscovery#getEnvironment()
+ */
+ public Dictionary<Object, Object> getEnvironment() {
+ return environment;
+ }
+
+ private String getFilterLabel(ConnectorDescriptorKind kind) {
+ switch (kind) {
+ case DOCUMENT:
+ return Messages.ConnectorDiscoveryWizardMainPage_filter_documents;
+ case TASK:
+ return Messages.ConnectorDiscoveryWizardMainPage_filter_tasks;
+ case VCS:
+ return Messages.ConnectorDiscoveryWizardMainPage_filter_vcs;
+ default:
+ throw new IllegalStateException(kind.name());
+ }
+ }
+
+ public List<ConnectorDescriptor> getInstallableConnectors() {
+ return installableConnectors;
+ }
+
+ public IStructuredSelection getSelection() {
+ return (IStructuredSelection) selectionProvider.getSelection();
+ }
+
+ private Shell getShell() {
+ return shellProvider.getShell();
+ }
+
+ public boolean getVerifyUpdateSiteAvailability() {
+ return verifyUpdateSiteAvailability;
+ }
+
+ private boolean hasTooltip(final DiscoveryCategory category) {
+ return category.getOverview() != null && category.getOverview().getSummary() !=
null
+ && category.getOverview().getSummary().length() > 0;
+ }
+
+ private boolean hasTooltip(final DiscoveryConnector connector) {
+ return connector.getOverview() != null && connector.getOverview().getSummary()
!= null
+ && connector.getOverview().getSummary().length() > 0;
+ }
+
+ private void hookRecursively(Control control, Listener listener) {
+ control.addListener(SWT.Dispose, listener);
+ control.addListener(SWT.MouseHover, listener);
+ control.addListener(SWT.MouseMove, listener);
+ control.addListener(SWT.MouseExit, listener);
+ control.addListener(SWT.MouseDown, listener);
+ control.addListener(SWT.MouseWheel, listener);
+ if (control instanceof Composite) {
+ for (Control child : ((Composite) control).getChildren()) {
+ hookRecursively(child, listener);
+ }
+ }
+ }
+
+ private void hookTooltip(final Control parent, final Widget tipActivator, final Control
exitControl,
+ final Control titleControl, AbstractDiscoverySource source, Overview overview, Image
image) {
+ final OverviewToolTip toolTip = new OverviewToolTip(parent, source, overview, image);
+ Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.MouseHover:
+ toolTip.show(titleControl);
+ break;
+ case SWT.Dispose:
+ case SWT.MouseWheel:
+ toolTip.hide();
+ break;
+ }
+
+ }
+ };
+ tipActivator.addListener(SWT.Dispose, listener);
+ tipActivator.addListener(SWT.MouseWheel, listener);
+ if (image != null) {
+ tipActivator.addListener(SWT.MouseHover, listener);
+ }
+ Listener selectionListener = new Listener() {
+ public void handleEvent(Event event) {
+ toolTip.show(titleControl);
+ }
+ };
+ tipActivator.addListener(SWT.Selection, selectionListener);
+ Listener exitListener = new Listener() {
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.MouseWheel:
+ toolTip.hide();
+ break;
+ case SWT.MouseExit:
+ /*
+ * Check if the mouse exit happened because we move over the
+ * tooltip
+ */
+ Rectangle containerBounds = exitControl.getBounds();
+ Point displayLocation = exitControl.getParent().toDisplay(containerBounds.x,
containerBounds.y);
+ containerBounds.x = displayLocation.x;
+ containerBounds.y = displayLocation.y;
+ if (containerBounds.contains(Display.getCurrent().getCursorLocation())) {
+ break;
+ }
+ toolTip.hide();
+ break;
+ }
+ }
+ };
+ hookRecursively(exitControl, exitListener);
+ }
+
+ private void initializeColors() {
+ IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
+ if (colorWhite == null) {
+ ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
+ if (!colorRegistry.hasValueFor(COLOR_WHITE)) {
+ colorRegistry.put(COLOR_WHITE, new RGB(255, 255, 255));
+ }
+ colorWhite = colorRegistry.get(COLOR_WHITE);
+ }
+ if (colorDisabled == null) {
+ ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
+ if (!colorRegistry.hasValueFor(COLOR_DARK_GRAY)) {
+ colorRegistry.put(COLOR_DARK_GRAY, new RGB(0x69, 0x69, 0x69));
+ }
+ colorDisabled = colorRegistry.get(COLOR_DARK_GRAY);
+ }
+ if (colorCategoryGradientStart == null) {
+ colorCategoryGradientStart = themeManager.getCurrentTheme()
+ .getColorRegistry()
+ .get(CommonThemes.COLOR_CATEGORY_GRADIENT_START);
+ colorCategoryGradientEnd = themeManager.getCurrentTheme()
+ .getColorRegistry()
+ .get(CommonThemes.COLOR_CATEGORY_GRADIENT_END);
+ }
+ }
+
+ private void initializeCursors() {
+ if (handCursor == null) {
+ handCursor = new Cursor(getShell().getDisplay(), SWT.CURSOR_HAND);
+ disposables.add(handCursor);
+ }
+ }
+
+ private FontDescriptor createFontDescriptor(int style, float heightMultiplier) {
+ Font baseFont = JFaceResources.getDialogFont();
+ FontData[] fontData = baseFont.getFontData();
+ FontData[] newFontData = new FontData[fontData.length];
+ for (int i = 0; i < newFontData.length; i++) {
+ newFontData[i] = new FontData(fontData[i].getName(), (int) (fontData[i].getHeight() *
heightMultiplier),
+ fontData[i].getStyle() | style);
+ }
+ return FontDescriptor.createFrom(newFontData);
+ }
+
+ private void initializeFonts() {
+ // create a level-2 heading font
+ if (h2Font == null) {
+ h2Font = new Font(Display.getCurrent(), createFontDescriptor(SWT.BOLD,
1.25f).getFontData());
+ disposables.add(h2Font);
+ }
+ // create a level-1 heading font
+ if (h1Font == null) {
+ h1Font = new Font(Display.getCurrent(), createFontDescriptor(SWT.BOLD,
1.35f).getFontData());
+ disposables.add(h1Font);
+ }
+ }
+
+ private void initializeImages() {
+ if (infoImage == null) {
+ infoImage = DiscoveryImages.MESSAGE_INFO.createImage();
+ disposables.add(infoImage);
+ }
+ }
+
+ public boolean isComplete() {
+ return complete;
+ }
+
+ /**
+ * indicate if there is nothing to display in the UI, given the current state of
+ * {@link ConnectorDiscoveryWizard#isVisible(ConnectorDescriptorKind) filters}.
+ */
+ private boolean isEmpty(ConnectorDiscovery discovery) {
+ for (DiscoveryCategory category : discovery.getCategories()) {
+ if (!isEmpty(category)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * indicate if the category has nothing to display in the UI, given the current state
of
+ * {@link ConnectorDiscoveryWizard#isVisible(ConnectorDescriptorKind) filters}.
+ */
+ private boolean isEmpty(DiscoveryCategory category) {
+ if (category.getConnectors().isEmpty()) {
+ return true;
+ }
+ for (ConnectorDescriptor descriptor : category.getConnectors()) {
+ if (!isFiltered(descriptor)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void addFilter(ViewerFilter filter) {
+ filters.add(filter);
+ }
+
+ public void removeFilter(ViewerFilter filter) {
+ filters.remove(filter);
+ }
+
+ private boolean isFiltered(ConnectorDescriptor descriptor) {
+ boolean kindFiltered = true;
+ for (ConnectorDescriptorKind kind : descriptor.getKind()) {
+ if (isVisible(kind)) {
+ kindFiltered = false;
+ break;
+ }
+ }
+ if (kindFiltered) {
+ return true;
+ }
+ if (!showInstalled && descriptor.isInstalled()) {
+ return true;
+ }
+ if (filterPattern != null) {
+ if (!(filterMatches(descriptor.getName()) ||
filterMatches(descriptor.getDescription())
+ || filterMatches(descriptor.getProvider()) ||
filterMatches(descriptor.getLicense()))) {
+ return true;
+ }
+ }
+ for (ViewerFilter filter : filters) {
+ if (!filter.select(null, null, descriptor)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * indicate if the connector descriptor filters should be shown in the UI. Changing this
setting only has an effect
+ * before the UI is presented.
+ */
+ public boolean isShowConnectorDescriptorKindFilter() {
+ return showConnectorDescriptorKindFilter;
+ }
+
+ /**
+ * indicate if a text field should be provided to allow the user to filter connector
descriptors
+ */
+ public boolean isShowConnectorDescriptorTextFilter() {
+ return showConnectorDescriptorTextFilter;
+ }
+
+ public boolean isShowInstalled() {
+ return showInstalled;
+ }
+
+ public boolean isShowInstalledFilterEnabled() {
+ return showInstalledFilterEnabled;
+ }
+
+ /**
+ * indicate if the given kind of connector is currently visible in the wizard
+ *
+ * @see #setVisibility(ConnectorDescriptorKind, boolean)
+ */
+ public boolean isVisible(ConnectorDescriptorKind kind) {
+ if (kind == null) {
+ throw new IllegalArgumentException();
+ }
+ return connectorDescriptorKindToVisibility.get(kind);
+ }
+
+ private void modifySelection(final DiscoveryConnector connector, boolean selected) {
+ modifySelectionInternal(connector, selected);
+ updateState();
+ }
+
+ private void modifySelectionInternal(final DiscoveryConnector connector, boolean
selected) {
+ connector.setSelected(selected);
+ if (selected) {
+ installableConnectors.add(connector);
+ } else {
+ installableConnectors.remove(connector);
+ }
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionProvider.removeSelectionChangedListener(listener);
+ }
+
+ public void setComplete(boolean complete) {
+ this.complete = complete;
+ }
+
+ protected void setControl(Control control) {
+ this.control = control;
+ }
+
+ public void setDirectoryUrl(String directoryUrl) {
+ this.directoryUrl = directoryUrl;
+ }
+
+ /**
+ * the environment in which discovery should be performed.
+ *
+ * @see ConnectorDiscovery#getEnvironment()
+ */
+ public void setEnvironment(Dictionary<Object, Object> environment) {
+ if (environment == null) {
+ throw new IllegalArgumentException();
+ }
+ this.environment = environment;
+ }
+
+ public void setSelection(IStructuredSelection selection) {
+ Set<ConnectorDescriptor> selected = new HashSet<ConnectorDescriptor>();
+ for (Object descriptor : selection.toArray()) {
+ if (descriptor instanceof ConnectorDescriptor) {
+ selected.add((ConnectorDescriptor) descriptor);
+ }
+ }
+ for (DiscoveryConnector connector : allConnectors) {
+ modifySelectionInternal(connector, selected.contains(connector));
+ }
+ updateState();
+ }
+
+ /**
+ * indicate if the connector descriptor filters should be shown in the UI. Changing this
setting only has an effect
+ * before the UI is presented.
+ */
+ public void setShowConnectorDescriptorKindFilter(boolean
showConnectorDescriptorKindFilter) {
+ this.showConnectorDescriptorKindFilter = showConnectorDescriptorKindFilter;
+ }
+
+ /**
+ * indicate if a text field should be provided to allow the user to filter connector
descriptors
+ */
+ public void setShowConnectorDescriptorTextFilter(boolean
showConnectorDescriptorTextFilter) {
+ this.showConnectorDescriptorTextFilter = showConnectorDescriptorTextFilter;
+ }
+
+ public void setShowInstalled(boolean showInstalled) {
+ this.showInstalled = showInstalled;
+ connectorDescriptorKindVisibilityUpdated();
+ }
+
+ public void setShowInstalledFilterEnabled(boolean showInstalledFilter) {
+ this.showInstalledFilterEnabled = showInstalledFilter;
+ }
+
+ public void setVerifyUpdateSiteAvailability(boolean verifyUpdateSiteAvailability) {
+ this.verifyUpdateSiteAvailability = verifyUpdateSiteAvailability;
+ }
+
+ /**
+ * configure the page to show or hide connector descriptors of the given kind
+ *
+ * @see #connectorDescriptorKindVisibilityUpdated()
+ */
+ public void setVisibility(ConnectorDescriptorKind kind, boolean visible) {
+ if (kind == null) {
+ throw new IllegalArgumentException();
+ }
+ connectorDescriptorKindToVisibility.put(kind, visible);
+ }
+
+ public void updateDiscovery() {
+ final Dictionary<Object, Object> environment = getEnvironment();
+ boolean wasCancelled = false;
+ try {
+ final IStatus[] result = new IStatus[1];
+ context.run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
+ if (DiscoveryViewer.this.installedFeatures == null) {
+ DiscoveryViewer.this.installedFeatures = getInstalledFeatures(monitor);
+ }
+
+ ConnectorDiscovery connectorDiscovery = new ConnectorDiscovery();
+
+ // look for descriptors from installed bundles
+ connectorDiscovery.getDiscoveryStrategies().add(new BundleDiscoveryStrategy());
+
+ // look for remote descriptor
+ if (directoryUrl != null) {
+ RemoteBundleDiscoveryStrategy remoteDiscoveryStrategy = new
RemoteBundleDiscoveryStrategy();
+ remoteDiscoveryStrategy.setDirectoryUrl(directoryUrl);
+ connectorDiscovery.getDiscoveryStrategies().add(remoteDiscoveryStrategy);
+ }
+
+ connectorDiscovery.setEnvironment(environment);
+ connectorDiscovery.setVerifyUpdateSiteAvailability(false);
+ try {
+ result[0] = connectorDiscovery.performDiscovery(monitor);
+ } finally {
+ DiscoveryViewer.this.discovery = connectorDiscovery;
+
+ postDiscovery(connectorDiscovery);
+ }
+ if (monitor.isCanceled()) {
+ throw new InterruptedException();
+ }
+ }
+ });
+
+ if (result[0] != null && !result[0].isOK()) {
+ StatusManager.getManager().handle(result[0],
+ StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
+ }
+ } catch (InvocationTargetException e) {
+ IStatus status = computeStatus(e,
Messages.ConnectorDiscoveryWizardMainPage_unexpectedException);
+ StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.BLOCK |
StatusManager.LOG);
+ } catch (InterruptedException e) {
+ // cancelled by user so nothing to do here.
+ wasCancelled = true;
+ }
+ if (discovery != null) {
+ discoveryUpdated(wasCancelled);
+ if (verifyUpdateSiteAvailability && !discovery.getConnectors().isEmpty()) {
+ try {
+ context.run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ discovery.verifySiteAvailability(monitor);
+ }
+ });
+ } catch (InvocationTargetException e) {
+ IStatus status = computeStatus(e,
Messages.ConnectorDiscoveryWizardMainPage_unexpectedException);
+ StatusManager.getManager().handle(status,
+ StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
+ } catch (InterruptedException e) {
+ // cancelled by user so nothing to do here.
+ wasCancelled = true;
+ }
+ }
+ // createBodyContents() shouldn't be necessary but for some
+ // reason checkboxes don't
+ // regain their enabled state
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ createBodyContents();
+ }
+ });
+
+ }
+ // help UI tests
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ body.setData("discoveryComplete", "true"); //$NON-NLS-1$
//$NON-NLS-2$
+ }
+ });
+ }
+
+ private void updateState() {
+ setComplete(!installableConnectors.isEmpty());
+ selectionProvider.setSelection(new StructuredSelection(getInstallableConnectors()));
+ }
+
+ protected void postDiscovery(ConnectorDiscovery connectorDiscovery) {
+ for (DiscoveryConnector connector : connectorDiscovery.getConnectors()) {
+ connector.setInstalled(installedFeatures != null
+ && installedFeatures.containsAll(connector.getInstallableUnits()));
+ }
+ }
+
+ protected Set<String> getInstalledFeatures(IProgressMonitor monitor) throws
InterruptedException {
+ return DiscoveryUi.createInstallJob().getInstalledFeatures(monitor);
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/OverviewToolTip.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/OverviewToolTip.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/xpl/OverviewToolTip.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,214 @@
+package org.jboss.tools.central.editors.xpl;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.mylyn.internal.discovery.core.model.AbstractDiscoverySource;
+import org.eclipse.mylyn.internal.discovery.core.model.Overview;
+import org.eclipse.mylyn.internal.discovery.ui.wizards.Messages;
+import org.eclipse.mylyn.internal.provisional.commons.ui.GradientToolTip;
+import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+
+/**
+ * @author David Green
+ */
+class OverviewToolTip extends GradientToolTip {
+
+ private final Overview overview;
+
+ private final AbstractDiscoverySource source;
+
+ private final Control parent;
+
+ private final Image leftImage;
+
+ public OverviewToolTip(Control control, AbstractDiscoverySource source, Overview
overview, Image leftImage) {
+ super(control, ToolTip.RECREATE, true);
+ Assert.isNotNull(source);
+ Assert.isNotNull(overview);
+ this.parent = control;
+ this.source = source;
+ this.overview = overview;
+ this.leftImage = leftImage;
+ setHideOnMouseDown(false); // required for links to work
+ }
+
+ @Override
+ protected Composite createToolTipArea(Event event, final Composite parent) {
+ GridLayoutFactory.fillDefaults().applyTo(parent);
+
+ Composite container = new Composite(parent, SWT.NULL);
+ container.setBackground(null);
+
+ Image image = null;
+ if (overview.getScreenshot() != null) {
+ image = computeImage(source, overview.getScreenshot());
+ if (image != null) {
+ final Image fimage = image;
+ container.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ fimage.dispose();
+ }
+ });
+ }
+ }
+ final boolean hasLearnMoreLink = overview.getUrl() != null &&
overview.getUrl().length() > 0;
+
+ final int borderWidth = 1;
+ final int fixedImageHeight = 240;
+ final int fixedImageWidth = 320;
+ final int heightHint = fixedImageHeight + (borderWidth * 2);
+ final int widthHint = fixedImageWidth;
+
+ final int containerWidthHintWithImage = 650;
+ final int containerWidthHintWithoutImage = 500;
+
+ GridDataFactory.fillDefaults()
+ .grab(true, true)
+ .hint(image == null ? containerWidthHintWithoutImage : containerWidthHintWithImage,
SWT.DEFAULT)
+ .applyTo(container);
+
+ GridLayoutFactory.fillDefaults()
+ .numColumns((leftImage != null) ? 3 : 2)
+ .margins(5, 5)
+ .spacing(3, 0)
+ .applyTo(container);
+
+ if (leftImage != null) {
+ Label imageLabel = new Label(container, SWT.NONE);
+ imageLabel.setImage(leftImage);
+ int imageWidthHint = leftImage.getBounds().width + 5;
+ GridDataFactory.fillDefaults()
+ .align(SWT.BEGINNING, SWT.BEGINNING)
+ .hint(imageWidthHint, SWT.DEFAULT)
+ .applyTo(imageLabel);
+ }
+
+ String summary = overview.getSummary();
+
+ Composite summaryContainer = new Composite(container, SWT.NULL);
+ summaryContainer.setBackground(null);
+ GridLayoutFactory.fillDefaults().applyTo(summaryContainer);
+
+ GridDataFactory gridDataFactory = GridDataFactory.fillDefaults()
+ .grab(true, true)
+ .span(image == null ? 2 : 1, 1);
+ if (image != null) {
+ gridDataFactory.hint(widthHint, heightHint);
+ }
+ gridDataFactory.applyTo(summaryContainer);
+
+ StyledText summaryLabel = new StyledText(summaryContainer, SWT.WRAP | SWT.READ_ONLY |
SWT.NO_FOCUS);
+ summaryLabel.setText(summary);
+ Point size = summaryLabel.computeSize(widthHint, SWT.DEFAULT);
+ if (size.y > heightHint - 20) {
+ summaryLabel.dispose();
+ summaryLabel = new StyledText(summaryContainer, SWT.WRAP | SWT.READ_ONLY |
SWT.NO_FOCUS | SWT.V_SCROLL);
+ summaryLabel.setText(summary);
+ }
+ summaryLabel.setBackground(null);
+
+ GridDataFactory.fillDefaults().grab(true, true).align(SWT.BEGINNING,
SWT.BEGINNING).applyTo(summaryLabel);
+
+ if (image != null) {
+ final Composite imageContainer = new Composite(container, SWT.BORDER);
+ GridLayoutFactory.fillDefaults().applyTo(imageContainer);
+
+ GridDataFactory.fillDefaults()
+ .grab(false, false)
+ .align(SWT.CENTER, SWT.BEGINNING)
+ .hint(widthHint + (borderWidth * 2), heightHint)
+ .applyTo(imageContainer);
+
+ Label imageLabel = new Label(imageContainer, SWT.NULL);
+ GridDataFactory.fillDefaults()
+ .hint(widthHint, fixedImageHeight)
+ .indent(borderWidth, borderWidth)
+ .applyTo(imageLabel);
+ imageLabel.setImage(image);
+ imageLabel.setBackground(null);
+ imageLabel.setSize(widthHint, fixedImageHeight);
+
+ // creates a border
+ imageContainer.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_BLACK));
+ }
+ if (hasLearnMoreLink) {
+ Link link = new Link(summaryContainer, SWT.NULL);
+ GridDataFactory.fillDefaults().grab(false, false).align(SWT.BEGINNING,
SWT.CENTER).applyTo(link);
+ link.setText(Messages.ConnectorDescriptorToolTip_detailsLink);
+ link.setBackground(null);
+ link.setToolTipText(NLS.bind(Messages.ConnectorDescriptorToolTip_detailsLink_tooltip,
overview.getUrl()));
+ link.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ WorkbenchUtil.openUrl(overview.getUrl(), IWorkbenchBrowserSupport.AS_EXTERNAL);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+ }
+ if (image == null) {
+ // prevent overviews with no image from providing unlimited text.
+ Point optimalSize = summaryContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ if (optimalSize.y > (heightHint + 10)) {
+ ((GridData) summaryContainer.getLayoutData()).heightHint = heightHint;
+ container.layout(true);
+ }
+ }
+ // hack: cause the tooltip to gain focus so that we can capture the escape key
+ // this must be done async since the tooltip is not yet visible.
+ Display.getCurrent().asyncExec(new Runnable() {
+ public void run() {
+ if (!parent.isDisposed()) {
+ parent.setFocus();
+ }
+ }
+ });
+ return container;
+ }
+
+ private Image computeImage(AbstractDiscoverySource discoverySource, String imagePath) {
+ URL resource = discoverySource.getResource(imagePath);
+ if (resource != null) {
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(resource);
+ Image image = descriptor.createImage();
+ return image;
+ }
+ return null;
+ }
+
+ public void show(Control titleControl) {
+ Point titleAbsLocation =
titleControl.getParent().toDisplay(titleControl.getLocation());
+ Point containerAbsLocation = parent.getParent().toDisplay(parent.getLocation());
+ Rectangle bounds = titleControl.getBounds();
+ int relativeX = titleAbsLocation.x - containerAbsLocation.x;
+ int relativeY = titleAbsLocation.y - containerAbsLocation.y;
+
+ relativeY += bounds.height + 3;
+ show(new Point(relativeX, relativeY));
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,39 @@
+package org.jboss.tools.central.jobs;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.central.JBossCentralActivator;
+import org.jboss.tools.central.editors.JBossCentralEditor;
+
+public class RefreshDiscoveryJob extends Job {
+
+ public static RefreshDiscoveryJob INSTANCE = new RefreshDiscoveryJob();
+
+ private RefreshDiscoveryJob() {
+ super("Refresh JBoss News...");
+ setPriority(LONG);
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ final JBossCentralEditor[] editors = new JBossCentralEditor[1];
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ editors[0] = JBossCentralActivator.getJBossCentralEditor();
+ }
+ });
+ if (editors[0] != null) {
+ editors[0].getSoftwarePage().getDiscoveryViewer().updateDiscovery();
+ }
+ return Status.OK_STATUS;
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshNewsJob.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,137 @@
+package org.jboss.tools.central.jobs;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.central.JBossCentralActivator;
+import org.jboss.tools.central.model.NewsEntry;
+
+import com.sun.syndication.feed.synd.SyndContent;
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.io.SyndFeedInput;
+import com.sun.syndication.io.XmlReader;
+
+public class RefreshNewsJob extends Job {
+
+ private List<NewsEntry> entries = new ArrayList<NewsEntry>();
+ private Exception exception;
+ public static RefreshNewsJob INSTANCE = new RefreshNewsJob();
+
+ private RefreshNewsJob() {
+ super("Refresh JBoss News...");
+ setPriority(LONG);
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ entries.clear();
+ SyndFeedInput input = new SyndFeedInput();
+ URL url;
+ try {
+ url = new URL(JBossCentralActivator.NEWS_ATOM_URL);
+ } catch (MalformedURLException e) {
+ exception = e;
+ return Status.CANCEL_STATUS;
+ }
+ try {
+ SyndFeed syndFeed = input.build(new XmlReader(url));
+ List<SyndEntry> feeds = syndFeed.getEntries();
+ if (feeds == null || feeds.size() == 0) {
+ return Status.OK_STATUS;
+ }
+ int i = 0;
+
+ for (SyndEntry feed:feeds) {
+ NewsEntry entry = adaptEntry(feed);
+ if (entry == null) {
+ continue;
+ }
+ if (i++ > JBossCentralActivator.MAX_FEEDS) {
+ break;
+ }
+ entries.add(entry);
+ }
+ } catch (Exception e) {
+ exception = e;
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+
+
+ private NewsEntry adaptEntry(SyndEntry entry) {
+ if (entry == null) {
+ return null;
+ }
+ String title = null;
+ if (entry.getTitle() != null) {
+ title = entry.getTitle();
+ } else {
+ SyndContent titleEx = entry.getTitleEx();
+ if (titleEx != null && !titleEx.getValue().isEmpty()) {
+ title = titleEx.getValue();
+ }
+ }
+ if (title == null) {
+ return null;
+ }
+ title = StringEscapeUtils.escapeHtml(title);
+ String link;
+ if (entry.getLink() != null) {
+ link = entry.getLink();
+ } else {
+ link = entry.getUri();
+ }
+ String description = null;
+ if (entry.getDescription() != null) {
+ SyndContent desc = entry.getDescription();
+ if (desc != null && !desc.getValue().isEmpty()) {
+ description = desc.getValue();
+ }
+ }
+ if (description == null) {
+ List<SyndContent> contents = entry.getContents();
+ if (contents != null && contents.size() > 0) {
+ SyndContent desc = contents.get(0);
+ if (desc != null && !desc.getValue().isEmpty()) {
+ description = desc.getValue();
+ }
+ }
+ }
+ Date date;
+ if (entry.getUpdatedDate() != null) {
+ date = entry.getUpdatedDate();
+ } else {
+ date = entry.getPublishedDate();
+ }
+ String author = entry.getAuthor();
+ if (author != null) {
+ author = StringEscapeUtils.escapeHtml(author);
+ }
+ return new NewsEntry(title, link, description, entry.getAuthor(), date);
+ }
+
+ public Exception getException() {
+ return exception;
+ }
+
+ public void setException(Exception exception) {
+ this.exception = exception;
+ }
+
+ public List<NewsEntry> getEntries() {
+ return entries;
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/NewsEntry.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,108 @@
+package org.jboss.tools.central.model;
+
+import java.util.Date;
+
+import org.jboss.tools.central.JBossCentralActivator;
+
+public class NewsEntry {
+ private String title;
+ private String link;
+ private String description;
+ private String author;
+ private Date date;
+
+
+ public NewsEntry() {
+
+ }
+
+ public NewsEntry(String title, String link, String description,
+ String author, Date date) {
+ this.title = title;
+ this.link = link;
+ this.description = description;
+ this.author = author;
+ this.date = date;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ public String getLink() {
+ return link;
+ }
+ public void setLink(String link) {
+ this.link = link;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public String getAuthor() {
+ return author;
+ }
+ public void setAuthor(String author) {
+ this.author = author;
+ }
+ public Date getDate() {
+ return date;
+ }
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public String getFormString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(JBossCentralActivator.FORM_START_TAG);
+ buffer.append("<img href=\"image\"/> ");
+ if (link != null && !link.isEmpty()) {
+ buffer.append("<a href=\"");
+ buffer.append(link);
+ buffer.append("\">");
+ buffer.append(title);
+ buffer.append("</a>");
+ } else {
+ buffer.append(title);
+ }
+ buffer.append("<br/>");
+ boolean cr = false;
+ buffer.append("<span font=\"default\">");
+ if (date != null) {
+ buffer.append("posted on ");
+ buffer.append(date);
+ cr = true;
+ }
+ buffer.append("</span>");
+ if (author != null && !author.isEmpty()) {
+ buffer.append(" ");
+ buffer.append("<span font=\"default\">");
+ buffer.append(" by");
+ buffer.append("</span>");
+ buffer.append(" ");
+ buffer.append("<span font=\"author\">");
+ buffer.append(author);
+ buffer.append("</span>");
+ cr = true;
+ }
+
+ if (cr) {
+ buffer.append("<br />");
+ }
+ //buffer.append("<br />");
+ buffer.append(JBossCentralActivator.FORM_END_TAG);
+ return buffer.toString();
+ }
+
+ @Override
+ public String toString() {
+ return "NewsEntry [title=" + title + ", link=" + link
+ + ", description=" + description + ", author=" + author
+ + ", date=" + date + "]";
+ }
+
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/preferences/JBossCentralPreferencePage.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/preferences/JBossCentralPreferencePage.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/preferences/JBossCentralPreferencePage.java 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,84 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.preferences;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.central.JBossCentralActivator;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class JBossCentralPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private Button showOnStartup;
+
+ @Override
+ public void init(IWorkbench workbench) {
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayout(layout);
+
+ showOnStartup = new Button(composite, SWT.CHECK);
+ showOnStartup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ showOnStartup.setSelection(JBossCentralActivator.getDefault().showJBossCentralOnStartup());
+ showOnStartup.setText("Show JBoss Central On Startup");
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ protected void performApply() {
+ IEclipsePreferences preferences = JBossCentralActivator.getDefault().getPreferences();
+ preferences.putBoolean(JBossCentralActivator.SHOW_JBOSS_CENTRAL_ON_STARTUP,
showOnStartup.getSelection());
+ JBossCentralActivator.getDefault().savePreferences();
+ }
+
+ @Override
+ protected void performDefaults() {
+ IEclipsePreferences preferences = JBossCentralActivator.getDefault().getPreferences();
+
+ showOnStartup.setSelection(JBossCentralActivator.SHOW_JBOSS_CENTRAL_ON_STARTUP_DEFAULT_VALUE);
+ preferences.putBoolean(JBossCentralActivator.SHOW_JBOSS_CENTRAL_ON_STARTUP,
JBossCentralActivator.SHOW_JBOSS_CENTRAL_ON_STARTUP_DEFAULT_VALUE);
+ JBossCentralActivator.getDefault().savePreferences();
+ super.performDefaults();
+ }
+
+ @Override
+ public boolean performOk() {
+ performApply();
+ return super.performOk();
+ }
+
+}
Added: trunk/central/plugins/org.jboss.tools.central.discovery/.classpath
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/.classpath
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/.classpath 2011-09-13 21:22:29
UTC (rev 34696)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/central/plugins/org.jboss.tools.central.discovery/.project
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/.project
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/.project 2011-09-13 21:22:29
UTC (rev 34696)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.central.discovery</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/central/plugins/org.jboss.tools.central.discovery/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/central/plugins/org.jboss.tools.central.discovery/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central.discovery/.settings/org.eclipse.jdt.core.prefs 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,8 @@
+#Mon Sep 12 14:00:46 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/central/plugins/org.jboss.tools.central.discovery/META-INF/MANIFEST.MF
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central.discovery/META-INF/MANIFEST.MF 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleVendor
+Bundle-SymbolicName: org.jboss.tools.central.discovery;singleton:=true
+Bundle-Version: 3.3.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.mylyn.discovery.core;bundle-version="3.6.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Localization: plugin
+Bundle-Vendor: %BundleName
Added: trunk/central/plugins/org.jboss.tools.central.discovery/build.properties
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/build.properties
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/build.properties 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,5 @@
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ images/
Added: trunk/central/plugins/org.jboss.tools.central.discovery/images/Thumbs.db
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central.discovery/images/Thumbs.db
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central.discovery/images/egit_32.png
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central.discovery/images/egit_32.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central.discovery/images/m2e_32.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central.discovery/images/m2e_32.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central.discovery/images/redhat_48.png
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central.discovery/images/redhat_48.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central.discovery/images/testng_16.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central.discovery/images/testng_16.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/central/plugins/org.jboss.tools.central.discovery/images/testng_screenshot.png
===================================================================
(Binary files differ)
Property changes on:
trunk/central/plugins/org.jboss.tools.central.discovery/images/testng_screenshot.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central.discovery/plugin.properties
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/plugin.properties
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/plugin.properties 2011-09-13
21:22:29 UTC (rev 34696)
@@ -0,0 +1,4 @@
+#Properties file for org.jboss.tools.central.discovery
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Central Discovery
+
Added: trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml
(rev 0)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2011-09-13 21:22:29
UTC (rev 34696)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.mylyn.discovery.core.connectorDiscovery">
+ <certification
+ id="com.jboss.jbds.discovery.JbdsCertified"
+ name="JBDS Certified"
+
url="https://engineering.redhat.com/pp/product/jbds/">
+ <description>
+ Features certified with JBoss Developer Studio have been tested by Red Hat.
We will provide best-effort assistance on using these plugins.
+ </description>
+ <icon
+ image48="images/redhat_48.png">
+ </icon>
+ </certification>
+
+ <connectorCategory
+ description="a category for testing purposes"
+ id="org.jboss.tools.category.test"
+ name="Test Category"
+ relevance="60">
+ <group id="bundled" />
+ <group id="extra" />
+ </connectorCategory>
+
+ <connectorDescriptor
+ categoryId="org.jboss.tools.category.test"
+ description="Eclipse EGit."
+ id="org.eclipse.egit"
+ kind="task"
+ license="Free, EPL, Incubation"
+ name="An Eclipse Git Team provider in pure Java."
+ provider="Eclipse Git"
+
siteUrl="http://download.eclipse.org/egit/updates">
+ <icon
+ image32="images/egit_32.png">
+ </icon>
+ <overview
+
url="http://www.eclipse.org/egit/">
+ </overview>
+ </connectorDescriptor>
+ <connectorDescriptor
+ categoryId="org.jboss.tools.category.test"
+ description="m2e - Maven Integration for Eclipse."
+ id="org.eclipse.m2e.feature"
+ kind="task"
+ license="Free, EPL"
+ name="m2e - Maven Integration for Eclipse."
+
provider="Eclipse.org - m2e"
+
siteUrl="http://download.eclipse.org/technology/m2e/releases">
+ <icon
+ image32="images/m2e_32.gif">
+ </icon>
+ <overview
+
url="http://www.eclipse.org/m2e/">
+ </overview>
+ </connectorDescriptor>
+ <connectorDescriptor
+ categoryId="org.jboss.tools.category.test"
+ certificationId="com.jboss.jbds.discovery.JbdsCertified"
+ description="TestNG plug-in for Eclipse."
+ id="org.testng.eclipse"
+ kind="task"
+ license="Free, ASL"
+ name="TestNG"
+ provider="Cedric Beust"
+
siteUrl="http://beust.com/eclipse">
+ <icon
+ image32="images/testng_16.gif">
+ </icon>
+ <overview
+ summary="TestNG plug-in for Eclipse."
+ screenshot="images/testng_screenshot.png"
+
url="http://testng.org/">
+ </overview>
+ </connectorDescriptor>
+
+ </extension>
+</plugin>