JBoss Tools SVN: r24176 - in trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage: googleanalytics and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-08-16 06:57:43 -0400 (Mon, 16 Aug 2010)
New Revision: 24176
Added:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ITracker.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/FocusPoint.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/Tracker.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/AbstractGoogleAnalyticsParameters.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/EclipseEnvironment.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/GoogleAnalyticsUrlStrategy.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/HttpGetMethod.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/PluginLogger.java
Removed:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/IUsageTracker.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/EclipseEnvironment.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/FocusPoint.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/HttpGetMethod.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/JGoogleAnalyticsTracker.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/PluginLogger.java
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/IGoogleAnalyticsParameters.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/ILoggingAdapter.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/IURLBuildingStrategy.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/UsageReport.java
Log:
[JBIDE-6376] user agent string corrected, tests added
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ITracker.java (from rev 24090, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/IUsageTracker.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ITracker.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ITracker.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -0,0 +1,34 @@
+package org.jboss.tools.usage;
+
+import java.io.UnsupportedEncodingException;
+
+import org.jboss.tools.usage.googleanalytics.FocusPoint;
+
+public interface ITracker {
+
+ /**
+ * Track the focusPoint in the application synchronously. <br/>
+ * <red><b>Please be cognizant while using this method. Since, it would have
+ * a peformance hit on the actual application. Use it unless it's really
+ * needed</b></red>
+ *
+ * @param focusPoint
+ * Focus point of the application like application load,
+ * application module load, user actions, error events etc.
+ * @throws UnsupportedEncodingException
+ */
+
+ public abstract void trackSynchronously(FocusPoint focusPoint)
+ throws UnsupportedEncodingException;
+
+ /**
+ * Track the focusPoint in the application asynchronously. <br/>
+ *
+ * @param focusPoint
+ * Focus point of the application like application load,
+ * application module load, user actions, error events etc.
+ */
+
+ public abstract void trackAsynchronously(FocusPoint focusPoint);
+
+}
\ No newline at end of file
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ITracker.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/IUsageTracker.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/IUsageTracker.java 2010-08-16 10:55:59 UTC (rev 24175)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/IUsageTracker.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -1,34 +0,0 @@
-package org.jboss.tools.usage;
-
-import java.io.UnsupportedEncodingException;
-
-import org.jboss.tools.usage.jgoogleanalytics.FocusPoint;
-
-public interface IUsageTracker {
-
- /**
- * Track the focusPoint in the application synchronously. <br/>
- * <red><b>Please be cognizant while using this method. Since, it would have
- * a peformance hit on the actual application. Use it unless it's really
- * needed</b></red>
- *
- * @param focusPoint
- * Focus point of the application like application load,
- * application module load, user actions, error events etc.
- * @throws UnsupportedEncodingException
- */
-
- public abstract void trackSynchronously(FocusPoint focusPoint)
- throws UnsupportedEncodingException;
-
- /**
- * Track the focusPoint in the application asynchronously. <br/>
- *
- * @param focusPoint
- * Focus point of the application like application load,
- * application module load, user actions, error events etc.
- */
-
- public abstract void trackAsynchronously(FocusPoint focusPoint);
-
-}
\ No newline at end of file
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics (from rev 24090, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics)
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/AbstractGoogleAnalyticsParameters.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.jgoogleanalytics;
-
-
-public abstract class AbstractGoogleAnalyticsParameters implements IGoogleAnalyticsParameters {
-
- private String accountName;
- private String referral;
-
- public AbstractGoogleAnalyticsParameters(String accountName, String referral) {
- this.accountName = accountName;
- this.referral = referral;
- }
-
- @Override
- public String getAccountName() {
- return accountName;
- }
-
- @Override
- public String getReferral() {
- return referral;
- }
-}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/EclipseEnvironment.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/EclipseEnvironment.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/EclipseEnvironment.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.jgoogleanalytics;
-
-import java.util.Random;
-
-import org.eclipse.core.runtime.IProduct;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
-import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
-import org.jboss.tools.usage.util.PreferencesUtil;
-import org.jboss.tools.usage.util.StatusUtils;
-import org.osgi.framework.Bundle;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-public class EclipseEnvironment extends AbstractGoogleAnalyticsParameters implements IGoogleAnalyticsParameters {
-
- private static final String SCREERESOLUTION_DELIMITER = "x";
-
- private static final String ECLIPSE_RUNTIME_BULDEID = "org.eclipse.core.runtime";
-
- private static final char VERSION_DELIMITER = '.';
-
- private static final String SCREENCOLORDEPTH_POSTFIX = "-bit";
-
- private static final char JAVA_LOCALE_DELIMITER = '_';
-
- private static final char BROWSER_LOCALE_DELIMITER = '-';
-
- private String screenResolution;
-
- private String screenColorDepth;
-
- private Random random;
-
- public EclipseEnvironment(String accountName, String referral) {
- super(accountName, referral);
- this.random = new Random();
- initScreenSettings(getDisplay());
- }
-
- @Override
- public String getScreenResolution() {
- return screenResolution;
- }
-
- @Override
- public String getHostname() {
- /* TODO implement */
- return "jboss.org";
- }
-
- @Override
- public String getBrowserLanguage() {
- String nl = Platform.getNL(); //$NON-NLS-1$
- if (nl == null) {
- return "";
- }
-
- int indexOf = nl.indexOf(JAVA_LOCALE_DELIMITER); //$NON-NLS-1$
- if (indexOf <= 0) {
- return nl;
- }
-
- StringBuilder builder = new StringBuilder();
- builder.append(nl.substring(0, indexOf));
- builder.append(BROWSER_LOCALE_DELIMITER);
- builder.append(nl.substring(indexOf + 1).toLowerCase());
- return builder.toString();
- }
-
- private void initScreenSettings(final Display display) {
- display.syncExec(new Runnable() {
- @Override
- public void run() {
- screenColorDepth = display.getDepth() + SCREENCOLORDEPTH_POSTFIX;
-
- Rectangle bounds = display.getBounds();
- screenResolution = bounds.width + SCREERESOLUTION_DELIMITER + bounds.height;
- }
- });
- }
-
- @Override
- public String getScreenColorDepth() {
- return screenColorDepth;
- }
-
- private Display getDisplay() {
- if (PlatformUI.isWorkbenchRunning()) {
- return PlatformUI.getWorkbench().getDisplay();
- }
-
- Display display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- return display;
- }
-
- @Override
- public String getUserAgent() {
-
- String productId = getDefiningBundle().getSymbolicName();
- String productVersion = getProductVersion();
- String eclipseVersion = getEclipseVersion();
- String windowSystem = Platform.getWS();
- String os = Platform.getOS();
- String architecture = Platform.getOSArch();
- String browserLanguage = Platform.getNL();
- String buildId = getBuildId();
-
- /**
- * Google API for android: this.userAgent = String.format(
- * "GoogleAnalytics/%s (Linux; U; Android %s; %s-%s; %s; Build/%s)" ,
- * new Object[] { "1.0" , Build.VERSION.RELEASE ,
- * (localLocale.getLanguage() != null) ?
- * localLocale.getLanguage().toLowerCase() : "en" ,
- * (localLocale.getCountry() != null) ?
- * localLocale.getCountry().toLowerCase() : "" , Build.MODEL, Build.ID
- * });
- */
-
- // return
- // MessageFormat.format("{0}/{1} ({2}; U; {3} {4}; {5}) {6} Eclipse/{7}"
- // , productId
- // , productVersion
- // , windowSystem
- // , os
- // , architecture
- // , browserLanguage
- // , buildId
- // , eclipseVersion);
- return "EclipseEnvironment/3.0.1";
- }
-
- private String getEclipseVersion() {
- return Platform.getBundle(ECLIPSE_RUNTIME_BULDEID).getVersion().toString();
- }
-
- private String getBuildId() {
- String fullVersion = getDefiningBundle().getVersion().toString();
- int buildIdStart = fullVersion.lastIndexOf(VERSION_DELIMITER);
- if (buildIdStart > 0) {
- return fullVersion.substring(buildIdStart + 1);
- } else {
- return fullVersion;
- }
- }
-
- private String getProductVersion() {
- String fullVersion = getDefiningBundle().getVersion().toString();
- int productVersionStart = fullVersion.lastIndexOf(VERSION_DELIMITER);
- if (productVersionStart > 0) {
- return fullVersion.substring(0, productVersionStart);
- } else {
- return fullVersion;
- }
- }
-
- private Bundle getDefiningBundle() {
- IProduct product = Platform.getProduct();
- if (product != null) {
- return product.getDefiningBundle();
- } else {
- return Platform.getBundle(ECLIPSE_RUNTIME_BULDEID);
- }
- }
-
- @Override
- public String getUserId() {
- Preferences preferences = PreferencesUtil.getConfigurationPreferences();
- String userId = getIdentifier();
- try {
- if (!preferences.nodeExists(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID)) {
- preferences.put(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID, userId);
- preferences.flush();
- } else {
- userId = preferences.get(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID, userId);
- }
- } catch (BackingStoreException e) {
- StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID, "Could not retrieve {0} from preferences.",
- e, IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID);
- }
- return userId;
- }
-
- private String getIdentifier() {
- StringBuilder builder = new StringBuilder();
- builder.append(random.nextLong());
- builder.append(System.currentTimeMillis());
- return builder.toString();
- }
-}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/FocusPoint.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/FocusPoint.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/FocusPoint.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.jgoogleanalytics;
-
-import org.jboss.tools.usage.util.EncodingUtils;
-
-/**
- * Focus point of the application. It can represent data points like application
- * load, application module load, user actions, error events etc.
- */
-
-public class FocusPoint {
-
- private String name;
- private FocusPoint childFocusPoint;
- public static final String URI_SEPARATOR = "/";
- public static final String TITLE_SEPARATOR = "-";
-
- public FocusPoint(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public FocusPoint setChild(FocusPoint childFocusPoint) {
- this.childFocusPoint = childFocusPoint;
- return this;
- }
-
- public FocusPoint getChild() {
- return childFocusPoint;
- }
-
- public String getContentURI() {
- StringBuilder builder = new StringBuilder();
- appendContentURI(builder, this);
- return EncodingUtils.checkedEncodeUtf8(builder.toString());
- }
-
- private void appendContentURI(StringBuilder builder, FocusPoint focusPoint) {
- FocusPoint parentFocuPoint = focusPoint.getChild();
- builder.append(URI_SEPARATOR);
- builder.append(focusPoint.getName());
- if (parentFocuPoint != null) {
- appendContentURI(builder, parentFocuPoint);
- }
- }
-
- public String getContentTitle() {
- StringBuilder builder = new StringBuilder();
- appendContentTitle(builder, this);
- return EncodingUtils.checkedEncodeUtf8(builder.toString());
- }
-
- private void appendContentTitle(StringBuilder builder, FocusPoint focusPoint) {
- FocusPoint childFocusPoint = focusPoint.getChild();
- builder.append(focusPoint.getName());
- builder.append(TITLE_SEPARATOR);
- if (childFocusPoint != null) {
- appendContentTitle(builder, childFocusPoint);
- }
- }
-}
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/FocusPoint.java (from rev 24092, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/FocusPoint.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/FocusPoint.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/FocusPoint.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.googleanalytics;
+
+import org.jboss.tools.usage.util.EncodingUtils;
+
+/**
+ * Focus point of the application. It can represent data points like application
+ * load, application module load, user actions, error events etc.
+ */
+
+public class FocusPoint {
+
+ private String name;
+ private FocusPoint childFocusPoint;
+ public static final String URI_SEPARATOR = "/";
+ public static final String TITLE_SEPARATOR = "-";
+
+ public FocusPoint(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public FocusPoint setChild(FocusPoint childFocusPoint) {
+ this.childFocusPoint = childFocusPoint;
+ return this;
+ }
+
+ public FocusPoint getChild() {
+ return childFocusPoint;
+ }
+
+ public String getContentURI() {
+ StringBuilder builder = new StringBuilder();
+ appendContentURI(builder, this);
+ return EncodingUtils.checkedEncodeUtf8(builder.toString());
+ }
+
+ private void appendContentURI(StringBuilder builder, FocusPoint focusPoint) {
+ FocusPoint parentFocuPoint = focusPoint.getChild();
+ builder.append(URI_SEPARATOR);
+ builder.append(focusPoint.getName());
+ if (parentFocuPoint != null) {
+ appendContentURI(builder, parentFocuPoint);
+ }
+ }
+
+ public String getContentTitle() {
+ StringBuilder builder = new StringBuilder();
+ appendContentTitle(builder, this);
+ return EncodingUtils.checkedEncodeUtf8(builder.toString());
+ }
+
+ private void appendContentTitle(StringBuilder builder, FocusPoint focusPoint) {
+ FocusPoint childFocusPoint = focusPoint.getChild();
+ builder.append(focusPoint.getName());
+ if (childFocusPoint != null) {
+ builder.append(TITLE_SEPARATOR);
+ appendContentTitle(builder, childFocusPoint);
+ }
+ }
+}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/GoogleAnalyticsUrlStrategy.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -1,262 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.jgoogleanalytics;
-
-import java.io.UnsupportedEncodingException;
-
-import org.jboss.tools.usage.util.EncodingUtils;
-
-/**
- * URL building logic for the earlier versions of google analytics (urchin.js)
- *
- * @author : Siddique Hameed, Andre Dietisheim
- * @version : 0.2
- */
-
-public class GoogleAnalyticsUrlStrategy implements IURLBuildingStrategy {
-
- private static final String TRACKING_URL = "http://www.google-analytics.com/__utm.gif";
-
- private static final String ENCODING_UTF8 = "UTF-8";
-
- private static final long TIMESTAMP = -1;
-
- private static final int VISITS = -1;
-
- private IGoogleAnalyticsParameters googleParameters;
-
- protected GoogleAnalyticsUrlStrategy(IGoogleAnalyticsParameters googleAnalyticsParameters) {
- this.googleParameters = googleAnalyticsParameters;
- }
-
- public String build(FocusPoint focusPoint) throws UnsupportedEncodingException {
- /*
- * Google Analytics for Android:
- *
- String str = "";
- if (paramEvent.action != null)
- str = paramEvent.action;
- if (!(str.startsWith("/")))
- str = "/" + str;
- str = encode(str);
- Locale localLocale = Locale.getDefault();
- StringBuilder localStringBuilder = new StringBuilder();
- localStringBuilder.append("/__utm.gif");
- localStringBuilder.append("?utmwv=4.3");
- localStringBuilder.append("&utmn=").append(paramEvent.randomVal);
- localStringBuilder.append("&utmcs=UTF-8");
- localStringBuilder.append(String.format("&utmsr=%dx%d", new Object[] {
- Integer.valueOf(paramEvent.screenWidth)
- , Integer.valueOf(paramEvent.screenHeight) }));
- localStringBuilder.append(String.format("&utmul=%s-%s", new Object[] {
- localLocale.getLanguage()
- , localLocale.getCountry() }));
- localStringBuilder.append("&utmp=").append(str);
- localStringBuilder.append("&utmac=").append(paramEvent.accountId);
- localStringBuilder.append("&utmcc=").append(
- getEscapedCookieString(paramEvent, paramString));
- return localStringBuilder.toString();
-
- *
- * getEscapedCookieString:
- *
- StringBuilder localStringBuilder = new StringBuilder();
- localStringBuilder.append("__utma=");
- localStringBuilder.append("999").append(".");
- localStringBuilder.append(paramEvent.userId).append(".");
- localStringBuilder.append(paramEvent.timestampFirst).append(".");
- localStringBuilder.append(paramEvent.timestampPrevious).append(".");
- localStringBuilder.append(paramEvent.timestampCurrent).append(".");
- localStringBuilder.append(paramEvent.visits);
- if (paramString != null)
- {
- localStringBuilder.append("+__utmz=");
- localStringBuilder.append("999").append(".");
- localStringBuilder.append(paramEvent.timestampFirst).append(".");
- localStringBuilder.append("1.1.");
- localStringBuilder.append(paramString);
- }
- return encode(localStringBuilder.toString());
-
- */
-
- /*
- * our working tracking code
- *
- http://www.google-analytics.com/__utm.gif?utmwv=4.7.2
- &utmn=338321265
- &utmhn=jboss.org
- &utmcs=UTF-8
- &utmsr=1920x1080
- &utmsc=24-bit
- &utmul=en-us
- &utmje=1
- &utmfl=10.1%20r53
- &utmdt=-%20JBoss%20Community
- &utmhid=1087431432
- &utmr=0
- &utmp=%2Ftools%2Fusage.html
- &utmac=UA-17645367-1
- &utmcc=__utma%3D156030500.1285760711.1281430767.1281430767.1281430767.1%3B%2B__utmz%3D156030500.1281430767.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B
- &gaq=1
- *
- */
-
- StringBuilder builder = new StringBuilder(TRACKING_URL)
- .append(IGoogleAnalyticsParameters.URL_PARAM_DELIMITER);
- appendParameter(IGoogleAnalyticsParameters.PARAM_TRACKING_CODE_VERSION,
- IGoogleAnalyticsParameters.VALUE_TRACKING_CODE_VERSION, builder);
- appendParameter(IGoogleAnalyticsParameters.PARAM_UNIQUE_TRACKING_NUMBER, getRandomNumber(), builder);
- appendParameter(IGoogleAnalyticsParameters.PARAM_HID, getRandomNumber(), builder);
- // appendParameter(IGoogleAnalyticsParameters.PARAM_HID,
- // getRandomNumber(), builder);
- appendParameter(IGoogleAnalyticsParameters.PARAM_LANGUAGE_ENCODING, ENCODING_UTF8, builder);
- appendParameter(IGoogleAnalyticsParameters.PARAM_SCREEN_COLOR_DEPTH, googleParameters.getScreenColorDepth(),
- builder);
- appendParameter(IGoogleAnalyticsParameters.PARAM_SCREEN_RESOLUTION, googleParameters.getScreenResolution(),
- builder);
- appendParameter(IGoogleAnalyticsParameters.PARAM_BROWSER_LANGUAGE, googleParameters.getBrowserLanguage(),
- builder);
- // appendParameter(IGoogleAnalyticsParameters.PARAM_REPEAT_CAMPAIGN_VISIT,
- // "1", builder);
- // appendParameter(IGoogleAnalyticsParameters.PARAM_PAGE_TITLE,
- // focusPoint.getContentTitle(), builder);
- // appendParameter(IGoogleAnalyticsParameters.PARAM_HOST_NAME,
- // googleParameters.getHostname(), builder);
- // appendParameter(IGoogleAnalyticsParameters.PARAM_REFERRAL,
- // googleParameters.getReferral(), builder);
- appendParameter(IGoogleAnalyticsParameters.PARAM_PAGE_REQUEST, focusPoint.getContentURI(), builder);
- appendParameter(IGoogleAnalyticsParameters.PARAM_ACCOUNT_NAME, googleParameters.getAccountName(), builder);
- appendCookies(focusPoint, builder);
- // appendParameter(IGoogleAnalyticsParameters.PARAM_GAQ, "1", false,
- // builder);
-
- // StringBuilder builder = new StringBuilder()
- // .append(TRACKING_URL)
- // .append(URL_PARAM_DELIMITER);
- // appendParameter(IGoogleAnalyticsParameters.TRACKING_CODE_VERSION,
- // IGoogleAnalyticsParameters.URCHIN_VERSION, builder);
- // appendParameter(IGoogleAnalyticsParameters.UNIQUE_TRACKING_NUMBER,
- // getRandomNumber(), builder);
- // appendParameter(IGoogleAnalyticsParameters.HOST_NAME,
- // URLEncoder.encode(googleParameters.getHostname(), ENCODING_UTF8),
- // builder);
- // appendParameter(IGoogleAnalyticsParameters.REFERRAL,
- // URLEncoder.encode(googleParameters.getReferral(), ENCODING_UTF8),
- // builder);
- // appendParameter(IGoogleAnalyticsParameters.PAGE_REQUEST,
- // URLEncoder.encode(appFocusPoint.getContentURI(), ENCODING_UTF8),
- // builder);
- // appendParameter(IGoogleAnalyticsParameters.ACCOUNT_NAME,
- // googleParameters.getAccountName(), builder);
- // appendParameter(IGoogleAnalyticsParameters.COOKIE_VALUES,
- // "__utma%3D999.999.999.999.999.1%3B", builder);
- // appendParameter(IGoogleAnalyticsParameters.LANGUAGE_ENCODING,
- // ENCODING_UTF8, builder);
- // appendParameter(IGoogleAnalyticsParameters.SCREEN_RESOLUTION,
- // googleParameters.getScreenResolution(), builder);
- // .append("&utmvid=").append(new EclipseInstance().toString());
- // .append("&utmip=").append(getIpAddress());
-
- return builder.toString();
- }
-
- private void appendCookies(FocusPoint focusPoint, StringBuilder builder) {
-
- StringBuilder stringBuilder = new StringBuilder();
- stringBuilder.append(IGoogleAnalyticsParameters.PARAM_COOKIES_FIRST_VISIT)
- .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
- .append("999.")
- .append(googleParameters.getUserId()).append(IGoogleAnalyticsParameters.DOT)
- .append(TIMESTAMP).append(IGoogleAnalyticsParameters.DOT)
- .append(TIMESTAMP).append(IGoogleAnalyticsParameters.DOT)
- .append(TIMESTAMP).append(IGoogleAnalyticsParameters.DOT)
- .append(VISITS)
- .append(IGoogleAnalyticsParameters.PLUS_SIGN)
- .append(IGoogleAnalyticsParameters.PARAM_COOKIES_REFERRAL_TYPE)
- .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
- .append("999.")
- .append(TIMESTAMP).append(IGoogleAnalyticsParameters.DOT)
- .append("1.1.")
- .append(focusPoint.getContentURI());
-
- String encodedString = EncodingUtils.checkedEncodeUtf8(stringBuilder.toString());
- builder.append(encodedString);
-
- // builder.append(IGoogleAnalyticsParameters.PARAM_COOKIE_VALUES)
- // .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
- // .append("__utma%3D")
- // .append(getRandomNumber())
- // .append(".")
- // .append(getRandomNumber())
- // .append(".")
- // .append(now)
- // .append(".")
- // .append(now)
- // .append(".")
- // .append(now)
- // .append(".2%3B%2B)")
- //
- // // .append("__utmb%3D")
- // // .append(getRandomNumber())
- // // .append("%3B%2B__utmc%3D")
- // // .append(getRandomNumber())
- // // .append("%3B%2B")
- //
- // .append("__utmz%3D")
- // .append(getRandomNumber())
- // .append(".")
- // .append(now)
- // .append(IGoogleAnalyticsParameters.AMPERSAND);
-
- // .append("utmcsr%3D(direct)%7C")
- // .append("utmccn%3D(direct)%7C")
- // .append("utmcmd%3D(none)%3B");
-
- }
-
- private String getRandomNumber() {
- return Integer.toString((int) (Math.random() * 0x7fffffff));
- }
-
- private void appendParameter(String name, String value, StringBuilder builder) {
- appendParameter(name, value, true, builder);
- }
-
- private void appendParameter(String name, String value, boolean appendAmpersand, StringBuilder builder) {
- builder.append(name)
- .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
- .append(value);
- if (appendAmpersand) {
- builder.append(IGoogleAnalyticsParameters.AMPERSAND);
- }
- }
-
- // private String getIpAddress() throws SocketException {
- // Enumeration<NetworkInterface> e1 =
- // (Enumeration<NetworkInterface>)NetworkInterface.getNetworkInterfaces();
- // while(e1.hasMoreElements()) {
- // NetworkInterface ni = e1.nextElement();
- //
- // System.out.print(ni.getName());
- // System.out.print(" : [");
- // Enumeration<InetAddress> e2 = ni.getInetAddresses();
- // while(e2.hasMoreElements()) {
- // InetAddress ia = e2.nextElement();
- // System.out.print(ia);
- // if( e2.hasMoreElements()) {
- // System.out.print(",");
- // }
- // }
- // System.out.println("]");
- // }
- // }
-}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/HttpGetMethod.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/HttpGetMethod.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/HttpGetMethod.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -1,98 +0,0 @@
-package org.jboss.tools.usage.jgoogleanalytics;
-
-import java.io.IOException;
-import java.net.CookieHandler;
-import java.net.CookieManager;
-import java.net.CookiePolicy;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.text.MessageFormat;
-
-/**
- * Simple class peforming HTTP Get method on the requested url
- *
- * @author Siddique Hameed
- * @author Andre Dietisheim
- * @version 0.2
- */
-
-public class HttpGetMethod {
- private static final String USER_AGENT = "User-Agent";
- private static final String GET_METHOD_NAME = "GET";
- private static final String SUCCESS_MESSAGE = "Http Get to url {0} successfull!";
- private static final String ERROR_MESSAGE = "Http Get to {0} failed, response code was {1}";
-
- private ILoggingAdapter loggingAdapter = null;
-
- private CookieManager cookieHandler;
- private String userAgent;
-
- public HttpGetMethod(String userAgent) {
- this.userAgent = userAgent;
- this.cookieHandler = new CookieManager();
- cookieHandler.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
- }
-
- public void setLoggingAdapter(ILoggingAdapter loggingAdapter) {
- this.loggingAdapter = loggingAdapter;
- }
-
- public void request(String urlString) {
-
- CookieHandler currentCookieHandler = setCookieHandler(cookieHandler);
- try {
- HttpURLConnection urlConnection = createURLConnection(urlString, userAgent);
- urlConnection.connect();
- int responseCode = getResponseCode(urlConnection);
- if (responseCode != HttpURLConnection.HTTP_OK) {
- logError(ERROR_MESSAGE, urlString, responseCode);
- } else {
- logMessage(SUCCESS_MESSAGE, urlString);
- }
- } catch (Exception e) {
- logError(e.getMessage());
- } finally {
- setCookieHandler(currentCookieHandler);
- }
- }
-
- /**
- * Returns the return code from the given {@link HttpURLConnection}.
- * Provided to be called by test cases so that they can retrieve the return code.
- *
- * @param urlConnection
- * to get the response code from
- * @return the return code the HttpUrlConnection received
- * @throws IOException
- */
- protected int getResponseCode(HttpURLConnection urlConnection) throws IOException {
- return urlConnection.getResponseCode();
- }
-
- private CookieHandler setCookieHandler(CookieHandler cookieHandler) {
- CookieHandler currentCookieHandler = CookieHandler.getDefault();
- CookieHandler.setDefault(cookieHandler);
- return currentCookieHandler;
- }
-
- protected HttpURLConnection createURLConnection(String urlString, String userAgent) throws IOException {
- URL url = new URL(urlString);
- HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
- urlConnection.setInstanceFollowRedirects(true);
- urlConnection.setRequestMethod(GET_METHOD_NAME);
- urlConnection.setRequestProperty(USER_AGENT, userAgent);
- return urlConnection;
- }
-
- private void logMessage(String message, Object... parameters) {
- if (loggingAdapter != null) {
- loggingAdapter.logMessage(MessageFormat.format(message, parameters));
- }
- }
-
- private void logError(String errorMesssage, Object... parameters) {
- if (loggingAdapter != null) {
- loggingAdapter.logError(MessageFormat.format(errorMesssage, parameters));
- }
- }
-}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/IGoogleAnalyticsParameters.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/IGoogleAnalyticsParameters.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/IGoogleAnalyticsParameters.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.usage.jgoogleanalytics;
+package org.jboss.tools.usage.googleanalytics;
/**
* An interface that provides methods for all parameters that google analytics
@@ -22,6 +22,13 @@
public static final char AMPERSAND = '&';
public static final char EQUALS_SIGN = '=';
public static final char URL_PARAM_DELIMITER = '?';
+ public static final char PLUS_SIGN = '+';
+ public static final char DOT = '.';
+ public static final char SEMICOLON = ';';
+ public static final char JAVA_LOCALE_DELIMITER = '_';
+ public static final char BROWSER_LOCALE_DELIMITER = '-';
+ public static final char PIPE = '|';
+ public static final char VERSION_DELIMITER = '.';
public static final String PARAM_HID = "utmhid";
public static final String PARAM_PAGE_REQUEST = "utmp";
@@ -42,13 +49,18 @@
public static final String PARAM_REPEAT_CAMPAIGN_VISIT = "utmcr";
public static final String PARAM_PAGE_TITLE = "utmdt";
public static final String PARAM_GAQ = "gaq";
+ public static final String PARAM_COOKIES_REFERRAL_TYPE = "__utmz";
+ public static final String PARAM_COOKIES_UTMCSR = "utmcsr";
+ public static final String PARAM_COOKIES_UTMCCN = "utmccn";
+ public static final String PARAM_COOKIES_UTMCMD = "utmcmd";
public static final String VALUE_TRACKING_CODE_VERSION = "4.7.2";
public static final String VALUE_NO_REFERRAL = "-";
- public static final char PLUS_SIGN = '+';
- public static final String PARAM_COOKIES_REFERRAL_TYPE = "__utmz";
- public static final char DOT = '.';
+ public static final String VALUE_ENCODING_UTF8 = "UTF-8";
+
+ public static final String SCREERESOLUTION_DELIMITER = "x";
+ public static final String SCREENCOLORDEPTH_POSTFIX = "-bit";
public String getAccountName();
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/ILoggingAdapter.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/ILoggingAdapter.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/ILoggingAdapter.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -8,15 +8,8 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.usage.jgoogleanalytics;
+package org.jboss.tools.usage.googleanalytics;
-/**
- * Interface for logging adapter. You can hook up log4j, System.out or any other loggers you want.
- *
- * @author : Siddique Hameed
- * @version : 0.1
- */
-
public interface ILoggingAdapter {
public void logError(String errorMessage);
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/IURLBuildingStrategy.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/IURLBuildingStrategy.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/IURLBuildingStrategy.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.usage.jgoogleanalytics;
+package org.jboss.tools.usage.googleanalytics;
import java.io.UnsupportedEncodingException;
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/JGoogleAnalyticsTracker.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/JGoogleAnalyticsTracker.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/JGoogleAnalyticsTracker.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.jgoogleanalytics;
-
-import java.io.UnsupportedEncodingException;
-import java.text.MessageFormat;
-
-import org.jboss.tools.usage.IUsageTracker;
-
-/**
- * Main class for tracking google analytics data.
- *
- * @author Siddique Hameed
- * @author Andre Dietisheim
- * @version 0.2
- * @see : <a
- * href="http://JGoogleAnalytics.googlecode.com">http://JGoogleAnalytics
- * .googlecode.com</a>
- */
-
-public class JGoogleAnalyticsTracker implements IUsageTracker {
-
- private IURLBuildingStrategy urlBuildingStrategy = null;
- private HttpGetMethod httpRequest;
- private ILoggingAdapter loggingAdapter;
-
- /**
- * Simple constructor passing the application name & google analytics
- * tracking code.
- *
- * @param appName
- * Application name (For ex: "LibraryFinder")
- */
- public JGoogleAnalyticsTracker(IGoogleAnalyticsParameters googleParameters) {
- this.httpRequest = new HttpGetMethod(googleParameters.getUserAgent());
- this.urlBuildingStrategy = new GoogleAnalyticsUrlStrategy(googleParameters);
- }
-
- /**
- * Setter injection for LoggingAdpater. You can hook up log4j, System.out or
- * any other loggers you want.
- *
- * @param loggingAdapter
- * implemented instance of LoggingAdapter
- */
-
- public void setLoggingAdapter(ILoggingAdapter loggingAdapter) {
- this.loggingAdapter = loggingAdapter;
- httpRequest.setLoggingAdapter(loggingAdapter);
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.usage.analytics.jgoogleanalytics.UsageAnalyticsTracker#trackSynchronously(org.jboss.tools.usage.analytics.jgoogleanalytics.FocusPoint)
- */
-
- public void trackSynchronously(FocusPoint focusPoint) throws UnsupportedEncodingException {
- logMessage("Tracking synchronously focusPoint=" + focusPoint.getContentTitle());
- httpRequest.request(urlBuildingStrategy.build(focusPoint));
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.usage.analytics.jgoogleanalytics.UsageAnalyticsTracker#trackAsynchronously(org.jboss.tools.usage.analytics.jgoogleanalytics.FocusPoint)
- */
-
- public void trackAsynchronously(FocusPoint focusPoint) {
- logMessage("Tracking Asynchronously focusPoint=" + focusPoint.getContentTitle());
- new TrackingThread(focusPoint).start();
- }
-
- private void logMessage(String message) {
- if (loggingAdapter != null) {
- loggingAdapter.logMessage(message);
- }
- }
-
- private class TrackingThread extends Thread {
- private FocusPoint focusPoint;
-
- public TrackingThread(FocusPoint focusPoint) {
- this.focusPoint = focusPoint;
- this.setPriority(Thread.MIN_PRIORITY);
- }
-
- public void run() {
- try {
- httpRequest.request(urlBuildingStrategy.build(focusPoint));
- } catch (UnsupportedEncodingException e) {
- logMessage(MessageFormat.format("Tracking failed: {0}", e.getMessage()));
- }
- }
- }
-}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/PluginLogger.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/PluginLogger.java 2010-08-12 11:42:42 UTC (rev 24090)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/PluginLogger.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.jgoogleanalytics;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-
-public class PluginLogger implements ILoggingAdapter {
-
- private Plugin plugin;
-
- public PluginLogger(Plugin plugin) {
- this.plugin = plugin;
- }
-
- public void logError(String message) {
- log(IStatus.ERROR, message);
- }
-
- public void logMessage(String message) {
- log(IStatus.INFO, message);
- }
-
- private void log(int severity, String message) {
- if (plugin != null) {
- IStatus status = new Status(severity, plugin.getBundle().getSymbolicName(), message);
- plugin.getLog().log(status);
- }
- }
-}
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/Tracker.java (from rev 24090, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/JGoogleAnalyticsTracker.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/Tracker.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/Tracker.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.googleanalytics;
+
+import java.io.UnsupportedEncodingException;
+import java.text.MessageFormat;
+
+import org.jboss.tools.usage.ITracker;
+import org.jboss.tools.usage.internal.GoogleAnalyticsUrlStrategy;
+import org.jboss.tools.usage.internal.HttpGetMethod;
+
+/**
+ * Reports (tracks) data to google analytics
+ *
+ * @author Andre Dietisheim
+ * @see <a
+ * href="http://jgoogleAnalytics.googlecode.com">http://jgoogleAnalytics.googlecode.com</a>
+ */
+public class Tracker implements ITracker {
+
+ private IURLBuildingStrategy urlBuildingStrategy = null;
+ private HttpGetMethod httpRequest;
+ private ILoggingAdapter loggingAdapter;
+
+ public Tracker(IGoogleAnalyticsParameters googleParameters, ILoggingAdapter loggingAdapter) {
+ this.httpRequest = new HttpGetMethod(googleParameters.getUserAgent(), loggingAdapter);
+ this.loggingAdapter = loggingAdapter;
+ this.urlBuildingStrategy = new GoogleAnalyticsUrlStrategy(googleParameters);
+ }
+
+ public void trackSynchronously(FocusPoint focusPoint) throws UnsupportedEncodingException {
+ loggingAdapter.logMessage("Tracking synchronously focusPoint=" + focusPoint.getContentTitle());
+ httpRequest.request(urlBuildingStrategy.build(focusPoint));
+ }
+
+ public void trackAsynchronously(FocusPoint focusPoint) {
+ loggingAdapter.logMessage("Tracking Asynchronously focusPoint=" + focusPoint.getContentTitle());
+ new TrackingThread(focusPoint).start();
+ }
+
+ private class TrackingThread extends Thread {
+ private FocusPoint focusPoint;
+
+ public TrackingThread(FocusPoint focusPoint) {
+ this.focusPoint = focusPoint;
+ this.setPriority(Thread.MIN_PRIORITY);
+ }
+
+ public void run() {
+ try {
+ httpRequest.request(urlBuildingStrategy.build(focusPoint));
+ } catch (UnsupportedEncodingException e) {
+ loggingAdapter.logMessage(MessageFormat.format("Tracking failed: {0}", e.getMessage()));
+ }
+ }
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/Tracker.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/AbstractGoogleAnalyticsParameters.java (from rev 24090, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/AbstractGoogleAnalyticsParameters.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/AbstractGoogleAnalyticsParameters.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/AbstractGoogleAnalyticsParameters.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.internal;
+
+import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
+
+
+public abstract class AbstractGoogleAnalyticsParameters implements IGoogleAnalyticsParameters {
+
+ private String accountName;
+ private String referral;
+ private String hostName;
+
+ public AbstractGoogleAnalyticsParameters(String accountName, String hostName, String referral) {
+ this.accountName = accountName;
+ this.hostName = hostName;
+ this.referral = referral;
+ }
+
+ @Override
+ public String getAccountName() {
+ return accountName;
+ }
+
+ @Override
+ public String getHostname() {
+ return hostName;
+ }
+
+ @Override
+ public String getReferral() {
+ return referral;
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/AbstractGoogleAnalyticsParameters.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/EclipseEnvironment.java (from rev 24090, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/EclipseEnvironment.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/EclipseEnvironment.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/EclipseEnvironment.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.internal;
+
+import java.text.MessageFormat;
+import java.util.Random;
+
+import org.eclipse.core.runtime.IProduct;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
+import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
+import org.jboss.tools.usage.util.PreferencesUtil;
+import org.jboss.tools.usage.util.StatusUtils;
+import org.osgi.framework.Bundle;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+public class EclipseEnvironment extends AbstractGoogleAnalyticsParameters implements IGoogleAnalyticsParameters {
+
+ private static final String ECLIPSE_RUNTIME_BULDEID = "org.eclipse.core.runtime";
+
+ private String screenResolution;
+
+ private String screenColorDepth;
+
+ private Random random;
+
+ public EclipseEnvironment(String accountName, String hostName, String referral) {
+ super(accountName, hostName, referral);
+ this.random = new Random();
+ initScreenSettings();
+ }
+
+ @Override
+ public String getBrowserLanguage() {
+ String nl = getNL();
+ if (nl == null) {
+ return "";
+ }
+
+ int indexOf = nl.indexOf(JAVA_LOCALE_DELIMITER); //$NON-NLS-1$
+ if (indexOf <= 0) {
+ return nl;
+ }
+
+ StringBuilder builder = new StringBuilder();
+ builder.append(nl.substring(0, indexOf));
+ builder.append(BROWSER_LOCALE_DELIMITER);
+ builder.append(nl.substring(indexOf + 1));
+ return builder.toString();
+ }
+
+ protected String getNL() {
+ return Platform.getNL(); //$NON-NLS-1$
+ }
+
+ protected void initScreenSettings() {
+ final Display display = getDisplay();
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ screenColorDepth = display.getDepth() + SCREENCOLORDEPTH_POSTFIX;
+
+ Rectangle bounds = display.getBounds();
+ screenResolution = bounds.width + SCREERESOLUTION_DELIMITER + bounds.height;
+ }
+ });
+ }
+
+ @Override
+ public String getScreenResolution() {
+ return screenResolution;
+ }
+
+ @Override
+ public String getScreenColorDepth() {
+ return screenColorDepth;
+ }
+
+ protected Display getDisplay() {
+ if (PlatformUI.isWorkbenchRunning()) {
+ return PlatformUI.getWorkbench().getDisplay();
+ }
+
+ Display display = Display.getCurrent();
+ if (display == null) {
+ display = Display.getDefault();
+ }
+ return display;
+ }
+
+ @Override
+ public String getUserAgent() {
+
+ String productId = getApplicationName();
+ String productVersion = getApplicationVersion();
+ String browserLanguage = getBrowserLanguage();
+
+ /**
+ * Google API for android: this.userAgent = String.format(
+ * "GoogleAnalytics/%s (Linux; U; Android %s; %s-%s; %s; Build/%s)" ,
+ * new Object[] { "1.0" , Build.VERSION.RELEASE ,
+ * (localLocale.getLanguage() != null) ?
+ * localLocale.getLanguage().toLowerCase() : "en" ,
+ * (localLocale.getCountry() != null) ?
+ * localLocale.getCountry().toLowerCase() : "" , Build.MODEL, Build.ID
+ * });
+ */
+
+ return MessageFormat.format(
+ getUserAgentPattern(getOS())
+ , productId
+ , productVersion
+ , browserLanguage
+ );
+ }
+
+ private String getUserAgentPattern(String os) {
+ String userAgentPattern = "";
+ /*
+ * TODO: implement architecture (i686, x86_64 etc.), Windows version, MacOS version etc.
+ */
+ if (Platform.OS_LINUX.equals(os)) {
+ return "{0}/{1} (X11; U; Linux i686; {2})";
+ } else if (Platform.OS_MACOSX.equals(os)) {
+ return "{0}/{1} (Macintosh; U; Intel Mac OS X 10.5; {2})";
+ } else if (Platform.OS_WIN32.equals(os)) {
+ return "{0}/{1} (Windows; U; Windows NT 6.1; {2})";
+ }
+ return userAgentPattern;
+ }
+
+ protected String getOS() {
+ return Platform.getOS();
+ }
+
+ protected String getApplicationName() {
+ return getApplicationBundle().getSymbolicName();
+ }
+
+ protected String getApplicationVersion() {
+ String fullVersion = getApplicationBundle().getVersion().toString();
+ int productVersionStart = fullVersion.lastIndexOf(VERSION_DELIMITER);
+ if (productVersionStart > 0) {
+ return fullVersion.substring(0, productVersionStart);
+ } else {
+ return fullVersion;
+ }
+ }
+
+ /**
+ * Returns the bundle that launched the application that this class runs in.
+ *
+ * @return the defining bundle
+ */
+ private Bundle getApplicationBundle() {
+ IProduct product = Platform.getProduct();
+ if (product != null) {
+ return product.getDefiningBundle();
+ } else {
+ return Platform.getBundle(ECLIPSE_RUNTIME_BULDEID);
+ }
+ }
+
+ @Override
+ public String getUserId() {
+ Preferences preferences = PreferencesUtil.getConfigurationPreferences();
+ String userId = createIdentifier();
+ try {
+ if (!preferences.nodeExists(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID)) {
+ preferences.put(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID, userId);
+ preferences.flush();
+ } else {
+ userId = preferences.get(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID, userId);
+ }
+ } catch (BackingStoreException e) {
+ StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID, "Could not retrieve {0} from preferences.",
+ e, IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID);
+ }
+ return userId;
+ }
+
+ /**
+ * Creates an unique identifier.
+ *
+ * @return the identifier
+ */
+ private String createIdentifier() {
+ StringBuilder builder = new StringBuilder();
+ builder.append(Math.abs(random.nextLong()));
+ builder.append(System.currentTimeMillis());
+ return builder.toString();
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/EclipseEnvironment.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/GoogleAnalyticsUrlStrategy.java (from rev 24090, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/GoogleAnalyticsUrlStrategy.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/GoogleAnalyticsUrlStrategy.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/GoogleAnalyticsUrlStrategy.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.internal;
+
+import java.io.UnsupportedEncodingException;
+
+import org.jboss.tools.usage.googleanalytics.FocusPoint;
+import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
+import org.jboss.tools.usage.googleanalytics.IURLBuildingStrategy;
+import org.jboss.tools.usage.util.EncodingUtils;
+
+/**
+ * Class that builds an URL that passes given parameters to google analytics
+ *
+ * @author Andre Dietisheim
+ */
+public class GoogleAnalyticsUrlStrategy implements IURLBuildingStrategy {
+
+ private static final String TRACKING_URL = "http://www.google-analytics.com/__utm.gif";
+
+ private static final int VISITS = -1;
+
+ private IGoogleAnalyticsParameters googleParameters;
+
+ public GoogleAnalyticsUrlStrategy(IGoogleAnalyticsParameters googleAnalyticsParameters) {
+ this.googleParameters = googleAnalyticsParameters;
+ }
+
+ public String build(FocusPoint focusPoint) throws UnsupportedEncodingException {
+ /*
+ * Google Analytics for Android:
+ *
+ String str = "";
+ if (paramEvent.action != null)
+ str = paramEvent.action;
+ if (!(str.startsWith("/")))
+ str = "/" + str;
+ str = encode(str);
+ Locale localLocale = Locale.getDefault();
+ StringBuilder localStringBuilder = new StringBuilder();
+ localStringBuilder.append("/__utm.gif");
+ localStringBuilder.append("?utmwv=4.3");
+ localStringBuilder.append("&utmn=").append(paramEvent.randomVal);
+ localStringBuilder.append("&utmcs=UTF-8");
+ localStringBuilder.append(String.format("&utmsr=%dx%d", new Object[] {
+ Integer.valueOf(paramEvent.screenWidth)
+ , Integer.valueOf(paramEvent.screenHeight) }));
+ localStringBuilder.append(String.format("&utmul=%s-%s", new Object[] {
+ localLocale.getLanguage()
+ , localLocale.getCountry() }));
+ localStringBuilder.append("&utmp=").append(str);
+ localStringBuilder.append("&utmac=").append(paramEvent.accountId);
+ localStringBuilder.append("&utmcc=").append(
+ getEscapedCookieString(paramEvent, paramString));
+ return localStringBuilder.toString();
+
+ *
+ * getEscapedCookieString:
+ *
+ StringBuilder localStringBuilder = new StringBuilder();
+ localStringBuilder.append("__utma=");
+ localStringBuilder.append("999").append(".");
+ localStringBuilder.append(paramEvent.userId).append(".");
+ localStringBuilder.append(paramEvent.timestampFirst).append(".");
+ localStringBuilder.append(paramEvent.timestampPrevious).append(".");
+ localStringBuilder.append(paramEvent.timestampCurrent).append(".");
+ localStringBuilder.append(paramEvent.visits);
+ if (paramString != null)
+ {
+ localStringBuilder.append("+__utmz=");
+ localStringBuilder.append("999").append(".");
+ localStringBuilder.append(paramEvent.timestampFirst).append(".");
+ localStringBuilder.append("1.1.");
+ localStringBuilder.append(paramString);
+ }
+ return encode(localStringBuilder.toString());
+
+ */
+
+ /*
+ * our working tracking code
+ *
+ http://www.google-analytics.com/__utm.gif?utmwv=4.7.2
+ &utmn=338321265
+ &utmhn=jboss.org
+ &utmcs=UTF-8
+ &utmsr=1920x1080
+ &utmsc=24-bit
+ &utmul=en-us
+ &utmje=1
+ &utmfl=10.1%20r53
+ &utmdt=-%20JBoss%20Community
+ &utmhid=1087431432
+ &utmr=0
+ &utmp=%2Ftools%2Fusage.html
+ &utmac=UA-17645367-1
+ &utmcc=__utma%3D156030500.1285760711.1281430767.1281430767.1281430767.1%3B%2B__utmz%3D156030500.1281430767.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B
+ &gaq=1
+ *
+ */
+
+ StringBuilder builder = new StringBuilder(TRACKING_URL)
+ .append(IGoogleAnalyticsParameters.URL_PARAM_DELIMITER);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_TRACKING_CODE_VERSION,
+ IGoogleAnalyticsParameters.VALUE_TRACKING_CODE_VERSION, builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_UNIQUE_TRACKING_NUMBER, getRandomNumber(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_HOST_NAME, googleParameters.getHostname(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_LANGUAGE_ENCODING,
+ IGoogleAnalyticsParameters.VALUE_ENCODING_UTF8, builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_SCREEN_RESOLUTION, googleParameters.getScreenResolution(),
+ builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_SCREEN_COLOR_DEPTH, googleParameters.getScreenColorDepth(),
+ builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_BROWSER_LANGUAGE, googleParameters.getBrowserLanguage(),
+ builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_PAGE_TITLE, focusPoint.getContentTitle(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_HID, getRandomNumber(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_REFERRAL, googleParameters.getReferral(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_PAGE_REQUEST, focusPoint.getContentURI(), builder);
+
+ appendParameter(IGoogleAnalyticsParameters.PARAM_ACCOUNT_NAME, googleParameters.getAccountName(), builder);
+ appendCookies(focusPoint, builder);
+ builder.append(IGoogleAnalyticsParameters.AMPERSAND);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_GAQ, "1", false, builder);
+
+ return builder.toString();
+ }
+
+ private void appendCookies(FocusPoint focusPoint, StringBuilder builder) {
+
+ long timeStamp = System.currentTimeMillis();
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.append(IGoogleAnalyticsParameters.PARAM_COOKIES_FIRST_VISIT)
+ .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ .append("999.")
+ .append(googleParameters.getUserId()).append(IGoogleAnalyticsParameters.DOT)
+ .append(timeStamp).append(IGoogleAnalyticsParameters.DOT)
+ .append(timeStamp).append(IGoogleAnalyticsParameters.DOT)
+ .append(timeStamp).append(IGoogleAnalyticsParameters.DOT)
+ .append(VISITS)
+ .append(IGoogleAnalyticsParameters.SEMICOLON)
+ .append(IGoogleAnalyticsParameters.PLUS_SIGN)
+ .append(IGoogleAnalyticsParameters.PARAM_COOKIES_REFERRAL_TYPE)
+ .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ .append("999.")
+ .append(timeStamp).append(IGoogleAnalyticsParameters.DOT)
+ .append("1.1.")
+ .append(IGoogleAnalyticsParameters.PARAM_COOKIES_UTMCSR).append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ .append("(direct)").append(IGoogleAnalyticsParameters.PIPE)
+ .append(IGoogleAnalyticsParameters.PARAM_COOKIES_UTMCCN).append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ .append("(direct)").append(IGoogleAnalyticsParameters.PIPE)
+ .append(IGoogleAnalyticsParameters.PARAM_COOKIES_UTMCMD).append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ .append("(none)")
+ .append(IGoogleAnalyticsParameters.SEMICOLON);
+
+ String encodedString = EncodingUtils.checkedEncodeUtf8(stringBuilder.toString());
+
+ builder.append(IGoogleAnalyticsParameters.PARAM_COOKIES).append(IGoogleAnalyticsParameters.EQUALS_SIGN).append(
+ encodedString);
+
+ // builder.append(IGoogleAnalyticsParameters.PARAM_COOKIE_VALUES)
+ // .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ // .append("__utma%3D")
+ // .append(getRandomNumber())
+ // .append(".")
+ // .append(getRandomNumber())
+ // .append(".")
+ // .append(now)
+ // .append(".")
+ // .append(now)
+ // .append(".")
+ // .append(now)
+ // .append(".2%3B%2B)")
+ //
+ // // .append("__utmb%3D")
+ // // .append(getRandomNumber())
+ // // .append("%3B%2B__utmc%3D")
+ // // .append(getRandomNumber())
+ // // .append("%3B%2B")
+ //
+ // .append("__utmz%3D")
+ // .append(getRandomNumber())
+ // .append(".")
+ // .append(now)
+ // .append(IGoogleAnalyticsParameters.AMPERSAND);
+
+ // .append("utmcsr%3D(direct)%7C")
+ // .append("utmccn%3D(direct)%7C")
+ // .append("utmcmd%3D(none)%3B");
+
+ }
+
+ private String getRandomNumber() {
+ return Integer.toString((int) (Math.random() * 0x7fffffff));
+ }
+
+ private void appendParameter(String name, String value, StringBuilder builder) {
+ appendParameter(name, value, true, builder);
+ }
+
+ private void appendParameter(String name, String value, boolean appendAmpersand, StringBuilder builder) {
+ builder.append(name)
+ .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ .append(value);
+ if (appendAmpersand) {
+ builder.append(IGoogleAnalyticsParameters.AMPERSAND);
+ }
+ }
+
+ // private String getIpAddress() throws SocketException {
+ // Enumeration<NetworkInterface> e1 =
+ // (Enumeration<NetworkInterface>)NetworkInterface.getNetworkInterfaces();
+ // while(e1.hasMoreElements()) {
+ // NetworkInterface ni = e1.nextElement();
+ //
+ // System.out.print(ni.getName());
+ // System.out.print(" : [");
+ // Enumeration<InetAddress> e2 = ni.getInetAddresses();
+ // while(e2.hasMoreElements()) {
+ // InetAddress ia = e2.nextElement();
+ // System.out.print(ia);
+ // if( e2.hasMoreElements()) {
+ // System.out.print(",");
+ // }
+ // }
+ // System.out.println("]");
+ // }
+ // }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/GoogleAnalyticsUrlStrategy.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/HttpGetMethod.java (from rev 24090, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/HttpGetMethod.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/HttpGetMethod.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/HttpGetMethod.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.internal;
+
+import java.io.IOException;
+import java.net.CookieHandler;
+import java.net.CookieManager;
+import java.net.CookiePolicy;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.text.MessageFormat;
+
+import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
+
+/**
+ * Class that executes a HTTP Get request to the given url.
+ *
+ * @author Andre Dietisheim
+ */
+public class HttpGetMethod {
+
+ private static final String USER_AGENT = "User-Agent";
+
+ private static final String GET_METHOD_NAME = "GET";
+
+ private static final String SUCCESS_MESSAGE = "Http Get to url {0} successfull!";
+
+ private static final String ERROR_MESSAGE = "Http Get to {0} failed, response code was {1}";
+
+ private ILoggingAdapter loggingAdapter = null;
+
+ private CookieManager cookieHandler;
+
+ private String userAgent;
+
+ public HttpGetMethod(String userAgent, ILoggingAdapter loggingAdapter) {
+ this.userAgent = userAgent;
+ this.loggingAdapter = loggingAdapter;
+ this.cookieHandler = new CookieManager();
+ cookieHandler.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
+ }
+
+ public void request(String urlString) {
+
+ CookieHandler currentCookieHandler = setCookieHandler(cookieHandler);
+ try {
+ HttpURLConnection urlConnection = createURLConnection(urlString, userAgent);
+ urlConnection.connect();
+ int responseCode = getResponseCode(urlConnection);
+ if (responseCode != HttpURLConnection.HTTP_OK) {
+ loggingAdapter.logMessage(MessageFormat.format(ERROR_MESSAGE, urlString, responseCode));
+ } else {
+ loggingAdapter.logError(MessageFormat.format(SUCCESS_MESSAGE, urlString));
+ }
+ } catch (Exception e) {
+ loggingAdapter.logError(e.getMessage());
+ } finally {
+ setCookieHandler(currentCookieHandler);
+ }
+ }
+
+ /**
+ * Returns the return code from the given {@link HttpURLConnection}.
+ * Provided to be called by test cases so that they can retrieve the return code.
+ *
+ * @param urlConnection to get the response code from
+ * @return the return code the HttpUrlConnection received
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ protected int getResponseCode(HttpURLConnection urlConnection) throws IOException {
+ return urlConnection.getResponseCode();
+ }
+
+ private CookieHandler setCookieHandler(CookieHandler cookieHandler) {
+ CookieHandler currentCookieHandler = CookieHandler.getDefault();
+ CookieHandler.setDefault(cookieHandler);
+ return currentCookieHandler;
+ }
+
+ /**
+ * Creates a new url connection.
+ *
+ * @param urlString the url string
+ * @param userAgent the user agent
+ * @return the http url connection
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ protected HttpURLConnection createURLConnection(String urlString, String userAgent) throws IOException {
+ URL url = new URL(urlString);
+ HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
+ urlConnection.setInstanceFollowRedirects(true);
+ urlConnection.setRequestMethod(GET_METHOD_NAME);
+ urlConnection.setRequestProperty(USER_AGENT, userAgent);
+ return urlConnection;
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/HttpGetMethod.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/PluginLogger.java (from rev 24090, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/jgoogleanalytics/PluginLogger.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/PluginLogger.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/PluginLogger.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.internal;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
+
+public class PluginLogger implements ILoggingAdapter {
+
+ private Plugin plugin;
+
+ public PluginLogger(Plugin plugin) {
+ this.plugin = plugin;
+ }
+
+ public void logError(String message) {
+ log(IStatus.ERROR, message);
+ }
+
+ public void logMessage(String message) {
+ log(IStatus.INFO, message);
+ }
+
+ private void log(int severity, String message) {
+ if (plugin != null) {
+ IStatus status = new Status(severity, plugin.getBundle().getSymbolicName(), message);
+ plugin.getLog().log(status);
+ }
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/PluginLogger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/UsageReport.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/UsageReport.java 2010-08-16 10:55:59 UTC (rev 24175)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/UsageReport.java 2010-08-16 10:57:43 UTC (rev 24176)
@@ -15,12 +15,11 @@
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.usage.IUsageTracker;
-import org.jboss.tools.usage.jgoogleanalytics.EclipseEnvironment;
-import org.jboss.tools.usage.jgoogleanalytics.FocusPoint;
-import org.jboss.tools.usage.jgoogleanalytics.IGoogleAnalyticsParameters;
-import org.jboss.tools.usage.jgoogleanalytics.JGoogleAnalyticsTracker;
-import org.jboss.tools.usage.jgoogleanalytics.PluginLogger;
+import org.jboss.tools.usage.ITracker;
+import org.jboss.tools.usage.googleanalytics.FocusPoint;
+import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
+import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
+import org.jboss.tools.usage.googleanalytics.Tracker;
import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.service.prefs.BackingStoreException;
@@ -29,6 +28,8 @@
private static final String GANALYTICS_TRACKINGCODE = "UA-17645367-1";
+ private static final String HOST_NAME = "jboss.org";
+
private FocusPoint focusPoint = new FocusPoint("jboss.org")
.setChild(new FocusPoint("tools").setChild(new FocusPoint("usage").setChild(new FocusPoint("action")
.setChild(new FocusPoint("wsstartup")))));
@@ -61,16 +62,17 @@
preferences.putBoolean(IUsageReportPreferenceConstants.USAGEREPORT_ENABLED, enabled);
}
- private void report(IUsageTracker tracker) {
+ private void report(ITracker tracker) {
tracker.trackAsynchronously(focusPoint);
}
- private IUsageTracker getAnalyticsTracker() {
+ private ITracker getAnalyticsTracker() {
IGoogleAnalyticsParameters eclipseSettings = new EclipseEnvironment(
GANALYTICS_TRACKINGCODE
+ , HOST_NAME
, IGoogleAnalyticsParameters.VALUE_NO_REFERRAL);
- JGoogleAnalyticsTracker tracker = new JGoogleAnalyticsTracker(eclipseSettings);
- tracker.setLoggingAdapter(new PluginLogger(JBossToolsUsageActivator.getDefault()));
+ ILoggingAdapter loggingAdapter = new PluginLogger(JBossToolsUsageActivator.getDefault());
+ Tracker tracker = new Tracker(eclipseSettings, loggingAdapter);
return tracker;
}
15 years, 8 months
JBoss Tools SVN: r24174 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/jpa2.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-08-16 04:28:40 -0400 (Mon, 16 Aug 2010)
New Revision: 24174
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/jpa2/HibernateOrmXml2_0Definition.java
Log:
https://jira.jboss.org/browse/JBIDE-6842
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/jpa2/HibernateOrmXml2_0Definition.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/jpa2/HibernateOrmXml2_0Definition.java 2010-08-16 06:26:54 UTC (rev 24173)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/jpa2/HibernateOrmXml2_0Definition.java 2010-08-16 08:28:40 UTC (rev 24174)
@@ -32,6 +32,7 @@
import org.eclipse.jpt.core.internal.context.orm.OrmOneToOneMappingDefinition;
import org.eclipse.jpt.core.internal.context.orm.OrmTransientMappingDefinition;
import org.eclipse.jpt.core.internal.context.orm.OrmVersionMappingDefinition;
+import org.eclipse.jpt.core.internal.jpa2.context.orm.OrmElementCollectionMapping2_0Definition;
import org.eclipse.jpt.core.resource.orm.OrmFactory;
/**
@@ -72,7 +73,7 @@
}
public JpaResourceType getResourceType() {
- return JptCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
+ return JptCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
}
@@ -81,7 +82,7 @@
@Override
protected OrmTypeMappingDefinition[] buildOrmTypeMappingDefinitions() {
// order should not matter here, but we'll use the same order as for java
- // (@see {@link GenericJpaPlatformProvider})
+ // (@see {@link Generic2_0JpaPlatformProvider})
return new OrmTypeMappingDefinition[] {
OrmEntityDefinition.instance(),
OrmEmbeddableDefinition.instance(),
@@ -94,9 +95,10 @@
@Override
protected OrmAttributeMappingDefinition[] buildOrmAttributeMappingDefinitions() {
// order should not matter here, but we'll use the same order as for java
- // (@see {@link GenericJpaPlatformProvider})
+ // (@see {@link Generic2_0JpaPlatformProvider})
return new OrmAttributeMappingDefinition[] {
OrmTransientMappingDefinition.instance(),
+ OrmElementCollectionMapping2_0Definition.instance(),
OrmIdMappingDefinition.instance(),
OrmVersionMappingDefinition.instance(),
OrmBasicMappingDefinition.instance(),
15 years, 8 months
JBoss Tools SVN: r24173 - in trunk: jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-08-16 02:26:54 -0400 (Mon, 16 Aug 2010)
New Revision: 24173
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
Removed:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectProbertyValidatorWrapper.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamProjectPropertyValidatorTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ValidatorSupport.java
Log:
https://jira.jboss.org/browse/JBDS-1130 Updated SeamProjectPropertyValidatorTest
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2010-08-14 04:42:33 UTC (rev 24172)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2010-08-16 06:26:54 UTC (rev 24173)
@@ -216,8 +216,11 @@
try {
if (documentProvider != null) {
documentProvider.connect(target);
- problemMessage.setLineNo(documentProvider.getDocument(
- target).getLineOfOffset(offset) + 1);
+ IDocument doc = documentProvider.getDocument(target);
+ if(doc != null)
+ problemMessage.setLineNo(doc.getLineOfOffset(offset) + 1);
+ else
+ problemMessage.setLineNo(1);
}
marker = TaskListUtility.addTask(markerOwner.getName().intern(), target, "" + problemMessage.getLineNumber(), problemMessage.getText(),
problemMessage.getText(), severity, null, problemMessage.getGroupName(), problemMessage.getOffset(), problemMessage.getLength());
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java 2010-08-14 04:42:33 UTC (rev 24172)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java 2010-08-16 06:26:54 UTC (rev 24173)
@@ -13,13 +13,26 @@
import java.util.Set;
import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
import org.jboss.tools.common.text.ITextSourceReference;
+import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
/**
* @author Alexey Kazakov
*/
public interface IValidationErrorManager {
+
+ /**
+ * inits validator error manager
+ * @param project
+ * @param validationHelper
+ * @param manager
+ * @param reporter
+ */
+ void init(IProject project, ContextValidationHelper validationHelper, IValidator manager, IReporter reporter);
/**
* Adds a marker to the resource
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java 2010-08-14 04:42:33 UTC (rev 24172)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java 2010-08-16 06:26:54 UTC (rev 24173)
@@ -36,6 +36,7 @@
import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
import org.jboss.tools.jst.web.kb.internal.validation.ProblemMessage;
import org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager;
+import org.jboss.tools.jst.web.kb.validation.IValidationErrorManager;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
@@ -49,7 +50,7 @@
*/
public class SeamProjectPropertyValidator implements IValidatorJob {
- private ValidationErrorManager errorManager;
+ private IValidationErrorManager errorManager;
private Set<String> validatedProjects = new HashSet<String>();
private static Set<String> beingValidatedProjects = new HashSet<String>();
private IReporter reporter;
@@ -60,6 +61,10 @@
public ISchedulingRule getSchedulingRule(IValidationContext helper) {
return null;
}
+
+ protected IValidationErrorManager getTestValidationErrorManager(){
+ return null;
+ }
/* (non-Javadoc)
* @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#validateInJob(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
@@ -73,8 +78,11 @@
return OK_STATUS;
}
ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, false);
-
- errorManager = new SeamValidationErrorManager() {
+
+ errorManager = getTestValidationErrorManager();
+
+ if(errorManager == null)
+ errorManager = new SeamValidationErrorManager() {
/* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMarkerOwner()
*/
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamProjectPropertyValidatorTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamProjectPropertyValidatorTest.java 2010-08-14 04:42:33 UTC (rev 24172)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamProjectPropertyValidatorTest.java 2010-08-16 06:26:54 UTC (rev 24173)
@@ -10,12 +10,18 @@
******************************************************************************/
package org.jboss.tools.seam.core.test;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.wst.validation.internal.core.ValidationException;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.test.validation.IValidatorSupport;
+import org.jboss.tools.seam.core.test.validation.SeamProjectPropertyValidatorWrapper;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.validation.SeamValidationMessages;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
@@ -65,29 +71,36 @@
JobUtils.waitForIdle(2000);
}
}
+
+ protected void assertMarkerIsCreated(IProject project, String template, Object[] parameters) throws CoreException, ValidationException {
+ IValidatorSupport validator = new SeamProjectPropertyValidatorWrapper(project);
+ validator.validate();
+ assertTrue("Error marker not found", validator.isMessageCreated(template, parameters));
+ }
- public void testProjectNameValidation() throws CoreException {
- assertMarkerIsCreated(ejbProject, null, ".*invalidParentProjectName.*");
- assertMarkerIsCreated(testProject, null, ".*invalidParentProjectName.*");
- assertMarkerIsCreated(warProject, null, ".*invalidEjbProjectName.*");
- assertMarkerIsCreated(warProject, null, ".*invalidTestProjectName.*");
+
+ public void testProjectNameValidation() throws CoreException, ValidationException {
+ assertMarkerIsCreated(ejbProject, SeamValidationMessages.INVALID_PARENT_PROJECT, new Object[]{"invalidParentProjectName","RefactoringTestProject-ejb"});
+ //assertMarkerIsCreated(testProject, SeamValidationMessages.INVALID_TEST_PROJECT, new Object[]{"invalidTestProjectName", "RefactoringTestProject-test"});
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_EJB_PROJECT, new Object[]{"invalidEjbProjectName", "RefactoringTestProject-war"});
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_TEST_PROJECT, new Object[]{"invalidTestProjectName", "RefactoringTestProject-war"});
}
- public void testFolderNameValidation() throws CoreException {
- assertMarkerIsCreated(warProject, null, ".*invalidWebFolderPath.*");
- assertMarkerIsCreated(warProject, null, ".*invalidModelSrcFolderPath.*");
- assertMarkerIsCreated(warProject, null, ".*invalidSessionBeanSrcFolderPath.*");
- assertMarkerIsCreated(warProject, null, ".*invalidTestSrcFolderPath.*");
+ public void testFolderNameValidation() throws CoreException, ValidationException {
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_WEBFOLDER, new Object[]{"invalidWebFolderPath", "RefactoringTestProject-war"});
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_MODEL_SRC, new Object[]{"invalidModelSrcFolderPath", "RefactoringTestProject-war"});
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_ACTION_SRC, new Object[]{"invalidSessionBeanSrcFolderPath", "RefactoringTestProject-war"});
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_TEST_SRC, new Object[]{"invalidTestSrcFolderPath", "RefactoringTestProject-war"});
}
- public void testPackageNameValidation() throws CoreException {
- assertMarkerIsCreated(warProject, null, ".*invalid model package name.*");
- assertMarkerIsCreated(warProject, null, ".*invalid session bean package name.*");
- assertMarkerIsCreated(warProject, null, ".*invalid test package name.*");
+ public void testPackageNameValidation() throws CoreException, ValidationException {
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_MODEL_PACKAGE_NAME, new Object[]{"invalid model package name", "RefactoringTestProject-war"});
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_ACTION_PACKAGE_NAME, new Object[]{"invalid session bean package name", "RefactoringTestProject-war"});
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_TEST_PACKAGE_NAME, new Object[]{"invalid test package name", "RefactoringTestProject-war"});
}
- public void testRuntimeNameValidation() throws CoreException {
- assertMarkerIsCreated(warProject, null, ".*invalidRuntimeName.*");
+ public void testRuntimeNameValidation() throws CoreException, ValidationException {
+ assertMarkerIsCreated(warProject, SeamValidationMessages.INVALID_SEAM_RUNTIME, new Object[]{"invalidRuntimeName", "RefactoringTestProject-war"});
}
}
\ No newline at end of file
Deleted: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectProbertyValidatorWrapper.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectProbertyValidatorWrapper.java 2010-08-14 04:42:33 UTC (rev 24172)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectProbertyValidatorWrapper.java 2010-08-16 06:26:54 UTC (rev 24173)
@@ -1,55 +0,0 @@
-package org.jboss.tools.seam.core.test.validation;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-import org.jboss.tools.seam.internal.core.validation.SeamProjectPropertyValidator;
-
-public class SeamProjectProbertyValidatorWrapper extends SeamProjectPropertyValidator implements IValidatorSupport{
- ValidatorSupport support;
- private IProject project;
-
- public SeamProjectProbertyValidatorWrapper(IProject project) {
- this.project = project;
- }
-
- public void validate() throws ValidationException {
- support.validate();
- }
-
- public void add(IMarker marker) {
- support.add(marker);
- }
-
- public boolean isMessageCreated(String template, Object[] parameters) {
- return support.isMessageCreated(template, parameters);
- }
-
- public void addFile(IFile o) {
- support.addFile(o);
- }
-
- public List<IMarker> getMarkers() {
- return support.getMarkers();
- }
-
- public void addMessage(IValidator origin, IMessage message) {
- support.addMessage(origin, message);
- }
-
- public void validate(IFile file) throws ValidationException {
- support.validate(file);
- }
-
- public boolean isMessageCreatedOnLine(String markerTemplate,
- Object[] parameters, int lineNumber) throws CoreException {
- return support.isMessageCreatedOnLine(markerTemplate, parameters,
- lineNumber);
- }
-}
Copied: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java (from rev 24136, trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectProbertyValidatorWrapper.java)
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java 2010-08-16 06:26:54 UTC (rev 24173)
@@ -0,0 +1,204 @@
+package org.jboss.tools.seam.core.test.validation;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.jboss.tools.common.text.ITextSourceReference;
+import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.validation.IValidationErrorManager;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
+import org.jboss.tools.seam.internal.core.validation.SeamProjectPropertyValidator;
+import org.jboss.tools.seam.internal.core.validation.SeamValidationErrorManager;
+
+public class SeamProjectPropertyValidatorWrapper extends SeamProjectPropertyValidator implements IValidatorSupport, IValidator, IValidationErrorManager{
+ ValidatorSupport support;
+ private IProject project;
+ SeamValidationErrorManager errorManager;
+
+ public SeamProjectPropertyValidatorWrapper(IProject project) {
+ this.project = project;
+ this.support = new ValidatorSupport(project,(IValidator)this);
+ }
+
+ public void validate() throws ValidationException {
+ support.validate();
+ }
+
+ public void add(IMarker marker) {
+ support.add(marker);
+ }
+
+ public boolean isMessageCreated(String template, Object[] parameters) {
+ return support.isMessageCreated(template, parameters);
+ }
+
+ public void addFile(IFile o) {
+ support.addFile(o);
+ }
+
+ public List<IMarker> getMarkers() {
+ return support.getMarkers();
+ }
+
+ public void addMessage(org.eclipse.wst.validation.internal.provisional.core.IValidator origin, IMessage message) {
+ support.addMessage(origin, message);
+ }
+
+ public void validate(IFile file) throws ValidationException {
+ support.validate(file);
+ }
+
+ public boolean isMessageCreatedOnLine(String markerTemplate,
+ Object[] parameters, int lineNumber) throws CoreException {
+ return support.isMessageCreatedOnLine(markerTemplate, parameters,
+ lineNumber);
+ }
+
+ @Override
+ public IStatus validate(Set<IFile> changedFiles, IProject project,
+ ContextValidationHelper validationHelper, ValidatorManager manager,
+ IReporter reporter) throws ValidationException {
+ errorManager = new SeamValidationErrorManager() {
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMarkerOwner()
+ */
+ @Override
+ protected Class getMarkerOwner() {
+ return SeamProjectPropertyValidatorWrapper.this.getClass();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#init(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.eclipse.wst.validation.internal.provisional.core.IValidator, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+
+ public void init(IProject project,
+ ContextValidationHelper validationHelper,
+ org.eclipse.wst.validation.internal.provisional.core.IValidator manager, IReporter reporter) {
+ setRootProject(project);
+ setValidationManager(manager);
+ setReporter(reporter);
+ setMarkerId(SeamValidationErrorManager.MARKED_SEAM_PROJECT_MESSAGE_GROUP);
+ }
+ };
+ //errorManager.init(project, null, this, reporter);
+
+ return validateInJob(validationHelper, reporter);
+ }
+
+ @Override
+ public IStatus validateAll(IProject project,
+ ContextValidationHelper validationHelper, ValidatorManager manager,
+ IReporter reporter) throws ValidationException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getId() {
+ return "id";
+ }
+
+ @Override
+ public IValidatingProjectSet getValidatingProjects(IProject project) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean shouldValidate(IProject project) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled(IProject project) {
+ return true;
+ }
+
+ protected IValidationErrorManager getTestValidationErrorManager(){
+ return this;
+ }
+
+ @Override
+ public void init(
+ IProject project,
+ ContextValidationHelper validationHelper,
+ org.eclipse.wst.validation.internal.provisional.core.IValidator manager,
+ IReporter reporter) {
+ ContextValidationHelper vh = new ContextValidationHelper();
+ vh.initialize();
+ errorManager.init(project, vh, manager, reporter);
+ }
+
+ @Override
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, ITextSourceReference location,
+ IResource target) {
+ IMarker marker = errorManager.addError(message, preferenceKey, messageArguments, location, target);
+ support.add(marker);
+ return marker;
+ }
+
+ @Override
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, IResource target) {
+ IMarker marker = errorManager.addError(message, preferenceKey, messageArguments, target);
+ support.add(marker);
+ return marker;
+ }
+
+ @Override
+ public IMarker addError(String message, String preferenceKey,
+ ITextSourceReference location, IResource target) {
+ IMarker marker = errorManager.addError(message, preferenceKey, location, target);
+ support.add(marker);
+ return marker;
+ }
+
+ @Override
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int length, int offset, IResource target) {
+ IMarker marker = errorManager.addError(message, preferenceKey, messageArguments, length, offset, target);
+ support.add(marker);
+ return marker;
+ }
+
+ @Override
+ public IMarker addError(String message, int severity,
+ String[] messageArguments, int length, int offset, IResource target) {
+ IMarker marker = errorManager.addError(message, severity, messageArguments, length, offset, target);
+ support.add(marker);
+ return marker;
+ }
+
+ @Override
+ public void displaySubtask(String message) {
+ errorManager.displaySubtask(message);
+ }
+
+ @Override
+ public void displaySubtask(String message, String[] messageArguments) {
+ errorManager.displaySubtask(message, messageArguments);
+ }
+
+ @Override
+ public void removeMessagesFromResources(Set<IResource> resources) {
+ errorManager.removeMessagesFromResources(resources);
+ }
+
+ @Override
+ public void removeAllMessagesFromResource(IResource resource) {
+ errorManager.removeAllMessagesFromResource(resource);
+ }
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ValidatorSupport.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ValidatorSupport.java 2010-08-14 04:42:33 UTC (rev 24172)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ValidatorSupport.java 2010-08-16 06:26:54 UTC (rev 24173)
@@ -57,9 +57,12 @@
boolean result = false;
for (IMarker marker : markers) {
String message = marker.getAttribute(IMarker.MESSAGE,"").toString();
- if(messagePattern.matches(message)) {
+ if(messagePattern.equals(message)){
result = true;
break;
+ }else if(messagePattern.matches(message)) {
+ result = true;
+ break;
}
}
return result;
15 years, 8 months
JBoss Tools SVN: r24172 - in trunk/bpel/plugins: org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2010-08-14 00:42:33 -0400 (Sat, 14 Aug 2010)
New Revision: 24172
Added:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/SAXParseDiagnostic.java
Modified:
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/util/DeployResourceSetImpl.java
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELReader.java
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResource.java
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceImpl.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELEditor.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELReader.java
trunk/bpel/plugins/org.eclipse.bpel.validator/plugin.xml
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/BPELReader.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/IProblem.java
Log:
https://jira.jboss.org/browse/JBIDE-6825
Fixed a bunch of NPEs and missing error markers for malformed BPEL XML files
Modified: trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/util/DeployResourceSetImpl.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/util/DeployResourceSetImpl.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/util/DeployResourceSetImpl.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -29,9 +29,9 @@
@Override
public Resource getResource(URI uri, boolean loadOnDemand) {
String name = uri.toString().toLowerCase();
- if (name.endsWith("wsdl"))
+ if (name.endsWith("?wsdl") || name.endsWith(".wsdl"))
return getResource(uri,true,"wsdl");
- if (name.endsWith("wsil"))
+ if (name.endsWith(".wsil"))
return getResource(uri,true,"wsil");
if (name.endsWith(".xsd"))
return getResource(uri,true,"xsd");
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELReader.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELReader.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELReader.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -165,7 +165,10 @@
// The process we are reading
private Process process = null;
+ // https://jira.jboss.org/browse/JBIDE-6825
// The resource we are reading from
+ private Resource fCurrentResource = null;
+ // The successfully loaded resource
private Resource fResource = null;
// The document builder controls various DOM characteristics
private DocumentBuilder docBuilder = null;
@@ -302,6 +305,11 @@
inputSource.setPublicId( resource.getURI().toString() );
inputSource.setSystemId( resource.getURI().toString() );
+ resource.setErrorHandler(fErrorHandler != null ? fErrorHandler : this);
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // set the resource currently being loaded so the error handler can
+ // attach diagnostics to it
+ fCurrentResource = resource;
doc = read ( inputSource );
// After the document has successfully parsed, it's okay
// to assign the resource.
@@ -311,15 +319,14 @@
} catch (IOException ioe) {
BPELPlugin.log("I/O Error Reading BPEL XML", ioe ) ;
} finally {
-
+
}
- if (doc == null) {
- return ;
+ if (doc != null) {
+ pass1(doc);
+ pass2();
}
-
- pass1(doc);
- pass2();
+ fCurrentResource = null;
}
@@ -336,22 +343,26 @@
/**
* @param xmlSource the XML source
- * @param sourceDesciption some textual description of the source (for example Clipboard).
+ * @param sourceDescription some textual description of the source (for example Clipboard).
* @return a list of objects
*/
- public List<EObject> fromXML ( String xmlSource , String sourceDesciption , Resource resource ) {
+ public List<EObject> fromXML ( String xmlSource , String sourceDescription , Resource resource ) {
armErrorHandler ();
- if (sourceDesciption == null) {
- sourceDesciption = "String";
+ if (sourceDescription == null) {
+ sourceDescription = "String";
}
Document doc = null;
try {
InputSource inputSource = new InputSource(new StringReader ( xmlSource ));
- inputSource.setPublicId( sourceDesciption );
+ inputSource.setPublicId( sourceDescription );
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // set the resource currently being loaded so the error handler can
+ // attach diagnostics to it
+ fCurrentResource = resource;
doc = read (inputSource);
} catch (SAXException sax) {
@@ -363,6 +374,7 @@
}
if (doc == null) {
+ fCurrentResource = null;
return Collections.emptyList();
}
@@ -376,6 +388,7 @@
// pass 1 (for example, establishing object links to variables).
pass2();
+ fCurrentResource = null;
return result;
}
@@ -3502,8 +3515,6 @@
return LINK_RESOLVER.getLink(activity, linkName);
}
-
-
/**
* @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
*/
@@ -3519,6 +3530,10 @@
exception.getLocalizedMessage()
);
BPELPlugin.logMessage(message, exception, IStatus.ERROR);
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // add the error to resource
+ if (fCurrentResource!=null)
+ fCurrentResource.getErrors().add(new SAXParseDiagnostic(exception, SAXParseDiagnostic.ERROR));
}
/**
@@ -3535,6 +3550,10 @@
exception.getLocalizedMessage()
);
BPELPlugin.logMessage(message, exception, IStatus.ERROR);
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // add the error to resource
+ if (fCurrentResource!=null)
+ fCurrentResource.getErrors().add(new SAXParseDiagnostic(exception, SAXParseDiagnostic.FATAL_ERROR));
}
/**
@@ -3551,7 +3570,9 @@
exception.getLocalizedMessage()
);
BPELPlugin.logMessage(message, exception, IStatus.WARNING);
-
-
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // add the error to resource
+ if (fCurrentResource!=null)
+ fCurrentResource.getErrors().add(new SAXParseDiagnostic(exception, SAXParseDiagnostic.WARNING));
}
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResource.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResource.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResource.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -15,6 +15,7 @@
import org.eclipse.bpel.model.Process;
import org.eclipse.emf.ecore.resource.Resource;
+import org.xml.sax.ErrorHandler;
/**
@@ -34,6 +35,20 @@
* @see org.eclipse.emf.ecore.resource.impl.ResourceImpl#doSave(OutputStream, Map)
*/
void doSave(OutputStream out, Map<?, ?> args) throws Exception;
+
+ /**
+ * Set an error handler for SAX Parser
+ * @param errorHandler
+ * @see https://jira.jboss.org/browse/JBIDE-6825
+ */
+ void setErrorHandler(ErrorHandler errorHandler);
+
+ /**
+ * Return the current SAX Parser error handler
+ * @return error handler
+ * @see https://jira.jboss.org/browse/JBIDE-6825
+ */
+ ErrorHandler getErrorHandler();
/**
* Returns the BPEL process contained by this resource or <code>null</code> if there is none.
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceImpl.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceImpl.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceImpl.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -78,6 +78,19 @@
validating = true;
}
+ // https://jira.jboss.org/browse/JBIDE-6825
+ public void setErrorHandler(ErrorHandler errorHandler)
+ {
+ this.errorHandler = errorHandler;
+ validating = true;
+ }
+
+ // https://jira.jboss.org/browse/JBIDE-6825
+ public ErrorHandler getErrorHandler()
+ {
+ return errorHandler;
+ }
+
/**
* Convert the BPEL model to an XML DOM model and then write the DOM model
* to the output stream.
Added: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/SAXParseDiagnostic.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/SAXParseDiagnostic.java (rev 0)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/SAXParseDiagnostic.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.eclipse.bpel.model.resource;
+
+import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
+import org.xml.sax.SAXParseException;
+
+/*
+ * This class represents a SAX parser diagnostic. These are added to the EMF resource.
+ *
+ * @see https://jira.jboss.org/browse/JBIDE-6825
+ * @author Bob Brodt
+ * @date Aug 13, 2010
+ */
+public class SAXParseDiagnostic implements Diagnostic
+{
+ protected SAXParseException exception;
+ protected int severity;
+
+ public static final int WARNING = 1;
+ public static final int ERROR = 2;
+ public static final int FATAL_ERROR = 3;
+
+ SAXParseDiagnostic(SAXParseException exception, int severity)
+ {
+ this.exception = exception;
+ this.severity = severity;
+ }
+
+ public int getColumn() {
+ return exception.getColumnNumber();
+ }
+
+ public int getLine() {
+ return exception.getLineNumber();
+ }
+
+ public String getLocation() {
+ return exception.getPublicId();
+ }
+
+ public String getMessage() {
+ return exception.getLocalizedMessage();
+ }
+
+ public int getSeverity() {
+ return severity;
+ }
+}
\ No newline at end of file
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELEditor.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELEditor.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELEditor.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -552,11 +552,17 @@
updateTitle();
}
// Put the timestamp of the bpel file into the bpelex file.
- IFile bpelFile = BPELUtil.getBPELFile(getProcess());
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // if the Resource failed to parse then the Process is null.
+ // use the model client to get the IFile resource instead of getting it from Process
+ IFile bpelFile = getEditModelClient().getPrimaryResourceInfo().getFile();
long modificationStamp = bpelFile.getLocalTimeStamp();
ProcessExtension processExtension = (ProcessExtension)ModelHelper.getExtension(getProcess());
- processExtension.setModificationStamp(modificationStamp);
- getExtensionsResource().setModified(true);
+ if (processExtension!=null)
+ {
+ processExtension.setModificationStamp(modificationStamp);
+ getExtensionsResource().setModified(true);
+ }
getEditModelClient().saveAll(progressMonitor);
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELReader.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELReader.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELReader.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -71,6 +71,12 @@
IFile extensionsFile = ResourcesPlugin.getWorkspace().getRoot().getFile(extensionsPath);
try {
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // At this point, the ResourceInfo.load() already loaded the process file
+ // but no parsing errors were logged in the Resource. This is because demand
+ // load was used by createResource(). Force a reload here, this time with
+ // proper error logging.
+ processResource.unload();
processResource.load(Collections.EMPTY_MAP);
EList<EObject> contents = processResource.getContents();
if (!contents.isEmpty())
@@ -175,6 +181,8 @@
IFile extensionsFile = ResourcesPlugin.getWorkspace().getRoot().getFile(extensionsPath);
try {
+ // https://jira.jboss.org/browse/JBIDE-6825
+ processResource.unload();
processResource.load(Collections.EMPTY_MAP);
EList<EObject> contents = processResource.getContents();
if (!contents.isEmpty())
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/plugin.xml
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/plugin.xml 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/plugin.xml 2010-08-14 04:42:33 UTC (rev 24172)
@@ -43,9 +43,12 @@
name="BPEL Validator"
point="org.eclipse.wst.validation.validator">
<validator>
- <filter
+ <runStrategy
+ project="true">
+ </runStrategy>
+ <filter
caseSensitive="false"
- nameFilter="*.bpel"
+ nameFilter="*.wsdl"
objectClass="org.eclipse.core.resources.IFile"/>
<run
async="true"
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/BPELReader.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/BPELReader.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/BPELReader.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -17,6 +17,7 @@
import org.eclipse.bpel.common.extension.model.ExtensionMap;
import org.eclipse.bpel.model.Process;
+import org.eclipse.bpel.model.impl.BPELFactoryImpl;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
@@ -115,6 +116,12 @@
this.process = null;
try {
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // If the ResourceInfo.load() already loaded the process file
+ // but no parsing errors were logged in the Resource. This is because demand
+ // load was used by createResource(). Force a reload here, this time with
+ // proper error logging.
+ processResource.unload();
processResource.load (Collections.EMPTY_MAP);
EList contents = processResource.getContents();
if (!contents.isEmpty()) {
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -13,11 +13,13 @@
import org.eclipse.bpel.model.Import;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.model.resource.BPELResourceSetImpl;
+import org.eclipse.bpel.model.resource.SAXParseDiagnostic;
import org.eclipse.bpel.validator.factory.AdapterFactory;
import org.eclipse.bpel.validator.helpers.ModelQueryImpl;
import org.eclipse.bpel.validator.model.INode;
import org.eclipse.bpel.validator.model.IProblem;
import org.eclipse.bpel.validator.model.Messages;
+import org.eclipse.bpel.validator.model.Problem;
import org.eclipse.bpel.validator.model.Runner;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -38,6 +40,7 @@
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
import org.eclipse.wst.wsdl.WSDLElement;
import org.w3c.dom.Element;
@@ -204,7 +207,7 @@
p("File Resource : " + file.getName() );
// https://jira.jboss.org/jira/browse/JBIDE-6006
// use content type to check for BPEL files
- if ( isBPELFile(file) || file.getName().endsWith(".wsdl")) {
+ if ( isBPELFile(file) || "wsdl".equalsIgnoreCase(file.getFileExtension()) ) {
IProject project = file.getProject();
validate(project, monitor);
// file.deleteMarkers(IBPELMarker.ID, true, IResource.DEPTH_INFINITE);
@@ -258,6 +261,12 @@
Process process = fReader.getProcess();
p("Delete markers");
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // in case of XML parse errors, the Process will be null!
+ if (process == null) {
+ p ("Cannot read BPEL Process !!!");
+ return;
+ }
IContainer container = bpelFile.getParent();
for(Import impt : process.getImports()){
@@ -293,6 +302,34 @@
Process process = fReader.getProcess();
if (process == null) {
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // if the resource failed to parse because of malformed XML, the Process
+ // will be null. Fetch the SAXParseDiagnostics from the resource and build
+ // problem markers for this resource.
+ Resource resource = fReader.getProcessResource();
+ if ( resource!=null && !resource.getErrors().isEmpty() )
+ {
+ ArrayList<IProblem> problems = new ArrayList<IProblem>(resource.getErrors().size());
+ for ( Diagnostic d : resource.getErrors())
+ {
+ IProblem problem = new Problem();
+ problem.setAttribute(IProblem.ERESOURCE,resource);
+ if (d instanceof SAXParseDiagnostic &&
+ ((SAXParseDiagnostic)d).getSeverity() == SAXParseDiagnostic.WARNING)
+ {
+ problem.setAttribute(IProblem.SEVERITY, IProblem.SEVERITY_WARNING);
+ }
+ else
+ problem.setAttribute(IProblem.SEVERITY, IProblem.SEVERITY_ERROR);
+ problem.setAttribute(IProblem.LINE_NUMBER, d.getLine());
+ problem.setAttribute(IProblem.COLUMN_NUMBER, d.getColumn());
+ problem.setAttribute(IProblem.MESSAGE, d.getMessage());
+
+ problems.add(problem);
+ }
+ return problems.toArray( new Problem[problems.size()] );
+ }
+
p ("Cannot read BPEL Process !!!");
return EMPTY_PROBLEMS ;
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -13,6 +13,7 @@
import org.eclipse.bpel.validator.helpers.DOMNodeAdapter;
import org.eclipse.bpel.validator.model.INode;
import org.eclipse.bpel.validator.model.IProblem;
+import org.eclipse.core.internal.resources.File;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -153,8 +154,17 @@
IMarker adapt_IProblem2IMarker (IProblem problem ) {
- INode node = (INode) problem.getAttribute( IProblem.NODE );
- IResource resource = (IResource) getAdapter(node.nodeValue(), IResource.class );
+ IResource resource = null;
+ INode node = (INode) problem.getAttribute( IProblem.NODE );
+ if (node!=null)
+ resource = (IResource) getAdapter(node.nodeValue(), IResource.class );
+ else
+ {
+ // https://jira.jboss.org/browse/JBIDE-6825
+ // added a new ERESOURCE attribute
+ Resource modelResource = (Resource) problem.getAttribute( IProblem.ERESOURCE );
+ resource = getFileFromURI(modelResource.getURI());
+ }
Map<String,Object> props = new HashMap<String,Object>();
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/IProblem.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/IProblem.java 2010-08-14 01:06:26 UTC (rev 24171)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/IProblem.java 2010-08-14 04:42:33 UTC (rev 24172)
@@ -174,6 +174,13 @@
public static final String CONTEXT = "context.name"; //$NON-NLS-1$
+ /**
+ * In case the model is completely hoarked and we don't even have
+ * a Process or any sort of context, we still want to be able to
+ * report this as a problem. This is the emf Resource that is in error.
+ * @see https://jira.jboss.org/browse/JBIDE-6825
+ */
+ public static final String ERESOURCE = "eResource"; //$NON-NLS-1$
/**
* This is the name of the Java Resource bundle
15 years, 8 months
JBoss Tools SVN: r24171 - trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-08-13 21:06:26 -0400 (Fri, 13 Aug 2010)
New Revision: 24171
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
Log:
https://jira.jboss.org/browse/JBIDE-6838 commented incorrectly implemented tests
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2010-08-14 00:04:16 UTC (rev 24170)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2010-08-14 01:06:26 UTC (rev 24171)
@@ -31,7 +31,8 @@
suite.addTestSuite(QueryPageViewerTest.class);
suite.addTestSuite(HBMInfoExtractorTest.class);
- suite.addTestSuite(CodeGenXMLFactoryTest.class);
+ // https://jira.jboss.org/browse/JBIDE-6838
+ //suite.addTestSuite(CodeGenXMLFactoryTest.class);
// core tests
//Properties properties = new Properties();
15 years, 8 months
JBoss Tools SVN: r24170 - trunk/vpe/features/org.jboss.tools.vpe.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-08-13 20:04:16 -0400 (Fri, 13 Aug 2010)
New Revision: 24170
Modified:
trunk/vpe/features/org.jboss.tools.vpe.feature/feature.xml
Log:
include spring VPE support in uberbuilder
Modified: trunk/vpe/features/org.jboss.tools.vpe.feature/feature.xml
===================================================================
--- trunk/vpe/features/org.jboss.tools.vpe.feature/feature.xml 2010-08-13 22:42:44 UTC (rev 24169)
+++ trunk/vpe/features/org.jboss.tools.vpe.feature/feature.xml 2010-08-14 00:04:16 UTC (rev 24170)
@@ -12,16 +12,16 @@
%copyright
</copyright>
- <license>Red Hat, Inc. licenses these features and plugins to you under
+ <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.
-</license>
+ </license>
-
<plugin
id="org.jboss.tools.vpe"
download-size="0"
@@ -70,4 +70,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.jboss.tools.vpe.spring"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
15 years, 8 months
JBoss Tools SVN: r24169 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: icons and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjohnstn
Date: 2010-08-13 18:42:44 -0400 (Fri, 13 Aug 2010)
New Revision: 24169
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/delta-large.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
Log:
2010-08-13 Jeff Johnston <jjohnstn(a)redhat.com>
* icons/delta-large.gif: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java: New file.
* src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java: Add large delta image.
* src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java (getElements): Changed
to just get the root element's children.
(getChildren): Changed to always return the parent element's children.
(inputChanged): Assumes the new input is a CVRootElement and saves it for
later. No longer creates clouds and categories here.
* src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java (clearChildren): New method
to clear all children.
* src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java (getChildren): Remove
Instances logic since it has its own element class now.
* src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java (hasChildren): New method
that always returns true.
(getChildren): New method to add the category elements.
* src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java (changeEvent): Set the input
to a new CVRootElement.
(createPartControl): Ditto
(.run): Ditto.
(makeActions): Remove bogus action1 and action2.
(fillLocalPullDown): Ditto.
* src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java (compareByColumn): Make
comparison ignore case.
* src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (ColumnListener.widgetSelected): Don't
set sort column indicator i.e. set it to SWT.NONE.
(createPartControl): Ditto.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java (NewCloudConnectionPage): Set
title image to new delta-large icon.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java (NewInstancePage): Ditto.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-13 22:42:44 UTC (rev 24169)
@@ -1,5 +1,38 @@
2010-08-13 Jeff Johnston <jjohnstn(a)redhat.com>
+ * icons/delta-large.gif: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java: Add large delta image.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java (getElements): Changed
+ to just get the root element's children.
+ (getChildren): Changed to always return the parent element's children.
+ (inputChanged): Assumes the new input is a CVRootElement and saves it for
+ later. No longer creates clouds and categories here.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java (clearChildren): New method
+ to clear all children.
+ * src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java (getChildren): Remove
+ Instances logic since it has its own element class now.
+ * src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java (hasChildren): New method
+ that always returns true.
+ (getChildren): New method to add the category elements.
+ * src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java (changeEvent): Set the input
+ to a new CVRootElement.
+ (createPartControl): Ditto
+ (.run): Ditto.
+ (makeActions): Remove bogus action1 and action2.
+ (fillLocalPullDown): Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java (compareByColumn): Make
+ comparison ignore case.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (ColumnListener.widgetSelected): Don't
+ set sort column indicator i.e. set it to SWT.NONE.
+ (createPartControl): Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java (NewCloudConnectionPage): Set
+ title image to new delta-large icon.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java (NewInstancePage): Ditto.
+
+2010-08-13 Jeff Johnston <jjohnstn(a)redhat.com>
+
* src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (changeEvent): Set the
currCloud variable.
(createPartControl): Ditto.
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/delta-large.gif
===================================================================
(Binary files differ)
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/delta-large.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -30,12 +30,14 @@
public static final String IMG_IMAGE= NAME_PREFIX + "image.gif"; //$NON-NLS-1$
public static final String IMG_COLLAPSE_ALL= NAME_PREFIX + "collapseall.gif"; //$NON-NLS-1$
public static final String IMG_DELTA= NAME_PREFIX + "delta.gif"; //$NON-NLS-1$
- public static final ImageDescriptor DESC_CLOUD= createManaged("", IMG_CLOUD);
+ public static final String IMG_DELTA_LARGE= NAME_PREFIX + "delta-large.gif"; //$NON-NLS-1$
+ public static final ImageDescriptor DESC_CLOUD= createManaged("", IMG_CLOUD);
public static final ImageDescriptor DESC_FOLDER= createManaged("", IMG_FOLDER);
public static final ImageDescriptor DESC_INSTANCE= createManaged("", IMG_INSTANCE);
public static final ImageDescriptor DESC_IMAGE= createManaged("", IMG_IMAGE);
public static final ImageDescriptor DESC_COLLAPSE_ALL= createManaged("", IMG_COLLAPSE_ALL);
public static final ImageDescriptor DESC_DELTA= createManaged("", IMG_DELTA);
+ public static final ImageDescriptor DESC_DELTA_LARGE= createManaged("", IMG_DELTA_LARGE);
private static ImageDescriptor createManaged(String prefix, String name) {
return createManaged(imageRegistry, prefix, name);
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -10,8 +10,8 @@
public final static int INSTANCES = 0;
public final static int IMAGES = 1;
- private int type;
- private boolean initialized;
+ protected int type;
+ protected boolean initialized;
public CVCategoryElement(Object element, String name, int type) {
super(element, name);
@@ -22,15 +22,7 @@
public Object[] getChildren() {
if (!initialized) {
DeltaCloud cloud = (DeltaCloud)getElement();
- if (type == INSTANCES) {
- DeltaCloudInstance[] instances = cloud.getInstances();
- for (int i = 0; i < instances.length; ++i) {
- DeltaCloudInstance d = instances[i];
- CVInstanceElement element = new CVInstanceElement(d, d.getName());
- addChild(element);
- }
- initialized = true;
- } else if (type == IMAGES) {
+ if (type == IMAGES) {
DeltaCloudImage[] images = cloud.getImages();
for (int i = 0; i < images.length; ++i) {
DeltaCloudImage d = images[i];
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -2,10 +2,15 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
public class CVCloudElement extends CloudViewElement {
+ private static final String INSTANCE_CATEGORY_NAME = "InstanceCategoryName"; //$NON-NLS-1$
+ private static final String IMAGE_CATEGORY_NAME = "ImageCategoryName"; //$NON-NLS-1$
+
private Viewer viewer;
+ private boolean initialized;
public CVCloudElement(Object element, String name, Viewer viewer) {
super(element, name);
@@ -15,8 +20,28 @@
public Viewer getViewer() {
return viewer;
}
+
+ @Override
+ public boolean hasChildren() {
+ return true;
+ }
@Override
+ public Object[] getChildren() {
+ if (!initialized) {
+ DeltaCloud cloud = (DeltaCloud)getElement();
+ CVCategoryElement c1 = new CVInstancesCategoryElement(cloud, CVMessages.getString(INSTANCE_CATEGORY_NAME),
+ viewer);
+ CVCategoryElement c2 = new CVCategoryElement(cloud, CVMessages.getString(IMAGE_CATEGORY_NAME),
+ CVCategoryElement.IMAGES);
+ addChild(c1);
+ addChild(c2);
+ }
+ initialized = true;
+ return super.getChildren();
+ }
+
+ @Override
public IPropertySource getPropertySource() {
return new CloudPropertySource(getElement());
}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -0,0 +1,57 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.IInstanceListListener;
+
+public class CVInstancesCategoryElement extends CVCategoryElement implements IInstanceListListener {
+
+ private Viewer viewer;
+ private CVInstancesCategoryElement category;
+
+ public CVInstancesCategoryElement(Object element, String name, Viewer viewer) {
+ super(element, name, CVCategoryElement.INSTANCES);
+ this.viewer = viewer;
+ DeltaCloud cloud = (DeltaCloud)getElement();
+ cloud.addInstanceListListener(this);
+ this.category = this;
+ }
+
+ @Override
+ public Object[] getChildren() {
+ if (!initialized) {
+ DeltaCloud cloud = (DeltaCloud)getElement();
+ cloud.removeInstanceListListener(this);
+ DeltaCloudInstance[] instances = cloud.getInstances();
+ for (int i = 0; i < instances.length; ++i) {
+ DeltaCloudInstance d = instances[i];
+ CVInstanceElement element = new CVInstanceElement(d, d.getName());
+ addChild(element);
+ }
+ initialized = true;
+ cloud.addInstanceListListener(this);
+ }
+ return super.getChildren();
+ }
+
+ @Override
+ public void listChanged(DeltaCloudInstance[] instances) {
+ clearChildren();
+ for (int i = 0; i < instances.length; ++i) {
+ DeltaCloudInstance d = instances[i];
+ CVInstanceElement element = new CVInstanceElement(d, d.getName());
+ addChild(element);
+ }
+ initialized = true;
+ Display.getCurrent().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ ((TreeViewer)viewer).refresh(category, false);
+ }
+ });
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -0,0 +1,63 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.core.ICloudManagerListener;
+
+public class CVRootElement extends CloudViewElement implements ICloudManagerListener {
+
+ private boolean initialized;
+ private Viewer viewer;
+
+ public CVRootElement(Viewer viewer) {
+ super(DeltaCloudManager.getDefault(), "root"); //$NON-NLS-1$
+ this.viewer = viewer;
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object[] getChildren() {
+ if (!initialized) {
+ DeltaCloudManager m = DeltaCloudManager.getDefault();
+ DeltaCloud[] clouds = m.getClouds();
+ for (int i = 0; i < clouds.length; ++i) {
+ DeltaCloud cloud = clouds[i];
+ CVCloudElement e = new CVCloudElement(cloud, cloud.getName(), viewer);
+ addChild(e);
+ }
+ m.addCloudManagerListener(this);
+ initialized = true;
+ }
+ return super.getChildren();
+ }
+
+ @Override
+ public void changeEvent(int type) {
+ DeltaCloudManager m = DeltaCloudManager.getDefault();
+ m.removeCloudManagerListener(this);
+ DeltaCloud[] clouds = m.getClouds();
+ for (int i = 0; i < clouds.length; ++i) {
+ DeltaCloud cloud = clouds[i];
+ CVCloudElement e = new CVCloudElement(cloud, cloud.getName(), viewer);
+ addChild(e);
+ }
+ initialized = true;
+ m.addCloudManagerListener(this);
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ ((TreeViewer)viewer).refresh(this, false);
+ }
+ });
+ }
+
+}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -1,23 +1,14 @@
package org.jboss.tools.deltacloud.ui.views;
-import java.util.ArrayList;
-
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.IViewSite;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudManager;
public class CloudViewContentProvider implements ITreeContentProvider {
- private CloudViewElement[] elements;
- private static final String INSTANCE_CATEGORY_NAME = "InstanceCategoryName"; //$NON-NLS-1$
- private static final String IMAGE_CATEGORY_NAME = "ImageCategoryName"; //$NON-NLS-1$
+ private CloudViewElement root;
@Override
public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof IViewSite)
- return elements;
CloudViewElement e = (CloudViewElement)parentElement;
return e.getChildren();
}
@@ -36,7 +27,7 @@
@Override
public Object[] getElements(Object inputElement) {
- return elements;
+ return root.getChildren();
}
@Override
@@ -45,27 +36,9 @@
}
- private void createElements(Viewer viewer) {
- ArrayList<CloudViewElement> list = new ArrayList<CloudViewElement>();
- DeltaCloudManager m = DeltaCloudManager.getDefault();
- DeltaCloud[] clouds = m.getClouds();
- for (int i = 0; i < clouds.length; ++i) {
- DeltaCloud cloud = clouds[i];
- CVCloudElement e = new CVCloudElement(cloud, cloud.getName(), viewer);
- CVCategoryElement c1 = new CVCategoryElement(cloud, CVMessages.getString(INSTANCE_CATEGORY_NAME),
- CVCategoryElement.INSTANCES);
- CVCategoryElement c2 = new CVCategoryElement(cloud, CVMessages.getString(IMAGE_CATEGORY_NAME),
- CVCategoryElement.IMAGES);
- e.addChild(c1);
- e.addChild(c2);
- list.add(e);
- }
- elements = list.toArray(new CloudViewElement[list.size()]);
- }
-
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- createElements(viewer);
+ root = (CloudViewElement)newInput;
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -18,6 +18,10 @@
return children.toArray();
}
+ protected void clearChildren() {
+ children.clear();
+ }
+
public boolean hasChildren() {
return children.size() > 0;
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -7,7 +7,6 @@
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
@@ -49,8 +48,6 @@
public static final String COLLAPSE_ALL = "CollapseAll.label"; //$NON-NLS-1$
private TreeViewer viewer;
- private Action action1;
- private Action action2;
private Action removeCloud;
private Action refreshAction;
private Action collapseall;
@@ -73,7 +70,7 @@
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
viewer.setContentProvider(new CloudViewContentProvider());
viewer.setLabelProvider(new CloudViewLabelProvider());
- viewer.setInput(getViewSite());
+ viewer.setInput(new CVRootElement(viewer));
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
getSite().setSelectionProvider(viewer); // for tabbed properties
@@ -121,8 +118,6 @@
}
private void fillLocalPullDown(IMenuManager manager) {
- manager.add(action1);
- manager.add(new Separator());
manager.add(removeCloud);
manager.add(refreshAction);
}
@@ -193,7 +188,7 @@
refreshAction = new Action() {
public void run() {
- viewer.setInput(getViewSite());
+ viewer.setInput(new CVRootElement(viewer));
}
};
refreshAction.setText(CVMessages.getString(REFRESH));
@@ -201,30 +196,11 @@
refreshAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
- action1 = new Action() {
- public void run() {
- showMessage("Action 1 executed");
- }
- };
- action1.setText("Action 1");
- action1.setToolTipText("Action 1 tooltip");
- action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
- getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
-
- action2 = new Action() {
- public void run() {
- showMessage("Action 2 executed");
- }
- };
- action2.setText("Action 2");
- action2.setToolTipText("Action 2 tooltip");
- action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
- getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
doubleClickAction = new Action() {
public void run() {
ISelection selection = viewer.getSelection();
+ @SuppressWarnings("unused")
Object obj = ((IStructuredSelection)selection).getFirstElement();
- showMessage("Double-click detected on "+obj.toString());
}
};
collapseall = new Action() {
@@ -244,12 +220,6 @@
}
});
}
- private void showMessage(String message) {
- MessageDialog.openInformation(
- viewer.getControl().getShell(),
- CVMessages.getString("CloudViewName"), //$NON-NLS-1$
- message);
- }
/**
* Passing the focus request to the viewer's control.
@@ -260,6 +230,6 @@
@Override
public void changeEvent(int type) {
- viewer.setInput(getViewSite());
+ viewer.setInput(new CVRootElement(viewer));
}
}
\ No newline at end of file
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -44,6 +44,6 @@
InstanceViewLabelAndContentProvider provider = (InstanceViewLabelAndContentProvider)((TableViewer)viewer).getContentProvider();
String s1 = provider.getColumnText(e1, column);
String s2 = provider.getColumnText(e2, column);
- return s1.compareTo(s2);
+ return s1.compareToIgnoreCase(s2);
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -119,16 +119,13 @@
public void widgetSelected(SelectionEvent e) {
InstanceComparator comparator = (InstanceComparator)viewer.getComparator();
Table t = viewer.getTable();
- int direction = SWT.UP;
if (comparator.getColumn() == column) {
comparator.reverseDirection();
- if (t.getSortDirection() == SWT.UP)
- direction = SWT.DOWN;
}
comparator.setColumn(column);
TableColumn tc = (TableColumn)e.getSource();
t.setSortColumn(tc);
- t.setSortDirection(direction);
+ t.setSortDirection(SWT.NONE);
viewer.refresh();
}
@@ -181,7 +178,7 @@
tableLayout.setColumnData(tc, new ColumnWeightData(c.getWeight()));
tc.addSelectionListener(new ColumnListener(i, viewer));
}
- table.setSortDirection(SWT.UP);
+ table.setSortDirection(SWT.NONE);
currCloud = clouds[0];
currCloud.removeInstanceListListener(parentView);
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -37,6 +37,7 @@
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -127,6 +128,7 @@
this.wizard= wizard;
setDescription(WizardMessages.getString(DESCRIPTION));
setTitle(WizardMessages.getString(TITLE));
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
setPageComplete(false);
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-08-13 19:54:13 UTC (rev 24168)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-08-13 22:42:44 UTC (rev 24169)
@@ -19,6 +19,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudRealm;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
public class NewInstancePage extends WizardPage {
@@ -76,6 +77,7 @@
getPossibleProfiles();
setDescription(WizardMessages.getString(DESCRIPTION));
setTitle(WizardMessages.getString(TITLE));
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
setPageComplete(false);
}
15 years, 8 months
JBoss Tools SVN: r24168 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/views and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jjohnstn
Date: 2010-08-13 15:54:13 -0400 (Fri, 13 Aug 2010)
New Revision: 24168
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
Log:
2010-08-13 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (changeEvent): Set the
currCloud variable.
(createPartControl): Ditto.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-13 19:48:36 UTC (rev 24167)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-13 19:54:13 UTC (rev 24168)
@@ -1,5 +1,11 @@
2010-08-13 Jeff Johnston <jjohnstn(a)redhat.com>
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (changeEvent): Set the
+ currCloud variable.
+ (createPartControl): Ditto.
+
+2010-08-13 Jeff Johnston <jjohnstn(a)redhat.com>
+
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java (performFinish):
(performTest): Pass url as String to DeltaCloudClient.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java (checkURL): Don't
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-08-13 19:48:36 UTC (rev 24167)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-08-13 19:54:13 UTC (rev 24168)
@@ -183,6 +183,7 @@
}
table.setSortDirection(SWT.UP);
+ currCloud = clouds[0];
currCloud.removeInstanceListListener(parentView);
viewer.setInput(clouds[0]);
currCloud.addInstanceListListener(parentView);
@@ -457,6 +458,7 @@
cloudSelector.removeModifyListener(cloudModifyListener);
cloudSelector.setItems(cloudNames);
cloudSelector.setText(cloudNames[index]);
+ currCloud = clouds[index];
cloudSelector.addModifyListener(cloudModifyListener);
}
15 years, 8 months
JBoss Tools SVN: r24167 - trunk/xulrunner.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-08-13 15:48:36 -0400 (Fri, 13 Aug 2010)
New Revision: 24167
Added:
trunk/xulrunner/features/
trunk/xulrunner/plugins/
trunk/xulrunner/site/
Log:
copy from 3.2.helios/xulrunner branch
Copied: trunk/xulrunner/features (from rev 24166, branches/3.2.helios/xulrunner/features)
Copied: trunk/xulrunner/plugins (from rev 24166, branches/3.2.helios/xulrunner/plugins)
Copied: trunk/xulrunner/site (from rev 24166, branches/3.2.helios/xulrunner/site)
15 years, 8 months