Author: DartPeng
Date: 2009-06-30 04:36:59 -0400 (Tue, 30 Jun 2009)
New Revision: 16275
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataConfiguraitonWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataPathWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java
Log:
JBIDE-4540
Add json data wizard and wizard page
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-06-30
08:29:52 UTC (rev 16274)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-06-30
08:36:59 UTC (rev 16275)
@@ -48,6 +48,8 @@
public class SmooksModelUtils {
public static final String INPUT_TYPE_JAVA = "java";
+
+ public static final String INPUT_TYPE_JSON = "json";
public static final String PARAM_NAME_CLASS = "class";
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-06-30
08:29:52 UTC (rev 16274)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-06-30
08:36:59 UTC (rev 16275)
@@ -24,7 +24,8 @@
org.eclipse.xsd,
org.eclipse.wst.wsdl,
org.apache.xerces,
- javax.wsdl
+ javax.wsdl,
+ org.jboss.tools.milyn.smooks1_1_2;bundle-version="1.1.2"
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataConfiguraitonWizardPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataConfiguraitonWizardPage.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataConfiguraitonWizardPage.java 2009-06-30
08:36:59 UTC (rev 16275)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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.json;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class JsonDataConfiguraitonWizardPage extends WizardPage {
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+
+ }
+
+ public JsonDataConfiguraitonWizardPage(String pageName, String title, ImageDescriptor
titleImage) {
+ super(pageName, title, titleImage);
+ // TODO Auto-generated constructor stub
+ }
+
+ public JsonDataConfiguraitonWizardPage(String pageName) {
+ super(pageName);
+ // TODO Auto-generated constructor stub
+ }
+
+
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataConfiguraitonWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataPathWizardPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataPathWizardPage.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataPathWizardPage.java 2009-06-30
08:36:59 UTC (rev 16275)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.json;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class JsonDataPathWizardPage extends AbstractFileSelectionWizardPage {
+
+ public JsonDataPathWizardPage(String pageName, boolean multiSelect, Object[]
initSelections,
+ List<ViewerFilter> filters) {
+ super(pageName, multiSelect, initSelections, filters);
+ // TODO Auto-generated constructor stub
+ }
+
+ public JsonDataPathWizardPage(String pageName, String[] fileExtensionNames) {
+ super(pageName, fileExtensionNames);
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
+ */
+ @Override
+ protected Object loadedTheObject(String path) throws Exception {
+ return null;
+ }
+
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataPathWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java 2009-06-30
08:36:59 UTC (rev 16275)
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * 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.json;
+
+import java.util.Properties;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import
org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class JsonDataWizard extends Wizard implements IStructuredDataSelectionWizard,
INewWizard {
+
+ private JsonDataPathWizardPage pathPage = null;
+
+ private JsonDataConfiguraitonWizardPage configPage = null;
+
+ public JsonDataWizard() {
+ super();
+ pathPage = new JsonDataPathWizardPage("Json Input Data Selection ", new
String[]{});
+ configPage = new JsonDataConfiguraitonWizardPage("Json data configuration
page");
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ super.addPages();
+ this.addPage(pathPage);
+ this.addPage(configPage);
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+ * org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getInputDataTypeID()
+ */
+ public String getInputDataTypeID() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getProperties()
+ */
+ public Properties getProperties() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getReturnData()
+ */
+ public Object getReturnData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getStructuredDataSourcePath()
+ */
+ public String getStructuredDataSourcePath() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#init(org.eclipse.ui.IEditorSite,
+ * org.eclipse.ui.IEditorInput)
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+
+ }
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java 2009-06-30
08:29:52 UTC (rev 16274)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java 2009-06-30
08:36:59 UTC (rev 16275)
@@ -20,6 +20,7 @@
import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanContentProvider;
import
org.jboss.tools.smooks.configuration.editors.javabean.JavabeanStrucutredDataWizard;
import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanlabelProvider;
+import org.jboss.tools.smooks.configuration.editors.json.JsonDataWizard;
import
org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataContentProvider;
import org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataLabelProvider;
import org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataWizard;
@@ -53,7 +54,16 @@
IViewerInitor initor = this.getInitorMap().get(typeID);
if (initor == null)
return null;
- return initor.getStructuredDataLoadWizard();
+ IStructuredDataSelectionWizard wizard = initor.getStructuredDataLoadWizard();
+ if(wizard != null){
+ try {
+ return wizard.getClass().newInstance();
+ } catch (Throwable t){
+ t.printStackTrace();
+ return wizard;
+ }
+ }
+ return null;
}
public ILabelProvider getLabelProvider(String typeID) {
@@ -125,13 +135,31 @@
protected HashMap<String, IViewerInitor> createNewInitorMap() {
HashMap<String, IViewerInitor> map = new HashMap<String, IViewerInitor>();
+
+ // for json
+ BaseViewerInitor jsonViewerInitor = new BaseViewerInitor();
+ String name = "Json";
+ String description = "Select Json data file as the input data.";
+ String iconPath = null;
+ String typeID = SmooksModelUtils.INPUT_TYPE_JSON;
+ jsonViewerInitor.setName(name);
+ jsonViewerInitor.setDescription(description);
+ jsonViewerInitor.setWizardIconPath(iconPath);
+ jsonViewerInitor.setTypeID(typeID);
+ jsonViewerInitor.setLabelProvider(new XMLStructuredDataLabelProvider());
+ jsonViewerInitor.setTreeContentProvider(new XMLStructuredDataContentProvider());
+ jsonViewerInitor.setStructuredDataLoadWizard(new JsonDataWizard());
+// jsonViewerInitor.setWizardIconPath(GraphicsConstants.IMAGE_JAVA_FILE);
+ map.put(typeID, jsonViewerInitor);
+
+
// for java
BaseViewerInitor javabeanViewerInitor = new BaseViewerInitor();
- String name = "Java";
- String description = "Select a Java type(class,interface) as the input
data.";
- String iconPath = null;
- String typeID = SmooksModelUtils.INPUT_TYPE_JAVA;
+ name = "Java";
+ description = "Select a Java type(class,interface) as the input data.";
+ iconPath = null;
+ typeID = SmooksModelUtils.INPUT_TYPE_JAVA;
javabeanViewerInitor.setName(name);
javabeanViewerInitor.setDescription(description);