JBoss Tools SVN: r24296 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-08-19 08:07:52 -0400 (Thu, 19 Aug 2010)
New Revision: 24296
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/HttpGetMethod.java
Log:
[JBIDE-6376] packages refactored, strings externalized
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/HttpGetMethod.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/HttpGetMethod.java 2010-08-19 12:05:44 UTC (rev 24295)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/HttpGetMethod.java 2010-08-19 12:07:52 UTC (rev 24296)
@@ -48,10 +48,10 @@
HttpURLConnection urlConnection = createURLConnection(urlString, userAgent);
urlConnection.connect();
int responseCode = getResponseCode(urlConnection);
- if (responseCode != HttpURLConnection.HTTP_OK) {
- loggingAdapter.logMessage(MessageFormat.format(UsageMessages.HttpGetMethod_Error_Http, urlString, responseCode));
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.HttpGetMethod_Success, urlString, responseCode));
} else {
- loggingAdapter.logError(MessageFormat.format(UsageMessages.HttpGetMethod_Success, urlString));
+ loggingAdapter.logError(MessageFormat.format(UsageMessages.HttpGetMethod_Error_Http, urlString));
}
} catch (Exception e) {
loggingAdapter.logMessage(MessageFormat.format(UsageMessages.HttpGetMethod_Error_Io, urlString, e.toString()));
15 years, 4 months
JBoss Tools SVN: r24295 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-08-19 08:05:44 -0400 (Thu, 19 Aug 2010)
New Revision: 24295
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java
Log:
[JBIDE-6376] packages refactored, strings externalized
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java 2010-08-19 12:04:38 UTC (rev 24294)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java 2010-08-19 12:05:44 UTC (rev 24295)
@@ -13,7 +13,7 @@
import org.eclipse.osgi.util.NLS;
public class ReportingMessages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.usage.reporting.reporting_messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.jboss.tools.usage.reporting.messages"; //$NON-NLS-1$
public static String EclipseEnvironment_Error_SavePreferences7;
public static String UsageReport_Checkbox_Text;
15 years, 4 months
JBoss Tools SVN: r24294 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-08-19 08:04:38 -0400 (Thu, 19 Aug 2010)
New Revision: 24294
Removed:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/Messages.java
Log:
[JBIDE-6376] packages refactored, strings externalized
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/Messages.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/Messages.java 2010-08-19 11:51:36 UTC (rev 24293)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/Messages.java 2010-08-19 12:04:38 UTC (rev 24294)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.preferences;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.usage.preferences.messages"; //$NON-NLS-1$
-
- public static String UsageReportPreferencePage_Description;
- public static String UsageReportPreferencePage_AllowReporting;
- public static String UsageReportPreferencePage_Error_Saving;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
15 years, 4 months
JBoss Tools SVN: r24293 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-08-19 07:51:36 -0400 (Thu, 19 Aug 2010)
New Revision: 24293
Removed:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/preferences_messages.properties
Log:
[JBIDE-6376] packages refactored, strings externalized
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/preferences_messages.properties
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/preferences_messages.properties 2010-08-19 11:16:52 UTC (rev 24292)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/preferences_messages.properties 2010-08-19 11:51:36 UTC (rev 24293)
@@ -1,3 +0,0 @@
-UsageReportPreferencePage_Description=Preference page with options for anonymous usage data reporting. Usage data is used for statistical matters only.
-UsageReportPreferencePage_AllowReporting=&Allow Red Hat Inc. to report usage anonymously.
-UsageReportPreferencePage_Error_Saving=Could not save the preferences.
15 years, 4 months
JBoss Tools SVN: r24292 - in branches/smooks-dmb/plugins: org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model and 12 other directories.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2010-08-19 07:16:52 -0400 (Thu, 19 Aug 2010)
New Revision: 24292
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/messages.properties
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java
Removed:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputParameter.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputType.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDdataWizard.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/ISmooksModelProvider.java
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/SmooksModel.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ExtentionInputLabelProvider.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizard.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizardPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLTemplateCreationWizardPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDStructuredDataWizard.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
Log:
https://jira.jboss.org/browse/JBIDE-6867
Clean up input task panel code + input source management
https://jira.jboss.org/browse/JBIDE-6802
Re-add XML Schema (XSD) input support
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF 2010-08-19 11:16:52 UTC (rev 24292)
@@ -9,7 +9,8 @@
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.jboss.tools.smooks.runtime,
- org.eclipse.emf.ecore
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.edit
Export-Package: org.jboss.tools.smooks.model,
org.jboss.tools.smooks.model.core,
org.jboss.tools.smooks.model.javabean
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.model;
+
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * @author Dart
+ *
+ */
+public interface ISmooksModelProvider extends IEditingDomainProvider{
+ Model<SmooksModel> getSmooksModel();
+
+ String getInputType();
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/SmooksModel.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/SmooksModel.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/SmooksModel.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -39,6 +39,8 @@
private GlobalParams params;
private List<IComponent> components = new ArrayList<IComponent>();
+ private ISmooksModelProvider modelProvider;
+
public GlobalParams getParams() {
return params;
}
@@ -54,4 +56,12 @@
public void setComponents(List<IComponent> components) {
this.components = components;
}
+
+ public void setModelProvider(ISmooksModelProvider modelProvider) {
+ this.modelProvider = modelProvider;
+ }
+
+ public ISmooksModelProvider getModelProvider() {
+ return modelProvider;
+ }
}
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -70,7 +70,7 @@
}
public Set<String> getRootElementNames() {
- return Collections.unmodifiableSet(elements.keySet());
+ return new LinkedHashSet<String>(elements.keySet());
}
public void setRootElementName(String rootElementName) {
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ExtentionInputLabelProvider.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ExtentionInputLabelProvider.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ExtentionInputLabelProvider.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -10,16 +10,12 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors;
-import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
-import org.jboss.tools.smooks.configuration.editors.input.InputParameter;
-import org.jboss.tools.smooks.configuration.editors.input.InputType;
+import org.jboss.tools.smooks.model.core.IParam;
/**
* @author Dart (dpeng(a)redhat.com)
@@ -36,8 +32,8 @@
* .Object, int)
*/
public Image getColumnImage(Object element, int columnIndex) {
- if (element instanceof InputType) {
- String type = ((InputType) element).getType();
+ if (element instanceof IParam) {
+ String type = ((IParam) element).getType();
switch (columnIndex) {
case 0:
if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
@@ -67,29 +63,14 @@
* .Object, int)
*/
public String getColumnText(Object element, int columnIndex) {
- if (element instanceof InputType) {
- String value = ((InputType) element).getPath();
- if (value == null)
- value = ""; //$NON-NLS-1$
- String extValue = ""; //$NON-NLS-1$
- List<InputParameter> paramers = ((InputType) element).getParameters();
- for (Iterator<?> iterator = paramers.iterator(); iterator.hasNext();) {
- InputParameter paramType = (InputParameter) iterator.next();
-// if ("path".equalsIgnoreCase(paramType.getName())) {
-// continue;
-// }
- extValue += paramType.getName() + "=" + paramType.getValue() + ","; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (extValue.length() != 0) {
- extValue = extValue.substring(0, extValue.length() - 1);
- }
+ if (element instanceof IParam) {
+ IParam inputTypeParam = (IParam) element;
+
switch (columnIndex) {
case 0:
- return ((InputType) element).getType();
+ return inputTypeParam.getValue();
case 1:
- return value;
- case 2:
- return extValue;
+ return ""; //$NON-NLS-1$
}
}
return ""; //$NON-NLS-1$
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.IJavaProject;
@@ -44,8 +43,9 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
-import org.jboss.tools.smooks.configuration.editors.input.InputParameter;
-import org.jboss.tools.smooks.configuration.editors.input.InputType;
+import org.jboss.tools.smooks.configuration.editors.input.InputModelFactory;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import org.jboss.tools.smooks.configuration.editors.input.InvalidInputSourceTypeException;
import org.jboss.tools.smooks.configuration.editors.java.JavaBeanModel;
import org.jboss.tools.smooks.configuration.editors.java.JavaBeanModelFactory;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
@@ -54,9 +54,13 @@
import org.jboss.tools.smooks.configuration.editors.xml.TagList;
import org.jboss.tools.smooks.configuration.editors.xml.XMLObjectAnalyzer;
import org.jboss.tools.smooks.configuration.editors.xml.XSDObjectAnalyzer;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.GlobalParams;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
import org.milyn.javabean.dynamic.Model;
+import org.w3c.dom.Document;
/**
* @author Dart (dpeng(a)redhat.com)
@@ -251,119 +255,41 @@
});
}
- public static List<Object> generateInputData(SmooksModel smooksResourceListType , IJavaProject project) {
+ public static List<Object> generateInputData(SmooksModel smooksConfigModel , IJavaProject project) {
currentException = null;
List<Object> list = new ArrayList<Object>();
- if (smooksResourceListType != null) {
-// IJavaProject project = SmooksUIUtils.getJavaProject(smooksResourceListType.get);
- try {
- List<InputType> inputLists = SmooksUIUtils.getInputTypeList(smooksResourceListType);
- for (Iterator<?> iterator = inputLists.iterator(); iterator.hasNext();) {
- InputType inputType = (InputType) iterator.next();
- if (!inputType.isActived())
- continue;
- String type = inputType.getType();
- String path = inputType.getPath();
- if (type != null && path != null) {
- path = path.trim();
-// if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(type)
-// || SmooksModelUtils.INPUT_TYPE_EDI_1_2.equals(type)) {
-// EDIDataParser parser = new EDIDataParser();
-// try {
-// TagList tl = parser.parseEDIFile(path, smooksResourceListType);
-// if (tl != null) {
-// list.addAll(((TagList) tl).getChildren());
-// }
-// } catch (Throwable t) {
-// currentException = t;
-// }
-// }
-// if (SmooksModelUtils.INPUT_TYPE_CSV.equals(type)
-// || SmooksModelUtils.INPUT_TYPE_CSV_1_2.equals(type)) {
-// CSVDataParser parser = new CSVDataParser();
-// try {
-// TagList tl = parser.parseCSV(path, smooksResourceListType);
-// if (tl != null) {
-// list.addAll(((TagList) tl).getChildren());
-// }
-// } catch (Throwable t) {
-// currentException = t;
-// }
-// }
-// if (SmooksModelUtils.INPUT_TYPE_JSON_1_1.equals(type)
-// || SmooksModelUtils.INPUT_TYPE_JSON_1_2.equals(type)) {
-// try {
-// JsonInputDataParser parser = new JsonInputDataParser();
-// IXMLStructuredObject tagList = parser.parseJsonFile(SmooksUIUtils.parseFilePath(path),
-// smooksResourceListType);
-// if (tagList instanceof TagList) {
-// list.addAll(((TagList) tagList).getChildren());
-// } else {
-// list.add(tagList);
-// }
-// } catch (Throwable tt) {
-// currentException = tt;
-// }
-// }
- if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
- try {
- Class<?> clazz = SmooksUIUtils.loadClass(path, project);
- JavaBeanModel model = JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(clazz);
- if (model != null) {
+
+ if (smooksConfigModel != null) {
+ GlobalParams globalParams = smooksConfigModel.getParams();
+ IParam inputType = globalParams.getParam(SmooksModelUtils.INPUT_TYPE);
+
+ if(inputType != null) {
+ InputSourceType inputTypeEnum;
+ try {
+ inputTypeEnum = InputSourceType.fromTypeName(inputType.getValue());
+ InputModelFactory modelFactory = inputTypeEnum.getInputModelFactory();
+
+ if(modelFactory != null) {
+ Document modelDoc = modelFactory.getModel(smooksConfigModel, project);
+
+ if(modelDoc != null) {
+ AbstractXMLObject model = new XMLObjectAnalyzer().analyze(modelDoc, null , null);
+
+ if (model != null) {
+ if (model instanceof TagList) {
+ list.addAll(((TagList) model).getChildren());
+ } else {
list.add(model);
}
- } catch (Throwable t) {
- currentException = t;
}
}
- if (SmooksModelUtils.INPUT_TYPE_XSD.equals(type)) {
- try {
- path = SmooksUIUtils.parseFilePath(path);
- String rootElementName = null;
- List<InputParameter> paramers = inputType.getParameters();
- for (Iterator<?> iterator2 = paramers.iterator(); iterator2.hasNext();) {
- InputParameter paramType = (InputParameter) iterator2.next();
- String pn = paramType.getName();
- if ("rootElement".equals(pn)) { //$NON-NLS-1$
- rootElementName = paramType.getValue();
- break;
- }
- }
- if (rootElementName != null) {
- rootElementName = rootElementName.trim();
- list.add(new XSDObjectAnalyzer().loadElement(path, rootElementName));
- }
- } catch (Throwable tt) {
- currentException = tt;
- }
- }
- if (SmooksModelUtils.INPUT_TYPE_XML.equals(type)) {
- try {
- path = SmooksUIUtils.parseFilePath(path);
-
- // XMLObjectAnalyzer analyzer = new
- // XMLObjectAnalyzer();
- // TagList doc = analyzer.analyze(path, null);
-
- AbstractXMLObject model = new XMLObjectAnalyzer().analyze(path, null , null);
- if (model != null) {
- if (model instanceof TagList) {
- list.addAll(((TagList) model).getChildren());
- } else {
- list.add(model);
- }
- }
- } catch (Throwable e) {
- currentException = e;
- }
- }
}
+ } catch (Exception e) {
+ currentException = e;
}
- } catch (Exception e) {
- currentException = e;
- // SmooksConfigurationActivator.getDefault().log(e);
}
}
+
return list;
}
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -10,56 +10,35 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors;
-
-
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.EventObject;
import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.draw2d.ColorConstants;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.command.CommandWrapper;
import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.DeleteCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ICheckStateProvider;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableColorProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -67,14 +46,9 @@
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
@@ -85,17 +59,14 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.ScrolledPageBook;
import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.ide.IDE;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
-import org.jboss.tools.smooks.configuration.editors.input.InputType;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributor;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributorFactory;
import org.jboss.tools.smooks.configuration.editors.input.InvalidInputSourceTypeException;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
-import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
-import org.jboss.tools.smooks.configuration.editors.wizard.StructuredDataSelectionWizard;
-import org.jboss.tools.smooks.configuration.editors.wizard.ViewerInitorStore;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksModel;
import org.jboss.tools.smooks.model.core.ICoreFactory;
import org.jboss.tools.smooks.model.core.ICorePackage;
@@ -149,15 +120,11 @@
});
}
- private CheckboxTableViewer inputDataViewer;
private TreeViewer inputModelViewer;
private Combo readerCombo;
private Composite readerConfigComposite;
-// private ModelPanelCreator modelPanelCreator;
- protected boolean lockCheck = false;
- private Button removeInputDataButton;
- private Button addInputDataButton;
private ScrolledPageBook scrolledPageBook;
+ private InputTaskPanelContributor sourceTypeConfigurationContributor;
public SmooksReaderFormPage(FormEditor editor, String id, String title) {
super(editor, id, title);
@@ -189,9 +156,7 @@
final ScrolledForm form = managedForm.getForm();
FormToolkit toolkit = managedForm.getToolkit();
form.setText(""); //$NON-NLS-1$
- // toolkit.decorateFormHeading(form.getForm());
- // // create master details UI
- // createMasterDetailBlock(managedForm);
+
Composite leftComposite = toolkit.createComposite(form.getBody());
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 300;
@@ -212,9 +177,8 @@
rightComposite.setLayout(rgl);
createReaderSection(toolkit, leftComposite);
- createInputDataSection(toolkit, rightComposite);
- createReaderConfigSection(toolkit, leftComposite);
createInputModelViewerSection(toolkit, rightComposite);
+ createReaderConfigSection(toolkit, leftComposite);
handleReaderCombo(readerCombo);
@@ -224,21 +188,8 @@
gridLayout.horizontalSpacing = 20;
gridLayout.makeColumnsEqualWidth = true;
form.getBody().setLayout(gridLayout);
-
- refreshInputDataButtons();
}
- private void refreshInputDataButtons() {
- this.addInputDataButton.setEnabled(true);
- this.removeInputDataButton.setEnabled(true);
-
- String inputType = getSmooksModelProvider().getInputType();
- if (inputType == null || inputType.trim().equals("")) { //$NON-NLS-1$
- this.addInputDataButton.setEnabled(false);
- this.removeInputDataButton.setEnabled(false);
- }
- }
-
private void createInputModelViewerSection(FormToolkit toolkit, Composite parent) {
Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
GridData gd = new GridData(GridData.FILL_BOTH);
@@ -257,17 +208,10 @@
Hyperlink refreshLink = toolkit.createHyperlink(mainContainer, Messages.SmooksReaderFormPage_RefreshLinkLabel,
SWT.NONE);
refreshLink.addHyperlinkListener(new IHyperlinkListener() {
-
public void linkExited(HyperlinkEvent e) {
- // TODO Auto-generated method stub
-
}
-
public void linkEntered(HyperlinkEvent e) {
- // TODO Auto-generated method stub
-
}
-
public void linkActivated(HyperlinkEvent e) {
refreshInputModelView();
}
@@ -289,18 +233,15 @@
public void doubleClick(DoubleClickEvent event) {
}
});
- inputModelViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- // currentSelection = ((IStructuredSelection)
- // event.getSelection()).getFirstElement();
- }
- });
refreshInputModelView();
}
private void refreshInputModelView() {
+ inputModelViewer.setInput(new ArrayList<Object>());
+ inputModelViewer.refresh();
+
if (this.getManagedForm() != null) {
this.getManagedForm().getMessageManager().removeAllMessages();
}
@@ -352,13 +293,14 @@
section.setClient(scrolledPageBook);
readerConfigComposite = scrolledPageBook.createPage(scrolledPageBook);
- scrolledPageBook.showPage(scrolledPageBook);
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- readerConfigComposite.setLayout(gl);
-
initReaderConfigSection();
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ readerConfigComposite.setLayout(layout);
+ readerConfigComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ scrolledPageBook.showPage(scrolledPageBook);
}
private void initReaderConfigSection() {
@@ -374,9 +316,11 @@
private void addInputConfigControls() {
disposeCompositeControls(readerConfigComposite, null);
- getCurrentInputType().getConfigurationContributor().addInputConfigControls(this, readerConfigComposite);
+ InputTaskPanelContributorFactory taskPanelContributorFactory = getCurrentInputType().getTaskPanelContributorFactory();
+ sourceTypeConfigurationContributor = taskPanelContributorFactory.newInstance(getManagedForm().getToolkit(), this, getSmooksModel());
+ sourceTypeConfigurationContributor.setInputSourceConfigComposite(readerConfigComposite);
+ sourceTypeConfigurationContributor.addInputSourceTypeConfigControls();
- readerConfigComposite.layout();
scrolledPageBook.reflow(false);
}
@@ -408,251 +352,16 @@
} catch (InvalidInputSourceTypeException e) {
return InputSourceType.NONE;
}
- }
+ }
- protected void createInputDataSection(FormToolkit toolkit, Composite parent) {
- Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.DESCRIPTION | Section.TWISTIE
- | Section.EXPANDED);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- section.setLayoutData(gd);
- section.setText(Messages.SmooksReaderFormPage_InputDataSectionTitle);
- section.setDescription(Messages.SmooksReaderFormPage_InputDataSectionDes);
- FillLayout flayout = new FillLayout();
- section.setLayout(flayout);
-
- Composite mainComposite = toolkit.createComposite(section, SWT.NONE);
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- mainComposite.setLayout(gl);
- section.setClient(mainComposite);
-
- Composite tableComposite = toolkit.createComposite(mainComposite, SWT.NONE);
- FillLayout fillLayout = new FillLayout();
- fillLayout.marginHeight = 1;
- fillLayout.marginWidth = 1;
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 70;
- tableComposite.setLayoutData(gd);
- tableComposite.setBackground(GraphicsConstants.BORDER_CORLOR);
- tableComposite.setLayout(fillLayout);
-
- inputDataViewer = CheckboxTableViewer.newCheckList(tableComposite, SWT.MULTI | SWT.FULL_SELECTION);
- // inputDataViewer.set
- inputDataViewer.setCheckStateProvider(new ICheckStateProvider() {
-
- public boolean isGrayed(Object element) {
- return !isValidInputType((InputType) element);
- }
-
- public boolean isChecked(Object element) {
- if (element instanceof InputType) {
- return ((InputType) element).isActived();
- }
- return false;
- }
- });
- inputDataViewer.addCheckStateListener(new ICheckStateListener() {
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (lockCheck)
- return;
- boolean checked = event.getChecked();
- InputType inputType = (InputType) event.getElement();
- if (!isValidInputType(inputType)) {
- lockCheck = true;
- inputDataViewer.setChecked(inputType, false);
- lockCheck = false;
- return;
- }
- CompoundCommand compoundCommand = new CompoundCommand();
- if (checked) {
- IParam param = SmooksUIUtils.getInputTypeAssociatedParamType(inputType,
- getSmooksConfigResourceList());
- if (param != null) {
- inputType.setActived(checked);
- String value = SmooksModelUtils.INPUT_ACTIVE_TYPE;
- Command c = SetCommand.create(getEditingDomain(), param,
- ICorePackage.Literals.PARAM__TYPE, value);
- if (c.canExecute())
- compoundCommand.append(c);
- }
-
- Object[] checkedObjects = inputDataViewer.getCheckedElements();
- for (int i = 0; i < checkedObjects.length; i++) {
- InputType type = (InputType) checkedObjects[i];
- if (type == inputType) {
- continue;
- }
- type.setActived(!checked);
- IParam param1 = SmooksUIUtils.getInputTypeAssociatedParamType(type,
- getSmooksConfigResourceList());
- if (param1 != null) {
- String value1 = SmooksModelUtils.INPUT_DEACTIVE_TYPE;
- Command c1 = SetCommand.create(getEditingDomain(), param1,
- ICorePackage.Literals.PARAM__TYPE, value1);
- compoundCommand.append(c1);
- }
-
- lockCheck = true;
- inputDataViewer.setChecked(type, false);
- lockCheck = false;
- }
-
- } else {
- IParam param = SmooksUIUtils.getInputTypeAssociatedParamType(inputType,
- getSmooksConfigResourceList());
- if (param != null) {
- String value = SmooksModelUtils.INPUT_DEACTIVE_TYPE;
- Command c = SetCommand.create(getEditingDomain(), param,
- ICorePackage.Literals.PARAM__TYPE, value);
- compoundCommand.append(c);
- }
- }
- try {
- getEditingDomain().getCommandStack().execute(compoundCommand);
- } catch (Exception e) {
- // e.printStackTrace();
- }
-
- // refreshInputModelView();
- }
- });
- inputDataViewer.addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object element = selection.getFirstElement();
- if (element instanceof InputType) {
- String type = ((InputType) element).getType();
- String filePath = ((InputType) element).getPath();
- if (type != null && filePath != null) {
- if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
- IFile file = ((IFileEditorInput) getEditorInput()).getFile();
- IJavaProject javaProject = JavaCore.create(file.getProject());
- if (javaProject != null) {
- try {
- if (filePath.endsWith("[]")) { //$NON-NLS-1$
- filePath = filePath.substring(0, filePath.length() - 2);
- }
- IJavaElement result = javaProject.findType(filePath);
- if (result != null)
- JavaUI.openInEditor(result);
- else {
- MessageDialog.openError(getSite().getWorkbenchWindow().getShell(),
- Messages.SmooksReaderFormPage_CantFindTypeErrorTitle,
- "Can't find type \"" + filePath + "\" in \"" //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- + javaProject.getProject().getName() + "\" project."); //$NON-NLS-1$
- }
- } catch (Exception e) {
-
- }
- }
- } else {
- try {
- filePath = SmooksUIUtils.parseFilePath(filePath);
- if (filePath != null) {
- IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(filePath));
- IFileInfo fetchInfo = fileStore.fetchInfo();
- if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- IWorkbenchPage page = window.getActivePage();
- try {
- IDE.openEditorOnFileStore(page, fileStore);
- } catch (PartInitException e) {
- MessageDialog.open(MessageDialog.ERROR, window.getShell(),
- Messages.SmooksReaderFormPage_OpenFileErrorTitle,
- "Can't open the file : '" + filePath + "'", SWT.SHEET); //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else {
- }
- }
- } catch (Exception e) {
- MessageDialog.open(MessageDialog.ERROR, getSite().getWorkbenchWindow().getShell(),
- Messages.SmooksReaderFormPage_OpenFileErrorTitle,
- "Can't open the file : '" + filePath + "'", SWT.SHEET); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- }
- }
- }
- });
- TableColumn header = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
- header.setText(Messages.SmooksReaderFormPage_TypeColumnText);
- header.setWidth(100);
- TableColumn pathColumn = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
- pathColumn.setText(Messages.SmooksReaderFormPage_PathColumnText);
- pathColumn.setWidth(300);
-
- // TableColumn extColumn = new TableColumn(inputDataViewer.getTable(),
- // SWT.NONE);
- // extColumn.setText("Extension Paramers");
- // extColumn.setWidth(400);
- inputDataViewer.setContentProvider(new ExtentionInputContentProvider());
- inputDataViewer.setLabelProvider(new InputDataViewerLabelProvider());
- inputDataViewer.getTable().setHeaderVisible(true);
- inputDataViewer.getTable().setLinesVisible(true);
- ISmooksModelProvider provider = getSmooksModelProvider();
- if (provider != null) {
- inputDataViewer.setInput(SmooksUIUtils.getInputTypeList(getSmooksConfigResourceList().getModelRoot()));
- }
- Composite buttonComposite = toolkit.createComposite(mainComposite, SWT.NONE);
- gd = new GridData(GridData.FILL_VERTICAL);
- buttonComposite.setLayoutData(gd);
- GridLayout l = new GridLayout();
- buttonComposite.setLayout(l);
-
- addInputDataButton = toolkit.createButton(buttonComposite, Messages.SmooksReaderFormPage_AddButtonLabel,
- SWT.FLAT);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- addInputDataButton.setLayoutData(gd);
- addInputDataButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- showInputDataWizard();
- }
-
- });
-
- removeInputDataButton = toolkit.createButton(buttonComposite, Messages.SmooksReaderFormPage_DeleteButtonLabel,
- SWT.FLAT);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- removeInputDataButton.setLayoutData(gd);
- removeInputDataButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection selection = (IStructuredSelection) inputDataViewer.getSelection();
- if (selection != null) {
- List<?> inputs = selection.toList();
- ISmooksModelProvider smooksModelProvider = getSmooksModelProvider();
- for (Iterator<?> iterator = inputs.iterator(); iterator.hasNext();) {
- InputType input = (InputType) iterator.next();
- SmooksUIUtils.removeInputType(input, smooksModelProvider);
- }
- if (!inputs.isEmpty()) {
- List<?> viewerInput = (List<?>) inputDataViewer.getInput();
- viewerInput.removeAll(inputs);
- // inputTypeChanged();
- if (inputDataViewer != null) {
- inputDataViewer.refresh();
- }
- }
- }
- }
- });
- }
-
-
protected boolean handleInputParamChange(Command command) {
Collection<?> affectedObjects = command.getAffectedObjects();
boolean refreshInputModel = false;
- for (Iterator<?> iterator2 = affectedObjects.iterator(); iterator2.hasNext();) {
- Object object = (Object) iterator2.next();
-// if (object instanceof AbstractReader) {
-// refreshInputModel = true;
-// break;
-// }
- if (object instanceof IParam) {
- if (SmooksUIUtils.isInputParamType((IParam) object)) {
+
+ for (Object affectedObject : affectedObjects) {
+
+ if (affectedObject instanceof IParam) {
+ if (InputSourceType.isValidName(((IParam)affectedObject).getName())) {
refreshInputModel = true;
break;
}
@@ -665,14 +374,9 @@
deletedObjs = ((RemoveCommand) command).getCollection();
}
if (deletedObjs != null) {
- for (Iterator<?> iterator = deletedObjs.iterator(); iterator.hasNext();) {
- Object object2 = (Object) iterator.next();
-// if (object2 instanceof AbstractReader) {
-// refreshInputModel = true;
-// break;
-// }
- if (object2 instanceof IParam) {
- if (SmooksUIUtils.isInputParamType((IParam) object2)) {
+ for (Object deletedObject : deletedObjs) {
+ if (deletedObject instanceof IParam) {
+ if (InputSourceType.isValidName(((IParam)deletedObject).getName())) {
refreshInputModel = true;
break;
}
@@ -694,26 +398,10 @@
return getSmooksModelProvider().getEditingDomain();
}
- protected Model<SmooksModel> getSmooksConfigResourceList() {
+ protected Model<SmooksModel> getSmooksModel() {
return getSmooksModelProvider().getSmooksModel();
}
- protected boolean isValidInputType(InputType element) {
- if (element == null) {
- // not specified is OK...
- return true;
- }
-
- String type = element.getType();
- int selectionIndex = readerCombo.getSelectionIndex();
-
- try {
- return InputSourceType.isValidIndexNamePair(selectionIndex, type);
- } catch (InvalidInputSourceTypeException e) {
- return false;
- }
- }
-
private void createReaderSection(FormToolkit toolkit, Composite parent) {
Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
@@ -817,16 +505,16 @@
CompoundCommand compoundCommand = new CompoundCommand();
- IGlobalParams params = getSmooksConfigResourceList().getModelRoot().getParams();
+ IGlobalParams params = getSmooksModel().getModelRoot().getParams();
if (params == null) {
params = ICoreFactory.eINSTANCE.createGlobalParams();
- Command addparamsCommand = SetCommand.create(getEditingDomain(), getSmooksConfigResourceList().getModelRoot(),
+ Command addparamsCommand = SetCommand.create(getEditingDomain(), getSmooksModel().getModelRoot(),
ICorePackage.Literals.PARAMS, params);
if (addparamsCommand.canExecute())
compoundCommand.append(addparamsCommand);
}
- IParam param = SmooksUIUtils.getInputTypeParam(getSmooksConfigResourceList().getModelRoot());
+ IParam param = SmooksUIUtils.getInputTypeParam(getSmooksModel().getModelRoot());
if (param == null) {
// add new one
param = ICoreFactory.eINSTANCE.createParam();
@@ -857,20 +545,15 @@
addInputConfigControls();
- deactiveAllInputFile(compoundCommand);
if (!compoundCommand.isEmpty() && compoundCommand.canExecute()) {
getEditingDomain().getCommandStack().execute(compoundCommand);
}
- if (inputDataViewer != null) {
- inputDataViewer.refresh();
- }
refreshInputModelView();
- refreshInputDataButtons();
}
private Command createRemoveReaderCommand() {
- Model<SmooksModel> rlist = getSmooksConfigResourceList();
+ Model<SmooksModel> rlist = getSmooksModel();
// List<AbstractReader> readerList = rlist.getAbstractReader();
CompoundCommand compoundCommand = new CompoundCommand();
// for (Iterator<?> iterator = readerList.iterator(); iterator.hasNext();) {
@@ -889,118 +572,8 @@
// }
return compoundCommand;
}
-
- protected void showInputDataWizard() {
- CompoundCommand compoundCommand = new CompoundCommand();
- // SmooksGraphicsExtType extType = getSmooksGraphicsExtType();
- String inputType = getSmooksModelProvider().getInputType();
- List<InputType> inputTypes = null;
- Model<SmooksModel> smooksModel = getSmooksConfigResourceList();
- SmooksModel rootModel = smooksModel.getModelRoot();
- if (inputType == null || SmooksModelUtils.INPUT_TYPE_CUSTOME.equals(inputType) || inputType.trim().equals("")) { //$NON-NLS-1$
- StructuredDataSelectionWizard wizard = new StructuredDataSelectionWizard();
- wizard.setInput(getEditorInput());
- wizard.setSite(getEditorSite());
- wizard.setForcePreviousAndNextButtons(true);
- StructuredDataSelectionWizardDailog dialog = new StructuredDataSelectionWizardDailog(getEditorSite()
- .getShell(), wizard);
- if (dialog.show() == Dialog.OK) {
- String type = dialog.getType();
- String path = dialog.getPath();
- Properties pros = dialog.getProperties();
- inputTypes = SmooksUIUtils.recordInputDataInfomation(getEditingDomain(),rootModel.getParams() , type, path, pros, compoundCommand);
- }
- } else {
- IStructuredDataSelectionWizard wizard = ViewerInitorStore.getInstance().getStructuredDataCreationWizard(
- inputType);
- WizardDialog dialog = new WizardDialog(getEditorSite().getShell(), wizard);
- wizard.init(getEditorSite(), getEditorInput());
- if (dialog.open() == Dialog.OK) {
- String path = wizard.getStructuredDataSourcePath();
- Properties pros = wizard.getProperties();
- inputTypes = SmooksUIUtils.recordInputDataInfomation(getEditingDomain(), rootModel.getParams(), inputType, path, pros, compoundCommand);
- }
- }
-
- if (inputTypes != null && !inputTypes.isEmpty()) {
- InputType addedInputType = inputTypes.get(0);
- Object obj = this.inputDataViewer.getInput();
- if (obj != null && obj instanceof List) {
- ((List) obj).add(addedInputType);
- }
-
- deactiveAllInputFile(compoundCommand);
- if (inputType.equals(SmooksModelUtils.INPUT_TYPE_CUSTOME)) {
- // don't active the input file
- } else {
- addedInputType.setActived(true);
- IParam param = addedInputType.getRelatedParameter();
- if (param != null) {
- String value = SmooksModelUtils.INPUT_ACTIVE_TYPE;
- Command c = SetCommand.create(this.getEditingDomain(), param,
- ICorePackage.Literals.PARAM__TYPE, value);
- if (c.canExecute()) {
- compoundCommand.append(c);
- }
- }
- }
- if (!compoundCommand.isEmpty()) {
- getSmooksModelProvider().getEditingDomain().getCommandStack().execute(compoundCommand);
- }
- if (inputDataViewer != null)
- inputDataViewer.refresh();
- }
- }
-
- private void deactiveAllInputFile(CompoundCommand command) {
- Object viewerInput = this.inputDataViewer.getInput();
- if (viewerInput != null && viewerInput instanceof List<?>) {
- List<InputType> inputList = (List) viewerInput;
- for (Iterator<?> iterator = inputList.iterator(); iterator.hasNext();) {
- InputType inputType = (InputType) iterator.next();
- setInputDataActiveStatus(false, inputType, command);
- }
- }
- }
-
- private void setInputDataActiveStatus(boolean active, InputType inputType, final CompoundCommand command) {
- inputType.setActived(active);
- IParam param = SmooksUIUtils.getInputTypeAssociatedParamType(inputType, getSmooksConfigResourceList());
- if (param != null) {
- String value = SmooksModelUtils.INPUT_ACTIVE_TYPE;
- if (!active) {
- value = SmooksModelUtils.INPUT_DEACTIVE_TYPE;
- }
- Command c = SetCommand.create(this.getEditingDomain(), param, ICorePackage.Literals.PARAM__TYPE,
- value);
- if (command != null) {
- command.append(c);
- } else {
- getEditingDomain().getCommandStack().execute(c);
- }
- }
- }
-
-
public void sourceChange(Object model) {
}
-
- private class InputDataViewerLabelProvider extends ExtentionInputLabelProvider implements ITableColorProvider {
-
- public Color getBackground(Object element, int columnIndex) {
- if (!isValidInputType((InputType) element)) {
- // return ColorConstants.darkGray;
- }
- return null;
- }
-
- public Color getForeground(Object element, int columnIndex) {
- if (!isValidInputType((InputType) element)) {
- return ColorConstants.lightGray;
- }
- return null;
- }
- }
}
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,102 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors.file;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.smooks.configuration.editors.xml.Messages;
+
+/**
+ *
+ * @author Dart Peng Date : 2008-8-13
+ */
+public abstract class AbstractFileSelectionWizardPage extends WizardPage {
+
+ protected FileSelectionPageComponent fileSelectionPageComponent;
+
+ protected IStructuredSelection selection;
+ protected Object returnObject = null;
+ protected Object[] initSelections;
+ protected List<ViewerFilter> filters = new ArrayList<ViewerFilter>();
+ protected boolean multiSelect = false;
+ protected boolean reasourceLoaded = false;
+
+ protected String[] fileExtensionNames;
+
+ public AbstractFileSelectionWizardPage(String pageName, boolean multiSelect, Object[] initSelections, List<ViewerFilter> filters,String[] fileExtensionNames) {
+ super(pageName);
+ fileSelectionPageComponent = new FileSelectionPageComponent(getShell(), multiSelect, initSelections, filters, fileExtensionNames);
+ }
+
+ public AbstractFileSelectionWizardPage(String pageName, boolean multiSelect, Object[] initSelections, List<ViewerFilter> filters) {
+ super(pageName);
+ fileSelectionPageComponent = new FileSelectionPageComponent(getShell(), multiSelect, initSelections, filters);
+ }
+
+ public AbstractFileSelectionWizardPage(String pageName, String[] fileExtensionNames) {
+ super(pageName);
+ fileSelectionPageComponent = new FileSelectionPageComponent(getShell(), fileExtensionNames);
+ }
+
+ public void createControl(Composite parent) {
+ Composite mainComposite = new Composite(parent, SWT.NONE);
+
+ fileSelectionPageComponent.createControl(mainComposite);
+
+ this.setControl(mainComposite);
+
+ changeWizardPageStatus();
+ // don't show the error message when first open the dialog
+ this.setErrorMessage(null);
+ parent.getShell().setText(Messages.AbstractFileSelectionWizardPage_WizardTitle);
+
+ fileSelectionPageComponent.addFileSelectionListener(new FileSelectionListener() {
+ public void fileSelected(String fileName) {
+ changeWizardPageStatus();
+ }
+ });
+ }
+
+ protected void changeWizardPageStatus() {
+ String text = getFilePath();
+ String error = null;
+
+ if (text == null || "".equals(text)) { //$NON-NLS-1$
+ error = "File name cannot be null"; //$NON-NLS-1$
+ }
+
+ this.setErrorMessage(error);
+ this.setPageComplete(error == null);
+ }
+
+ public String getFilePath() {
+ return fileSelectionPageComponent.getFilePath();
+ }
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+ public Object[] getInitSelections() {
+ return initSelections;
+ }
+
+ public void setInitSelections(Object[] initSelections) {
+ this.initSelections = initSelections;
+ }
+
+ public Object getReturnValue() {
+ return null;
+ }
+
+ public void setFileExtensionNames(String[] fileExtensionNames) {
+ fileSelectionPageComponent.setFileExtensionNames(fileExtensionNames);
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.file;
+
+/**
+ * File Selected listener.
+ *
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public interface FileSelectionListener {
+
+ /**
+ * File Selected event.
+ * @param fileName The file name of the selected file.
+ */
+ void fileSelected(String fileName);
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,345 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors.file;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.smooks.configuration.editors.IFilePathProcessor;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+
+/**
+ *
+ *
+ * @author Dart Peng Date : 2008-8-13
+ */
+public class FileSelectionPageComponent {
+
+ private String label = "File : "; //$NON-NLS-1$
+ protected Text filePathWidget;
+ private String filePath;
+ protected Composite fileTextComposite;
+ protected CheckboxTableViewer tableViewer = null;
+ protected Button fileSystemBrowseButton;
+ protected boolean reasourceLoaded = false;
+ protected Button workspaceBrowseButton;
+ private List<FileSelectionListener> fileSelectionListeners = new ArrayList<FileSelectionListener>();
+ protected Object[] initSelections;
+ protected List<ViewerFilter> filters = new ArrayList<ViewerFilter>();
+ protected boolean multiSelect = false;
+ private IFilePathProcessor filePathProcessor = null;
+ protected String[] fileExtensionNames;
+ private Shell shell;
+
+ public FileSelectionPageComponent(Shell shell, boolean multiSelect, Object[] initSelections, List<ViewerFilter> filters,String[] fileExtensionNames) {
+ this(shell, false, initSelections, Collections.EMPTY_LIST);
+ this.fileExtensionNames = fileExtensionNames;
+ createFileExtensionNameFilter();
+ }
+
+ public FileSelectionPageComponent(Shell shell, boolean multiSelect, Object[] initSelections, List<ViewerFilter> filters) {
+ this.shell = shell;
+ this.initSelections = initSelections;
+ if (filters != null) {
+ this.filters.addAll(filters);
+ }
+ this.multiSelect = multiSelect;
+ }
+
+ public FileSelectionPageComponent(Shell shell, String[] fileExtensionNames) {
+ this.shell = shell;
+ this.fileExtensionNames = fileExtensionNames;
+ createFileExtensionNameFilter();
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public void addFileSelectionListener(FileSelectionListener listener) {
+ fileSelectionListeners.add(listener);
+ }
+
+ public void removeFileSelectionListener(FileSelectionListener listener) {
+ fileSelectionListeners.remove(listener);
+ }
+
+ private void notifyFileSelectionListeners() {
+ filePath = filePathWidget.getText();
+ for(FileSelectionListener listener : fileSelectionListeners) {
+ listener.fileSelected(filePath);
+ }
+ }
+
+ /**
+ * @return the fileExtensionNames
+ */
+ public String[] getFileExtensionNames() {
+ return fileExtensionNames;
+ }
+
+ /**
+ * @param fileExtensionNames the fileExtensionNames to set
+ */
+ public void setFileExtensionNames(String[] fileExtensionNames) {
+ this.fileExtensionNames = fileExtensionNames;
+ }
+
+ public void createFileExtensionNameFilter(){
+ if (this.fileExtensionNames != null && this.fileExtensionNames.length != 0) {
+ ViewerFilter extensionNameFilter = new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IFile && fileExtensionNames != null) {
+ String extName = ((IFile) element).getFileExtension();
+ for (int i = 0; i < fileExtensionNames.length; i++) {
+ String name = fileExtensionNames[i];
+ if (name.equalsIgnoreCase(extName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+ };
+ this.filters.add(extensionNameFilter);
+ }
+ }
+
+ public IFilePathProcessor getFilePathProcessor() {
+ return filePathProcessor;
+ }
+
+ public void setFilePathProcessor(IFilePathProcessor filePathProcessor) {
+ this.filePathProcessor = filePathProcessor;
+ }
+
+ public void createControl(Composite mainComposite) {
+ GridLayout layout = new GridLayout();
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ layout.numColumns = 1;
+ mainComposite.setLayout(layout);
+ mainComposite.setLayoutData(gd);
+
+ createFileSelectionComposite(mainComposite);
+
+ // register the listener for controls
+ hookFileTextModifyListener();
+ hookBrowseButtonSelectionAdapter();
+ }
+
+ private void hookFileTextModifyListener() {
+ filePathWidget.addFocusListener(new FocusListener() {
+ public void focusGained(FocusEvent arg0) {
+ }
+ public void focusLost(FocusEvent arg0) {
+ notifyFileSelectionListeners();
+ }});
+ filePathWidget.addKeyListener(new KeyListener() {
+ public void keyReleased(KeyEvent event) {
+ }
+ public void keyPressed(KeyEvent event) {
+ if(event.character == '\r') {
+ notifyFileSelectionListeners();
+ }
+ }
+ });
+ }
+
+ private void hookBrowseButtonSelectionAdapter() {
+ SelectionAdapter browseButtonSelectionAdapter = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Text relationT = null;
+ if (e.getSource() == fileSystemBrowseButton) {
+ relationT = filePathWidget;
+ }
+ openFileSelection(relationT);
+ }
+ };
+ SelectionAdapter wbrowseButtonSelectionAdapter = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Text relationT = null;
+ if (e.getSource() == workspaceBrowseButton) {
+ relationT = filePathWidget;
+ }
+ openWorkSpaceSelection(relationT);
+ }
+
+ };
+
+ workspaceBrowseButton.addSelectionListener(wbrowseButtonSelectionAdapter);
+ // xmlFileSystemBrowseButton
+ // .addSelectionListener(browseButtonSelectionAdapter);
+ fileSystemBrowseButton.addSelectionListener(browseButtonSelectionAdapter);
+ }
+
+ protected String processFileSystemFilePath(String path) {
+ if (filePathProcessor != null) {
+ String s = filePathProcessor.processFileSystemPath(path);
+ if (s != null) {
+ return s;
+ }
+ }
+ path = SmooksUIUtils.FILE_PRIX + path;
+ return path;
+ }
+
+ protected String processWorkSpaceFilePath(IFile file) {
+ if (filePathProcessor != null) {
+ String s = filePathProcessor.processWorkBenchPath(file);
+ if (s != null) {
+ return s;
+ }
+ }
+ String s = file.getFullPath().toPortableString();
+ s = SmooksUIUtils.WORKSPACE_PRIX + s;
+ return s;
+ }
+
+ public Text createFilePathText(Composite parent) {
+ fileTextComposite = new Composite(parent, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.grabExcessHorizontalSpace = true;
+ fileTextComposite.setLayoutData(gd);
+ GridLayout xsdtgl = new GridLayout();
+ xsdtgl.marginWidth = 0;
+ xsdtgl.marginHeight = 0;
+ xsdtgl.numColumns = 1;
+ fileTextComposite.setLayout(xsdtgl);
+
+ Text fileText = new Text(fileTextComposite, SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fileText.setLayoutData(gd);
+ gd.grabExcessHorizontalSpace = true;
+
+ return fileText;
+ }
+
+ protected Composite createFileSelectionComposite(Composite parent) {
+ Composite xsdComposite = new Composite(parent, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ xsdComposite.setLayoutData(gd);
+ GridLayout xsdLayout = new GridLayout();
+ xsdLayout.numColumns = 2;
+ xsdLayout.marginWidth = 0;
+ xsdComposite.setLayout(xsdLayout);
+ Label nfileLanel = new Label(xsdComposite, SWT.NONE);
+ nfileLanel.setText(label);
+
+ filePathWidget = createFilePathText(xsdComposite);
+
+ Composite browseButtonComposite = new Composite(xsdComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ browseButtonComposite.setLayoutData(gd);
+
+ GridLayout bg = new GridLayout();
+ bg.numColumns = 2;
+ bg.marginHeight = 0;
+ bg.marginWidth = 0;
+ bg.makeColumnsEqualWidth = false;
+ browseButtonComposite.setLayout(bg);
+
+ fileSystemBrowseButton = new Button(browseButtonComposite, SWT.NONE);
+ fileSystemBrowseButton.setText(Messages.FileSelectionPageComponent_Browse_FileSys_Button);
+
+ workspaceBrowseButton = new Button(browseButtonComposite, SWT.NONE);
+ workspaceBrowseButton.setText(Messages.FileSelectionPageComponent_Browse_Workspace_Button);
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.END;
+ workspaceBrowseButton.setLayoutData(gd);
+
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = GridData.END;
+ fileSystemBrowseButton.setLayoutData(gd);
+
+ return xsdComposite;
+ }
+
+ protected void setCompositeChildrenEnabled(Composite composite, boolean enabled) {
+ Control[] children = composite.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if (child instanceof Text) {
+ child.setEnabled(enabled);
+ }
+ if (child instanceof Button) {
+ child.setEnabled(enabled);
+ }
+ if (child instanceof Composite) {
+ setCompositeChildrenEnabled((Composite) child, enabled);
+ }
+ }
+ }
+
+ private void openFileSelection(Text relationText) {
+ FileDialog dialog = new FileDialog(shell);
+ if (fileExtensionNames != null) {
+ String s = ""; //$NON-NLS-1$
+ for (int i = 0; i < fileExtensionNames.length; i++) {
+ String exname = fileExtensionNames[i];
+ s += "*." + exname + ";"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (s.length() != 0) {
+ s = s.substring(0, s.length() - 1);
+ dialog.setFilterExtensions(new String[]{s,"*.*"}); //$NON-NLS-1$
+ }
+ }
+ String path = dialog.open();
+ if (path != null) {
+ path = processFileSystemFilePath(path);
+ relationText.setText(path);
+ notifyFileSelectionListeners();
+ }
+ }
+
+ private void openWorkSpaceSelection(Text relationT) {
+ IFile[] files = WorkspaceResourceDialog.openFileSelection(shell,
+ "Select Files", "", false, initSelections, filters); //$NON-NLS-1$ //$NON-NLS-2$
+ // dialog.setInitialSelections(selectedResources);
+ if (files.length > 0) {
+ IFile file = files[0];
+ String s = processWorkSpaceFilePath(file);
+ relationT.setText(s);
+ notifyFileSelectionListeners();
+ }
+ }
+
+ public String getFilePath() {
+ return filePath;
+ }
+
+ public void setFilePath(String filePath) {
+ if(!filePathWidget.isDisposed()) {
+ filePathWidget.setText(filePath);
+ }
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,17 @@
+package org.jboss.tools.smooks.configuration.editors.file;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ public static String FileSelectionPageComponent_Browse_FileSys_Button;
+ public static String FileSelectionPageComponent_Browse_Workspace_Button;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(Messages.class.getPackage().getName() + ".messages", Messages.class); //$NON-NLS-1$
+ }
+
+ private Messages() {
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/messages.properties
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/messages.properties (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/messages.properties 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,2 @@
+FileSelectionPageComponent_Browse_FileSys_Button=Browse File System...
+FileSelectionPageComponent_Browse_Workspace_Button=Browse Workspace...
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Input Source Model Factory.
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public interface InputModelFactory {
+
+ /**
+ * Get the input message model for the specified {@link SmooksModel} instance.
+ * @param smooksConfigModel The Smooks model instance.
+ * @param project The Eclipse project.
+ * @return The model.
+ * @throws ModelBuilderException Error building model.
+ */
+ Document getModel(SmooksModel smooksConfigModel, IJavaProject project) throws ModelBuilderException;
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputParameter.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputParameter.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputParameter.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -1,51 +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.smooks.configuration.editors.input;
-
-/**
- * @author Dart
- *
- */
-public class InputParameter {
- private String name;
-
- private String value;
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
-
-
-}
Deleted: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.smooks.configuration.editors.input;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.editor.FormPage;
-
-/**
- *
- * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
- */
-public interface InputReaderConfigurationContributor {
-
- /**
- * Add the input configuration controls to the Input Configuration area
- * of the input task panel.
- * @param formPage The composite parent {@link FormPage}.
- * @param configComposite The task panel Composite.
- */
- void addInputConfigControls(FormPage formPage, Composite configComposite);
-}
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -10,7 +10,12 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.input;
-import org.jboss.tools.smooks.configuration.editors.input.contributors.SimpleMessageContributor;
+import org.jboss.tools.smooks.configuration.editors.input.contributors.SampleDataConfigurationContributorFactory;
+import org.jboss.tools.smooks.configuration.editors.input.contributors.SimpleMessageContributorFactory;
+import org.jboss.tools.smooks.configuration.editors.input.contributors.XSDConfigurationContributorFactory;
+import org.jboss.tools.smooks.configuration.editors.input.model.JavaInputModelFactory;
+import org.jboss.tools.smooks.configuration.editors.input.model.XMLInputModelFactory;
+import org.jboss.tools.smooks.configuration.editors.input.model.XSDInputModelFactory;
/**
* Smooks filter input Source type.
@@ -20,27 +25,34 @@
public enum InputSourceType {
// NOTE: If a new type is added, be sure and update the fromTypeIndex/fromTypeName static methods !!!
- NONE(0, new SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Input_Type)),
- XML(1, new SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Sample_Data)),
- XSD(2, new SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Sample_Data)),
- JAVA(3, new SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Sample_Data));
+ NONE(0, new SimpleMessageContributorFactory(Messages.InputSourceType_Warning_Specify_Input_Type), null),
+ XML(1, new SampleDataConfigurationContributorFactory(), new XMLInputModelFactory()),
+ XSD(2, new XSDConfigurationContributorFactory(), new XSDInputModelFactory()),
+ JAVA(3, new SimpleMessageContributorFactory(Messages.InputSourceType_Warning_Specify_Sample_Data), new JavaInputModelFactory());
private int typeIndex;
- private InputReaderConfigurationContributor configurationContributor;
+ private InputTaskPanelContributorFactory taskPanelContributorFactory;
+ private InputModelFactory inputModelFactory;
- InputSourceType(int typeIndex, InputReaderConfigurationContributor configurationContributor) {
+ InputSourceType(int typeIndex, InputTaskPanelContributorFactory configurationContributorFactory, InputModelFactory inputModelFactory) {
this.typeIndex = typeIndex;
- this.configurationContributor = configurationContributor;
+ this.taskPanelContributorFactory = configurationContributorFactory;
+ this.inputModelFactory = inputModelFactory;
+ configurationContributorFactory.setInputSourceType(this);
}
public int getTypeIndex() {
return typeIndex;
}
- public InputReaderConfigurationContributor getConfigurationContributor() {
- return configurationContributor;
+ public InputTaskPanelContributorFactory getTaskPanelContributorFactory() {
+ return taskPanelContributorFactory;
}
+ public InputModelFactory getInputModelFactory() {
+ return inputModelFactory;
+ }
+
public boolean isType(int typeIndex) {
return (this.typeIndex == typeIndex);
}
@@ -65,7 +77,7 @@
return InputSourceType.NONE;
}
- throw new InvalidInputSourceTypeException("");
+ throw new InvalidInputSourceTypeException(Messages.InputSourceType_Unknown_Input_Type_Index + " " + typeIndex);
}
public static InputSourceType fromTypeName(String typeName) throws InvalidInputSourceTypeException {
@@ -80,9 +92,18 @@
return InputSourceType.NONE;
}
- throw new InvalidInputSourceTypeException("");
+ throw new InvalidInputSourceTypeException(Messages.InputSourceType_Unknown_Input_Type_Name + " " + typeName);
}
+ public static boolean isValidName(String typeName) {
+ try {
+ fromTypeName(typeName);
+ return true;
+ } catch (InvalidInputSourceTypeException e) {
+ return false;
+ }
+ }
+
public static boolean isValidIndexNamePair(int typeIndex, String typeName) throws InvalidInputSourceTypeException {
return (fromTypeIndex(typeIndex) == fromTypeName(typeName));
}
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Input task panel contributor.
+ *
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public interface InputTaskPanelContributor {
+
+ /**
+ * Set the Input Type Source configuration Composite on the contributor instance.
+ * @param inputSourceConfigComposite Input Source Type configuration Composite.
+ */
+ void setInputSourceConfigComposite(Composite inputSourceConfigComposite);
+
+ /**
+ * Add the input configuration controls to the Input Configuration area
+ * of the input task panel.
+ */
+ void addInputSourceTypeConfigControls();
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input;
+
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.EditorPart;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * Input task panel contributor Factory.
+ *
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public interface InputTaskPanelContributorFactory {
+
+ /**
+ * Set the {@link InputSourceType} associated with the factory instance.
+ * @param inputSourceType The {@link InputSourceType} associated with the factory instance.
+ */
+ void setInputSourceType(InputSourceType inputSourceType);
+
+ /**
+ * Create a new contributor instance.
+ * @param toolkit The associate Form Toolkit instance.
+ * @param editorPart Editor part.
+ * @param configModel The Smooks configuration model.
+ * @return The contributor instance.
+ */
+ InputTaskPanelContributor newInstance(FormToolkit toolkit, EditorPart editorPart, Model<SmooksModel> configModel);
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputType.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputType.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputType.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -1,90 +0,0 @@
-package org.jboss.tools.smooks.configuration.editors.input;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.tools.smooks.model.core.IParam;
-
-public class InputType {
- private String path;
- private String type;
- private boolean actived = false;
-
- private IParam relatedParameter = null;
-
- private List<InputParameter> parameters = null;
-
- /**
- * @return the parameters
- */
- public List<InputParameter> getParameters() {
- if (parameters == null) {
- parameters = new ArrayList<InputParameter>();
- }
- return parameters;
- }
-
-
- /**
- * @return the relatedParameter
- */
- public IParam getRelatedParameter() {
- return relatedParameter;
- }
-
-
- /**
- * @param relatedParameter the relatedParameter to set
- */
- public void setRelatedParameter(IParam relatedParameter) {
- this.relatedParameter = relatedParameter;
- }
-
-
-
- /**
- * @return the path
- */
- public String getPath() {
- return path;
- }
-
- /**
- * @param path
- * the path to set
- */
- public void setPath(String path) {
- this.path = path;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the actived
- */
- public boolean isActived() {
- return actived;
- }
-
- /**
- * @param actived
- * the actived to set
- */
- public void setActived(boolean actived) {
- this.actived = actived;
- }
-
-}
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -6,6 +6,10 @@
public static String InputSourceType_Warning_Specify_Input_Type;
public static String InputSourceType_Warning_Specify_Sample_Data;
+ public static String InputSourceType_Unknown_Input_Type_Name;
+ public static String InputSourceType_Unknown_Input_Type_Index;
+ public static String XSDConfigurationContributor_XML_Schema_File;
+ public static String XSDConfigurationContributor_Root_Element_Name;
static {
// initialize resource bundle
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,434 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input.contributors;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ICheckStateProvider;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.EditorPart;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.ExtentionInputContentProvider;
+import org.jboss.tools.smooks.configuration.editors.ExtentionInputLabelProvider;
+import org.jboss.tools.smooks.configuration.editors.Messages;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributor;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributorFactory;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
+import org.jboss.tools.smooks.configuration.editors.wizard.ViewerInitorStore;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.GlobalParams;
+import org.jboss.tools.smooks.model.core.ICorePackage;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * Simple contributor used to add a message to the configuration composite.
+ *
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public class SampleDataConfigurationContributorFactory implements InputTaskPanelContributorFactory {
+
+ private InputSourceType inputSourceType;
+
+ public void setInputSourceType(InputSourceType inputSourceType) {
+ this.inputSourceType = inputSourceType;
+ }
+
+ public InputTaskPanelContributor newInstance(FormToolkit toolkit, EditorPart editorPart, Model<SmooksModel> configModel) {
+ return new PanelContributor(toolkit, editorPart, configModel);
+ }
+
+ private class PanelContributor implements InputTaskPanelContributor {
+
+ private EditorPart editorPart;
+ private Model<SmooksModel> configModel;
+ private ISmooksModelProvider modelProvider;
+ private EditingDomain editingDomain;
+ private Composite inputSourceConfigComposite;
+ private CheckboxTableViewer inputDataViewer;
+ private boolean lockCheck;
+
+ public Button addInputDataButton;
+ private Button removeInputDataButton;
+
+ public PanelContributor(FormToolkit toolkit, EditorPart editorPart, Model<SmooksModel> configModel) {
+ this.editorPart = editorPart;
+ this.configModel = configModel;
+ this.modelProvider = configModel.getModelRoot().getModelProvider();
+ this.editingDomain = modelProvider.getEditingDomain();
+ }
+
+ public void setInputSourceConfigComposite(Composite inputSourceConfigComposite) {
+ this.inputSourceConfigComposite = inputSourceConfigComposite;
+ }
+
+ public void addInputSourceTypeConfigControls() {
+ Composite mainComposite = new Composite(inputSourceConfigComposite, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ gl.numColumns = 2;
+ mainComposite.setLayout(gl);
+ mainComposite.setLayoutData(gd);
+
+ Composite tableComposite = new Composite(mainComposite, SWT.BORDER);
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.marginHeight = 1;
+ fillLayout.marginWidth = 1;
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 100;
+ tableComposite.setLayoutData(gd);
+ tableComposite.setLayout(fillLayout);
+
+ inputDataViewer = CheckboxTableViewer.newCheckList(tableComposite, SWT.MULTI | SWT.FULL_SELECTION);
+ inputDataViewer.setCheckStateProvider(new ICheckStateProvider() {
+
+ public boolean isGrayed(Object element) {
+ return !isValidInputType((IParam) element);
+ }
+
+ public boolean isChecked(Object element) {
+ if (element instanceof IParam) {
+ return SmooksModelUtils.INPUT_ACTIVE_TYPE.equals(((IParam)element).getType());
+ }
+ return false;
+ }
+ });
+ inputDataViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (lockCheck)
+ return;
+ IParam param = (IParam) event.getElement();
+ if (!isValidInputType(param)) {
+ lockCheck = true;
+ inputDataViewer.setChecked(param, false);
+ lockCheck = false;
+ return;
+ }
+ CompoundCommand compoundCommand = new CompoundCommand();
+ if (event.getChecked()) {
+
+ Object[] checkedObjects = inputDataViewer.getCheckedElements();
+ for(Object checkedObject : checkedObjects) {
+ if (checkedObject != param) {
+ IParam checkedParam = (IParam) checkedObject;
+ setParamType(checkedParam, SmooksModelUtils.INPUT_DEACTIVE_TYPE, compoundCommand);
+ lockCheck = true;
+ inputDataViewer.setChecked(checkedParam, false);
+ lockCheck = false;
+ }
+ }
+ if (param != null) {
+ setParamType(param, SmooksModelUtils.INPUT_ACTIVE_TYPE, compoundCommand);
+ }
+ } else {
+ if (param != null) {
+ setParamType(param, SmooksModelUtils.INPUT_DEACTIVE_TYPE, compoundCommand);
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ });
+ inputDataViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Object element = selection.getFirstElement();
+ if (element instanceof IParam) {
+ IParam param = (IParam) element;
+ String type = param.getType();
+ String filePath = param.getValue();
+ if (type != null && filePath != null) {
+ if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
+ IFile file = ((IFileEditorInput) editorPart.getEditorInput()).getFile();
+ IJavaProject javaProject = JavaCore.create(file.getProject());
+ if (javaProject != null) {
+ try {
+ if (filePath.endsWith("[]")) { //$NON-NLS-1$
+ filePath = filePath.substring(0, filePath.length() - 2);
+ }
+ IJavaElement result = javaProject.findType(filePath);
+ if (result != null)
+ JavaUI.openInEditor(result);
+ else {
+ MessageDialog.openError(editorPart.getEditorSite().getShell(),
+ Messages.SmooksReaderFormPage_CantFindTypeErrorTitle,
+ "Can't find type \"" + filePath + "\" in \"" //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ + javaProject.getProject().getName() + "\" project."); //$NON-NLS-1$
+ }
+ } catch (Exception e) {
+
+ }
+ }
+ } else {
+ try {
+ filePath = SmooksUIUtils.parseFilePath(filePath);
+ if (filePath != null) {
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(filePath));
+ IFileInfo fetchInfo = fileStore.fetchInfo();
+ if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
+ IWorkbenchWindow window = editorPart.getEditorSite().getWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+ try {
+ IDE.openEditorOnFileStore(page, fileStore);
+ } catch (PartInitException e) {
+ MessageDialog.open(MessageDialog.ERROR, window.getShell(),
+ Messages.SmooksReaderFormPage_OpenFileErrorTitle,
+ "Can't open the file : '" + filePath + "'", SWT.SHEET); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else {
+ }
+ }
+ } catch (Exception e) {
+ MessageDialog.open(MessageDialog.ERROR, editorPart.getEditorSite().getWorkbenchWindow().getShell(),
+ Messages.SmooksReaderFormPage_OpenFileErrorTitle,
+ "Can't open the file : '" + filePath + "'", SWT.SHEET); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+ }
+ }
+ }
+ });
+
+ TableColumn pathColumn = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
+ pathColumn.setText(Messages.SmooksReaderFormPage_PathColumnText);
+ pathColumn.setWidth(600);
+
+ inputDataViewer.setContentProvider(new ExtentionInputContentProvider());
+ inputDataViewer.setLabelProvider(new InputDataViewerLabelProvider());
+ inputDataViewer.getTable().setHeaderVisible(true);
+ inputDataViewer.getTable().setLinesVisible(true);
+ if (modelProvider != null) {
+ inputDataViewer.setInput(getInputs());
+ }
+
+ Composite buttonComposite = new Composite(mainComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_VERTICAL);
+ buttonComposite.setLayoutData(gd);
+ GridLayout l = new GridLayout();
+ buttonComposite.setLayout(l);
+
+ addInputDataButton = new Button(buttonComposite, SWT.NONE);
+ addInputDataButton.setText(Messages.SmooksReaderFormPage_AddButtonLabel);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ addInputDataButton.setLayoutData(gd);
+ addInputDataButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ showInputDataWizard();
+ }
+
+ });
+
+ removeInputDataButton = new Button(buttonComposite, SWT.NONE);
+ removeInputDataButton.setText(Messages.SmooksReaderFormPage_DeleteButtonLabel);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ removeInputDataButton.setLayoutData(gd);
+ removeInputDataButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) inputDataViewer.getSelection();
+ if (selection != null) {
+ List<IParam> inputs = selection.toList();
+ CompoundCommand compoundCommand = new CompoundCommand();
+
+ for (IParam input : inputs) {
+ removeParam(input, compoundCommand);
+ }
+
+ if(!compoundCommand.isEmpty()) {
+ compoundCommand.execute();
+ }
+
+ if (!inputs.isEmpty()) {
+ List<?> viewerInput = (List<?>) inputDataViewer.getInput();
+ viewerInput.removeAll(inputs);
+ // inputTypeChanged();
+ if (inputDataViewer != null) {
+ inputDataViewer.refresh();
+ }
+ }
+ }
+ }
+ });
+
+ refreshInputDataButtons();
+
+ inputSourceConfigComposite.setBackgroundMode(SWT.TRANSPARENT);
+ inputSourceConfigComposite.layout();
+ }
+
+ private void setParamType(IParam param, String typeValue, CompoundCommand compoundCommand) {
+ Command c = SetCommand.create(editingDomain, param, ICorePackage.Literals.PARAM__TYPE, typeValue);
+ if (c.canExecute()) {
+ compoundCommand.append(c);
+ }
+ }
+
+ private void removeParam(IParam param, CompoundCommand compoundCommand) {
+ List<IParam> removingList = new ArrayList<IParam>();
+
+ removingList.add(param);
+
+ Command removeCommand = RemoveCommand.create(editingDomain, removingList);
+ if (removeCommand.canExecute()) {
+ compoundCommand.append(removeCommand);
+ }
+ }
+
+ protected void showInputDataWizard() {
+ String inputType = modelProvider.getInputType();
+ SmooksModel rootModel = configModel.getModelRoot();
+
+ IStructuredDataSelectionWizard wizard = ViewerInitorStore.getInstance().getStructuredDataCreationWizard(inputType);
+ WizardDialog dialog = new WizardDialog(editorPart.getEditorSite().getShell(), wizard);
+ wizard.init(editorPart.getEditorSite(), editorPart.getEditorInput());
+
+ if (dialog.open() == Dialog.OK) {
+ String path = wizard.getStructuredDataSourcePath();
+ Properties pros = wizard.getProperties();
+
+ CompoundCommand compoundCommand = new CompoundCommand();
+ IParam addedInputType = SmooksUIUtils.recordInputDataInfomation(editingDomain, rootModel.getParams(), inputType, path, pros, compoundCommand);
+
+ if (addedInputType != null) {
+ Object obj = this.inputDataViewer.getInput();
+
+ if (obj != null && obj instanceof List) {
+ ((List) obj).add(addedInputType);
+ }
+
+ deactivateAllInputs(compoundCommand);
+
+ if (inputType.equals(SmooksModelUtils.INPUT_TYPE_CUSTOME)) {
+ // don't active the input file
+ } else {
+ setParamType(addedInputType, SmooksModelUtils.INPUT_ACTIVE_TYPE, compoundCommand);
+ }
+
+ if (!compoundCommand.isEmpty()) {
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+
+ if (inputDataViewer != null) {
+ inputDataViewer.refresh();
+ }
+ }
+ }
+ }
+
+ private void deactivateAllInputs(CompoundCommand command) {
+ Object viewerInput = this.inputDataViewer.getInput();
+ if (viewerInput != null && viewerInput instanceof List<?>) {
+ List<IParam> inputList = (List<IParam>) viewerInput;
+ for (IParam inputType : inputList ) {
+ setParamType(inputType, SmooksModelUtils.INPUT_ACTIVE_TYPE, command);
+ }
+ }
+ }
+
+ private List<IParam> getInputs() {
+ List<IParam> inputs = new ArrayList<IParam>();
+ GlobalParams globalParams = configModel.getModelRoot().getParams();
+
+ for(IParam param : globalParams.getParams()) {
+ if(inputSourceType.isType(param.getName())) {
+ inputs.add(param);
+ }
+ }
+
+ return inputs;
+ }
+
+ private void refreshInputDataButtons() {
+ this.addInputDataButton.setEnabled(true);
+ this.removeInputDataButton.setEnabled(true);
+
+ String inputType = modelProvider.getInputType();
+ if (inputType == null || inputType.trim().equals("")) { //$NON-NLS-1$
+ this.addInputDataButton.setEnabled(false);
+ this.removeInputDataButton.setEnabled(false);
+ }
+ }
+
+ protected boolean isValidInputType(IParam inputParam) {
+ if (inputParam == null) {
+ // not specified is OK...
+ return true;
+ }
+
+ return inputSourceType.isType(inputParam.getName());
+ }
+
+ private class InputDataViewerLabelProvider extends ExtentionInputLabelProvider implements ITableColorProvider {
+
+ public Color getBackground(Object element, int columnIndex) {
+ if (!isValidInputType((IParam) element)) {
+ // return ColorConstants.darkGray;
+ }
+ return null;
+ }
+
+ public Color getForeground(Object element, int columnIndex) {
+ if (!isValidInputType((IParam) element)) {
+ return ColorConstants.lightGray;
+ }
+ return null;
+ }
+ }
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.smooks.configuration.editors.input.contributors;
-
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.editor.FormPage;
-import org.jboss.tools.smooks.configuration.editors.input.InputReaderConfigurationContributor;
-
-/**
- * Simple contributor used to add a "No type selected" warning message to the composite.
- *
- * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
- */
-public class SimpleMessageContributor implements InputReaderConfigurationContributor {
-
- private String message;
-
- public SimpleMessageContributor(String message) {
- this.message = message;
- }
-
- public void addInputConfigControls(FormPage formPage, Composite configComposite) {
- Label formText = formPage.getManagedForm().getToolkit().createLabel(configComposite, ""); //$NON-NLS-1$
- GridData gd = new GridData(GridData.FILL_BOTH);
-
- gd.heightHint = 50;
- gd.horizontalSpan = 2;
- formText.setLayoutData(gd);
- formText.setText(message);
- }
-}
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input.contributors;
+
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.EditorPart;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributor;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributorFactory;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * Simple contributor used to add a message to the configuration composite.
+ *
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public class SimpleMessageContributorFactory implements InputTaskPanelContributorFactory {
+
+ private String message;
+
+ public SimpleMessageContributorFactory(String message) {
+ this.message = message;
+ }
+
+ public void setInputSourceType(InputSourceType inputSourceType) {
+ }
+
+ public InputTaskPanelContributor newInstance(FormToolkit toolkit, EditorPart editorPart, Model<SmooksModel> configModel) {
+ return new PanelContributor(toolkit);
+ }
+
+ private class PanelContributor implements InputTaskPanelContributor {
+
+ private FormToolkit toolkit;
+ private Composite inputSourceConfigComposite;
+
+ public PanelContributor(FormToolkit toolkit) {
+ this.toolkit = toolkit;
+ }
+
+ public void setInputSourceConfigComposite(Composite inputSourceConfigComposite) {
+ this.inputSourceConfigComposite = inputSourceConfigComposite;
+ }
+
+ public void addInputSourceTypeConfigControls() {
+ Label formText = toolkit.createLabel(inputSourceConfigComposite, ""); //$NON-NLS-1$
+ GridData gd = new GridData(GridData.FILL_BOTH);
+
+ gd.heightHint = 50;
+ gd.horizontalSpan = 2;
+ formText.setLayoutData(gd);
+ formText.setText(message);
+
+ inputSourceConfigComposite.layout();
+ }
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input.contributors;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.EditorPart;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.file.FileSelectionListener;
+import org.jboss.tools.smooks.configuration.editors.file.FileSelectionPageComponent;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributor;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributorFactory;
+import org.jboss.tools.smooks.configuration.editors.input.Messages;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.ICorePackage;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.jboss.tools.smooks.templating.model.xml.XSDModelBuilder;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * XSD configuration contributor factory.
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public class XSDConfigurationContributorFactory implements InputTaskPanelContributorFactory {
+
+ public InputTaskPanelContributor newInstance(FormToolkit toolkit, EditorPart editorPart, Model<SmooksModel> configModel) {
+ return new PanelContributor(toolkit, editorPart, configModel);
+ }
+
+ public void setInputSourceType(InputSourceType inputSourceType) {
+ }
+
+ private class PanelContributor implements InputTaskPanelContributor {
+
+ private EditorPart editorPart;
+ private SmooksModel modelRoot;
+ private EditingDomain editingDomain;
+ private Composite inputSourceConfigComposite;
+ private FileSelectionPageComponent pageSelectionComponent;
+ private Combo rootElementsDropDown;
+ private Composite xsdRootElementSelectionSection;
+
+ public PanelContributor(FormToolkit toolkit, EditorPart editorPart, Model<SmooksModel> configModel) {
+ this.editorPart = editorPart;
+ this.modelRoot = configModel.getModelRoot();
+ this.editingDomain = modelRoot.getModelProvider().getEditingDomain();
+ }
+
+ public void setInputSourceConfigComposite(Composite inputSourceConfigComposite) {
+ this.inputSourceConfigComposite = inputSourceConfigComposite;
+ }
+
+ public void addInputSourceTypeConfigControls() {
+ Composite xsdFileSelectionSection = new Composite(inputSourceConfigComposite, SWT.NONE);
+
+ pageSelectionComponent = new FileSelectionPageComponent(editorPart.getEditorSite().getShell(), new String[] {"xsd"});
+ pageSelectionComponent.setLabel(Messages.XSDConfigurationContributor_XML_Schema_File);
+ pageSelectionComponent.createControl(xsdFileSelectionSection);
+ pageSelectionComponent.addFileSelectionListener(new FileSelectionListener() {
+ public void fileSelected(String fileName) {
+ CompoundCommand compoundCommand = new CompoundCommand();
+
+ IParam xsdInputParam = setInputTypeInfo(compoundCommand);
+ populateRootElementsDropDown(xsdInputParam, compoundCommand);
+
+ if(!compoundCommand.isEmpty()) {
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ });
+ xsdFileSelectionSection.layout();
+
+ xsdRootElementSelectionSection = new Composite(inputSourceConfigComposite, SWT.NONE);
+ createRootElementDropDown(xsdRootElementSelectionSection);
+
+ xsdRootElementSelectionSection.layout();
+ xsdRootElementSelectionSection.setVisible(false);
+
+ IParam xsdFileParam = getXSDParam();
+ if(xsdFileParam != null) {
+ String[] xsdPathTokens = xsdFileParam.getValue().split(";"); //$NON-NLS-1$
+
+ pageSelectionComponent.setFilePath(xsdPathTokens[0]);
+ if(xsdPathTokens.length == 2) {
+ populateRootElementsDropDown(xsdPathTokens[0], xsdPathTokens[1]);
+ }
+ }
+
+ inputSourceConfigComposite.setBackgroundMode(SWT.TRANSPARENT);
+ inputSourceConfigComposite.layout();
+ }
+
+ protected IParam setInputTypeInfo(CompoundCommand compoundCommand) {
+ String xsdFile = pageSelectionComponent.getFilePath();
+ IParam xsdInputParam = getXSDParam();
+
+ if(xsdInputParam == null) {
+ xsdInputParam = SmooksUIUtils.recordInputDataInfomation(editingDomain, modelRoot.getParams(), SmooksModelUtils.INPUT_TYPE_XSD, xsdFile, null, compoundCommand);
+ } else {
+ setParamValue(xsdInputParam, xsdFile, compoundCommand);
+ }
+
+ return xsdInputParam;
+ }
+
+ private void setParamValue(IParam param, String xsdFile, CompoundCommand compoundCommand) {
+ Command command = SetCommand.create(editingDomain, param, ICorePackage.Literals.PARAM__VALUE, xsdFile);
+ if (command.canExecute()) {
+ if(compoundCommand == null) {
+ editingDomain.getCommandStack().execute(command);
+ } else {
+ compoundCommand.append(command);
+ }
+ }
+ }
+
+ private void createRootElementDropDown(Composite xsdRootElementSelectionSection) {
+ GridLayout layout = new GridLayout();
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+
+ layout.numColumns = 2;
+ xsdRootElementSelectionSection.setLayout(layout);
+ xsdRootElementSelectionSection.setLayoutData(gd);
+
+ gd = new GridData(GridData.BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
+ Label rootElementsLabel = new Label(xsdRootElementSelectionSection, SWT.NONE);
+ rootElementsLabel.setLayoutData(gd);
+ rootElementsLabel.setText(Messages.XSDConfigurationContributor_Root_Element_Name);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ rootElementsDropDown = new Combo(xsdRootElementSelectionSection, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.RESIZE);
+ rootElementsDropDown.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent event) {
+ setRootElement(rootElementsDropDown.getItem(rootElementsDropDown.getSelectionIndex()));
+ }
+ public void widgetDefaultSelected(SelectionEvent event) {
+ }
+ });
+ rootElementsDropDown.setLayoutData(gd);
+ }
+
+ protected void setRootElement(String rootElementName) {
+ IParam xsdParam = getXSDParam();
+
+ if(xsdParam != null) {
+ String[] paramTokens = xsdParam.getValue().split(";"); //$NON-NLS-1$
+ setParamValue(xsdParam, paramTokens[0] + ";" + rootElementName, null); //$NON-NLS-1$
+ }
+ }
+
+ private IParam getXSDParam() {
+ return modelRoot.getParams().getParam(SmooksModelUtils.INPUT_TYPE_XSD);
+ }
+
+ private void populateRootElementsDropDown(IParam xsdInputParam, CompoundCommand compoundCommand) {
+ rootElementsDropDown.removeAll();
+ xsdRootElementSelectionSection.setVisible(false);
+
+ String xsdFile = pageSelectionComponent.getFilePath();
+ if(xsdFile != null && xsdFile.trim().length() > 0) {
+ populateRootElementsDropDown(xsdFile, null);
+
+ String rootElementName = rootElementsDropDown.getText();
+ setParamValue(xsdInputParam, xsdFile + ";" + rootElementName, compoundCommand);
+ }
+ }
+
+ private void populateRootElementsDropDown(String xsdFile, String selectedRootElement) {
+ URI xsdURI = toURI(xsdFile);
+
+ if(xsdURI != null) {
+ try {
+ XSDModelBuilder xsdModelBuilder = new XSDModelBuilder(xsdURI);
+ Set<String> rootElementNames = xsdModelBuilder.getRootElementNames();
+
+ if(!rootElementNames.isEmpty()) {
+ for(String rootElementName : rootElementNames) {
+ rootElementsDropDown.add(rootElementName);
+ if(rootElementName.equals(selectedRootElement)) {
+ rootElementsDropDown.select(rootElementsDropDown.indexOf(rootElementName));
+ }
+ }
+ if(selectedRootElement == null) {
+ rootElementsDropDown.select(0);
+ }
+ }
+
+ xsdRootElementSelectionSection.setVisible(true);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (ModelBuilderException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private URI toURI(String xsdFile) {
+ return URI.createFileURI(SmooksUIUtils.parseFilePath(xsdFile));
+ }
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties 2010-08-19 11:16:52 UTC (rev 24292)
@@ -1,2 +1,6 @@
InputSourceType_Warning_Specify_Input_Type=Input type should be specified.
-InputSourceType_Warning_Specify_Sample_Data=Specify sample data in the Input Data section.
\ No newline at end of file
+InputSourceType_Warning_Specify_Sample_Data=Specify sample data in the Input Data section.
+InputSourceType_Unknown_Input_Type_Name=Unknown Input Type Name:
+InputSourceType_Unknown_Input_Type_Index=Unknown Input Type Index:
+XSDConfigurationContributor_XML_Schema_File=XML Schema File:
+XSDConfigurationContributor_Root_Element_Name=Root Element Name:
\ No newline at end of file
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input.model;
+
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.input.InputModelFactory;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.GlobalParams;
+import org.jboss.tools.smooks.model.core.IParam;
+
+/**
+ * Abstract {@link InputModelFactory}.
+ *
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+abstract class AbstractInputModelFactory implements InputModelFactory {
+
+ protected IParam getInputSourceParam(String inputType, SmooksModel smooksConfigModel) {
+ GlobalParams globalParams = smooksConfigModel.getParams();
+ IParam inputSource = globalParams.getParam(inputType, SmooksModelUtils.INPUT_ACTIVE_TYPE);
+
+ if(inputSource == null) {
+ inputSource = globalParams.getParam(inputType);
+ }
+
+ return inputSource;
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input.model;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Java Source Input Model Factory.
+ *
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public class JavaInputModelFactory extends AbstractInputModelFactory {
+
+ public Document getModel(SmooksModel smooksConfigModel, IJavaProject project) {
+ IParam inputSourceParam = getInputSourceParam(SmooksModelUtils.INPUT_TYPE_JAVA, smooksConfigModel);
+
+
+
+ return null;
+ }
+
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input.model;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.w3c.dom.Document;
+
+/**
+ * XML (Sample) Input Model Factory.
+ *
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public class XMLInputModelFactory extends AbstractInputModelFactory {
+
+ private static final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+
+ static {
+ docBuilderFactory.setNamespaceAware(true);
+ }
+
+ public Document getModel(SmooksModel smooksConfigModel, IJavaProject project) throws ModelBuilderException {
+ IParam inputSourceParam = getInputSourceParam(SmooksModelUtils.INPUT_TYPE_XML, smooksConfigModel);
+
+ if(inputSourceParam != null) {
+ String inputSourceFileName = SmooksUIUtils.parseFilePath(inputSourceParam.getValue());
+ File inputSourceFile = new File(inputSourceFileName);
+
+ if(!inputSourceFile.isFile()) {
+ throw new ModelBuilderException("XML Model Input file '" + inputSourceFile.getAbsolutePath() + "' is not available on local file system."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ try {
+ DocumentBuilder documentBuilder = docBuilderFactory.newDocumentBuilder();
+ return documentBuilder.parse(inputSourceFile);
+ } catch (Exception e) {
+ throw new ModelBuilderException("Error building XML Model for Input '" + inputSourceFileName + "'.", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ return null;
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.smooks.configuration.editors.input.model;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.jboss.tools.smooks.templating.model.xml.XSDModelBuilder;
+import org.w3c.dom.Document;
+
+/**
+ * XML Schema Input Model Factory.
+ *
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public class XSDInputModelFactory extends AbstractInputModelFactory {
+
+ public Document getModel(SmooksModel smooksConfigModel, IJavaProject project) throws ModelBuilderException {
+ IParam inputSourceParam = getInputSourceParam(SmooksModelUtils.INPUT_TYPE_XSD, smooksConfigModel);
+
+ if(inputSourceParam != null) {
+ String xsdInputSource = inputSourceParam.getValue();
+ String[] xsdInputSourceTokens = xsdInputSource.split(";");
+
+ if(xsdInputSourceTokens.length != 2) {
+ throw new ModelBuilderException("Invalid XML Schema Model Input file configuration '" + xsdInputSource + "'. Must contain 2 semi-colon separated tokens '<file-path>;<root-element-name>'."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String inputSourceFileName = SmooksUIUtils.parseFilePath(xsdInputSourceTokens[0]);
+ File inputSourceFile = new File(inputSourceFileName);
+ if(!inputSourceFile.isFile()) {
+ throw new ModelBuilderException("XML Schema Model Input file '" + inputSourceFile.getAbsolutePath() + "' is not available on local file system."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ try {
+ XSDModelBuilder schemaModelBuilder = new XSDModelBuilder(URI.createFileURI(inputSourceFileName));
+ schemaModelBuilder.setRootElementName(xsdInputSourceTokens[1]);
+ return schemaModelBuilder.buildModel();
+ } catch (IOException e) {
+ throw new ModelBuilderException("Error reading XML Schema Model Input file '" + inputSourceFile.getAbsolutePath() + "'.", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ return null;
+ }
+
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -27,12 +27,10 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -43,15 +41,13 @@
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
-import org.jboss.tools.smooks.configuration.editors.input.InputParameter;
-import org.jboss.tools.smooks.configuration.editors.input.InputType;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksModel;
import org.jboss.tools.smooks.model.core.GlobalParams;
import org.jboss.tools.smooks.model.core.ICoreFactory;
import org.jboss.tools.smooks.model.core.ICorePackage;
import org.jboss.tools.smooks.model.core.IParam;
-import org.milyn.javabean.dynamic.Model;
/**
*
@@ -81,8 +77,7 @@
public static final String[] SELECTOR_SPERATORS = new String[] { " ", "/" }; //$NON-NLS-1$ //$NON-NLS-2$
- public static String parseFilePath(String path)
- throws InvocationTargetException {
+ public static String parseFilePath(String path) {
if (path == null)
return null;
if (new File(path).exists()) {
@@ -102,12 +97,10 @@
if (file.exists()) {
path = file.getLocation().toOSString();
} else {
- throw new InvocationTargetException(new Exception(
- "File : " + path + " isn't exsit")); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new IllegalArgumentException("File : " + path + " isn't exsit"); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
- throw new InvocationTargetException(new Exception(
- "This path is un-support" + path + ".")); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new IllegalArgumentException("This path is un-support" + path + "."); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return path;
@@ -131,16 +124,6 @@
return createErrorStatus(throwable, "Error"); //$NON-NLS-1$
}
- public static IParam getInputTypeAssociatedParamType(InputType inputType,
- Model<SmooksModel> resourceList) {
- SmooksModel rootModel = resourceList.getModelRoot();
- GlobalParams params = rootModel.getParams();
- if (params != null) {
- return params.getParam(inputType.getType(), inputType.getPath());
- }
- return null;
- }
-
public static IParam getInputTypeParam(SmooksModel resourceList) {
GlobalParams params = resourceList.getParams();
if (params != null) {
@@ -149,97 +132,48 @@
return null;
}
- public static List<InputType> recordInputDataInfomation(
+ public static IParam recordInputDataInfomation(
EditingDomain domain, GlobalParams paramsType, String type,
String path, Properties properties, CompoundCommand compoundCommand) {
- List<InputType> inputTypeList = new ArrayList<InputType>();
+
if (type != null && path != null && domain != null) {
String[] values = path.split(";"); //$NON-NLS-1$
- if (values == null || values.length == 0) {
- values = new String[] { path };
- }
- for (int i = 0; i < values.length; i++) {
- String value = values[i];
- value = value.trim();
- if (value.length() == 0)
- continue;
- IParam inputParam = ICoreFactory.eINSTANCE.createParam();
- InputType input = new InputType();
- input.setPath(path);
- input.setType(type);
- input.setActived(false);
+
+ if (values != null && values.length > 0) {
+ String value = values[0].trim();
+
+ if (value.length() > 0) {
+ IParam inputParam = ICoreFactory.eINSTANCE.createParam();
+ inputParam.setName(type);
+ inputParam.setValue(path);
+
+ List<IParam> params = generateExtParams(type, path, properties);
+ params.add(inputParam);
- inputParam.setName(type);
- inputParam.setValue(path);
- input.setRelatedParameter(inputParam);
- List<IParam> params = generateExtParams(type, path, properties);
- for (Iterator<?> iterator = params.iterator(); iterator
- .hasNext();) {
- IParam paramType2 = (IParam) iterator.next();
- InputParameter p = new InputParameter();
- p.setName(getInputParameterName(input.getType(),
- paramType2.getName()));
- p.setValue(paramType2.getValue());
- input.getParameters().add(p);
- // input.setRelatedParameter(paramType2);
- }
- params.add(inputParam);
- Command command = null;
- try {
- command = AddCommand.create(domain, paramsType,
- ICorePackage.Literals.PARAMS__PARAMS, params);
- } catch (Throwable t) {
- t.printStackTrace();
- }
- if (command.canExecute()) {
- if (compoundCommand != null) {
- compoundCommand.append(command);
- } else {
- domain.getCommandStack().execute(command);
+ Command command = null;
+ try {
+ command = AddCommand.create(domain, paramsType, ICorePackage.Literals.PARAMS__PARAMS, params);
+ } catch (Throwable t) {
+ t.printStackTrace();
}
- input.setRelatedParameter(inputParam);
- inputTypeList.add(input);
+ if (command.canExecute()) {
+ if (compoundCommand != null) {
+ compoundCommand.append(command);
+ } else {
+ domain.getCommandStack().execute(command);
+ }
+ }
+
+ return inputParam;
}
}
}
- return inputTypeList;
+
+ return null;
}
- public static void removeInputType(InputType inputType,
+ public static void removeInputType(IParam inputToRemove,
ISmooksModelProvider smooksModelProvider) {
- SmooksModel resourceList = smooksModelProvider.getSmooksModel()
- .getModelRoot();
- if (resourceList != null) {
- GlobalParams params = resourceList.getParams();
- if (params != null) {
- List<IParam> paramList = params.getParams();
- List<IParam> removingList = new ArrayList<IParam>();
- for (Iterator<?> iterator = paramList.iterator(); iterator
- .hasNext();) {
- IParam paramType = (IParam) iterator.next();
- String name = paramType.getName();
- String value = paramType.getValue();
- if (inputType.getType().equals(name)
- && inputType.getPath().equals(value)) {
- // find the associated param
- removingList.add(paramType);
- continue;
- }
- if (isInputAssociatedParameter(paramType, inputType)) {
- removingList.add(paramType);
- }
- }
- if (!removingList.isEmpty()) {
- Command removeCommand = RemoveCommand.create(
- smooksModelProvider.getEditingDomain(),
- removingList);
- if (removeCommand.canExecute()) {
- smooksModelProvider.getEditingDomain()
- .getCommandStack().execute(removeCommand);
- }
- }
- }
- }
}
public static IJavaProject getJavaProject(EObject model) {
@@ -340,54 +274,17 @@
return type + "." + name; //$NON-NLS-1$
}
- public static List<InputType> recordInputDataInfomation(
- EditingDomain domain, GlobalParams paramsType, String type,
- String path, Properties properties) {
- return recordInputDataInfomation(domain, paramsType, type, path,
- properties, null);
- }
-
- public static List<InputType> getInputTypeList(SmooksModel resourceList) {
- List<InputType> inputList = new ArrayList<org.jboss.tools.smooks.configuration.editors.input.InputType>();
- GlobalParams params = resourceList.getParams();
- if (params != null) {
- List<IParam> paramList = params.getParams();
- for (Iterator<?> iterator = paramList.iterator(); iterator
- .hasNext();) {
- IParam paramType = (IParam) iterator.next();
- String type = paramType.getType();
- if (isInputParamType(paramType)) {
- org.jboss.tools.smooks.configuration.editors.input.InputType input = new org.jboss.tools.smooks.configuration.editors.input.InputType();
- input.setType(paramType.getName());
- input.setActived(SmooksModelUtils.INPUT_ACTIVE_TYPE
- .equals(type));
- String path = paramType.getValue();
- if (path != null) {
- path = path.trim();
- }
- input.setPath(path);
- inputList.add(input);
- }
+ public static List<IParam> getInputTypeList(SmooksModel resourceList) {
+ List<IParam> inputs = new ArrayList<IParam>();
+ GlobalParams globalParams = resourceList.getParams();
+
+ for(IParam param : globalParams.getParams()) {
+ if(InputSourceType.isValidName(param.getName())) {
+ inputs.add(param);
}
-
- for (Iterator<?> iterator = inputList.iterator(); iterator
- .hasNext();) {
- org.jboss.tools.smooks.configuration.editors.input.InputType input = (org.jboss.tools.smooks.configuration.editors.input.InputType) iterator
- .next();
- for (Iterator<?> iterator2 = paramList.iterator(); iterator2
- .hasNext();) {
- IParam paramType = (IParam) iterator2.next();
- if (isInputAssociatedParameter(paramType, input)) {
- InputParameter p = new InputParameter();
- p.setName(getInputParameterName(input.getType(),
- paramType.getName()));
- p.setValue(paramType.getValue());
- input.getParameters().add(p);
- }
- }
- }
}
- return inputList;
+
+ return inputs;
}
public static boolean isInputParamType(IParam param) {
@@ -399,16 +296,6 @@
return false;
}
- public static boolean isInputAssociatedParameter(IParam param,
- org.jboss.tools.smooks.configuration.editors.input.InputType input) {
- String type = input.getType();
- String pn = param.getName();
- if (pn != null && pn.startsWith(type) && !pn.equals(type)) {
- return true;
- }
- return false;
- }
-
private static void expandSelectorViewer(IXMLStructuredObject model,
TreeViewer viewer, List<String> expandedModel, int level) {
if (level >= SELECTOR_EXPAND_MAX_LEVEL)
Deleted: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -1,501 +0,0 @@
-/**
- *
- */
-package org.jboss.tools.smooks.configuration.editors.xml;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.smooks.configuration.editors.IFilePathProcessor;
-import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
-
-/**
- *
- * @author Dart Peng Date : 2008-8-13
- */
-public abstract class AbstractFileSelectionWizardPage extends WizardPage implements SelectionListener {
- protected IStructuredSelection selection;
- protected Object returnObject = null;
- protected Text fileText;
- protected Composite fileTextComposite;
- protected CheckboxTableViewer tableViewer = null;
- protected Button fileSystemBrowseButton;
- protected boolean reasourceLoaded = false;
- protected Button workspaceBrowseButton;
- private String filePath = null;
- protected Object[] initSelections;
- protected List<ViewerFilter> filters = new ArrayList<ViewerFilter>();
- protected boolean multiSelect = false;
-
- private IFilePathProcessor filePathProcessor = null;
-
- protected String[] fileExtensionNames;
-
- public AbstractFileSelectionWizardPage(String pageName, boolean multiSelect, Object[] initSelections,
- List<ViewerFilter> filters,String[] fileExtensionNames) {
- this(pageName, false, initSelections, Collections.EMPTY_LIST);
- this.fileExtensionNames = fileExtensionNames;
- createFileExtensionNameFilter();
- }
-
- /**
- * @return the fileExtensionNames
- */
- public String[] getFileExtensionNames() {
- return fileExtensionNames;
- }
-
-
-
- /**
- * @param fileExtensionNames the fileExtensionNames to set
- */
- public void setFileExtensionNames(String[] fileExtensionNames) {
- this.fileExtensionNames = fileExtensionNames;
- }
-
-
-
- public void createFileExtensionNameFilter(){
- if (this.fileExtensionNames != null && this.fileExtensionNames.length != 0) {
- ViewerFilter extensionNameFilter = new ViewerFilter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse
- * .jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof IFile && AbstractFileSelectionWizardPage.this.fileExtensionNames != null) {
- String extName = ((IFile) element).getFileExtension();
- for (int i = 0; i < AbstractFileSelectionWizardPage.this.fileExtensionNames.length; i++) {
- String name = AbstractFileSelectionWizardPage.this.fileExtensionNames[i];
- if (name.equalsIgnoreCase(extName)) {
- return true;
- }
- }
- return false;
- }
- return true;
- }
- };
- this.filters.add(extensionNameFilter);
- }
- }
-
- public AbstractFileSelectionWizardPage(String pageName, boolean multiSelect, Object[] initSelections,
- List<ViewerFilter> filters) {
- super(pageName);
- this.initSelections = initSelections;
- if (filters != null) {
- this.filters.addAll(filters);
- }
- this.multiSelect = multiSelect;
- }
-
- public AbstractFileSelectionWizardPage(String pageName, String[] fileExtensionNames) {
- this(pageName, false, null, Collections.EMPTY_LIST);
- this.fileExtensionNames = fileExtensionNames;
- createFileExtensionNameFilter();
- }
-
- public Object getReturnValue() {
- try {
- String path = getFilePath();
- if (path == null)
- return null;
- path = SmooksUIUtils.parseFilePath(path);
- returnObject = this.loadedTheObject(path);
- } catch (Exception e) {
- SmooksUIUtils.showErrorDialog(getShell(), SmooksUIUtils.createErrorStatus(e));
- }
- return returnObject;
- }
-
- public String getFilePath() {
- return filePath;
- }
-
- public IFilePathProcessor getFilePathProcessor() {
- return filePathProcessor;
- }
-
- public void setFilePathProcessor(IFilePathProcessor filePathProcessor) {
- this.filePathProcessor = filePathProcessor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
- * .Composite)
- */
- public void createControl(Composite parent) {
- Composite mainComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- mainComposite.setLayout(layout);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- mainComposite.setLayoutData(gd);
-
- // xmlButton = new Button(mainComposite, SWT.RADIO);
- // xmlButton.setText("Select a XML file");
- //
- // Composite xmlComposite = this
- // .createXMLFileSelectionComposite(mainComposite);
- //
- // Label sp = new Label(mainComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
- // gd = new GridData(GridData.FILL_HORIZONTAL);
- // sp.setLayoutData(gd);
- //
- // xsdButton = new Button(mainComposite, SWT.RADIO);
- // xsdButton.setText("Select a XSD file");
-
- createFileSelectionComposite(mainComposite);
-
- // init the panel status (XSD file selection composite is disabled)
- // xsdButton.setSelection(true);
- //
- // setCompositeChildrenEnabled(xmlComposite, false);
-
- // registe the listener for controls
- hookBrowseButtonSelectionAdapter();
- hookFileTextModifyListener();
- this.setControl(mainComposite);
-
- changeWizardPageStatus();
- // don't show the error message when first open the dialog
- this.setErrorMessage(null);
- parent.getShell().setText(Messages.AbstractFileSelectionWizardPage_WizardTitle);
- }
-
- protected void hookFileTextModifyListener() {
- final ModifyListener modifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- filePath = fileText.getText();
- changeWizardPageStatus();
- }
- };
- // xmlFileText.addModifyListener(modifyListener);
- fileText.addModifyListener(modifyListener);
- }
-
- protected void hookRadioButtonSelectionAdapter() {
- // xsdButton.addSelectionListener(this);
- }
-
- protected void hookBrowseButtonSelectionAdapter() {
- SelectionAdapter browseButtonSelectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Text relationT = null;
- if (e.getSource() == fileSystemBrowseButton) {
- relationT = fileText;
- }
- openFileSelection(relationT);
- }
- };
- SelectionAdapter wbrowseButtonSelectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Text relationT = null;
- if (e.getSource() == workspaceBrowseButton) {
- relationT = fileText;
- }
- openWorkSpaceSelection(relationT);
- }
-
- };
-
- workspaceBrowseButton.addSelectionListener(wbrowseButtonSelectionAdapter);
- // xmlFileSystemBrowseButton
- // .addSelectionListener(browseButtonSelectionAdapter);
- fileSystemBrowseButton.addSelectionListener(browseButtonSelectionAdapter);
- }
-
- protected void openWorkSpaceSelection(Text relationT) {
- IFile[] files = WorkspaceResourceDialog.openFileSelection(getShell(),
- "Select Files", "", false, initSelections, filters); //$NON-NLS-1$ //$NON-NLS-2$
- // dialog.setInitialSelections(selectedResources);
- if (files.length > 0) {
- IFile file = files[0];
- String s = processWorkSpaceFilePath(file);
- relationT.setText(s);
- }
- }
-
- protected String processFileSystemFilePath(String path) {
- if (filePathProcessor != null) {
- String s = filePathProcessor.processFileSystemPath(path);
- if (s != null) {
- return s;
- }
- }
- path = SmooksUIUtils.FILE_PRIX + path;
- return path;
- }
-
- protected String processWorkSpaceFilePath(IFile file) {
- if (filePathProcessor != null) {
- String s = filePathProcessor.processWorkBenchPath(file);
- if (s != null) {
- return s;
- }
- }
- String s = file.getFullPath().toPortableString();
- s = SmooksUIUtils.WORKSPACE_PRIX + s;
- return s;
- }
-
- protected Text createFilePathText(Composite parent) {
- fileTextComposite = new Composite(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.grabExcessHorizontalSpace = true;
- fileTextComposite.setLayoutData(gd);
- GridLayout xsdtgl = new GridLayout();
- xsdtgl.marginWidth = 0;
- xsdtgl.marginHeight = 0;
- xsdtgl.numColumns = 1;
- fileTextComposite.setLayout(xsdtgl);
-
- Text fileText = new Text(fileTextComposite, SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fileText.setLayoutData(gd);
- gd.grabExcessHorizontalSpace = true;
-
- return fileText;
- }
-
- protected Composite createFileSelectionComposite(Composite parent) {
- Composite xsdComposite = new Composite(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- xsdComposite.setLayoutData(gd);
- GridLayout xsdLayout = new GridLayout();
- xsdLayout.numColumns = 2;
- xsdLayout.marginWidth = 0;
- xsdComposite.setLayout(xsdLayout);
- createExtensionGUIFirst(xsdComposite);
- Label nfileLanel = new Label(xsdComposite, SWT.NONE);
- nfileLanel.setText("File : "); //$NON-NLS-1$
- // fileTextComposite = new Composite(xsdComposite, SWT.NONE);
- // gd = new GridData(GridData.FILL_HORIZONTAL);
- // gd.grabExcessHorizontalSpace = true;
- // fileTextComposite.setLayoutData(gd);
- // GridLayout xsdtgl = new GridLayout();
- // xsdtgl.marginWidth = 0;
- // xsdtgl.marginHeight = 0;
- // xsdtgl.numColumns = 1;
- // fileTextComposite.setLayout(xsdtgl);
- //
- // fileText = new Text(fileTextComposite, SWT.BORDER);
- // gd = new GridData(GridData.FILL_HORIZONTAL);
- // fileText.setLayoutData(gd);
- // gd.grabExcessHorizontalSpace = true;
-
- fileText = createFilePathText(xsdComposite);
-
- // final Button loadXSDButton = new Button(fileTextComposite, SWT.NONE);
- // loadXSDButton.setText("Load");
- // loadXSDButton.addSelectionListener(new SelectionAdapter() {
- //
- // @Override
- // public void widgetSelected(SelectionEvent e) {
- // super.widgetSelected(e);
- // reasourceLoaded = false;
- // try {
- // returnObject = loadedTheObject(fileText.getText());
- // reasourceLoaded = true;
- // } catch (Throwable e2) {
- // // ignore
- // e2.printStackTrace();
- // }
- // changeWizardPageStatus();
- // }
- //
- // });
-
- Composite browseButtonComposite = new Composite(xsdComposite, SWT.NONE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- browseButtonComposite.setLayoutData(gd);
-
- GridLayout bg = new GridLayout();
- bg.numColumns = 2;
- bg.marginHeight = 0;
- bg.marginWidth = 0;
- bg.makeColumnsEqualWidth = false;
- browseButtonComposite.setLayout(bg);
-
- fileSystemBrowseButton = new Button(browseButtonComposite, SWT.NONE);
- fileSystemBrowseButton.setText("Browse File System"); //$NON-NLS-1$
-
- workspaceBrowseButton = new Button(browseButtonComposite, SWT.NONE);
- workspaceBrowseButton.setText("Browse WorkSpace"); //$NON-NLS-1$
- gd = new GridData();
- gd.horizontalAlignment = GridData.END;
- workspaceBrowseButton.setLayoutData(gd);
-
- gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = GridData.END;
- fileSystemBrowseButton.setLayoutData(gd);
-
- return xsdComposite;
- }
-
- protected void createExtensionGUIFirst(Composite parent) {
- // do nothing
- }
-
- abstract protected Object loadedTheObject(String path) throws Exception;
-
- protected void initTableViewer() {
- // tableViewer.addCheckStateListener(new ICheckStateListener() {
- // boolean flag = true;
- //
- // public void checkStateChanged(CheckStateChangedEvent event) {
- // if (flag) {
- // Object checkObject = event.getElement();
- // boolean check = event.getChecked();
- // flag = false;
- // tableViewer.setAllChecked(false);
- // tableViewer.setChecked(checkObject, check);
- // flag = true;
- // changeWizardPageStatus();
- // }
- // }
- // });
- // tableViewer.setContentProvider(new
- // XSDStructuredModelContentProvider());
- // tableViewer.setLabelProvider(new XSDStructuredModelLabelProvider());
- }
-
- protected void setCompositeChildrenEnabled(Composite composite, boolean enabled) {
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- Control child = children[i];
- if (child instanceof Text) {
- child.setEnabled(enabled);
- }
- if (child instanceof Button) {
- child.setEnabled(enabled);
- }
- if (child instanceof Composite) {
- setCompositeChildrenEnabled((Composite) child, enabled);
- }
- }
- }
-
- protected void openFileSelection(Text relationText) {
- FileDialog dialog = new FileDialog(this.getShell());
- if (fileExtensionNames != null) {
- String s = ""; //$NON-NLS-1$
- for (int i = 0; i < fileExtensionNames.length; i++) {
- String exname = fileExtensionNames[i];
- s += "*." + exname + ";"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (s.length() != 0) {
- s = s.substring(0, s.length() - 1);
- dialog.setFilterExtensions(new String[]{s,"*.*"}); //$NON-NLS-1$
- }
- }
- String path = dialog.open();
- if (path != null) {
- path = processFileSystemFilePath(path);
- relationText.setText(path);
- }
- }
-
- protected void changeWizardPageStatus() {
- String text = this.fileText.getText();
- String error = null;
- if (text == null || "".equals(text)) //$NON-NLS-1$
- error = "File name cannot be null"; //$NON-NLS-1$
-
- // File tempFile = new File(text);
- // if(!tempFile.exists()){
- // error = "Can't find the file , please select another one.";
- // }
-
- // if (!reasourceLoaded) {
- // error = "Resource must be loaded";
- // }
- this.setErrorMessage(error);
- this.setPageComplete(error == null);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- changeWizardPageStatus();
- }
-
- public CheckboxTableViewer getTableViewer() {
- return tableViewer;
- }
-
- public void setTableViewer(CheckboxTableViewer tableViewer) {
- this.tableViewer = tableViewer;
- }
-
- public IStructuredSelection getSelection() {
- return selection;
- }
-
- public void setSelection(IStructuredSelection selection) {
- this.selection = selection;
- }
-
- public Object[] getInitSelections() {
- return initSelections;
- }
-
- public void setInitSelections(Object[] initSelections) {
- this.initSelections = initSelections;
- }
-
- public List<ViewerFilter> getFilters() {
- return filters;
- }
-
- public void setFilters(List<ViewerFilter> filters) {
- this.filters = filters;
- }
-
- public boolean isMultiSelect() {
- return multiSelect;
- }
-
- public void setMultiSelect(boolean multiSelect) {
- this.multiSelect = multiSelect;
- }
-
-}
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -0,0 +1,89 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors.xml;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
+import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
+
+/**
+ * @author Dart
+ *
+ */
+public abstract class AbstractStructuredDataWizard extends Wizard implements IStructuredDataSelectionWizard,
+ INewWizard {
+ protected IWorkbench workbench;
+
+ protected IStructuredSelection selection;
+
+ protected AbstractFileSelectionWizardPage page = null;
+ protected Object xsdElement = null;
+ protected IWizardNode strucutredDataCreationWizardNode;
+
+ private IContainer folder = null;
+
+ public AbstractStructuredDataWizard() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void addPages() {
+ if (page == null) {
+ page = createAbstractFileSelectionWizardPage();
+ page.setSelection(this.selection);
+ if (folder != null) {
+ page.setInitSelections(new Object[] { folder });
+ }
+ }
+ this.addPage(page);
+ }
+
+ abstract protected AbstractFileSelectionWizardPage createAbstractFileSelectionWizardPage();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ xsdElement = this.page.getReturnValue();
+ return true;
+ }
+
+ public Object getReturnData() {
+ return xsdElement;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.ui.IStructuredDataCreationWizard#
+ * getStructuredDataSourcePath()
+ */
+ public String getStructuredDataSourcePath() {
+ return page.getFilePath();
+ }
+
+ public void init(IEditorSite site, IEditorInput input) {
+ this.folder = ((IFileEditorInput) input).getFile().getParent();
+ if (page != null && folder != null) {
+ page.setInitSelections(new Object[] { folder });
+ }
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ }
+
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDdataWizard.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDdataWizard.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDdataWizard.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -1,88 +0,0 @@
-/**
- *
- */
-package org.jboss.tools.smooks.configuration.editors.xml;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardNode;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
-
-/**
- * @author Dart
- *
- */
-public abstract class AbstractStructuredDdataWizard extends Wizard implements IStructuredDataSelectionWizard,
- INewWizard {
- protected IWorkbench workbench;
-
- protected IStructuredSelection selection;
-
- protected AbstractFileSelectionWizardPage page = null;
- protected Object xsdElement = null;
- protected IWizardNode strucutredDataCreationWizardNode;
-
- private IContainer folder = null;
-
- public AbstractStructuredDdataWizard() {
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public void addPages() {
- if (page == null) {
- page = createAbstractFileSelectionWizardPage();
- page.setSelection(this.selection);
- if (folder != null) {
- page.setInitSelections(new Object[] { folder });
- }
- }
- this.addPage(page);
- }
-
- abstract protected AbstractFileSelectionWizardPage createAbstractFileSelectionWizardPage();
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- @Override
- public boolean performFinish() {
- xsdElement = this.page.getReturnValue();
- return true;
- }
-
- public Object getReturnData() {
- return xsdElement;
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.jboss.tools.smooks.ui.IStructuredDataCreationWizard#
- * getStructuredDataSourcePath()
- */
- public String getStructuredDataSourcePath() {
- return page.getFilePath();
- }
-
- public void init(IEditorSite site, IEditorInput input) {
- this.folder = ((IFileEditorInput) input).getFile().getParent();
- if (page != null && folder != null) {
- page.setInitSelections(new Object[] { folder });
- }
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- }
-
-}
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -49,7 +49,7 @@
return null;
Element rootElement = doc.getDocumentElement();
TagList dco = new TagList();
- dco.setName("Docuement"); //$NON-NLS-1$
+ dco.setName("Document"); //$NON-NLS-1$
dco.addRootTag(parseElement(rootElement, null, ignoreNodeNames, tagObjectClass));
return dco;
}
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizard.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizard.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizard.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -14,12 +14,13 @@
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
/**
* @author Dart Peng
* @Date Aug 18, 2008
*/
-public class XMLStructuredDataWizard extends AbstractStructuredDdataWizard {
+public class XMLStructuredDataWizard extends AbstractStructuredDataWizard {
Properties properties = new Properties();
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizardPage.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizardPage.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizardPage.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -3,6 +3,8 @@
*/
package org.jboss.tools.smooks.configuration.editors.xml;
+import org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
+
/**
* @author Dart Peng Date : 2008-8-16
*/
@@ -26,7 +28,6 @@
* org.jboss.tools.smooks.xml.ui.AbstractFileSelectionWizardPage#loadedTheObject
* (java.lang.String)
*/
- @Override
protected Object loadedTheObject(String path) throws Exception {
return null;
// XMLObjectAnalyzer analyzer = new XMLObjectAnalyzer();
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLTemplateCreationWizardPage.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLTemplateCreationWizardPage.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLTemplateCreationWizardPage.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -38,6 +38,7 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.xsd.XSDElementDeclaration;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.templating.model.ModelBuilderException;
import org.jboss.tools.smooks.templating.model.xml.XSDModelBuilder;
@@ -77,7 +78,6 @@
* @seeorg.jboss.tools.smooks.configuration.editors.xml.
* AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
*/
- @Override
protected Object loadedTheObject(String path) throws Exception {
// TODO Auto-generated method stub
return null;
@@ -144,78 +144,79 @@
* AbstractFileSelectionWizardPage
* #createFilePathText(org.eclipse.swt.widgets.Composite)
*/
- @Override
+// @Override
protected Text createFilePathText(Composite parent) {
- fileTextComposite = new Composite(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.grabExcessHorizontalSpace = true;
- fileTextComposite.setLayoutData(gd);
- GridLayout xsdtgl = new GridLayout();
- xsdtgl.marginWidth = 0;
- xsdtgl.marginHeight = 0;
- xsdtgl.numColumns = 2;
- fileTextComposite.setLayout(xsdtgl);
-
- final Text fileText = new Text(fileTextComposite, SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fileText.setLayoutData(gd);
- fileText.addModifyListener(new ModifyListener() {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.
- * swt.events.ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- reasourceLoaded = false;
- if (tableViewer != null) {
- tableViewer.setInput(Collections.emptyList());
- }
- }
-
- });
- gd.grabExcessHorizontalSpace = true;
-
- loadXSDButton = new Button(fileTextComposite, SWT.NONE);
- loadXSDButton.setText(Messages.XMLTemplateCreationWizardPage_Button_Load);
- loadXSDButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- parsingError = null;
- reasourceLoaded = false;
- if (fileText.getText() == null || fileText.getText().length() == 0) {
- changeWizardPageStatus();
- return;
- }
-
- List<String> list;
- try {
- list = loadElement(fileText.getText());
- if (list == null || list.isEmpty()) {
- setErrorMessage(Messages.XMLTemplateCreationWizardPage_XSDParsingError1);
- } else {
- tableViewer.setInput(list);
- reasourceLoaded = true;
- }
- } catch (InvocationTargetException e1) {
- parsingError = e1.getTargetException();
- while(parsingError instanceof InvocationTargetException){
- parsingError = ((InvocationTargetException)parsingError).getTargetException();
- }
- } catch (IOException e1) {
- parsingError = e1;
- } catch (ModelBuilderException e1) {
- parsingError = e1;
- }
- changeWizardPageStatus();
- }
-
- });
- return fileText;
+// fileTextComposite = new Composite(parent, SWT.NONE);
+// GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+// gd.grabExcessHorizontalSpace = true;
+// fileTextComposite.setLayoutData(gd);
+// GridLayout xsdtgl = new GridLayout();
+// xsdtgl.marginWidth = 0;
+// xsdtgl.marginHeight = 0;
+// xsdtgl.numColumns = 2;
+// fileTextComposite.setLayout(xsdtgl);
+//
+// final Text fileText = new Text(fileTextComposite, SWT.BORDER);
+// gd = new GridData(GridData.FILL_HORIZONTAL);
+// fileText.setLayoutData(gd);
+// fileText.addModifyListener(new ModifyListener() {
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see
+// * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.
+// * swt.events.ModifyEvent)
+// */
+// public void modifyText(ModifyEvent e) {
+// reasourceLoaded = false;
+// if (tableViewer != null) {
+// tableViewer.setInput(Collections.emptyList());
+// }
+// }
+//
+// });
+// gd.grabExcessHorizontalSpace = true;
+//
+// loadXSDButton = new Button(fileTextComposite, SWT.NONE);
+// loadXSDButton.setText(Messages.XMLTemplateCreationWizardPage_Button_Load);
+// loadXSDButton.addSelectionListener(new SelectionAdapter() {
+//
+// @Override
+// public void widgetSelected(SelectionEvent e) {
+// super.widgetSelected(e);
+// parsingError = null;
+// reasourceLoaded = false;
+// if (fileText.getText() == null || fileText.getText().length() == 0) {
+// changeWizardPageStatus();
+// return;
+// }
+//
+// List<String> list;
+// try {
+// list = loadElement(fileText.getText());
+// if (list == null || list.isEmpty()) {
+// setErrorMessage(Messages.XMLTemplateCreationWizardPage_XSDParsingError1);
+// } else {
+// tableViewer.setInput(list);
+// reasourceLoaded = true;
+// }
+// } catch (InvocationTargetException e1) {
+// parsingError = e1.getTargetException();
+// while(parsingError instanceof InvocationTargetException){
+// parsingError = ((InvocationTargetException)parsingError).getTargetException();
+// }
+// } catch (IOException e1) {
+// parsingError = e1;
+// } catch (ModelBuilderException e1) {
+// parsingError = e1;
+// }
+// changeWizardPageStatus();
+// }
+//
+// });
+// return fileText;
+ return null;
}
private List<String> loadElement(String path) throws InvocationTargetException, IOException, ModelBuilderException {
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDStructuredDataWizard.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDStructuredDataWizard.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDStructuredDataWizard.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -14,12 +14,13 @@
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
/**
* @author Dart (dpeng(a)redhat.com)
*
*/
-public class XSDStructuredDataWizard extends AbstractStructuredDdataWizard {
+public class XSDStructuredDataWizard extends AbstractStructuredDataWizard {
public XSDStructuredDataWizard() {
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -34,10 +34,10 @@
import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.configuration.SmooksConstants;
import org.jboss.tools.smooks.configuration.editors.Messages;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
import org.jboss.tools.smooks.graphical.editors.ISmooksEditorInitListener;
import org.jboss.tools.smooks.graphical.editors.SmooksMessage;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.core.GlobalParams;
import org.jboss.tools.smooks.model.core.ICorePackage;
import org.jboss.tools.smooks.model.core.IParam;
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -58,6 +58,7 @@
import org.jboss.tools.smooks.configuration.editors.SmooksXMLEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.graphical.editors.ISmooksEditorInitListener;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksEditorModelBuilder;
import org.jboss.tools.smooks.model.SmooksModel;
import org.jboss.tools.smooks.model.core.IParam;
@@ -233,8 +234,8 @@
// create EMF resource
if (file != null) {
try {
- smooksModel = smooksEditorModelBuilder.readModel(file
- .getContents());
+ smooksModel = smooksEditorModelBuilder.readModel(file.getContents());
+ smooksModel.getModelRoot().setModelProvider(this);
} catch (Exception e) {
initSmooksModelException = e;
}
@@ -479,6 +480,7 @@
try {
stream = new ByteArrayInputStream(conents.getBytes());
this.smooksModel = smooksEditorModelBuilder.readModel(stream);
+ smooksModel.getModelRoot().setModelProvider(this);
} catch (Exception e) {
smooksModel = null;
exception = e;
Deleted: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/ISmooksModelProvider.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/ISmooksModelProvider.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/ISmooksModelProvider.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -1,18 +0,0 @@
-/**
- *
- */
-package org.jboss.tools.smooks.editor;
-
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.jboss.tools.smooks.model.SmooksModel;
-import org.milyn.javabean.dynamic.Model;
-
-/**
- * @author Dart
- *
- */
-public interface ISmooksModelProvider extends IEditingDomainProvider{
- Model<SmooksModel> getSmooksModel();
-
- String getInputType();
-}
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -20,8 +20,8 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
/**
* @author Dart
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -12,10 +12,10 @@
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
import org.jboss.tools.smooks.graphical.editors.process.ProcessFactory;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksModel;
import org.milyn.javabean.dynamic.Model;
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -1,9 +1,9 @@
package org.jboss.tools.smooks.graphical.actions;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
public class AddTaskNodeAction extends AbstractProcessGraphAction {
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -17,11 +17,11 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
import org.jboss.tools.smooks.graphical.editors.process.IProcessProvider;
import org.jboss.tools.smooks.graphical.editors.process.ProcessType;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
/**
* @author Dart
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-08-19 10:56:56 UTC (rev 24291)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-08-19 11:16:52 UTC (rev 24292)
@@ -73,7 +73,6 @@
import org.jboss.tools.smooks.configuration.editors.SmooksReaderFormPage;
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.actions.AbstractProcessGraphAction;
import org.jboss.tools.smooks.graphical.actions.AddNextTaskNodeAction;
import org.jboss.tools.smooks.graphical.actions.DeleteTaskNodeAction;
@@ -86,6 +85,7 @@
import org.jboss.tools.smooks.graphical.editors.process.TaskNodeFigure;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
import org.jboss.tools.smooks.graphical.editors.process.TemplateAppyTaskNode;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
/**
* @author Dart
15 years, 4 months
JBoss Tools SVN: r24291 - in trunk/usage: plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-08-19 06:56:56 -0400 (Thu, 19 Aug 2010)
New Revision: 24291
Added:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/messages.properties
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/JBossToolsUsageActivator.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties
Removed:
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/HttpGetMethod.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/googleanalytics/PluginLogger.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/googleanalytics/googleanalytics_messages.properties
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/reporting_messages.properties
Modified:
trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.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/preferences/PreferencesMessages.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/FocusPointTest.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GoogleAnalyticsUrlStrategyTest.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageRequestsTest.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageTest.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/SystemOutLogger.java
Log:
[JBIDE-6376] packages refactored, strings externalized
Modified: trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF 2010-08-19 10:56:56 UTC (rev 24291)
@@ -6,12 +6,11 @@
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.jboss.tools.usage,
org.jboss.tools.usage.googleanalytics,
- org.jboss.tools.usage.preferences,
- org.jboss.tools.usage.reporting,
+ org.jboss.tools.usage.reporting; x-internal:=true; x-friends="org.jboss.tools.usage.test",
org.jboss.tools.usage.util
Require-Bundle: org.eclipse.osgi;bundle-version="3.5.0",
org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui;bundle-version="3.5.0"
-Bundle-Activator: org.jboss.tools.usage.JBossToolsUsageActivator
+Bundle-Activator: org.jboss.tools.usage.internal.JBossToolsUsageActivator
Bundle-Vendor: %BundleVendor
Bundle-ActivationPolicy: lazy
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/googleanalytics/FocusPoint.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/FocusPoint.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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);
- }
- }
-}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -3,13 +3,7 @@
import org.eclipse.osgi.util.NLS;
public class GoogleAnalyticsMessages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.usage.googleanalytics.googleanalytics_messages"; //$NON-NLS-1$
- public static String HttpGetMethod_Error_Http;
- public static String HttpGetMethod_Error_Io;
- public static String HttpGetMethod_Success;
- public static String Tracker_Synchronous;
- public static String Tracker_Asynchronous;
- public static String Tracker_Error;
+ private static final String BUNDLE_NAME = "org.jboss.tools.usage.googleanalytics.messages"; //$NON-NLS-1$
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, GoogleAnalyticsMessages.class);
Modified: 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/GoogleAnalyticsUrlStrategy.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -12,12 +12,17 @@
import java.io.UnsupportedEncodingException;
+import org.jboss.tools.usage.FocusPoint;
+import org.jboss.tools.usage.IURLBuildingStrategy;
import org.jboss.tools.usage.util.EncodingUtils;
/**
* Class that builds an URL that passes given parameters to google analytics
*
* @author Andre Dietisheim
+ *
+ * @see <a
+ * href="http://code.google.com/apis/analytics/docs/tracking/gaTrackingTroubleshoo...">GIF Request Parameters</a>
*/
public class GoogleAnalyticsUrlStrategy implements IURLBuildingStrategy {
@@ -119,7 +124,7 @@
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_HID, getRandomNumber(), builder);
appendParameter(IGoogleAnalyticsParameters.PARAM_REFERRAL, googleParameters.getReferral(), builder);
appendParameter(IGoogleAnalyticsParameters.PARAM_PAGE_REQUEST, focusPoint.getContentURI(), builder);
@@ -131,7 +136,7 @@
}
private String getCookies(FocusPoint focusPoint) {
- long timeStamp = System.currentTimeMillis();
+ long timeStamp = System.currentTimeMillis();
StringBuilder builder = new StringBuilder();
builder.append(IGoogleAnalyticsParameters.PARAM_COOKIES_FIRST_VISIT)
.append(IGoogleAnalyticsParameters.EQUALS_SIGN)
@@ -193,8 +198,9 @@
/**
* Appends the keyword to the cookies.
- *
- * @param builder the builder to append to
+ *
+ * @param builder
+ * the builder to append to
*/
private void appendCookieKeyword(StringBuilder builder) {
String keyword = googleParameters.getKeyword();
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/googleanalytics/HttpGetMethod.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/HttpGetMethod.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.text.MessageFormat;
-
-
-/**
- * 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"; //$NON-NLS-1$
-
- private static final String GET_METHOD_NAME = "GET"; //$NON-NLS-1$
-
- private ILoggingAdapter loggingAdapter = null;
-
-// private CookieHandler cookieHandler;
-
- private String userAgent;
-
- public HttpGetMethod(String userAgent, ILoggingAdapter loggingAdapter) {
- this.userAgent = userAgent;
- this.loggingAdapter = loggingAdapter;
-// this.cookieHandler = new CookieHandler();
-// this.cookieHandler = CookieHandler.getDefault();
-// 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(GoogleAnalyticsMessages.HttpGetMethod_Error_Http, urlString, responseCode));
- } else {
- loggingAdapter.logError(MessageFormat.format(GoogleAnalyticsMessages.HttpGetMethod_Success, urlString));
- }
- } catch (Exception e) {
- loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.HttpGetMethod_Error_Io, urlString, e.toString()));
- } 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;
- }
-}
Deleted: 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/ILoggingAdapter.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/ILoggingAdapter.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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;
-
-/**
- * @author Andre Dietisheim
- */
-public interface ILoggingAdapter {
-
- public void logError(String errorMessage);
-
- public void logMessage(String message);
-
-}
Deleted: 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/googleanalytics/IURLBuildingStrategy.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/IURLBuildingStrategy.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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;
-
-/**
- * Interface for the URL building strategy
- *
- * @author Andre Dietisheim
- *
- */
-public interface IURLBuildingStrategy {
-
- public String build(FocusPoint focusPoint) throws UnsupportedEncodingException;
-
-}
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/googleanalytics/PluginLogger.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/PluginLogger.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-
-/**
- * @author Andre Dietisheim
- */
-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);
- }
- }
-}
Deleted: 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/googleanalytics/Tracker.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/Tracker.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.text.MessageFormat;
-
-import org.jboss.tools.usage.ITracker;
-
-/**
- * Reports (tracks) usage
- *
- * @author Andre Dietisheim
- * @see based on <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(IURLBuildingStrategy urlBuildingStrategy, String userAgent, ILoggingAdapter loggingAdapter) {
- this.httpRequest = new HttpGetMethod(userAgent, loggingAdapter);
- this.loggingAdapter = loggingAdapter;
- this.urlBuildingStrategy = urlBuildingStrategy;
- }
-
- public void trackSynchronously(FocusPoint focusPoint) {
- loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.Tracker_Synchronous, focusPoint.getContentTitle()));
- try {
- httpRequest.request(urlBuildingStrategy.build(focusPoint));
- } catch (Exception e) {
- loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.Tracker_Error, e.getMessage()));
- }
- }
-
- public void trackAsynchronously(FocusPoint focusPoint) {
- loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.Tracker_Asynchronous, 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 (Exception e) {
- loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.Tracker_Error, e.getMessage()));
- }
- }
- }
-}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/googleanalytics_messages.properties
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/googleanalytics_messages.properties 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/googleanalytics_messages.properties 2010-08-19 10:56:56 UTC (rev 24291)
@@ -1,7 +0,0 @@
-HttpGetMethod_Error_Http=HTTP GET to \"{0}\" failed, response code received \"{1}\"
-HttpGetMethod_Error_Io=HTTP GET to \"{0}\" failed, exception occured: \"{1}\"
-HttpGetMethod_Success=HTTP GET to url \"{0}\" successfull\!
-
-Tracker_Asynchronous=Tracking asynchronously focusPoint \"{0}\"
-Tracker_Error=Tracking failed, exception thrown: \"{0}\"
-Tracker_Synchronous=Tracking synchronously focusPoint \"{0}\"
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/messages.properties (from rev 24289, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/googleanalytics_messages.properties)
===================================================================
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/JBossToolsUsageActivator.java (from rev 24289, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/JBossToolsUsageActivator.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/JBossToolsUsageActivator.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/JBossToolsUsageActivator.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class JBossToolsUsageActivator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.usage"; //$NON-NLS-1$
+
+ private static JBossToolsUsageActivator plugin;
+
+ public JBossToolsUsageActivator() {
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static JBossToolsUsageActivator getDefault() {
+ return plugin;
+ }
+
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/PreferencesMessages.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/PreferencesMessages.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/PreferencesMessages.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -13,7 +13,7 @@
import org.eclipse.osgi.util.NLS;
public class PreferencesMessages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.usage.preferences.preferences_messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.jboss.tools.usage.preferences.messages"; //$NON-NLS-1$
public static String UsageReportPreferencePage_Description;
public static String UsageReportPreferencePage_AllowReporting;
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -15,7 +15,7 @@
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.jboss.tools.usage.JBossToolsUsageActivator;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
import org.jboss.tools.usage.reporting.UsageReportPreferences;
import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.service.prefs.BackingStoreException;
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -19,9 +19,9 @@
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.usage.JBossToolsUsageActivator;
import org.jboss.tools.usage.googleanalytics.AbstractGoogleAnalyticsParameters;
import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
import org.jboss.tools.usage.util.BundleUtils;
import org.jboss.tools.usage.util.PreferencesUtils;
@@ -35,11 +35,15 @@
*/
public class EclipseEnvironment extends AbstractGoogleAnalyticsParameters implements IGoogleAnalyticsParameters {
+ private static final String USERAGENT_WIN = "{0}/{1} (Windows; U; Windows NT 6.1; {2})"; //$NON-NLS-1$
+ private static final String USERAGENT_MAC = "{0}/{1} (Macintosh; U; Intel Mac OS X 10.5; {2})"; //$NON-NLS-1$
+ private static final String USERAGENT_LINUX = "{0}/{1} (X11; U; Linux i686; {2})"; //$NON-NLS-1$
+
private static final char BUNDLE_GROUP_DELIMITER = '-';
- private static final String JBOSS_TOOLS_BUNDLES_PREFIX = "org\\.jboss\\.tools.+";
+ private static final String JBOSS_TOOLS_BUNDLES_PREFIX = "org\\.jboss\\.tools.+"; //$NON-NLS-1$
- private static final String ECLIPSE_RUNTIME_BULDEID = "org.eclipse.core.runtime";
+ private static final String ECLIPSE_RUNTIME_BULDEID = "org.eclipse.core.runtime"; //$NON-NLS-1$
private String screenResolution;
@@ -56,7 +60,7 @@
public String getBrowserLanguage() {
String nl = getNL();
if (nl == null) {
- return "";
+ return ""; //$NON-NLS-1$
}
int indexOf = nl.indexOf(JAVA_LOCALE_DELIMITER); //$NON-NLS-1$
@@ -124,7 +128,7 @@
* localLocale.getCountry().toLowerCase() : "" , Build.MODEL, Build.ID
* });
*/
-
+
return MessageFormat.format(
getUserAgentPattern(getOS())
, productId
@@ -134,24 +138,24 @@
}
private String getUserAgentPattern(String os) {
- String userAgentPattern = "";
+ String userAgentPattern = ""; //$NON-NLS-1$
/*
* 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})";
+ return USERAGENT_LINUX; //$NON-NLS-1$
} else if (Platform.OS_MACOSX.equals(os)) {
- return "{0}/{1} (Macintosh; U; Intel Mac OS X 10.5; {2})";
+ return USERAGENT_MAC; //$NON-NLS-1$
} else if (Platform.OS_WIN32.equals(os)) {
- return "{0}/{1} (Windows; U; Windows NT 6.1; {2})";
+ return USERAGENT_WIN; //$NON-NLS-1$
}
return userAgentPattern;
}
-
+
protected String getOS() {
return Platform.getOS();
}
-
+
protected String getApplicationName() {
return getApplicationBundle().getSymbolicName();
}
@@ -183,17 +187,22 @@
public String getUserId() {
IEclipsePreferences preferences = PreferencesUtils.getPreferences();
String userId = preferences.get(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID, null);
+ if (userId == null) {
+ userId = createIdentifier();
+ preferences.put(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID, userId);
+ savePreferences(preferences);
+ }
+ return userId;
+ }
+
+ private void savePreferences(IEclipsePreferences preferences) {
try {
- if (userId == null) {
- userId = createIdentifier();
- preferences.put(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID, userId);
- preferences.flush();
- }
+ preferences.flush();
} catch (BackingStoreException e) {
- StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID, "Could not retrieve {0} from preferences.",
+ StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID,
+ ReportingMessages.EclipseEnvironment_Error_SavePreferences7,
e, IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID);
}
- return userId;
}
/**
@@ -213,22 +222,22 @@
IBundleEntryFilter jbossToolsFilter = new BundleUtils.BundleSymbolicNameFilter(JBOSS_TOOLS_BUNDLES_PREFIX);
IBundleEntryFilter compositeFilter = new BundleUtils.CompositeFilter(
jbossToolsFilter
- , jbossBundleGroups );
+ , jbossBundleGroups);
BundleUtils.getBundles(compositeFilter, getBundles());
-
+
return bundleGroupsToKeywordString(jbossBundleGroups);
}
protected Bundle[] getBundles() {
return JBossToolsUsageActivator.getDefault().getBundle().getBundleContext().getBundles();
}
-
+
private String bundleGroupsToKeywordString(JBossBundleGroups jbossBundleGroups) {
char delimiter = BUNDLE_GROUP_DELIMITER;
StringBuilder builder = new StringBuilder();
for (String bundleGroupId : jbossBundleGroups.getBundleGroupIds()) {
builder.append(bundleGroupId)
- .append(delimiter);
+ .append(delimiter);
}
return builder.toString();
}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -14,6 +14,8 @@
public class ReportingMessages extends NLS {
private static final String BUNDLE_NAME = "org.jboss.tools.usage.reporting.reporting_messages"; //$NON-NLS-1$
+ public static String EclipseEnvironment_Error_SavePreferences7;
+
public static String UsageReport_Checkbox_Text;
public static String UsageReport_DialogMessage;
public static String UsageReport_DialogTitle;
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -10,15 +10,15 @@
******************************************************************************/
package org.jboss.tools.usage.reporting;
+import org.jboss.tools.usage.FocusPoint;
+import org.jboss.tools.usage.ILoggingAdapter;
import org.jboss.tools.usage.ITracker;
-import org.jboss.tools.usage.JBossToolsUsageActivator;
-import org.jboss.tools.usage.googleanalytics.FocusPoint;
+import org.jboss.tools.usage.IURLBuildingStrategy;
+import org.jboss.tools.usage.PluginLogger;
+import org.jboss.tools.usage.Tracker;
import org.jboss.tools.usage.googleanalytics.GoogleAnalyticsUrlStrategy;
import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
-import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
-import org.jboss.tools.usage.googleanalytics.IURLBuildingStrategy;
-import org.jboss.tools.usage.googleanalytics.PluginLogger;
-import org.jboss.tools.usage.googleanalytics.Tracker;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
/**
* @author Andre Dietisheim
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -15,7 +15,7 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.usage.JBossToolsUsageActivator;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
import org.jboss.tools.usage.reporting.ReportingMessages;
import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.service.prefs.BackingStoreException;
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -12,7 +12,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.jboss.tools.usage.JBossToolsUsageActivator;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
import org.jboss.tools.usage.util.PreferencesUtils;
import org.jboss.tools.usage.util.StatusUtils;
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties (from rev 24289, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/reporting_messages.properties)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties 2010-08-19 10:56:56 UTC (rev 24291)
@@ -0,0 +1,7 @@
+EclipseEnvironment_Error_SavePreferences7=Could not sage {0} to preferences.
+UsageReport_Checkbox_Text=Report usage anonymously to Red Hat Inc.
+UsageReport_DialogMessage=Please allow Red Hat Inc. to report this installation anynomously for statistical matters.
+UsageReport_DialogTitle=Report usage
+UsageReport_Error_SavePreferences=Could not save preferences {0}
+UsageReport_GoogleAnalyticsAccount=UA-17645367-1
+UsageReport_HostName=jboss.org
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/reporting_messages.properties
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/reporting_messages.properties 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/reporting_messages.properties 2010-08-19 10:56:56 UTC (rev 24291)
@@ -1,6 +0,0 @@
-UsageReport_Checkbox_Text=Report usage anonymously to Red Hat Inc.
-UsageReport_DialogMessage=Please allow Red Hat Inc. to report this installation anynomously for statistical matters.
-UsageReport_DialogTitle=Report usage
-UsageReport_Error_SavePreferences=Could not save preferences {0}
-UsageReport_GoogleAnalyticsAccount=UA-17645367-1
-UsageReport_HostName=jboss.org
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -14,7 +14,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
-import org.jboss.tools.usage.JBossToolsUsageActivator;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
public class PreferencesUtils {
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/FocusPointTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/FocusPointTest.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/FocusPointTest.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.usage.test;
-import org.jboss.tools.usage.googleanalytics.FocusPoint;
+import org.jboss.tools.usage.FocusPoint;
import org.jboss.tools.usage.util.EncodingUtils;
import junit.framework.TestCase;
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GoogleAnalyticsUrlStrategyTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GoogleAnalyticsUrlStrategyTest.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GoogleAnalyticsUrlStrategyTest.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -15,7 +15,7 @@
import java.io.UnsupportedEncodingException;
import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.usage.googleanalytics.FocusPoint;
+import org.jboss.tools.usage.FocusPoint;
import org.jboss.tools.usage.googleanalytics.GoogleAnalyticsUrlStrategy;
import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
import org.junit.Before;
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageRequestsTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageRequestsTest.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageRequestsTest.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -14,8 +14,8 @@
import java.io.IOException;
import java.net.HttpURLConnection;
-import org.jboss.tools.usage.googleanalytics.HttpGetMethod;
-import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
+import org.jboss.tools.usage.HttpGetMethod;
+import org.jboss.tools.usage.ILoggingAdapter;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageTest.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageTest.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -11,14 +11,14 @@
package org.jboss.tools.usage.test;
import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.usage.FocusPoint;
+import org.jboss.tools.usage.ILoggingAdapter;
import org.jboss.tools.usage.ITracker;
-import org.jboss.tools.usage.googleanalytics.FocusPoint;
+import org.jboss.tools.usage.IURLBuildingStrategy;
+import org.jboss.tools.usage.PluginLogger;
+import org.jboss.tools.usage.Tracker;
import org.jboss.tools.usage.googleanalytics.GoogleAnalyticsUrlStrategy;
import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
-import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
-import org.jboss.tools.usage.googleanalytics.IURLBuildingStrategy;
-import org.jboss.tools.usage.googleanalytics.PluginLogger;
-import org.jboss.tools.usage.googleanalytics.Tracker;
import org.junit.Test;
/**
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/SystemOutLogger.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/SystemOutLogger.java 2010-08-19 10:54:06 UTC (rev 24290)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/SystemOutLogger.java 2010-08-19 10:56:56 UTC (rev 24291)
@@ -1,6 +1,6 @@
package org.jboss.tools.usage.test;
-import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
+import org.jboss.tools.usage.ILoggingAdapter;
/**
* @author Andre Dietisheim
15 years, 4 months
JBoss Tools SVN: r24290 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-08-19 06:54:06 -0400 (Thu, 19 Aug 2010)
New Revision: 24290
Added:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/FocusPoint.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/HttpGetMethod.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ILoggingAdapter.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/IURLBuildingStrategy.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/PluginLogger.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/Tracker.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/UsageMessages.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/messages.properties
Removed:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/JBossToolsUsageActivator.java
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ITracker.java
Log:
[JBIDE-6376] packages refactored, strings externalized
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/FocusPoint.java (from rev 24263, 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/FocusPoint.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/FocusPoint.java 2010-08-19 10:54:06 UTC (rev 24290)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+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);
+ }
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/FocusPoint.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/HttpGetMethod.java (from rev 24289, 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/HttpGetMethod.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/HttpGetMethod.java 2010-08-19 10:54:06 UTC (rev 24290)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.text.MessageFormat;
+
+
+/**
+ * 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"; //$NON-NLS-1$
+
+ private static final String GET_METHOD_NAME = "GET"; //$NON-NLS-1$
+
+ private ILoggingAdapter loggingAdapter = null;
+
+// private CookieHandler cookieHandler;
+
+ private String userAgent;
+
+ public HttpGetMethod(String userAgent, ILoggingAdapter loggingAdapter) {
+ this.userAgent = userAgent;
+ this.loggingAdapter = loggingAdapter;
+// this.cookieHandler = new CookieHandler();
+// this.cookieHandler = CookieHandler.getDefault();
+// 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(UsageMessages.HttpGetMethod_Error_Http, urlString, responseCode));
+ } else {
+ loggingAdapter.logError(MessageFormat.format(UsageMessages.HttpGetMethod_Success, urlString));
+ }
+ } catch (Exception e) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.HttpGetMethod_Error_Io, urlString, e.toString()));
+ } 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;
+ }
+}
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ILoggingAdapter.java (from rev 24263, 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/ILoggingAdapter.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ILoggingAdapter.java 2010-08-19 10:54:06 UTC (rev 24290)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+/**
+ * @author Andre Dietisheim
+ */
+public interface ILoggingAdapter {
+
+ public void logError(String errorMessage);
+
+ public void logMessage(String message);
+
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ILoggingAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: 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/ITracker.java 2010-08-19 09:53:32 UTC (rev 24289)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ITracker.java 2010-08-19 10:54:06 UTC (rev 24290)
@@ -2,7 +2,6 @@
import java.io.UnsupportedEncodingException;
-import org.jboss.tools.usage.googleanalytics.FocusPoint;
/**
* @author Andre Dietisheim
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/IURLBuildingStrategy.java (from rev 24263, 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/IURLBuildingStrategy.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/IURLBuildingStrategy.java 2010-08-19 10:54:06 UTC (rev 24290)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+import java.io.UnsupportedEncodingException;
+
+
+/**
+ * Interface for the URL building strategy
+ *
+ * @author Andre Dietisheim
+ *
+ */
+public interface IURLBuildingStrategy {
+
+ public String build(FocusPoint focusPoint) throws UnsupportedEncodingException;
+
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/IURLBuildingStrategy.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/JBossToolsUsageActivator.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/JBossToolsUsageActivator.java 2010-08-19 09:53:32 UTC (rev 24289)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/JBossToolsUsageActivator.java 2010-08-19 10:54:06 UTC (rev 24290)
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * @author Andre Dietisheim
- */
-public class JBossToolsUsageActivator extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.jboss.tools.usage"; //$NON-NLS-1$
-
- private static JBossToolsUsageActivator plugin;
-
- public JBossToolsUsageActivator() {
- plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- public static JBossToolsUsageActivator getDefault() {
- return plugin;
- }
-
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-}
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/PluginLogger.java (from rev 24289, 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/PluginLogger.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/PluginLogger.java 2010-08-19 10:54:06 UTC (rev 24290)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * @author Andre Dietisheim
+ */
+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/Tracker.java (from rev 24289, 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/Tracker.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/Tracker.java 2010-08-19 10:54:06 UTC (rev 24290)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+import java.text.MessageFormat;
+
+/**
+ * Reports (tracks) usage
+ *
+ * @author Andre Dietisheim
+ * @see based on <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(IURLBuildingStrategy urlBuildingStrategy, String userAgent, ILoggingAdapter loggingAdapter) {
+ this.httpRequest = new HttpGetMethod(userAgent, loggingAdapter);
+ this.loggingAdapter = loggingAdapter;
+ this.urlBuildingStrategy = urlBuildingStrategy;
+ }
+
+ public void trackSynchronously(FocusPoint focusPoint) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.Tracker_Synchronous, focusPoint.getContentTitle()));
+ try {
+ httpRequest.request(urlBuildingStrategy.build(focusPoint));
+ } catch (Exception e) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.Tracker_Error, e.getMessage()));
+ }
+ }
+
+ public void trackAsynchronously(FocusPoint focusPoint) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.Tracker_Asynchronous, 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 (Exception e) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.Tracker_Error, e.getMessage()));
+ }
+ }
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/Tracker.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/UsageMessages.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/UsageMessages.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/UsageMessages.java 2010-08-19 10:54:06 UTC (rev 24290)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+import org.eclipse.osgi.util.NLS;
+
+public class UsageMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.usage.messages"; //$NON-NLS-1$
+ public static String Tracker_Synchronous;
+ public static String Tracker_Asynchronous;
+ public static String Tracker_Error;
+
+ public static String HttpGetMethod_Error_Http;
+ public static String HttpGetMethod_Error_Io;
+ public static String HttpGetMethod_Success;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, UsageMessages.class);
+ }
+
+ private UsageMessages() {
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/UsageMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/messages.properties
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/messages.properties (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/messages.properties 2010-08-19 10:54:06 UTC (rev 24290)
@@ -0,0 +1,7 @@
+HttpGetMethod_Error_Http=HTTP GET to \"{0}\" failed, response code received \"{1}\"
+HttpGetMethod_Error_Io=HTTP GET to \"{0}\" failed, exception occured: \"{1}\"
+HttpGetMethod_Success=HTTP GET to url \"{0}\" successfull\!
+
+Tracker_Asynchronous=Tracking asynchronously focusPoint \"{0}\"
+Tracker_Error=Tracking failed, exception thrown: \"{0}\"
+Tracker_Synchronous=Tracking synchronously focusPoint \"{0}\"
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 4 months
JBoss Tools SVN: r24289 - in trunk/usage/plugins/org.jboss.tools.usage: src/org/jboss/tools/usage and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-08-19 05:53:32 -0400 (Thu, 19 Aug 2010)
New Revision: 24289
Added:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/JBossToolsUsageActivator.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/GoogleAnalyticsMessages.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/PluginLogger.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/googleanalytics_messages.properties
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/PreferencesMessages.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/preferences_messages.properties
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/reporting_messages.properties
Removed:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/AbstractGoogleAnalyticsParameters.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/GoogleAnalyticsUrlStrategy.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/HttpGetMethod.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossToolsUsageActivator.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/Messages.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/PluginLogger.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties
Modified:
trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF
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/Tracker.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java
Log:
[JBIDE-6376] urls corrected, strings externalized, connection handling/reporting cleaned up
Modified: trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF 2010-08-19 09:53:32 UTC (rev 24289)
@@ -12,6 +12,6 @@
Require-Bundle: org.eclipse.osgi;bundle-version="3.5.0",
org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui;bundle-version="3.5.0"
-Bundle-Activator: org.jboss.tools.usage.reporting.JBossToolsUsageActivator
+Bundle-Activator: org.jboss.tools.usage.JBossToolsUsageActivator
Bundle-Vendor: %BundleVendor
Bundle-ActivationPolicy: lazy
Modified: 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/ITracker.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/ITracker.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -21,8 +21,7 @@
* @throws UnsupportedEncodingException
*/
- public abstract void trackSynchronously(FocusPoint focusPoint)
- throws UnsupportedEncodingException;
+ public abstract void trackSynchronously(FocusPoint focusPoint);
/**
* Track the focusPoint in the application asynchronously. <br/>
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/JBossToolsUsageActivator.java (from rev 24264, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossToolsUsageActivator.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/JBossToolsUsageActivator.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/JBossToolsUsageActivator.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class JBossToolsUsageActivator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.usage"; //$NON-NLS-1$
+
+ private static JBossToolsUsageActivator plugin;
+
+ public JBossToolsUsageActivator() {
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static JBossToolsUsageActivator getDefault() {
+ return plugin;
+ }
+
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+}
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java (from rev 24264, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/AbstractGoogleAnalyticsParameters.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+
+/**
+ * @author Andre Dietisheim
+ */
+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;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public String getHostname() {
+ return hostName;
+ }
+
+ public String getReferral() {
+ return referral;
+ }
+}
Added: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,20 @@
+package org.jboss.tools.usage.googleanalytics;
+
+import org.eclipse.osgi.util.NLS;
+
+public class GoogleAnalyticsMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.usage.googleanalytics.googleanalytics_messages"; //$NON-NLS-1$
+ public static String HttpGetMethod_Error_Http;
+ public static String HttpGetMethod_Error_Io;
+ public static String HttpGetMethod_Success;
+ public static String Tracker_Synchronous;
+ public static String Tracker_Asynchronous;
+ public static String Tracker_Error;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, GoogleAnalyticsMessages.class);
+ }
+
+ private GoogleAnalyticsMessages() {
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java (from rev 24264, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/GoogleAnalyticsUrlStrategy.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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 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);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_COOKIES, getCookies(focusPoint), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_GAQ, "1", false, builder);
+
+ return builder.toString();
+ }
+
+ private String getCookies(FocusPoint focusPoint) {
+ long timeStamp = System.currentTimeMillis();
+ StringBuilder builder = new StringBuilder();
+ builder.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)");
+ appendCookieKeyword(builder);
+ builder.append(IGoogleAnalyticsParameters.SEMICOLON);
+
+ return EncodingUtils.checkedEncodeUtf8(builder.toString());
+
+ // 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");
+
+ }
+
+ /**
+ * Appends the keyword to the cookies.
+ *
+ * @param builder the builder to append to
+ */
+ private void appendCookieKeyword(StringBuilder builder) {
+ String keyword = googleParameters.getKeyword();
+ if (keyword != null && keyword.length() > 0) {
+ builder.append(IGoogleAnalyticsParameters.PIPE)
+ .append(IGoogleAnalyticsParameters.PARAM_COOKIES_KEYWORD)
+ .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ .append(keyword);
+ }
+ }
+
+ 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("]");
+ // }
+ // }
+}
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/HttpGetMethod.java (from rev 24264, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/HttpGetMethod.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/HttpGetMethod.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/HttpGetMethod.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.text.MessageFormat;
+
+
+/**
+ * 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"; //$NON-NLS-1$
+
+ private static final String GET_METHOD_NAME = "GET"; //$NON-NLS-1$
+
+ private ILoggingAdapter loggingAdapter = null;
+
+// private CookieHandler cookieHandler;
+
+ private String userAgent;
+
+ public HttpGetMethod(String userAgent, ILoggingAdapter loggingAdapter) {
+ this.userAgent = userAgent;
+ this.loggingAdapter = loggingAdapter;
+// this.cookieHandler = new CookieHandler();
+// this.cookieHandler = CookieHandler.getDefault();
+// 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(GoogleAnalyticsMessages.HttpGetMethod_Error_Http, urlString, responseCode));
+ } else {
+ loggingAdapter.logError(MessageFormat.format(GoogleAnalyticsMessages.HttpGetMethod_Success, urlString));
+ }
+ } catch (Exception e) {
+ loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.HttpGetMethod_Error_Io, urlString, e.toString()));
+ } 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;
+ }
+}
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/PluginLogger.java (from rev 24264, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/PluginLogger.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/PluginLogger.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/PluginLogger.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * @author Andre Dietisheim
+ */
+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);
+ }
+ }
+}
Modified: 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/googleanalytics/Tracker.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/Tracker.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -10,11 +10,9 @@
******************************************************************************/
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.reporting.HttpGetMethod;
/**
* Reports (tracks) usage
@@ -35,13 +33,17 @@
this.urlBuildingStrategy = urlBuildingStrategy;
}
- public void trackSynchronously(FocusPoint focusPoint) throws UnsupportedEncodingException {
- loggingAdapter.logMessage("Tracking synchronously focusPoint=" + focusPoint.getContentTitle());
- httpRequest.request(urlBuildingStrategy.build(focusPoint));
+ public void trackSynchronously(FocusPoint focusPoint) {
+ loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.Tracker_Synchronous, focusPoint.getContentTitle()));
+ try {
+ httpRequest.request(urlBuildingStrategy.build(focusPoint));
+ } catch (Exception e) {
+ loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.Tracker_Error, e.getMessage()));
+ }
}
public void trackAsynchronously(FocusPoint focusPoint) {
- loggingAdapter.logMessage("Tracking Asynchronously focusPoint=" + focusPoint.getContentTitle());
+ loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.Tracker_Asynchronous, focusPoint.getContentTitle()));
new TrackingThread(focusPoint).start();
}
@@ -56,8 +58,8 @@
public void run() {
try {
httpRequest.request(urlBuildingStrategy.build(focusPoint));
- } catch (UnsupportedEncodingException e) {
- loggingAdapter.logMessage(MessageFormat.format("Tracking failed: {0}", e.getMessage()));
+ } catch (Exception e) {
+ loggingAdapter.logMessage(MessageFormat.format(GoogleAnalyticsMessages.Tracker_Error, e.getMessage()));
}
}
}
Added: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/googleanalytics_messages.properties
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/googleanalytics_messages.properties (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/googleanalytics_messages.properties 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,7 @@
+HttpGetMethod_Error_Http=HTTP GET to \"{0}\" failed, response code received \"{1}\"
+HttpGetMethod_Error_Io=HTTP GET to \"{0}\" failed, exception occured: \"{1}\"
+HttpGetMethod_Success=HTTP GET to url \"{0}\" successfull\!
+
+Tracker_Asynchronous=Tracking asynchronously focusPoint \"{0}\"
+Tracker_Error=Tracking failed, exception thrown: \"{0}\"
+Tracker_Synchronous=Tracking synchronously focusPoint \"{0}\"
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/googleanalytics_messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/PreferencesMessages.java (from rev 24266, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/Messages.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/PreferencesMessages.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/PreferencesMessages.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+public class PreferencesMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.usage.preferences.preferences_messages"; //$NON-NLS-1$
+
+ public static String UsageReportPreferencePage_Description;
+ public static String UsageReportPreferencePage_AllowReporting;
+ public static String UsageReportPreferencePage_Error_Saving;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, PreferencesMessages.class);
+ }
+
+ private PreferencesMessages() {
+ }
+}
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/PreferencesMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -15,7 +15,7 @@
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.jboss.tools.usage.reporting.JBossToolsUsageActivator;
+import org.jboss.tools.usage.JBossToolsUsageActivator;
import org.jboss.tools.usage.reporting.UsageReportPreferences;
import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.service.prefs.BackingStoreException;
@@ -32,13 +32,13 @@
public void createFieldEditors() {
addField(new BooleanFieldEditor(
IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID
- , Messages.UsageReportPreferencePage_AllowReporting
+ , PreferencesMessages.UsageReportPreferencePage_AllowReporting
, getFieldEditorParent()));
}
public void init(IWorkbench workbench) {
setPreferenceStore(UsageReportPreferences.createPreferenceStore());
- setDescription(Messages.UsageReportPreferencePage_Description);
+ setDescription(PreferencesMessages.UsageReportPreferencePage_Description);
}
@Override
@@ -47,7 +47,7 @@
UsageReportPreferences.flush();
} catch (BackingStoreException e) {
IStatus status = StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID,
- Messages.UsageReportPreferencePage_Error_Saving, e);
+ PreferencesMessages.UsageReportPreferencePage_Error_Saving, e);
JBossToolsUsageActivator.getDefault().getLog().log(status);
}
return super.performOk();
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/preferences_messages.properties (from rev 24266, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/messages.properties)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/preferences_messages.properties (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/preferences_messages.properties 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,3 @@
+UsageReportPreferencePage_Description=Preference page with options for anonymous usage data reporting. Usage data is used for statistical matters only.
+UsageReportPreferencePage_AllowReporting=&Allow Red Hat Inc. to report usage anonymously.
+UsageReportPreferencePage_Error_Saving=Could not save the preferences.
Property changes on: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/preferences/preferences_messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/AbstractGoogleAnalyticsParameters.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/AbstractGoogleAnalyticsParameters.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/AbstractGoogleAnalyticsParameters.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.reporting;
-
-import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
-
-/**
- * @author Andre Dietisheim
- */
-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;
- }
-
- public String getAccountName() {
- return accountName;
- }
-
- public String getHostname() {
- return hostName;
- }
-
- public String getReferral() {
- return referral;
- }
-}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -19,6 +19,8 @@
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.usage.JBossToolsUsageActivator;
+import org.jboss.tools.usage.googleanalytics.AbstractGoogleAnalyticsParameters;
import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
import org.jboss.tools.usage.util.BundleUtils;
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/GoogleAnalyticsUrlStrategy.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/GoogleAnalyticsUrlStrategy.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/GoogleAnalyticsUrlStrategy.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.reporting;
-
-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);
- appendParameter(IGoogleAnalyticsParameters.PARAM_COOKIES, getCookies(focusPoint), builder);
- appendParameter(IGoogleAnalyticsParameters.PARAM_GAQ, "1", false, builder);
-
- return builder.toString();
- }
-
- private String getCookies(FocusPoint focusPoint) {
- long timeStamp = System.currentTimeMillis();
- StringBuilder builder = new StringBuilder();
- builder.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)");
- appendCookieKeyword(builder);
- builder.append(IGoogleAnalyticsParameters.SEMICOLON);
-
- return EncodingUtils.checkedEncodeUtf8(builder.toString());
-
- // 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");
-
- }
-
- /**
- * Appends the keyword to the cookies.
- *
- * @param builder the builder to append to
- */
- private void appendCookieKeyword(StringBuilder builder) {
- String keyword = googleParameters.getKeyword();
- if (keyword != null && keyword.length() > 0) {
- builder.append(IGoogleAnalyticsParameters.PIPE)
- .append(IGoogleAnalyticsParameters.PARAM_COOKIES_KEYWORD)
- .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
- .append(keyword);
- }
- }
-
- 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/reporting/HttpGetMethod.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/HttpGetMethod.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/HttpGetMethod.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.reporting;
-
-import java.io.IOException;
-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 CookieHandler cookieHandler;
-
- private String userAgent;
-
- public HttpGetMethod(String userAgent, ILoggingAdapter loggingAdapter) {
- this.userAgent = userAgent;
- this.loggingAdapter = loggingAdapter;
-// this.cookieHandler = new CookieHandler();
-// this.cookieHandler = CookieHandler.getDefault();
-// 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;
- }
-}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossToolsUsageActivator.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossToolsUsageActivator.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossToolsUsageActivator.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.reporting;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * @author Andre Dietisheim
- */
-public class JBossToolsUsageActivator extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.jboss.tools.usage"; //$NON-NLS-1$
-
- private static JBossToolsUsageActivator plugin;
-
- public JBossToolsUsageActivator() {
- plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- public static JBossToolsUsageActivator getDefault() {
- return plugin;
- }
-
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/Messages.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/Messages.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/Messages.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.reporting;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.usage.reporting.messages"; //$NON-NLS-1$
- public static String UsageReport_Checkbox_Text;
- public static String UsageReport_DialogMessage;
- public static String UsageReport_DialogTitle;
-
- public static String UsageReport_Error_SavePreferences;
- public static String UsageReport_GoogleAnalyticsAccount;
- public static String UsageReport_HostName;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/PluginLogger.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/PluginLogger.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/PluginLogger.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.reporting;
-
-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;
-
-/**
- * @author Andre Dietisheim
- */
-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/reporting/ReportingMessages.java (from rev 24264, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/Messages.java)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingMessages.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.reporting;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ReportingMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.usage.reporting.reporting_messages"; //$NON-NLS-1$
+ public static String UsageReport_Checkbox_Text;
+ public static String UsageReport_DialogMessage;
+ public static String UsageReport_DialogTitle;
+
+ public static String UsageReport_Error_SavePreferences;
+ public static String UsageReport_GoogleAnalyticsAccount;
+ public static String UsageReport_HostName;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, ReportingMessages.class);
+ }
+
+ private ReportingMessages() {
+ }
+}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReport.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -11,10 +11,13 @@
package org.jboss.tools.usage.reporting;
import org.jboss.tools.usage.ITracker;
+import org.jboss.tools.usage.JBossToolsUsageActivator;
import org.jboss.tools.usage.googleanalytics.FocusPoint;
+import org.jboss.tools.usage.googleanalytics.GoogleAnalyticsUrlStrategy;
import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
import org.jboss.tools.usage.googleanalytics.IURLBuildingStrategy;
+import org.jboss.tools.usage.googleanalytics.PluginLogger;
import org.jboss.tools.usage.googleanalytics.Tracker;
/**
@@ -22,13 +25,15 @@
*/
public class UsageReport {
- private static final String GANALYTICS_ACCOUNTNAME = Messages.UsageReport_GoogleAnalyticsAccount;
+ private static final String GANALYTICS_ACCOUNTNAME = ReportingMessages.UsageReport_GoogleAnalyticsAccount;
- private static final String HOST_NAME = Messages.UsageReport_HostName;
+ private static final String HOST_NAME = ReportingMessages.UsageReport_HostName;
- private FocusPoint focusPoint = new FocusPoint("jboss.org").setChild(new FocusPoint("tools") //$NON-NLS-1$ //$NON-NLS-2$
- .setChild(new FocusPoint("usage").setChild(new FocusPoint("action") //$NON-NLS-1$ //$NON-NLS-2$
- .setChild(new FocusPoint("wsstartup"))))); //$NON-NLS-1$
+ private FocusPoint focusPoint = new FocusPoint("tools") //$NON-NLS-1$
+ .setChild(new FocusPoint("usage") //$NON-NLS-1$
+ .setChild(new FocusPoint("action") //$NON-NLS-1$
+ .setChild(new FocusPoint("wsstartup") //$NON-NLS-1$
+ ))); //$NON-NLS-1$
public void report() {
if (UsageReportPreferences.isEnabled()) {
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -15,7 +15,8 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.usage.reporting.Messages;
+import org.jboss.tools.usage.JBossToolsUsageActivator;
+import org.jboss.tools.usage.reporting.ReportingMessages;
import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.service.prefs.BackingStoreException;
@@ -28,9 +29,9 @@
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- UsageReportEnablementDialog dialog = new UsageReportEnablementDialog(Messages.UsageReport_DialogTitle,
- Messages.UsageReport_DialogMessage,
- Messages.UsageReport_Checkbox_Text,
+ UsageReportEnablementDialog dialog = new UsageReportEnablementDialog(ReportingMessages.UsageReport_DialogTitle,
+ ReportingMessages.UsageReport_DialogMessage,
+ ReportingMessages.UsageReport_Checkbox_Text,
true,
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
if (UsageReportPreferences.isAskUser()) {
@@ -51,7 +52,7 @@
UsageReportPreferences.flush();
} catch (BackingStoreException e) {
IStatus status = StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID,
- Messages.UsageReport_Error_SavePreferences, e);
+ ReportingMessages.UsageReport_Error_SavePreferences, e);
JBossToolsUsageActivator.getDefault().getLog().log(status);
}
}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/UsageReportPreferences.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -12,6 +12,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.jboss.tools.usage.JBossToolsUsageActivator;
import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
import org.jboss.tools.usage.util.PreferencesUtils;
import org.jboss.tools.usage.util.StatusUtils;
@@ -51,7 +52,7 @@
} catch (BackingStoreException e) {
JBossToolsUsageActivator.getDefault().getLog().log(
StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID,
- Messages.UsageReport_Error_SavePreferences, e,
+ ReportingMessages.UsageReport_Error_SavePreferences, e,
IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID));
}
}
Deleted: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties 2010-08-19 09:53:32 UTC (rev 24289)
@@ -1,6 +0,0 @@
-UsageReport_Checkbox_Text=Report usage anonymously to Red Hat Inc.
-UsageReport_DialogMessage=Please allow Red Hat Inc. to report this installation anynomously for statistical matters.
-UsageReport_DialogTitle=Report usage
-UsageReport_Error_SavePreferences=Could not save preferences {0}
-UsageReport_GoogleAnalyticsAccount=UA-17645367-1
-UsageReport_HostName=jboss.org
Copied: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/reporting_messages.properties (from rev 24264, trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/messages.properties)
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/reporting_messages.properties (rev 0)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/reporting_messages.properties 2010-08-19 09:53:32 UTC (rev 24289)
@@ -0,0 +1,6 @@
+UsageReport_Checkbox_Text=Report usage anonymously to Red Hat Inc.
+UsageReport_DialogMessage=Please allow Red Hat Inc. to report this installation anynomously for statistical matters.
+UsageReport_DialogTitle=Report usage
+UsageReport_Error_SavePreferences=Could not save preferences {0}
+UsageReport_GoogleAnalyticsAccount=UA-17645367-1
+UsageReport_HostName=jboss.org
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java 2010-08-19 09:51:42 UTC (rev 24288)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/PreferencesUtils.java 2010-08-19 09:53:32 UTC (rev 24289)
@@ -14,7 +14,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
-import org.jboss.tools.usage.reporting.JBossToolsUsageActivator;
+import org.jboss.tools.usage.JBossToolsUsageActivator;
public class PreferencesUtils {
15 years, 4 months
JBoss Tools SVN: r24288 - trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-08-19 05:51:42 -0400 (Thu, 19 Aug 2010)
New Revision: 24288
Modified:
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GoogleAnalyticsUrlStrategyTest.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageRequestsTest.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageTest.java
Log:
[JBIDE-6376] test url corrected
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GoogleAnalyticsUrlStrategyTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GoogleAnalyticsUrlStrategyTest.java 2010-08-19 06:24:48 UTC (rev 24287)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/GoogleAnalyticsUrlStrategyTest.java 2010-08-19 09:51:42 UTC (rev 24288)
@@ -16,8 +16,8 @@
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.usage.googleanalytics.FocusPoint;
+import org.jboss.tools.usage.googleanalytics.GoogleAnalyticsUrlStrategy;
import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
-import org.jboss.tools.usage.reporting.GoogleAnalyticsUrlStrategy;
import org.junit.Before;
import org.junit.Test;
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageRequestsTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageRequestsTest.java 2010-08-19 06:24:48 UTC (rev 24287)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageRequestsTest.java 2010-08-19 09:51:42 UTC (rev 24288)
@@ -14,8 +14,8 @@
import java.io.IOException;
import java.net.HttpURLConnection;
+import org.jboss.tools.usage.googleanalytics.HttpGetMethod;
import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
-import org.jboss.tools.usage.reporting.HttpGetMethod;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageTest.java 2010-08-19 06:24:48 UTC (rev 24287)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageTest.java 2010-08-19 09:51:42 UTC (rev 24288)
@@ -13,12 +13,12 @@
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.usage.ITracker;
import org.jboss.tools.usage.googleanalytics.FocusPoint;
+import org.jboss.tools.usage.googleanalytics.GoogleAnalyticsUrlStrategy;
import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
import org.jboss.tools.usage.googleanalytics.ILoggingAdapter;
import org.jboss.tools.usage.googleanalytics.IURLBuildingStrategy;
+import org.jboss.tools.usage.googleanalytics.PluginLogger;
import org.jboss.tools.usage.googleanalytics.Tracker;
-import org.jboss.tools.usage.reporting.GoogleAnalyticsUrlStrategy;
-import org.jboss.tools.usage.reporting.PluginLogger;
import org.junit.Test;
/**
@@ -29,10 +29,10 @@
private static final String HOST_NAME = "jboss.org";
private static final String LOCALE_US = "en_US";
- private FocusPoint focusPoint = new FocusPoint("jboss.org")
- .setChild(new FocusPoint("tools")
+ private FocusPoint focusPoint =
+ new FocusPoint("tools")
.setChild(new FocusPoint("usage")
- .setChild(new FocusPoint("test"))));
+ .setChild(new FocusPoint("test")));
private static final String GANALYTICS_ACCOUNTNAME = "UA-17645367-1";
15 years, 4 months
JBoss Tools SVN: r24287 - trunk/hibernatetools/docs/task-reference/en-US.
by jbosstools-commits@lists.jboss.org
Author: benlc
Date: 2010-08-19 02:24:48 -0400 (Thu, 19 Aug 2010)
New Revision: 24287
Removed:
trunk/hibernatetools/docs/task-reference/en-US/dialogs-link_sets.xml
trunk/hibernatetools/docs/task-reference/en-US/editors-link_sets.xml
trunk/hibernatetools/docs/task-reference/en-US/icons_and_buttons-link_sets.xml
trunk/hibernatetools/docs/task-reference/en-US/link_sets.xml
trunk/hibernatetools/docs/task-reference/en-US/perspectives-link_sets.xml
trunk/hibernatetools/docs/task-reference/en-US/preferences_pages-link_sets.xml
trunk/hibernatetools/docs/task-reference/en-US/views-link_sets.xml
trunk/hibernatetools/docs/task-reference/en-US/wizards-link_sets.xml
Modified:
trunk/hibernatetools/docs/task-reference/en-US/Hibernate_Tools_Reference_Guide.xml
Log:
' removing redundant link set files'
Modified: trunk/hibernatetools/docs/task-reference/en-US/Hibernate_Tools_Reference_Guide.xml
===================================================================
--- trunk/hibernatetools/docs/task-reference/en-US/Hibernate_Tools_Reference_Guide.xml 2010-08-19 06:01:17 UTC (rev 24286)
+++ trunk/hibernatetools/docs/task-reference/en-US/Hibernate_Tools_Reference_Guide.xml 2010-08-19 06:24:48 UTC (rev 24287)
@@ -17,8 +17,6 @@
<!--
<xi:include href="error_and_warning_messages.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="hints.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-
- <xi:include href="link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-->
<xi:include href="document_navigation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="link_placeholder.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
@@ -26,4 +24,4 @@
<xi:include href="Revision_History.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<index />
-</book>
\ No newline at end of file
+</book>
Deleted: trunk/hibernatetools/docs/task-reference/en-US/dialogs-link_sets.xml
===================================================================
--- trunk/hibernatetools/docs/task-reference/en-US/dialogs-link_sets.xml 2010-08-19 06:01:17 UTC (rev 24286)
+++ trunk/hibernatetools/docs/task-reference/en-US/dialogs-link_sets.xml 2010-08-19 06:24:48 UTC (rev 24287)
@@ -1,12 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Tools_Reference_Guide.ent">
-%BOOK_ENTITIES;
-]>
-<section id="link_sets-dialogs">
- <title>Dialogs</title>
- <para>
-
- </para>
- <para>&FEEDBACK-link_sets-dialogs;</para>
-</section>
\ No newline at end of file
Deleted: trunk/hibernatetools/docs/task-reference/en-US/editors-link_sets.xml
===================================================================
--- trunk/hibernatetools/docs/task-reference/en-US/editors-link_sets.xml 2010-08-19 06:01:17 UTC (rev 24286)
+++ trunk/hibernatetools/docs/task-reference/en-US/editors-link_sets.xml 2010-08-19 06:24:48 UTC (rev 24287)
@@ -1,18 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Tools_Reference_Guide.ent">
-%BOOK_ENTITIES;
-]>
-<section id="link_sets-editors">
- <title>Editors</title>
- <para>
-
- </para>
- <xi:include href="hibernate_mapping-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="hibernate_configuration-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="jboss_tools_properties-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="reveng.xml-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="hibernate_query_language-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="criteria_editor-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-
-</section>
\ No newline at end of file
Deleted: trunk/hibernatetools/docs/task-reference/en-US/icons_and_buttons-link_sets.xml
===================================================================
--- trunk/hibernatetools/docs/task-reference/en-US/icons_and_buttons-link_sets.xml 2010-08-19 06:01:17 UTC (rev 24286)
+++ trunk/hibernatetools/docs/task-reference/en-US/icons_and_buttons-link_sets.xml 2010-08-19 06:24:48 UTC (rev 24287)
@@ -1,12 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Tools_Reference_Guide.ent">
-%BOOK_ENTITIES;
-]>
-<section id="link_sets-icons_and_buttons">
- <title>Icons and buttons</title>
- <para>
-
- </para>
- <para>&FEEDBACK-link_sets-icons_and_buttons;</para>
-</section>
\ No newline at end of file
Deleted: trunk/hibernatetools/docs/task-reference/en-US/link_sets.xml
===================================================================
--- trunk/hibernatetools/docs/task-reference/en-US/link_sets.xml 2010-08-19 06:01:17 UTC (rev 24286)
+++ trunk/hibernatetools/docs/task-reference/en-US/link_sets.xml 2010-08-19 06:24:48 UTC (rev 24287)
@@ -1,18 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Tools_Reference_Guide.ent">
-%BOOK_ENTITIES;
-]>
-<chapter id="link_sets">
- <title>Link sets</title>
- <para>
-
- </para>
- <xi:include href="wizards-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="views-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="editors-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="perspectives-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="preferences_pages-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="dialogs-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="icons_and_buttons-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-</chapter>
\ No newline at end of file
Deleted: trunk/hibernatetools/docs/task-reference/en-US/perspectives-link_sets.xml
===================================================================
--- trunk/hibernatetools/docs/task-reference/en-US/perspectives-link_sets.xml 2010-08-19 06:01:17 UTC (rev 24286)
+++ trunk/hibernatetools/docs/task-reference/en-US/perspectives-link_sets.xml 2010-08-19 06:24:48 UTC (rev 24287)
@@ -1,14 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Tools_Reference_Guide.ent">
-%BOOK_ENTITIES;
-]>
-<section id="link_sets-perspectives">
- <title>Perspectives</title>
- <para>
-
- </para>
- <xi:include href="hibernate_console-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="jpa_perspective-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-
-</section>
\ No newline at end of file
Deleted: trunk/hibernatetools/docs/task-reference/en-US/preferences_pages-link_sets.xml
===================================================================
--- trunk/hibernatetools/docs/task-reference/en-US/preferences_pages-link_sets.xml 2010-08-19 06:01:17 UTC (rev 24286)
+++ trunk/hibernatetools/docs/task-reference/en-US/preferences_pages-link_sets.xml 2010-08-19 06:24:48 UTC (rev 24287)
@@ -1,12 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Tools_Reference_Guide.ent">
-%BOOK_ENTITIES;
-]>
-<section id="link_sets-preferences_pages">
- <title>Preferences pages</title>
- <para>
-
- </para>
- <para>&FEEDBACK-link_sets-preferences_pages;</para>
-</section>
\ No newline at end of file
Deleted: trunk/hibernatetools/docs/task-reference/en-US/views-link_sets.xml
===================================================================
--- trunk/hibernatetools/docs/task-reference/en-US/views-link_sets.xml 2010-08-19 06:01:17 UTC (rev 24286)
+++ trunk/hibernatetools/docs/task-reference/en-US/views-link_sets.xml 2010-08-19 06:24:48 UTC (rev 24287)
@@ -1,21 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Tools_Reference_Guide.ent">
-%BOOK_ENTITIES;
-]>
-<section id="link_sets-views">
- <title>Views</title>
- <para>
-
- </para>
- <xi:include href="web_projects-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="hibernate_configurations-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="properties_view-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="mapping_diagram_view-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="hibernate_query_result-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="hibernate_dynamic_query_translator-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="error_log-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="add_jpa_annotations_view-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="jpa_details-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-
-</section>
\ No newline at end of file
Deleted: trunk/hibernatetools/docs/task-reference/en-US/wizards-link_sets.xml
===================================================================
--- trunk/hibernatetools/docs/task-reference/en-US/wizards-link_sets.xml 2010-08-19 06:01:17 UTC (rev 24286)
+++ trunk/hibernatetools/docs/task-reference/en-US/wizards-link_sets.xml 2010-08-19 06:24:48 UTC (rev 24287)
@@ -1,19 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Tools_Reference_Guide.ent">
-%BOOK_ENTITIES;
-]>
-<section id="link_sets-wizards">
- <title>Wizards</title>
- <para>
-
- </para>
- <xi:include href="hibernate_mapping_file-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="hibernate_configuration_file-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="hibernate_console_configuration-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="code_generation-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="reverse_engineering_file-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="add_jpa_annotations-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="new_jpa_project-link_sets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-
-</section>
\ No newline at end of file
15 years, 4 months