JBoss Tools SVN: r11036 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-10-21 07:04:01 -0400 (Tue, 21 Oct 2008)
New Revision: 11036
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
Log:
corrected a4j:commandButton
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml 2008-10-21 09:20:19 UTC (rev 11035)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml 2008-10-21 11:04:01 UTC (rev 11036)
@@ -74,9 +74,9 @@
<vpe:tag name="a4j:commandButton" case-sensitive="yes">
<vpe:if test="not(attrpresent('image'))">
- <vpe:if test="(@type='')|(@type='submit')">
+ <vpe:if test="(@type='')">
<vpe:template children="no" modify="no">
- <input type="reset" value="{jsfvalue(@value)}" class="{@styleClass}" style="{@style}" title="{tagstring()}"/>
+ <input type="button" value="{jsfvalue(@value)}" class="{@styleClass}" style="{@style}" title="{tagstring()}"/>
<vpe:resize>
<vpe:width width-attr="style.width" />
<vpe:height height-attr="style.height" />
@@ -89,7 +89,7 @@
</vpe:template>
</vpe:if>
- <vpe:if test="not(@type='') and not(@type='submit')">
+ <vpe:if test="not(@type='') ">
<vpe:template children="no" modify="no">
<input type="{@type}" value="{jsfvalue(@value)}" class="{@styleClass}" style="{@style}" title="{tagstring()}"/>
<vpe:resize>
16 years, 2 months
JBoss Tools SVN: r11035 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-10-21 05:20:19 -0400 (Tue, 21 Oct 2008)
New Revision: 11035
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/icons/full/obj16/esb16.png
trunk/smooks/plugins/org.jboss.tools.smooks.ui/libs/dom4j.license
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java
Log:
JBIDE-2846
Thanks John for helping me to modify that
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 2008-10-21 09:18:30 UTC (rev 11034)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2008-10-21 09:20:19 UTC (rev 11035)
@@ -21,7 +21,8 @@
org.eclipse.emf.edit,
org.eclipse.emf.edit.ui,
org.eclipse.xsd.edit,
- org.jboss.tools.smooks.core
+ org.jboss.tools.smooks.core,
+ org.jboss.tools.common.model.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .,
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/icons/full/obj16/esb16.png
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/icons/full/obj16/esb16.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/libs/dom4j.license
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/libs/dom4j.license (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/libs/dom4j.license 2008-10-21 09:20:19 UTC (rev 11035)
@@ -0,0 +1,13 @@
+BSD style license
+
+Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright statements and notices. Redistributions must also contain a copy of this document.
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ 3. The name "DOM4J" must not be used to endorse or promote products derived from this Software without prior written permission of MetaStuff, Ltd. For written permission, please contact dom4j-info(a)metastuff.com.
+ 4. Products derived from this Software may not be called "DOM4J" nor may "DOM4J" appear in their names without prior written permission of MetaStuff, Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
+ 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
+
+THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. \ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-10-21 09:18:30 UTC (rev 11034)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-10-21 09:20:19 UTC (rev 11035)
@@ -1,161 +1,161 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="viewerInitor" name="viewerInitor" schema="schema/viewerInitor.exsd"/>
- <extension-point id="analyzer" name="analyzer" schema="schema/analyzer.exsd"/>
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
- uri = "http://www.jboss.org/tools/smooks/graphicalInformation"
- class = "org.jboss.tools.smooks.graphical.GraphicalPackage"
- genModel = "model/graphical.genmodel" />
- </extension>
-
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="Smooks Form Editor"
- extensions="smooks"
- icon="icons/sample.gif"
- class="org.jboss.tools.smooks.ui.editors.SmooksFormEditor"
- id="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.views.properties.tabbed.propertySections">
- <propertySections
- contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
- <propertySection
- class="org.jboss.tools.smooks.ui.ConnectionPropertySection"
- id="org.jboss.tools.smooks.ui.connection.propertyTab.Section"
- tab="org.jboss.tools.smooks.ui.connection.propertyTab">
- <input
- type="org.jboss.tools.smooks.ui.gef.model.LineConnectionModel">
- </input>
- </propertySection>
- </propertySections>
- </extension>
- <extension
- point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
- <propertyContributor
- contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor"
- typeMapper="org.jboss.tools.smooks.ui.SmooksGraphPropertyTypeMapper">
- <propertyCategory
- category="connection"></propertyCategory>
- </propertyContributor>
- </extension>
- <extension
- point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
- <propertyTabs
- contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
- <propertyTab
- category="connection"
- id="org.jboss.tools.smooks.ui.connection.propertyTab"
- label="Mapping Properties">
- </propertyTab>
- </propertyTabs>
- </extension>
- <extension
- point="org.eclipse.ui.newWizards">
- <category
- id="org.jboss.tools.smooks.ui.wizards"
- name="Smooks">
- </category>
- <wizard
- category="org.jboss.tools.smooks.ui.wizards"
- class="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
- icon="icons/sample.gif"
- id="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
- name="Smooks Configuration File">
- </wizard>
- </extension>
-
- <extension
- point="org.jboss.tools.smooks.ui.viewerInitor">
- <viewerInitor
- contentProvider="org.jboss.tools.smooks.xml.ui.XMLStructuredDataContentProvider"
- creationWizard="org.jboss.tools.smooks.xml.ui.XMLStructuredDataWizard"
- description="XML data type comes from any .xml file."
- labelProvider="org.jboss.tools.smooks.xml.ui.XMLStructuredDataLabelProvider"
- name="XML Data Type"
- typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
- </viewerInitor>
- </extension>
- <extension
- point="org.jboss.tools.smooks.ui.analyzer">
- <mappingAnalyzer
- class="org.jboss.tools.smooks.xml2xml.XML2XMLAnalyzer"
- name="XML2XML Analyzer"
- typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
- <targetSourceType
- id="org.jboss.tools.smooks.xml.viewerInitor.xml"
- name="XML">
- </targetSourceType>
- </mappingAnalyzer>
- </extension>
- <extension
- point="org.jboss.tools.smooks.ui.viewerInitor">
- <viewerInitor
- contentProvider="org.jboss.tools.smooks.javabean.model.BeanContentProvider"
- creationWizard="org.jboss.tools.smooks.javabean.ui.NewJavaBeanStrucutredDataWizard"
- description="This data type can get from any Java .class."
- labelProvider="org.jboss.tools.smooks.javabean.model.BeanlabelProvider"
- name="JavaBean Data Type"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- </viewerInitor>
- </extension>
- <extension
- point="org.jboss.tools.smooks.ui.analyzer">
- <mappingAnalyzer
- class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
- name="JavaBean Analyzer"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- <targetSourceType
- id="org.jboss.tools.smooks.ui.viewerInitor.javabean"
- name="java2java">
- </targetSourceType>
- </mappingAnalyzer>
- <sourceModelAnalyzer
- class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
- level="0"
- name="JavaBean SourceModel Analyzer"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- </sourceModelAnalyzer>
- <targetModelAnalyzer
- class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
- level="0"
- name="JavaBean TargetModel Analyzer"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- </targetModelAnalyzer>
- </extension>
-
- <extension
- point="org.jboss.tools.smooks.ui.analyzer">
- <mappingAnalyzer
- class="org.jboss.tools.smooks.java2xml.analyzer.Java2XMLAnalyzer"
- name="Java Bean"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- <targetSourceType
- id="org.jboss.tools.smooks.xml.viewerInitor.xml"
- name="XML">
- </targetSourceType>
- </mappingAnalyzer>
- </extension>
-
- <extension
- point="org.jboss.tools.smooks.ui.analyzer">
- <mappingAnalyzer
- class="org.jboss.tools.smooks.xml2java.analyzer.XML2JavaAnalyzer"
- name="XML2Java"
- typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
- <targetSourceType
- id="org.jboss.tools.smooks.ui.viewerInitor.javabean"
- name="JavaBean">
- </targetSourceType>
- </mappingAnalyzer>
- <sourceModelAnalyzer
- class="org.jboss.tools.smooks.xml2java.analyzer.XMLSourceModelAnalyzer"
- name="XML"
- typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
- </sourceModelAnalyzer>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="viewerInitor" name="viewerInitor" schema="schema/viewerInitor.exsd"/>
+ <extension-point id="analyzer" name="analyzer" schema="schema/analyzer.exsd"/>
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri = "http://www.jboss.org/tools/smooks/graphicalInformation"
+ class = "org.jboss.tools.smooks.graphical.GraphicalPackage"
+ genModel = "model/graphical.genmodel" />
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="Smooks Form Editor"
+ extensions="smooks"
+ icon="icons/sample.gif"
+ class="org.jboss.tools.smooks.ui.editors.SmooksFormEditor"
+ id="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections
+ contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
+ <propertySection
+ class="org.jboss.tools.smooks.ui.ConnectionPropertySection"
+ id="org.jboss.tools.smooks.ui.connection.propertyTab.Section"
+ tab="org.jboss.tools.smooks.ui.connection.propertyTab">
+ <input
+ type="org.jboss.tools.smooks.ui.gef.model.LineConnectionModel">
+ </input>
+ </propertySection>
+ </propertySections>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <propertyContributor
+ contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor"
+ typeMapper="org.jboss.tools.smooks.ui.SmooksGraphPropertyTypeMapper">
+ <propertyCategory
+ category="connection"></propertyCategory>
+ </propertyContributor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs
+ contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
+ <propertyTab
+ category="connection"
+ id="org.jboss.tools.smooks.ui.connection.propertyTab"
+ label="Mapping Properties">
+ </propertyTab>
+ </propertyTabs>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.jboss.tools.smooks.ui.wizards"
+ name="Smooks">
+ </category>
+ <wizard
+ category="org.jboss.tools.smooks.ui.wizards"
+ class="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
+ icon="icons/full/obj16/esb16.png"
+ id="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
+ name="Smooks Configuration File">
+ </wizard>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.smooks.ui.viewerInitor">
+ <viewerInitor
+ contentProvider="org.jboss.tools.smooks.xml.ui.XMLStructuredDataContentProvider"
+ creationWizard="org.jboss.tools.smooks.xml.ui.XMLStructuredDataWizard"
+ description="XML data type comes from any .xml file."
+ labelProvider="org.jboss.tools.smooks.xml.ui.XMLStructuredDataLabelProvider"
+ name="XML Data Type"
+ typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
+ </viewerInitor>
+ </extension>
+ <extension
+ point="org.jboss.tools.smooks.ui.analyzer">
+ <mappingAnalyzer
+ class="org.jboss.tools.smooks.xml2xml.XML2XMLAnalyzer"
+ name="XML2XML Analyzer"
+ typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
+ <targetSourceType
+ id="org.jboss.tools.smooks.xml.viewerInitor.xml"
+ name="XML">
+ </targetSourceType>
+ </mappingAnalyzer>
+ </extension>
+ <extension
+ point="org.jboss.tools.smooks.ui.viewerInitor">
+ <viewerInitor
+ contentProvider="org.jboss.tools.smooks.javabean.model.BeanContentProvider"
+ creationWizard="org.jboss.tools.smooks.javabean.ui.NewJavaBeanStrucutredDataWizard"
+ description="This data type can get from any Java .class."
+ labelProvider="org.jboss.tools.smooks.javabean.model.BeanlabelProvider"
+ name="JavaBean Data Type"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ </viewerInitor>
+ </extension>
+ <extension
+ point="org.jboss.tools.smooks.ui.analyzer">
+ <mappingAnalyzer
+ class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
+ name="JavaBean Analyzer"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ <targetSourceType
+ id="org.jboss.tools.smooks.ui.viewerInitor.javabean"
+ name="java2java">
+ </targetSourceType>
+ </mappingAnalyzer>
+ <sourceModelAnalyzer
+ class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
+ level="0"
+ name="JavaBean SourceModel Analyzer"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ </sourceModelAnalyzer>
+ <targetModelAnalyzer
+ class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
+ level="0"
+ name="JavaBean TargetModel Analyzer"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ </targetModelAnalyzer>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.smooks.ui.analyzer">
+ <mappingAnalyzer
+ class="org.jboss.tools.smooks.java2xml.analyzer.Java2XMLAnalyzer"
+ name="Java Bean"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ <targetSourceType
+ id="org.jboss.tools.smooks.xml.viewerInitor.xml"
+ name="XML">
+ </targetSourceType>
+ </mappingAnalyzer>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.smooks.ui.analyzer">
+ <mappingAnalyzer
+ class="org.jboss.tools.smooks.xml2java.analyzer.XML2JavaAnalyzer"
+ name="XML2Java"
+ typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
+ <targetSourceType
+ id="org.jboss.tools.smooks.ui.viewerInitor.javabean"
+ name="JavaBean">
+ </targetSourceType>
+ </mappingAnalyzer>
+ <sourceModelAnalyzer
+ class="org.jboss.tools.smooks.xml2java.analyzer.XMLSourceModelAnalyzer"
+ name="XML"
+ typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
+ </sourceModelAnalyzer>
+ </extension>
+</plugin>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-21 09:18:30 UTC (rev 11034)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-21 09:20:19 UTC (rev 11035)
@@ -1,483 +1,503 @@
-/*******************************************************************************
- * 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.ui.editors;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-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.ICheckStateListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardNode;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.jboss.tools.smooks.analyzer.AnalyzerFactory;
-import org.jboss.tools.smooks.analyzer.DataTypeID;
-import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
-import org.jboss.tools.smooks.ui.IViewerInitor;
-import org.jboss.tools.smooks.ui.StructuredDataCreationWizardDailog;
-import org.jboss.tools.smooks.ui.ViewerInitorStore;
-import org.jboss.tools.smooks.ui.wizards.ISmooksDataCreationAddtionWizard;
-import org.jboss.tools.smooks.ui.wizards.TransformSelectWizardNode;
-
-/**
- * @author Dart Peng<br>
- * Date : Sep 5, 2008
- */
-public class TypeIDSelectionWizardPage extends WizardPage {
- protected IWizard sourceDataCreationWizard;
-
- protected IWizard targetDataCreationWizard;
-
- private Object sourceTreeViewerInputContents;
-
- private Object targetTreeViewerInputContents;
-
- protected CheckboxTableViewer source;
- protected CheckboxTableViewer target;
- private List sourceList;
- private String sourceID = null;
- private String targetID = null;
- private String oldSourceID = null;
- private String oldTargetID = null;
- private IStructuredSelection selection;
- private boolean showDataSelectPage = false;
-
- private Hyperlink sourceDataLink;
-
- private Hyperlink targetDataLink;
-
- public IStructuredSelection getSelection() {
- return selection;
- }
-
- public void setSelection(IStructuredSelection selection) {
- this.selection = selection;
- }
-
- public String getSourceID() {
- return sourceID;
- }
-
- public void setSourceID(String sourceID) {
- this.sourceID = sourceID;
- }
-
- public String getTargetID() {
- return targetID;
- }
-
- public void setTargetID(String targetID) {
- this.targetID = targetID;
- }
-
- public TypeIDSelectionWizardPage(String pageName, boolean showDataSelectPage) {
- super(pageName);
- this.showDataSelectPage = showDataSelectPage;
- }
-
- @Override
- public boolean canFlipToNextPage() {
- if (this.getSourceID() != null || getTargetID() != null) {
- return true;
- }
- return false;
- }
-
- @Override
- public IWizardPage getNextPage() {
- String sourceID = this.getSourceID();
- String targetID = this.getTargetID();
- IStructuredDataCreationWizard sourceWizard = null;
- IStructuredDataCreationWizard targetWizard = null;
- IWizard rootWizard = getWizard();
- ISmooksDataCreationAddtionWizard wizard = (ISmooksDataCreationAddtionWizard) rootWizard;
- if (sourceID == null) {
- wizard.clearSourceWizardPages();
- }
- if (targetID == null) {
- wizard.clearTargetWizardPages();
- }
- if (sourceID != null && (!sourceID.equals(oldSourceID))) {
- sourceWizard = ViewerInitorStore.getInstance()
- .getStructuredDataCreationWizard(sourceID);
- oldSourceID = sourceID;
- }
- if (targetID != null && (!targetID.equals(oldTargetID))) {
- targetWizard = ViewerInitorStore.getInstance()
- .getStructuredDataCreationWizard(targetID);
- oldTargetID = targetID;
- }
- if (!wizardIsCreated(sourceWizard) && sourceWizard != null) {
- if (sourceWizard instanceof INewWizard) {
- ((INewWizard) sourceWizard).init(null, selection);
- }
- sourceWizard.addPages();
- }
- if (!wizardIsCreated(targetWizard) && targetWizard != null) {
- if (targetWizard instanceof INewWizard) {
- ((INewWizard) targetWizard).init(null, selection);
- }
- targetWizard.addPages();
- }
- addDataCreationPages(sourceWizard, targetWizard);
- return super.getNextPage();
- }
-
- private void addDataCreationPages(IWizard sourceWizard, IWizard targetWizard) {
- IWizard rootWizard = getWizard();
- if (rootWizard instanceof ISmooksDataCreationAddtionWizard) {
- ISmooksDataCreationAddtionWizard wizard = (ISmooksDataCreationAddtionWizard) rootWizard;
- if (sourceWizard != null) {
- wizard.clearSourceWizardPages();
- IWizardPage[] pages = sourceWizard.getPages();
- for (int i = 0; i < pages.length; i++) {
- IWizardPage p = pages[i];
- wizard.addSourceWizardPage(p);
- p.setWizard(rootWizard);
- }
- }
-
- if (targetWizard != null) {
- wizard.clearTargetWizardPages();
- IWizardPage[] pages = targetWizard.getPages();
- for (int i = 0; i < pages.length; i++) {
- IWizardPage p = pages[i];
- wizard.addTargetWizardPage(p);
- p.setWizard(rootWizard);
- }
- }
- }
- sourceDataCreationWizard = sourceWizard;
- targetDataCreationWizard = targetWizard;
- }
-
- private boolean wizardIsCreated(IWizard wizard) {
- if (wizard == null)
- return false;
- if (wizard.getPageCount() <= 0) {
- return false;
- }
- return true;
- }
-
- /*
- * (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 gl = new GridLayout();
- gl.numColumns = 2;
- gl.makeColumnsEqualWidth = true;
- mainComposite.setLayout(gl);
- sourceList = AnalyzerFactory.getInstance().getRegistrySourceIDList();
- Label sl = new Label(mainComposite, SWT.NONE);
- sl.setText("Source Data Type ID List : ");
-
- Label tl = new Label(mainComposite, SWT.NONE);
- tl.setText("Target Data Type ID List : ");
-
- source = createTableViewer(mainComposite);
- GridData gd = new GridData(GridData.FILL_BOTH);
- source.getTable().setLayoutData(gd);
- target = createTableViewer(mainComposite);
- target.getTable().setLayoutData(gd);
-
- source.setInput(sourceList);
- target.setInput(sourceList);
- initViewer();
-
- sourceDataLink = new Hyperlink(mainComposite, SWT.NONE);
- sourceDataLink.setText("Source Model Select:Empty");
- sourceDataLink.addHyperlinkListener(new IHyperlinkListener() {
-
- public void linkActivated(HyperlinkEvent e) {
- openSourceWizard();
- }
-
- public void linkEntered(HyperlinkEvent e) {
-
- }
-
- public void linkExited(HyperlinkEvent e) {
-
- }
-
- });
- // TODO don't show this
- sourceDataLink.setVisible(false);
- targetDataLink = new Hyperlink(mainComposite, SWT.NONE);
- targetDataLink.setText("Target Model Select:Empty");
- targetDataLink.addHyperlinkListener(new IHyperlinkListener() {
-
- public void linkActivated(HyperlinkEvent e) {
- openTargetWizard();
- }
-
- public void linkEntered(HyperlinkEvent e) {
-
- }
-
- public void linkExited(HyperlinkEvent e) {
-
- }
-
- });
- // TODO don't show this
- targetDataLink.setVisible(false);
-
- this.setControl(mainComposite);
- }
-
- protected void openTargetWizard() {
- targetTreeViewerInputContents = getReturnObjectFromWizard(getTargetID());
- resetLinkText();
- }
-
- protected IWizard getWizardViaDataID(String dataID) {
- if (dataID == null)
- return null;
- IWizardNode wn = getSourceWizard(dataID);
- // setSelectedNode(wn);
- IWizard sw = wn.getWizard();
- if (sw instanceof IStructuredDataCreationWizard) {
- // ((IStrucutredDataCreationWizard)sw).i
- }
- if (sw instanceof INewWizard) {
- ((INewWizard) sw).init(null, this.getSelection());
- }
- return sw;
- }
-
- protected Object getReturnObjectFromWizard(String dataID) {
- IWizard wizard = getWizardViaDataID(dataID);
- if (wizard != null) {
- StructuredDataCreationWizardDailog dialog = new StructuredDataCreationWizardDailog(
- getShell(), wizard);
- if (dialog.open() == Dialog.OK) {
- return dialog.getCurrentCreationWizard()
- .getTreeViewerInputContents();
- }
- } else {
- MessageDialog.openInformation(getShell(), "Info",
- "Please select the data type first");
- }
-
- return null;
- }
-
- protected void openSourceWizard() {
- sourceTreeViewerInputContents = getReturnObjectFromWizard(getSourceID());
- resetLinkText();
- }
-
- private void resetLinkText() {
- if (sourceTreeViewerInputContents != null) {
- sourceDataLink.setText("Source Model Select");
- }
-
- if (targetTreeViewerInputContents != null) {
- targetDataLink.setText("Target Model Select");
- }
- }
-
- protected String getDataTypeID(CheckboxTableViewer viewer) {
- Object[] objs = viewer.getCheckedElements();
- if (objs == null)
- return null;
- if (objs.length <= 0)
- return null;
- DataTypeID d = (DataTypeID) objs[0];
- return d.getId();
- }
-
- protected void initViewer() {
- IWizard wizard = this.getWizard();
- if (wizard instanceof TypeIDSelectionWizard) {
- String s = ((TypeIDSelectionWizard) wizard).getSourceDataTypeID();
- String t = ((TypeIDSelectionWizard) wizard).getTargetDataTypeID();
- this.setSourceID(s);
- this.setTargetID(t);
- if (initViewerCheckState(s, source)) {
- source.getTable().setEnabled(false);
- }
- if (initViewerCheckState(t, target)) {
- target.getTable().setEnabled(false);
- }
- }
- }
-
- protected boolean initViewerCheckState(String id, CheckboxTableViewer viewer) {
- if (id == null)
- return false;
- List l = (List) viewer.getInput();
- for (Iterator iterator = l.iterator(); iterator.hasNext();) {
- DataTypeID dti = (DataTypeID) iterator.next();
- if (id.equals(dti.getId())) {
- viewer.setChecked(dti, true);
- return true;
- }
- }
- return false;
- }
-
- private IWizardNode getSourceWizard(String id) {
- Collection<IViewerInitor> viewers = ViewerInitorStore.getInstance()
- .getViewerInitorCollection();
- for (Iterator iterator = viewers.iterator(); iterator.hasNext();) {
- IViewerInitor viewerInitor = (IViewerInitor) iterator.next();
- if (viewerInitor.getTypeID().equals(id)) {
- TransformSelectWizardNode wn = new TransformSelectWizardNode();
- IStructuredDataCreationWizard wizard = viewerInitor
- .getStructuredDataLoadWizard();
- if (wizard == null)
- return null;
- wn.setWizard(wizard);
- wn.setName(viewerInitor.getName());
- wn.setIconPath(viewerInitor.getWizardIconPath());
- wn.setDescription(viewerInitor.getDescription());
- return wn;
- }
- }
- return null;
- }
-
- protected CheckboxTableViewer createTableViewer(Composite parent) {
- final CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(
- parent, SWT.FULL_SELECTION);
- viewer.addCheckStateListener(new ICheckStateListener() {
- private boolean fireEvent = true;
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (!fireEvent)
- return;
- boolean check = event.getChecked();
- if (check) {
- fireEvent = false;
- viewer.setAllChecked(false);
- viewer.setChecked(event.getElement(), true);
- fireEvent = true;
- }
-
- if (viewer == source) {
- String sourceID = getDataTypeID(source);
- setSourceID(sourceID);
- }
-
- if (viewer == target) {
- String targetID = getDataTypeID(target);
- setTargetID(targetID);
- }
- IWizardContainer container = getContainer();
- if (container != null) {
- container.updateButtons();
- }
- }
-
- });
- TableColumn nameColumn = new TableColumn(viewer.getTable(), SWT.NONE);
- nameColumn.setWidth(100);
- nameColumn.setText("Name");
- viewer.setContentProvider(new TypeIDContentProvider());
- viewer.setLabelProvider(new TypeIDLabelProvider());
- return viewer;
- }
-
- private class TypeIDContentProvider implements IStructuredContentProvider {
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof List) {
- return ((List) inputElement).toArray();
- }
- return new Object[] {};
- }
-
- public void dispose() {
-
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- }
-
- private class TypeIDLabelProvider extends LabelProvider implements
- ITableLabelProvider {
-
- public Image getColumnImage(Object element, int columnIndex) {
-
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof DataTypeID) {
- switch (columnIndex) {
- case 0:
- return ((DataTypeID) element).getName();
- // case 1:
- // return ((DataTypeID) element).getId();
- }
- }
- return "";
- }
-
- }
-
-
- public Object getSourceTreeViewerInputContents() {
- return sourceTreeViewerInputContents;
- }
-
- public void setSourceTreeViewerInputContents(
- Object sourceTreeViewerInputContents) {
- this.sourceTreeViewerInputContents = sourceTreeViewerInputContents;
- }
-
- public Object getTargetTreeViewerInputContents() {
- return targetTreeViewerInputContents;
- }
-
- public void setTargetTreeViewerInputContents(
- Object targetTreeViewerInputContents) {
- this.targetTreeViewerInputContents = targetTreeViewerInputContents;
- }
-
- public IWizard getSourceDataCreationWizard() {
- return sourceDataCreationWizard;
- }
-
- public IWizard getTargetDataCreationWizard() {
- return targetDataCreationWizard;
- }
-}
+/*******************************************************************************
+ * 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.ui.editors;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+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.ICheckStateListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.jboss.tools.smooks.analyzer.AnalyzerFactory;
+import org.jboss.tools.smooks.analyzer.DataTypeID;
+import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
+import org.jboss.tools.smooks.ui.IViewerInitor;
+import org.jboss.tools.smooks.ui.StructuredDataCreationWizardDailog;
+import org.jboss.tools.smooks.ui.ViewerInitorStore;
+import org.jboss.tools.smooks.ui.wizards.ISmooksDataCreationAddtionWizard;
+import org.jboss.tools.smooks.ui.wizards.TransformSelectWizardNode;
+
+/**
+ * @author Dart Peng<br>
+ * Date : Sep 5, 2008
+ */
+public class TypeIDSelectionWizardPage extends WizardPage {
+ protected IWizard sourceDataCreationWizard;
+
+ protected IWizard targetDataCreationWizard;
+
+ private Object sourceTreeViewerInputContents;
+
+ private Object targetTreeViewerInputContents;
+
+ protected CheckboxTableViewer source;
+ protected CheckboxTableViewer target;
+ private List sourceList;
+ private String sourceID = null;
+ private String targetID = null;
+ private String oldSourceID = null;
+ private String oldTargetID = null;
+ private IStructuredSelection selection;
+ private boolean showDataSelectPage = false;
+
+ private Hyperlink sourceDataLink;
+
+ private Hyperlink targetDataLink;
+
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+ public String getSourceID() {
+ return sourceID;
+ }
+
+ public void setSourceID(String sourceID) {
+ this.sourceID = sourceID;
+ }
+
+ public String getTargetID() {
+ return targetID;
+ }
+
+ public void setTargetID(String targetID) {
+ this.targetID = targetID;
+ }
+
+ public TypeIDSelectionWizardPage(String pageName, boolean showDataSelectPage) {
+ super(pageName);
+ this.showDataSelectPage = showDataSelectPage;
+ setTitle("Select Source/Target Data Type");
+ setDescription("Select the data type for source/target data");
+ }
+
+ @Override
+ public boolean canFlipToNextPage() {
+ if (this.getSourceID() != null && getTargetID() != null) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ String sourceID = this.getSourceID();
+ String targetID = this.getTargetID();
+ IStructuredDataCreationWizard sourceWizard = null;
+ IStructuredDataCreationWizard targetWizard = null;
+ IWizard rootWizard = getWizard();
+ ISmooksDataCreationAddtionWizard wizard = (ISmooksDataCreationAddtionWizard) rootWizard;
+ if (sourceID == null) {
+ wizard.clearSourceWizardPages();
+ }
+ if (targetID == null) {
+ wizard.clearTargetWizardPages();
+ }
+ if (sourceID != null && (!sourceID.equals(oldSourceID))) {
+ sourceWizard = ViewerInitorStore.getInstance()
+ .getStructuredDataCreationWizard(sourceID);
+ oldSourceID = sourceID;
+ }
+ if (targetID != null && (!targetID.equals(oldTargetID))) {
+ targetWizard = ViewerInitorStore.getInstance()
+ .getStructuredDataCreationWizard(targetID);
+ oldTargetID = targetID;
+ }
+ if (!wizardIsCreated(sourceWizard) && sourceWizard != null) {
+ if (sourceWizard instanceof INewWizard) {
+ ((INewWizard) sourceWizard).init(null, selection);
+ }
+ sourceWizard.addPages();
+ }
+ if (!wizardIsCreated(targetWizard) && targetWizard != null) {
+ if (targetWizard instanceof INewWizard) {
+ ((INewWizard) targetWizard).init(null, selection);
+ }
+ targetWizard.addPages();
+ }
+ addDataCreationPages(sourceWizard, targetWizard);
+ return super.getNextPage();
+ }
+
+ private void addDataCreationPages(IWizard sourceWizard, IWizard targetWizard) {
+ IWizard rootWizard = getWizard();
+ if (rootWizard instanceof ISmooksDataCreationAddtionWizard) {
+ ISmooksDataCreationAddtionWizard wizard = (ISmooksDataCreationAddtionWizard) rootWizard;
+ if (sourceWizard != null) {
+ wizard.clearSourceWizardPages();
+ IWizardPage[] pages = sourceWizard.getPages();
+ for (int i = 0; i < pages.length; i++) {
+ IWizardPage p = pages[i];
+ wizard.addSourceWizardPage(p);
+ p.setWizard(rootWizard);
+ }
+ }
+
+ if (targetWizard != null) {
+ wizard.clearTargetWizardPages();
+ IWizardPage[] pages = targetWizard.getPages();
+ for (int i = 0; i < pages.length; i++) {
+ IWizardPage p = pages[i];
+ wizard.addTargetWizardPage(p);
+ p.setWizard(rootWizard);
+ }
+ }
+ }
+ sourceDataCreationWizard = sourceWizard;
+ targetDataCreationWizard = targetWizard;
+ }
+
+ private boolean wizardIsCreated(IWizard wizard) {
+ if (wizard == null)
+ return false;
+ if (wizard.getPageCount() <= 0) {
+ return false;
+ }
+ return true;
+ }
+
+ /*
+ * (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 gl = new GridLayout();
+ gl.numColumns = 2;
+ gl.makeColumnsEqualWidth = true;
+ mainComposite.setLayout(gl);
+ sourceList = AnalyzerFactory.getInstance().getRegistrySourceIDList();
+ Label sl = new Label(mainComposite, SWT.NONE);
+ sl.setText("Source Data Type ID List : ");
+
+ Label tl = new Label(mainComposite, SWT.NONE);
+ tl.setText("Target Data Type ID List : ");
+
+ Composite sourceBorder = new Composite(mainComposite,SWT.NONE);
+ sourceBorder.setBackground(ColorConstants.black);
+ FillLayout sbLayout = new FillLayout();
+ sbLayout.marginHeight = 1;
+ sbLayout.marginWidth = 1;
+ sourceBorder.setLayout(sbLayout);
+ source = createTableViewer(sourceBorder);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ sourceBorder.setLayoutData(gd);
+
+
+ Composite targetBorder = new Composite(mainComposite,SWT.NONE);
+ targetBorder.setBackground(ColorConstants.black);
+ FillLayout tbLayout = new FillLayout();
+ tbLayout.marginHeight = 1;
+ tbLayout.marginWidth = 1;
+ targetBorder.setLayout(tbLayout);
+ target = createTableViewer(targetBorder);
+ targetBorder.setLayoutData(gd);
+
+ source.setInput(sourceList);
+ target.setInput(sourceList);
+ initViewer();
+
+ sourceDataLink = new Hyperlink(mainComposite, SWT.NONE);
+ sourceDataLink.setText("Source Model Select:Empty");
+ sourceDataLink.addHyperlinkListener(new IHyperlinkListener() {
+
+ public void linkActivated(HyperlinkEvent e) {
+ openSourceWizard();
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+
+ }
+
+ public void linkExited(HyperlinkEvent e) {
+
+ }
+
+ });
+ // TODO don't show this
+ sourceDataLink.setVisible(false);
+ targetDataLink = new Hyperlink(mainComposite, SWT.NONE);
+ targetDataLink.setText("Target Model Select:Empty");
+ targetDataLink.addHyperlinkListener(new IHyperlinkListener() {
+
+ public void linkActivated(HyperlinkEvent e) {
+ openTargetWizard();
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+
+ }
+
+ public void linkExited(HyperlinkEvent e) {
+
+ }
+
+ });
+ // TODO don't show this
+ targetDataLink.setVisible(false);
+
+ this.setControl(mainComposite);
+ }
+
+ protected void openTargetWizard() {
+ targetTreeViewerInputContents = getReturnObjectFromWizard(getTargetID());
+ resetLinkText();
+ }
+
+ protected IWizard getWizardViaDataID(String dataID) {
+ if (dataID == null)
+ return null;
+ IWizardNode wn = getSourceWizard(dataID);
+ // setSelectedNode(wn);
+ IWizard sw = wn.getWizard();
+ if (sw instanceof IStructuredDataCreationWizard) {
+ // ((IStrucutredDataCreationWizard)sw).i
+ }
+ if (sw instanceof INewWizard) {
+ ((INewWizard) sw).init(null, this.getSelection());
+ }
+ return sw;
+ }
+
+ protected Object getReturnObjectFromWizard(String dataID) {
+ IWizard wizard = getWizardViaDataID(dataID);
+ if (wizard != null) {
+ StructuredDataCreationWizardDailog dialog = new StructuredDataCreationWizardDailog(
+ getShell(), wizard);
+ if (dialog.open() == Dialog.OK) {
+ return dialog.getCurrentCreationWizard()
+ .getTreeViewerInputContents();
+ }
+ } else {
+ MessageDialog.openInformation(getShell(), "Info",
+ "Please select the data type first");
+ }
+
+ return null;
+ }
+
+ protected void openSourceWizard() {
+ sourceTreeViewerInputContents = getReturnObjectFromWizard(getSourceID());
+// resetLinkText();
+ }
+/**
+ * @deprecated
+ */
+ private void resetLinkText() {
+ // if (sourceTreeViewerInputContents != null) {
+ // sourceDataLink.setText("Source Model Select");
+ // }
+ //
+ // if (targetTreeViewerInputContents != null) {
+ // targetDataLink.setText("Target Model Select");
+ // }
+ }
+
+ protected String getDataTypeID(CheckboxTableViewer viewer) {
+ Object[] objs = viewer.getCheckedElements();
+ if (objs == null)
+ return null;
+ if (objs.length <= 0)
+ return null;
+ DataTypeID d = (DataTypeID) objs[0];
+ return d.getId();
+ }
+
+ protected void initViewer() {
+ IWizard wizard = this.getWizard();
+ if (wizard instanceof TypeIDSelectionWizard) {
+ String s = ((TypeIDSelectionWizard) wizard).getSourceDataTypeID();
+ String t = ((TypeIDSelectionWizard) wizard).getTargetDataTypeID();
+ this.setSourceID(s);
+ this.setTargetID(t);
+ if (initViewerCheckState(s, source)) {
+ source.getTable().setEnabled(false);
+ }
+ if (initViewerCheckState(t, target)) {
+ target.getTable().setEnabled(false);
+ }
+ }
+ }
+
+ protected boolean initViewerCheckState(String id, CheckboxTableViewer viewer) {
+ if (id == null)
+ return false;
+ List l = (List) viewer.getInput();
+ for (Iterator iterator = l.iterator(); iterator.hasNext();) {
+ DataTypeID dti = (DataTypeID) iterator.next();
+ if (id.equals(dti.getId())) {
+ viewer.setChecked(dti, true);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private IWizardNode getSourceWizard(String id) {
+ Collection<IViewerInitor> viewers = ViewerInitorStore.getInstance()
+ .getViewerInitorCollection();
+ for (Iterator iterator = viewers.iterator(); iterator.hasNext();) {
+ IViewerInitor viewerInitor = (IViewerInitor) iterator.next();
+ if (viewerInitor.getTypeID().equals(id)) {
+ TransformSelectWizardNode wn = new TransformSelectWizardNode();
+ IStructuredDataCreationWizard wizard = viewerInitor
+ .getStructuredDataLoadWizard();
+ if (wizard == null)
+ return null;
+ wn.setWizard(wizard);
+ wn.setName(viewerInitor.getName());
+ wn.setIconPath(viewerInitor.getWizardIconPath());
+ wn.setDescription(viewerInitor.getDescription());
+ return wn;
+ }
+ }
+ return null;
+ }
+
+ protected CheckboxTableViewer createTableViewer(Composite parent) {
+ final CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(
+ parent, SWT.FULL_SELECTION);
+ viewer.addCheckStateListener(new ICheckStateListener() {
+ private boolean fireEvent = true;
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (!fireEvent)
+ return;
+ boolean check = event.getChecked();
+ if (check) {
+ fireEvent = false;
+ viewer.setAllChecked(false);
+ viewer.setChecked(event.getElement(), true);
+ fireEvent = true;
+ }
+
+ if (viewer == source) {
+ String sourceID = getDataTypeID(source);
+ setSourceID(sourceID);
+ }
+
+ if (viewer == target) {
+ String targetID = getDataTypeID(target);
+ setTargetID(targetID);
+ }
+ IWizardContainer container = getContainer();
+ if (container != null) {
+ container.updateButtons();
+ }
+ }
+
+ });
+ TableColumn nameColumn = new TableColumn(viewer.getTable(), SWT.NONE);
+ nameColumn.setWidth(250);
+ nameColumn.setText("Name");
+ viewer.setContentProvider(new TypeIDContentProvider());
+ viewer.setLabelProvider(new TypeIDLabelProvider());
+ return viewer;
+ }
+
+ private class TypeIDContentProvider implements IStructuredContentProvider {
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List) {
+ return ((List) inputElement).toArray();
+ }
+ return new Object[] {};
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ }
+
+ private class TypeIDLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof DataTypeID) {
+ switch (columnIndex) {
+ case 0:
+ return ((DataTypeID) element).getName();
+ // case 1:
+ // return ((DataTypeID) element).getId();
+ }
+ }
+ return "";
+ }
+
+ }
+
+
+ public Object getSourceTreeViewerInputContents() {
+ return sourceTreeViewerInputContents;
+ }
+
+ public void setSourceTreeViewerInputContents(
+ Object sourceTreeViewerInputContents) {
+ this.sourceTreeViewerInputContents = sourceTreeViewerInputContents;
+ }
+
+ public Object getTargetTreeViewerInputContents() {
+ return targetTreeViewerInputContents;
+ }
+
+ public void setTargetTreeViewerInputContents(
+ Object targetTreeViewerInputContents) {
+ this.targetTreeViewerInputContents = targetTreeViewerInputContents;
+ }
+
+ public IWizard getSourceDataCreationWizard() {
+ return sourceDataCreationWizard;
+ }
+
+ public IWizard getTargetDataCreationWizard() {
+ return targetDataCreationWizard;
+ }
+}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigWizardPage.java 2008-10-21 09:18:30 UTC (rev 11034)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigWizardPage.java 2008-10-21 09:20:19 UTC (rev 11035)
@@ -1,128 +1,131 @@
-/*******************************************************************************
- * 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.ui.wizards;
-
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Dart Peng<br>
- * Date : Sep 18, 2008
- */
-public class NewResourceConfigWizardPage extends WizardPage implements ISelectionChangedListener{
-
- private NewResourceConfigKey selectedKey = null;
-
- public NewResourceConfigWizardPage(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- // TODO Auto-generated constructor stub
- }
-
- public NewResourceConfigWizardPage(String pageName) {
- super(pageName);
- }
-
- /* (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);
- FillLayout layout = new FillLayout();
-// layout.marginHeight = 350;
- mainComposite.setLayout(layout);
- TableViewer viewer = new TableViewer(mainComposite);
- viewer.setContentProvider(new NewResourceConfigKeyContentProvider());
- viewer.setLabelProvider(new NewResourceConfigKeyLabelProvider());
- viewer.setInput(NewResourceConfigFactory.getInstance().getAllIDs());
- viewer.addSelectionChangedListener(this);
- setControl(mainComposite);
-
- validatePageFinish();
- }
-
- protected void validatePageFinish(){
- String error = null;
- if(selectedKey == null){
- error = "Please select one key";
- }
-
- setErrorMessage(error);
- setPageComplete(error == null);
- }
-
- private class NewResourceConfigKeyContentProvider implements IStructuredContentProvider{
-
- public Object[] getElements(Object inputElement) {
- if(inputElement instanceof List){
- return ((List)inputElement).toArray();
- }
- if(inputElement.getClass().isArray()){
- return (Object[])inputElement;
- }
- return new Object[]{};
- }
-
- public void dispose() {
-
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
- }
-
- private class NewResourceConfigKeyLabelProvider extends LabelProvider{
-
- public Image getImage(Object element) {
- if(element instanceof NewResourceConfigKey){
- return ((NewResourceConfigKey)element).getImage();
- }
- return super.getImage(element);
- }
-
- public String getText(Object element) {
- if(element instanceof NewResourceConfigKey){
- return ((NewResourceConfigKey)element).getName();
- }
- return super.getText(element);
- }
-
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- Object obj = ((IStructuredSelection)event.getSelection()).getFirstElement();
- if(obj != null && obj instanceof NewResourceConfigKey){
- selectedKey = (NewResourceConfigKey)obj;
- }
-
- validatePageFinish();
- }
-
- public NewResourceConfigKey getSelectedKey() {
- return selectedKey;
- }
-
-}
+/*******************************************************************************
+ * 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.ui.wizards;
+
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Dart Peng<br>
+ * Date : Sep 18, 2008
+ */
+public class NewResourceConfigWizardPage extends WizardPage implements ISelectionChangedListener{
+
+ private NewResourceConfigKey selectedKey = null;
+
+
+ public NewResourceConfigWizardPage(String pageName, String title,
+ ImageDescriptor titleImage) {
+ super(pageName, "Select New ResourceConfig Type", titleImage);
+ setDescription("Select the ResourceConfig type to add into the config file");
+ }
+
+ public NewResourceConfigWizardPage(String pageName) {
+ super(pageName);
+ setTitle("Select New ResourceConfig Type");
+ setDescription("Select the ResourceConfig type to add into the config file");
+ }
+
+ /* (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);
+ FillLayout layout = new FillLayout();
+// layout.marginHeight = 350;
+ mainComposite.setLayout(layout);
+ TableViewer viewer = new TableViewer(mainComposite);
+ viewer.setContentProvider(new NewResourceConfigKeyContentProvider());
+ viewer.setLabelProvider(new NewResourceConfigKeyLabelProvider());
+ viewer.setInput(NewResourceConfigFactory.getInstance().getAllIDs());
+ viewer.addSelectionChangedListener(this);
+ setControl(mainComposite);
+
+ validatePageFinish();
+ }
+
+ protected void validatePageFinish(){
+ String error = null;
+ if(selectedKey == null){
+ error = "Please select one key";
+ }
+
+ setErrorMessage(error);
+ setPageComplete(error == null);
+ }
+
+ private class NewResourceConfigKeyContentProvider implements IStructuredContentProvider{
+
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof List){
+ return ((List)inputElement).toArray();
+ }
+ if(inputElement.getClass().isArray()){
+ return (Object[])inputElement;
+ }
+ return new Object[]{};
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ }
+
+ private class NewResourceConfigKeyLabelProvider extends LabelProvider{
+
+ public Image getImage(Object element) {
+ if(element instanceof NewResourceConfigKey){
+ return ((NewResourceConfigKey)element).getImage();
+ }
+ return super.getImage(element);
+ }
+
+ public String getText(Object element) {
+ if(element instanceof NewResourceConfigKey){
+ return ((NewResourceConfigKey)element).getName();
+ }
+ return super.getText(element);
+ }
+
+ }
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ Object obj = ((IStructuredSelection)event.getSelection()).getFirstElement();
+ if(obj != null && obj instanceof NewResourceConfigKey){
+ selectedKey = (NewResourceConfigKey)obj;
+ }
+
+ validatePageFinish();
+ }
+
+ public NewResourceConfigKey getSelectedKey() {
+ return selectedKey;
+ }
+
+}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java 2008-10-21 09:18:30 UTC (rev 11034)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java 2008-10-21 09:20:19 UTC (rev 11035)
@@ -1,301 +1,304 @@
-package org.jboss.tools.smooks.ui.wizards;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.jboss.tools.smooks.graphical.util.GraphicalInformationSaver;
-import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
-import org.jboss.tools.smooks.ui.editors.SmooksFileEditorInput;
-import org.jboss.tools.smooks.ui.editors.SmooksFormEditor;
-import org.jboss.tools.smooks.ui.editors.TypeIDSelectionWizardPage;
-
-/**
- * This is a sample new wizard. Its role is to create a new file resource in the
- * provided container. If the container resource (a folder or a project) is
- * selected in the workspace when the wizard is opened, it will accept it as the
- * target container. The wizard creates one file with the extension "smooks". If
- * a sample multi-page editor (also available as a template) is registered for
- * the same extension, it will be able to open it.
- */
-
-public class SmooksConfigFileNewWizard extends Wizard implements INewWizard,
- ISmooksDataCreationAddtionWizard {
- private SmooksConfigFileNewWizardPage page;
- private TypeIDSelectionWizardPage typeIDPage;
-
- private List<IWizardPage> sourceCreationPages = new ArrayList<IWizardPage>();
-
- private List<IWizardPage> targetCreationPages = new ArrayList<IWizardPage>();
-
- private IStructuredSelection selection;
-
- private IWorkbench workbench;
-
- /**
- * Constructor for SmooksConfigFileNewWizard.
- */
- public SmooksConfigFileNewWizard() {
- super();
- setNeedsProgressMonitor(true);
- }
-
- /**
- * Adding the page to the wizard.
- */
- public void addPages() {
- page = new SmooksConfigFileNewWizardPage("newSmooksFile1",
- getSelection());
- addPage(page);
- // TODO don't use the WizardSelectionPage
- typeIDPage = new TypeIDSelectionWizardPage("", false);
- typeIDPage.setSelection(selection);
- addPage(typeIDPage);
- }
-
- /**
- * This method is called when 'Finish' button is pressed in the wizard. We
- * will create an operation and run it using wizard as execution context.
- */
- public boolean performFinish() {
- // final String containerName = page.getContainerName();
- // final String fileName = page.getFileName();
- final IFile file = page.createNewFile();
- IRunnableWithProgress op = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException {
- try {
- doFinish(file, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- };
- try {
- getContainer().run(true, false, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- Throwable realException = e.getTargetException();
- MessageDialog.openError(getShell(), "Error", realException
- .getMessage());
- return false;
- }
- return true;
- }
-
- /**
- * The worker method. It will find the container, create the file if missing
- * or just replace its contents, and open the editor on the newly created
- * file.
- */
-
- private void doFinish(final IFile file, IProgressMonitor monitor)
- throws CoreException {
- // create a sample file
- String sourceTypeID = typeIDPage.getSourceID();
- String targetTypeID = typeIDPage.getTargetID();
-
- try {
- InputStream stream = openContentStream();
- if (file.exists()) {
- file.setContents(stream, true, true, monitor);
- } else {
- file.create(stream, true, monitor);
- }
- stream.close();
- GraphicalInformationSaver ginforSave = new GraphicalInformationSaver(
- file);
- ginforSave.doSave(monitor, sourceTypeID, targetTypeID);
- } catch (IOException e) {
- }
- monitor.worked(1);
- monitor.setTaskName("Opening file for editing...");
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- IWorkbenchPage page = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
- try {
- SmooksFileEditorInput input = new SmooksFileEditorInput(
- file);
- IWizard sourceWizard = typeIDPage
- .getSourceDataCreationWizard();
- IWizard targetWizard = typeIDPage
- .getTargetDataCreationWizard();
- if (sourceWizard != null) {
- sourceWizard.performFinish();
- }
- if (targetWizard != null) {
- targetWizard.performFinish();
- }
- if (sourceWizard instanceof IStructuredDataCreationWizard) {
- Object sourceObj = ((IStructuredDataCreationWizard) sourceWizard)
- .getTreeViewerInputContents();
-// if (sourceObj instanceof List) {
-// if (!((List) sourceObj).isEmpty()) {
-// sourceObj = ((List) sourceObj).get(0);
-// }
-// }
- input.setSourceTreeViewerInputContents(sourceObj);
- }
-
- if (targetWizard instanceof IStructuredDataCreationWizard) {
- Object targetObj = ((IStructuredDataCreationWizard) targetWizard)
- .getTreeViewerInputContents();
-// if (targetObj instanceof List) {
-// if (!((List) targetObj).isEmpty()) {
-// targetObj = ((List) targetObj).get(0);
-// }
-// }
- input.setTargetTreeViewerInputContents(targetObj);
-
- }
-
- IDE.openEditor(page, input, SmooksFormEditor.EDITOR_ID,
- true);// openEditor(page, file, true);
- } catch (PartInitException e) {
- }
- }
- });
- monitor.worked(1);
- }
-
- /**
- * We will initialize file contents with a sample text.
- */
-
- private InputStream openContentStream() {
- String contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + " <smooks-resource-list xmlns=\"http://www.milyn.org/xsd/smooks-1.0.xsd\"/>";
- return new ByteArrayInputStream(contents.getBytes());
- }
-
- private void throwCoreException(String message) throws CoreException {
- IStatus status = new Status(IStatus.ERROR, "org.jboss.tools.smooks.ui",
- IStatus.OK, message, null);
- throw new CoreException(status);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- }
-
- public IStructuredSelection getSelection() {
- return selection;
- }
-
- public void setSelection(IStructuredSelection selection) {
- this.selection = selection;
- }
-
- public void addSourceWizardPage(IWizardPage page) {
- sourceCreationPages.add(page);
- page.setTitle("Source Data Selection Page");
- }
-
- public void addTargetWizardPage(IWizardPage page) {
- targetCreationPages.add(page);
- page.setTitle("Target Data Selection Page");
- }
-
- public void clearSourceWizardPages() {
- // for (Iterator iterator = sourceCreationPages.iterator();
- // iterator.hasNext();) {
- // IWizardPage page = (IWizardPage) iterator.next();
- // if(page != null){
- // page.dispose();
- // }
- // }
- sourceCreationPages.clear();
- }
-
- private IWizardPage getSourceCreationPage(IWizardPage page) {
- if (page == typeIDPage) {
- if (sourceCreationPages.isEmpty())
- return null;
- return (IWizardPage) sourceCreationPages.get(0);
- }
- if (sourceCreationPages.contains(page)) {
- int i = sourceCreationPages.indexOf(page);
- if ((i + 1) >= sourceCreationPages.size()) {
- return null;
- }
- return (IWizardPage) sourceCreationPages.get(i + 1);
- }
- return null;
- }
-
- private IWizardPage getTargetCreationPage(IWizardPage page) {
- if (page == typeIDPage) {
- if (targetCreationPages.isEmpty())
- return null;
- return (IWizardPage) targetCreationPages.get(0);
- }
- if (targetCreationPages.contains(page)) {
- int i = targetCreationPages.indexOf(page);
- if ((i + 1) >= targetCreationPages.size()) {
- return null;
- }
- return (IWizardPage) targetCreationPages.get(i + 1);
- }
- if (sourceCreationPages.contains(page)) {
- if (sourceCreationPages.get(sourceCreationPages.size() - 1) == page) {
- return (IWizardPage) targetCreationPages.get(0);
- }
- }
- return null;
- }
-
- @Override
- public IWizardPage getNextPage(IWizardPage page) {
- IWizardPage p = getSourceCreationPage(page);
- if (p != null)
- return p;
- p = getTargetCreationPage(page);
- if (p != null)
- return p;
- return super.getNextPage(page);
- }
-
- public void clearTargetWizardPages() {
- // for (Iterator iterator = sourceCreationPages.iterator();
- // iterator.hasNext();) {
- // IWizardPage page = (IWizardPage) iterator.next();
- // if(page != null){
- // page.dispose();
- // }
- // }
- targetCreationPages.clear();
- }
-
- public void removeSourceWIzardPage(IWizardPage page) {
- sourceCreationPages.remove(page);
- }
-
- public void removeTargetWIzardPage(IWizardPage page) {
- targetCreationPages.remove(page);
- }
+package org.jboss.tools.smooks.ui.wizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.tools.common.model.ui.ModelUIImages;
+import org.jboss.tools.smooks.graphical.util.GraphicalInformationSaver;
+import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
+import org.jboss.tools.smooks.ui.editors.SmooksFileEditorInput;
+import org.jboss.tools.smooks.ui.editors.SmooksFormEditor;
+import org.jboss.tools.smooks.ui.editors.TypeIDSelectionWizardPage;
+
+/**
+ * This is a sample new wizard. Its role is to create a new file resource in the
+ * provided container. If the container resource (a folder or a project) is
+ * selected in the workspace when the wizard is opened, it will accept it as the
+ * target container. The wizard creates one file with the extension "smooks". If
+ * a sample multi-page editor (also available as a template) is registered for
+ * the same extension, it will be able to open it.
+ */
+
+public class SmooksConfigFileNewWizard extends Wizard implements INewWizard,
+ ISmooksDataCreationAddtionWizard {
+ private SmooksConfigFileNewWizardPage page;
+ private TypeIDSelectionWizardPage typeIDPage;
+
+ private List<IWizardPage> sourceCreationPages = new ArrayList<IWizardPage>();
+
+ private List<IWizardPage> targetCreationPages = new ArrayList<IWizardPage>();
+
+ private IStructuredSelection selection;
+
+ private IWorkbench workbench;
+
+ /**
+ * Constructor for SmooksConfigFileNewWizard.
+ */
+ public SmooksConfigFileNewWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ super.setWindowTitle("New Smooks Configuration File");
+ setDefaultPageImageDescriptor(ModelUIImages.getImageDescriptor(ModelUIImages.WIZARD_NEW_PROJECT));
+ }
+
+ /**
+ * Adding the page to the wizard.
+ */
+ public void addPages() {
+ page = new SmooksConfigFileNewWizardPage("newSmooksFile1",
+ getSelection());
+ addPage(page);
+ // TODO don't use the WizardSelectionPage
+ typeIDPage = new TypeIDSelectionWizardPage("", false);
+ typeIDPage.setSelection(selection);
+ addPage(typeIDPage);
+ }
+
+ /**
+ * This method is called when 'Finish' button is pressed in the wizard. We
+ * will create an operation and run it using wizard as execution context.
+ */
+ public boolean performFinish() {
+ // final String containerName = page.getContainerName();
+ // final String fileName = page.getFileName();
+ final IFile file = page.createNewFile();
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException {
+ try {
+ doFinish(file, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+ };
+ try {
+ getContainer().run(true, false, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ Throwable realException = e.getTargetException();
+ MessageDialog.openError(getShell(), "Error", realException
+ .getMessage());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The worker method. It will find the container, create the file if missing
+ * or just replace its contents, and open the editor on the newly created
+ * file.
+ */
+
+ private void doFinish(final IFile file, IProgressMonitor monitor)
+ throws CoreException {
+ // create a sample file
+ String sourceTypeID = typeIDPage.getSourceID();
+ String targetTypeID = typeIDPage.getTargetID();
+
+ try {
+ InputStream stream = openContentStream();
+ if (file.exists()) {
+ file.setContents(stream, true, true, monitor);
+ } else {
+ file.create(stream, true, monitor);
+ }
+ stream.close();
+ GraphicalInformationSaver ginforSave = new GraphicalInformationSaver(
+ file);
+ ginforSave.doSave(monitor, sourceTypeID, targetTypeID);
+ } catch (IOException e) {
+ }
+ monitor.worked(1);
+ monitor.setTaskName("Opening file for editing...");
+ getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ try {
+ SmooksFileEditorInput input = new SmooksFileEditorInput(
+ file);
+ IWizard sourceWizard = typeIDPage
+ .getSourceDataCreationWizard();
+ IWizard targetWizard = typeIDPage
+ .getTargetDataCreationWizard();
+ if (sourceWizard != null) {
+ sourceWizard.performFinish();
+ }
+ if (targetWizard != null) {
+ targetWizard.performFinish();
+ }
+ if (sourceWizard instanceof IStructuredDataCreationWizard) {
+ Object sourceObj = ((IStructuredDataCreationWizard) sourceWizard)
+ .getTreeViewerInputContents();
+// if (sourceObj instanceof List) {
+// if (!((List) sourceObj).isEmpty()) {
+// sourceObj = ((List) sourceObj).get(0);
+// }
+// }
+ input.setSourceTreeViewerInputContents(sourceObj);
+ }
+
+ if (targetWizard instanceof IStructuredDataCreationWizard) {
+ Object targetObj = ((IStructuredDataCreationWizard) targetWizard)
+ .getTreeViewerInputContents();
+// if (targetObj instanceof List) {
+// if (!((List) targetObj).isEmpty()) {
+// targetObj = ((List) targetObj).get(0);
+// }
+// }
+ input.setTargetTreeViewerInputContents(targetObj);
+
+ }
+
+ IDE.openEditor(page, input, SmooksFormEditor.EDITOR_ID,
+ true);// openEditor(page, file, true);
+ } catch (PartInitException e) {
+ }
+ }
+ });
+ monitor.worked(1);
+ }
+
+ /**
+ * We will initialize file contents with a sample text.
+ */
+
+ private InputStream openContentStream() {
+ String contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ + " <smooks-resource-list xmlns=\"http://www.milyn.org/xsd/smooks-1.0.xsd\"/>";
+ return new ByteArrayInputStream(contents.getBytes());
+ }
+
+ private void throwCoreException(String message) throws CoreException {
+ IStatus status = new Status(IStatus.ERROR, "org.jboss.tools.smooks.ui",
+ IStatus.OK, message, null);
+ throw new CoreException(status);
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ }
+
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+ public void addSourceWizardPage(IWizardPage page) {
+ sourceCreationPages.add(page);
+ page.setTitle("Source Data Selection");
+ }
+
+ public void addTargetWizardPage(IWizardPage page) {
+ targetCreationPages.add(page);
+ page.setTitle("Target Data Selection");
+ }
+
+ public void clearSourceWizardPages() {
+ // for (Iterator iterator = sourceCreationPages.iterator();
+ // iterator.hasNext();) {
+ // IWizardPage page = (IWizardPage) iterator.next();
+ // if(page != null){
+ // page.dispose();
+ // }
+ // }
+ sourceCreationPages.clear();
+ }
+
+ private IWizardPage getSourceCreationPage(IWizardPage page) {
+ if (page == typeIDPage) {
+ if (sourceCreationPages.isEmpty())
+ return null;
+ return (IWizardPage) sourceCreationPages.get(0);
+ }
+ if (sourceCreationPages.contains(page)) {
+ int i = sourceCreationPages.indexOf(page);
+ if ((i + 1) >= sourceCreationPages.size()) {
+ return null;
+ }
+ return (IWizardPage) sourceCreationPages.get(i + 1);
+ }
+ return null;
+ }
+
+ private IWizardPage getTargetCreationPage(IWizardPage page) {
+ if (page == typeIDPage) {
+ if (targetCreationPages.isEmpty())
+ return null;
+ return (IWizardPage) targetCreationPages.get(0);
+ }
+ if (targetCreationPages.contains(page)) {
+ int i = targetCreationPages.indexOf(page);
+ if ((i + 1) >= targetCreationPages.size()) {
+ return null;
+ }
+ return (IWizardPage) targetCreationPages.get(i + 1);
+ }
+ if (sourceCreationPages.contains(page)) {
+ if (sourceCreationPages.get(sourceCreationPages.size() - 1) == page) {
+ return (IWizardPage) targetCreationPages.get(0);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ IWizardPage p = getSourceCreationPage(page);
+ if (p != null)
+ return p;
+ p = getTargetCreationPage(page);
+ if (p != null)
+ return p;
+ return super.getNextPage(page);
+ }
+
+ public void clearTargetWizardPages() {
+ // for (Iterator iterator = sourceCreationPages.iterator();
+ // iterator.hasNext();) {
+ // IWizardPage page = (IWizardPage) iterator.next();
+ // if(page != null){
+ // page.dispose();
+ // }
+ // }
+ targetCreationPages.clear();
+ }
+
+ public void removeSourceWIzardPage(IWizardPage page) {
+ sourceCreationPages.remove(page);
+ }
+
+ public void removeTargetWIzardPage(IWizardPage page) {
+ targetCreationPages.remove(page);
+ }
}
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java 2008-10-21 09:18:30 UTC (rev 11034)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java 2008-10-21 09:20:19 UTC (rev 11035)
@@ -1,37 +1,40 @@
-package org.jboss.tools.smooks.ui.wizards;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-/**
- *
- * @author dart
- *
- */
-public class SmooksConfigFileNewWizardPage extends WizardNewFileCreationPage {
- public SmooksConfigFileNewWizardPage(String pageName,
- IStructuredSelection selection) {
- super(pageName, selection);
- setFileExtension("smooks");
- }
-
- @Override
- protected boolean validatePage() {
- boolean flag = super.validatePage();
- String name = this.getFileName();
- if (name.indexOf(".") == -1)
- return flag;
- String extensionName = name.substring(name.indexOf(".") + 1, name
- .length());
- String error = null;
- if (extensionName.equalsIgnoreCase(this.getFileExtension())) {
-
- } else {
- error = "file extension must be \"smooks\"";
- }
- if (error != null) {
- this.setErrorMessage(error);
- }
- return (error == null);
- }
+package org.jboss.tools.smooks.ui.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ *
+ * @author dart
+ *
+ */
+public class SmooksConfigFileNewWizardPage extends WizardNewFileCreationPage {
+ public SmooksConfigFileNewWizardPage(String pageName,
+ IStructuredSelection selection) {
+ super(pageName, selection);
+ setFileExtension("smooks");
+ super.setTitle("Smooks Configuration");
+ super.setDescription("Create a new Smooks configuration file");
+ this.setFileName("newConfig.smooks");
+ }
+
+ @Override
+ protected boolean validatePage() {
+ boolean flag = super.validatePage();
+ String name = this.getFileName();
+ if (name.indexOf(".") == -1)
+ return flag;
+ String extensionName = name.substring(name.indexOf(".") + 1, name
+ .length());
+ String error = null;
+ if (extensionName.equalsIgnoreCase(this.getFileExtension())) {
+
+ } else {
+ error = "file extension must be \"smooks\"";
+ }
+ if (error != null) {
+ this.setErrorMessage(error);
+ }
+ return (error == null);
+ }
}
\ No newline at end of file
16 years, 2 months
JBoss Tools SVN: r11034 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-10-21 05:18:30 -0400 (Tue, 21 Oct 2008)
New Revision: 11034
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractXMLFileImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
Log:
JBIDE-2909
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractXMLFileImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractXMLFileImpl.java 2008-10-21 09:15:01 UTC (rev 11033)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractXMLFileImpl.java 2008-10-21 09:18:30 UTC (rev 11034)
@@ -67,11 +67,11 @@
for (int i = 0; i < errors.length; i++) {
String er = errors[i];
int q = er.lastIndexOf(':');
- String pos = er.substring(q + 1);
- er = er.substring(0, q);
+ String pos = (q < 0) ? "" : er.substring(q + 1);
+ if(q >= 0) er = er.substring(0, q);
q = er.lastIndexOf(':');
- String ln = er.substring(q + 1), ln1 = ln;
- er = er.substring(0, q);
+ String ln = (q < 0) ? "" : er.substring(q + 1), ln1 = ln;
+ if(q >= 0) er = er.substring(0, q);
int iln = -1;
try {
if(q >= 0 && ln1.length() > 0) {
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2008-10-21 09:15:01 UTC (rev 11033)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2008-10-21 09:18:30 UTC (rev 11034)
@@ -185,6 +185,10 @@
}
public void fileRenamed(String name, String extension) {
+ if(name != null && name.equals(super.get("NAME"))
+ && extension != null && extension.equals(super.get("EXTENSION"))) {
+ return;
+ }
super.set("NAME", name);
super.set("EXTENSION", extension);
fireObjectChanged(null);
16 years, 2 months
JBoss Tools SVN: r11033 - in branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-10-21 05:15:01 -0400 (Tue, 21 Oct 2008)
New Revision: 11033
Added:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/icons/full/obj16/esb16.png
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/libs/dom4j.license
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigWizardPage.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java
Log:
JBIDE-2846
Thanks John for helping me modify that :)
Modified: branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2008-10-21 08:50:25 UTC (rev 11032)
+++ branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2008-10-21 09:15:01 UTC (rev 11033)
@@ -20,8 +20,9 @@
org.eclipse.emf,
org.eclipse.emf.edit,
org.eclipse.emf.edit.ui,
- org.eclipse.xsd.edit;bundle-version="2.4.0",
- org.jboss.tools.smooks.core
+ org.eclipse.xsd.edit,
+ org.jboss.tools.smooks.core,
+ org.jboss.tools.common.model.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .,
Added: branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/icons/full/obj16/esb16.png
===================================================================
(Binary files differ)
Property changes on: branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/icons/full/obj16/esb16.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/libs/dom4j.license
===================================================================
--- branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/libs/dom4j.license (rev 0)
+++ branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/libs/dom4j.license 2008-10-21 09:15:01 UTC (rev 11033)
@@ -0,0 +1,13 @@
+BSD style license
+
+Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright statements and notices. Redistributions must also contain a copy of this document.
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ 3. The name "DOM4J" must not be used to endorse or promote products derived from this Software without prior written permission of MetaStuff, Ltd. For written permission, please contact dom4j-info(a)metastuff.com.
+ 4. Products derived from this Software may not be called "DOM4J" nor may "DOM4J" appear in their names without prior written permission of MetaStuff, Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
+ 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
+
+THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
\ No newline at end of file
Modified: branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-10-21 08:50:25 UTC (rev 11032)
+++ branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-10-21 09:15:01 UTC (rev 11033)
@@ -1,161 +1,161 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="viewerInitor" name="viewerInitor" schema="schema/viewerInitor.exsd"/>
- <extension-point id="analyzer" name="analyzer" schema="schema/analyzer.exsd"/>
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
- uri = "http://www.jboss.org/tools/smooks/graphicalInformation"
- class = "org.jboss.tools.smooks.graphical.GraphicalPackage"
- genModel = "model/graphical.genmodel" />
- </extension>
-
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="Smooks Form Editor"
- extensions="smooks"
- icon="icons/sample.gif"
- class="org.jboss.tools.smooks.ui.editors.SmooksFormEditor"
- id="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.views.properties.tabbed.propertySections">
- <propertySections
- contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
- <propertySection
- class="org.jboss.tools.smooks.ui.ConnectionPropertySection"
- id="org.jboss.tools.smooks.ui.connection.propertyTab.Section"
- tab="org.jboss.tools.smooks.ui.connection.propertyTab">
- <input
- type="org.jboss.tools.smooks.ui.gef.model.LineConnectionModel">
- </input>
- </propertySection>
- </propertySections>
- </extension>
- <extension
- point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
- <propertyContributor
- contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor"
- typeMapper="org.jboss.tools.smooks.ui.SmooksGraphPropertyTypeMapper">
- <propertyCategory
- category="connection"></propertyCategory>
- </propertyContributor>
- </extension>
- <extension
- point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
- <propertyTabs
- contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
- <propertyTab
- category="connection"
- id="org.jboss.tools.smooks.ui.connection.propertyTab"
- label="Mapping Properties">
- </propertyTab>
- </propertyTabs>
- </extension>
- <extension
- point="org.eclipse.ui.newWizards">
- <category
- id="org.jboss.tools.smooks.ui.wizards"
- name="Smooks">
- </category>
- <wizard
- category="org.jboss.tools.smooks.ui.wizards"
- class="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
- icon="icons/sample.gif"
- id="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
- name="Smooks Configuration File">
- </wizard>
- </extension>
-
- <extension
- point="org.jboss.tools.smooks.ui.viewerInitor">
- <viewerInitor
- contentProvider="org.jboss.tools.smooks.xml.ui.XMLStructuredDataContentProvider"
- creationWizard="org.jboss.tools.smooks.xml.ui.XMLStructuredDataWizard"
- description="XML data type comes from any .xml file."
- labelProvider="org.jboss.tools.smooks.xml.ui.XMLStructuredDataLabelProvider"
- name="XML Data Type"
- typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
- </viewerInitor>
- </extension>
- <extension
- point="org.jboss.tools.smooks.ui.analyzer">
- <mappingAnalyzer
- class="org.jboss.tools.smooks.xml2xml.XML2XMLAnalyzer"
- name="XML2XML Analyzer"
- typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
- <targetSourceType
- id="org.jboss.tools.smooks.xml.viewerInitor.xml"
- name="XML">
- </targetSourceType>
- </mappingAnalyzer>
- </extension>
- <extension
- point="org.jboss.tools.smooks.ui.viewerInitor">
- <viewerInitor
- contentProvider="org.jboss.tools.smooks.javabean.model.BeanContentProvider"
- creationWizard="org.jboss.tools.smooks.javabean.ui.NewJavaBeanStrucutredDataWizard"
- description="This data type can get from any Java .class."
- labelProvider="org.jboss.tools.smooks.javabean.model.BeanlabelProvider"
- name="JavaBean Data Type"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- </viewerInitor>
- </extension>
- <extension
- point="org.jboss.tools.smooks.ui.analyzer">
- <mappingAnalyzer
- class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
- name="JavaBean Analyzer"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- <targetSourceType
- id="org.jboss.tools.smooks.ui.viewerInitor.javabean"
- name="java2java">
- </targetSourceType>
- </mappingAnalyzer>
- <sourceModelAnalyzer
- class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
- level="0"
- name="JavaBean SourceModel Analyzer"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- </sourceModelAnalyzer>
- <targetModelAnalyzer
- class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
- level="0"
- name="JavaBean TargetModel Analyzer"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- </targetModelAnalyzer>
- </extension>
-
- <extension
- point="org.jboss.tools.smooks.ui.analyzer">
- <mappingAnalyzer
- class="org.jboss.tools.smooks.java2xml.analyzer.Java2XMLAnalyzer"
- name="Java Bean"
- typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
- <targetSourceType
- id="org.jboss.tools.smooks.xml.viewerInitor.xml"
- name="XML">
- </targetSourceType>
- </mappingAnalyzer>
- </extension>
-
- <extension
- point="org.jboss.tools.smooks.ui.analyzer">
- <mappingAnalyzer
- class="org.jboss.tools.smooks.xml2java.analyzer.XML2JavaAnalyzer"
- name="XML2Java"
- typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
- <targetSourceType
- id="org.jboss.tools.smooks.ui.viewerInitor.javabean"
- name="JavaBean">
- </targetSourceType>
- </mappingAnalyzer>
- <sourceModelAnalyzer
- class="org.jboss.tools.smooks.xml2java.analyzer.XMLSourceModelAnalyzer"
- name="XML"
- typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
- </sourceModelAnalyzer>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="viewerInitor" name="viewerInitor" schema="schema/viewerInitor.exsd"/>
+ <extension-point id="analyzer" name="analyzer" schema="schema/analyzer.exsd"/>
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri = "http://www.jboss.org/tools/smooks/graphicalInformation"
+ class = "org.jboss.tools.smooks.graphical.GraphicalPackage"
+ genModel = "model/graphical.genmodel" />
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="Smooks Form Editor"
+ extensions="smooks"
+ icon="icons/sample.gif"
+ class="org.jboss.tools.smooks.ui.editors.SmooksFormEditor"
+ id="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections
+ contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
+ <propertySection
+ class="org.jboss.tools.smooks.ui.ConnectionPropertySection"
+ id="org.jboss.tools.smooks.ui.connection.propertyTab.Section"
+ tab="org.jboss.tools.smooks.ui.connection.propertyTab">
+ <input
+ type="org.jboss.tools.smooks.ui.gef.model.LineConnectionModel">
+ </input>
+ </propertySection>
+ </propertySections>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <propertyContributor
+ contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor"
+ typeMapper="org.jboss.tools.smooks.ui.SmooksGraphPropertyTypeMapper">
+ <propertyCategory
+ category="connection"></propertyCategory>
+ </propertyContributor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs
+ contributorId="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
+ <propertyTab
+ category="connection"
+ id="org.jboss.tools.smooks.ui.connection.propertyTab"
+ label="Mapping Properties">
+ </propertyTab>
+ </propertyTabs>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.jboss.tools.smooks.ui.wizards"
+ name="Smooks">
+ </category>
+ <wizard
+ category="org.jboss.tools.smooks.ui.wizards"
+ class="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
+ icon="icons/full/obj16/esb16.png"
+ id="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
+ name="Smooks Configuration File">
+ </wizard>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.smooks.ui.viewerInitor">
+ <viewerInitor
+ contentProvider="org.jboss.tools.smooks.xml.ui.XMLStructuredDataContentProvider"
+ creationWizard="org.jboss.tools.smooks.xml.ui.XMLStructuredDataWizard"
+ description="XML data type comes from any .xml file."
+ labelProvider="org.jboss.tools.smooks.xml.ui.XMLStructuredDataLabelProvider"
+ name="XML Data Type"
+ typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
+ </viewerInitor>
+ </extension>
+ <extension
+ point="org.jboss.tools.smooks.ui.analyzer">
+ <mappingAnalyzer
+ class="org.jboss.tools.smooks.xml2xml.XML2XMLAnalyzer"
+ name="XML2XML Analyzer"
+ typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
+ <targetSourceType
+ id="org.jboss.tools.smooks.xml.viewerInitor.xml"
+ name="XML">
+ </targetSourceType>
+ </mappingAnalyzer>
+ </extension>
+ <extension
+ point="org.jboss.tools.smooks.ui.viewerInitor">
+ <viewerInitor
+ contentProvider="org.jboss.tools.smooks.javabean.model.BeanContentProvider"
+ creationWizard="org.jboss.tools.smooks.javabean.ui.NewJavaBeanStrucutredDataWizard"
+ description="This data type can get from any Java .class."
+ labelProvider="org.jboss.tools.smooks.javabean.model.BeanlabelProvider"
+ name="JavaBean Data Type"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ </viewerInitor>
+ </extension>
+ <extension
+ point="org.jboss.tools.smooks.ui.analyzer">
+ <mappingAnalyzer
+ class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
+ name="JavaBean Analyzer"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ <targetSourceType
+ id="org.jboss.tools.smooks.ui.viewerInitor.javabean"
+ name="java2java">
+ </targetSourceType>
+ </mappingAnalyzer>
+ <sourceModelAnalyzer
+ class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
+ level="0"
+ name="JavaBean SourceModel Analyzer"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ </sourceModelAnalyzer>
+ <targetModelAnalyzer
+ class="org.jboss.tools.smooks.javabean.analyzer.JavaBeanAnalyzer"
+ level="0"
+ name="JavaBean TargetModel Analyzer"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ </targetModelAnalyzer>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.smooks.ui.analyzer">
+ <mappingAnalyzer
+ class="org.jboss.tools.smooks.java2xml.analyzer.Java2XMLAnalyzer"
+ name="Java Bean"
+ typeID="org.jboss.tools.smooks.ui.viewerInitor.javabean">
+ <targetSourceType
+ id="org.jboss.tools.smooks.xml.viewerInitor.xml"
+ name="XML">
+ </targetSourceType>
+ </mappingAnalyzer>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.smooks.ui.analyzer">
+ <mappingAnalyzer
+ class="org.jboss.tools.smooks.xml2java.analyzer.XML2JavaAnalyzer"
+ name="XML2Java"
+ typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
+ <targetSourceType
+ id="org.jboss.tools.smooks.ui.viewerInitor.javabean"
+ name="JavaBean">
+ </targetSourceType>
+ </mappingAnalyzer>
+ <sourceModelAnalyzer
+ class="org.jboss.tools.smooks.xml2java.analyzer.XMLSourceModelAnalyzer"
+ name="XML"
+ typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
+ </sourceModelAnalyzer>
+ </extension>
+</plugin>
Modified: branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
===================================================================
--- branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-21 08:50:25 UTC (rev 11032)
+++ branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-21 09:15:01 UTC (rev 11033)
@@ -14,6 +14,7 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@@ -31,6 +32,7 @@
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -103,11 +105,13 @@
public TypeIDSelectionWizardPage(String pageName, boolean showDataSelectPage) {
super(pageName);
this.showDataSelectPage = showDataSelectPage;
+ setTitle("Select Source/Target Data Type");
+ setDescription("Select the data type for source/target data");
}
@Override
public boolean canFlipToNextPage() {
- if (this.getSourceID() != null || getTargetID() != null) {
+ if (this.getSourceID() != null && getTargetID() != null) {
return true;
}
return false;
@@ -207,12 +211,26 @@
Label tl = new Label(mainComposite, SWT.NONE);
tl.setText("Target Data Type ID List : ");
-
- source = createTableViewer(mainComposite);
+
+ Composite sourceBorder = new Composite(mainComposite,SWT.NONE);
+ sourceBorder.setBackground(ColorConstants.black);
+ FillLayout sbLayout = new FillLayout();
+ sbLayout.marginHeight = 1;
+ sbLayout.marginWidth = 1;
+ sourceBorder.setLayout(sbLayout);
+ source = createTableViewer(sourceBorder);
GridData gd = new GridData(GridData.FILL_BOTH);
- source.getTable().setLayoutData(gd);
- target = createTableViewer(mainComposite);
- target.getTable().setLayoutData(gd);
+ sourceBorder.setLayoutData(gd);
+
+
+ Composite targetBorder = new Composite(mainComposite,SWT.NONE);
+ targetBorder.setBackground(ColorConstants.black);
+ FillLayout tbLayout = new FillLayout();
+ tbLayout.marginHeight = 1;
+ tbLayout.marginWidth = 1;
+ targetBorder.setLayout(tbLayout);
+ target = createTableViewer(targetBorder);
+ targetBorder.setLayoutData(gd);
source.setInput(sourceList);
target.setInput(sourceList);
@@ -299,17 +317,19 @@
protected void openSourceWizard() {
sourceTreeViewerInputContents = getReturnObjectFromWizard(getSourceID());
- resetLinkText();
+// resetLinkText();
}
-
+/**
+ * @deprecated
+ */
private void resetLinkText() {
- if (sourceTreeViewerInputContents != null) {
- sourceDataLink.setText("Source Model Select");
- }
-
- if (targetTreeViewerInputContents != null) {
- targetDataLink.setText("Target Model Select");
- }
+ // if (sourceTreeViewerInputContents != null) {
+ // sourceDataLink.setText("Source Model Select");
+ // }
+ //
+ // if (targetTreeViewerInputContents != null) {
+ // targetDataLink.setText("Target Model Select");
+ // }
}
protected String getDataTypeID(CheckboxTableViewer viewer) {
@@ -407,7 +427,7 @@
});
TableColumn nameColumn = new TableColumn(viewer.getTable(), SWT.NONE);
- nameColumn.setWidth(100);
+ nameColumn.setWidth(250);
nameColumn.setText("Name");
viewer.setContentProvider(new TypeIDContentProvider());
viewer.setLabelProvider(new TypeIDLabelProvider());
Modified: branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigWizardPage.java
===================================================================
--- branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigWizardPage.java 2008-10-21 08:50:25 UTC (rev 11032)
+++ branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigWizardPage.java 2008-10-21 09:15:01 UTC (rev 11033)
@@ -34,14 +34,17 @@
private NewResourceConfigKey selectedKey = null;
+
public NewResourceConfigWizardPage(String pageName, String title,
ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- // TODO Auto-generated constructor stub
+ super(pageName, "Select New ResourceConfig Type", titleImage);
+ setDescription("Select the ResourceConfig type to add into the config file");
}
public NewResourceConfigWizardPage(String pageName) {
super(pageName);
+ setTitle("Select New ResourceConfig Type");
+ setDescription("Select the ResourceConfig type to add into the config file");
}
/* (non-Javadoc)
Modified: branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
===================================================================
--- branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java 2008-10-21 08:50:25 UTC (rev 11032)
+++ branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java 2008-10-21 09:15:01 UTC (rev 11033)
@@ -1,301 +1,304 @@
-package org.jboss.tools.smooks.ui.wizards;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.jboss.tools.smooks.graphical.util.GraphicalInformationSaver;
-import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
-import org.jboss.tools.smooks.ui.editors.SmooksFileEditorInput;
-import org.jboss.tools.smooks.ui.editors.SmooksFormEditor;
-import org.jboss.tools.smooks.ui.editors.TypeIDSelectionWizardPage;
-
-/**
- * This is a sample new wizard. Its role is to create a new file resource in the
- * provided container. If the container resource (a folder or a project) is
- * selected in the workspace when the wizard is opened, it will accept it as the
- * target container. The wizard creates one file with the extension "smooks". If
- * a sample multi-page editor (also available as a template) is registered for
- * the same extension, it will be able to open it.
- */
-
-public class SmooksConfigFileNewWizard extends Wizard implements INewWizard,
- ISmooksDataCreationAddtionWizard {
- private SmooksConfigFileNewWizardPage page;
- private TypeIDSelectionWizardPage typeIDPage;
-
- private List<IWizardPage> sourceCreationPages = new ArrayList<IWizardPage>();
-
- private List<IWizardPage> targetCreationPages = new ArrayList<IWizardPage>();
-
- private IStructuredSelection selection;
-
- private IWorkbench workbench;
-
- /**
- * Constructor for SmooksConfigFileNewWizard.
- */
- public SmooksConfigFileNewWizard() {
- super();
- setNeedsProgressMonitor(true);
- }
-
- /**
- * Adding the page to the wizard.
- */
- public void addPages() {
- page = new SmooksConfigFileNewWizardPage("newSmooksFile1",
- getSelection());
- addPage(page);
- // TODO don't use the WizardSelectionPage
- typeIDPage = new TypeIDSelectionWizardPage("", false);
- typeIDPage.setSelection(selection);
- addPage(typeIDPage);
- }
-
- /**
- * This method is called when 'Finish' button is pressed in the wizard. We
- * will create an operation and run it using wizard as execution context.
- */
- public boolean performFinish() {
- // final String containerName = page.getContainerName();
- // final String fileName = page.getFileName();
- final IFile file = page.createNewFile();
- IRunnableWithProgress op = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException {
- try {
- doFinish(file, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- };
- try {
- getContainer().run(true, false, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- Throwable realException = e.getTargetException();
- MessageDialog.openError(getShell(), "Error", realException
- .getMessage());
- return false;
- }
- return true;
- }
-
- /**
- * The worker method. It will find the container, create the file if missing
- * or just replace its contents, and open the editor on the newly created
- * file.
- */
-
- private void doFinish(final IFile file, IProgressMonitor monitor)
- throws CoreException {
- // create a sample file
- String sourceTypeID = typeIDPage.getSourceID();
- String targetTypeID = typeIDPage.getTargetID();
-
- try {
- InputStream stream = openContentStream();
- if (file.exists()) {
- file.setContents(stream, true, true, monitor);
- } else {
- file.create(stream, true, monitor);
- }
- stream.close();
- GraphicalInformationSaver ginforSave = new GraphicalInformationSaver(
- file);
- ginforSave.doSave(monitor, sourceTypeID, targetTypeID);
- } catch (IOException e) {
- }
- monitor.worked(1);
- monitor.setTaskName("Opening file for editing...");
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- IWorkbenchPage page = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
- try {
- SmooksFileEditorInput input = new SmooksFileEditorInput(
- file);
- IWizard sourceWizard = typeIDPage
- .getSourceDataCreationWizard();
- IWizard targetWizard = typeIDPage
- .getTargetDataCreationWizard();
- if (sourceWizard != null) {
- sourceWizard.performFinish();
- }
- if (targetWizard != null) {
- targetWizard.performFinish();
- }
- if (sourceWizard instanceof IStructuredDataCreationWizard) {
- Object sourceObj = ((IStructuredDataCreationWizard) sourceWizard)
- .getTreeViewerInputContents();
-// if (sourceObj instanceof List) {
-// if (!((List) sourceObj).isEmpty()) {
-// sourceObj = ((List) sourceObj).get(0);
-// }
-// }
- input.setSourceTreeViewerInputContents(sourceObj);
- }
-
- if (targetWizard instanceof IStructuredDataCreationWizard) {
- Object targetObj = ((IStructuredDataCreationWizard) targetWizard)
- .getTreeViewerInputContents();
-// if (targetObj instanceof List) {
-// if (!((List) targetObj).isEmpty()) {
-// targetObj = ((List) targetObj).get(0);
-// }
-// }
- input.setTargetTreeViewerInputContents(targetObj);
-
- }
-
- IDE.openEditor(page, input, SmooksFormEditor.EDITOR_ID,
- true);// openEditor(page, file, true);
- } catch (PartInitException e) {
- }
- }
- });
- monitor.worked(1);
- }
-
- /**
- * We will initialize file contents with a sample text.
- */
-
- private InputStream openContentStream() {
- String contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + " <smooks-resource-list xmlns=\"http://www.milyn.org/xsd/smooks-1.0.xsd\"/>";
- return new ByteArrayInputStream(contents.getBytes());
- }
-
- private void throwCoreException(String message) throws CoreException {
- IStatus status = new Status(IStatus.ERROR, "org.jboss.tools.smooks.ui",
- IStatus.OK, message, null);
- throw new CoreException(status);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- }
-
- public IStructuredSelection getSelection() {
- return selection;
- }
-
- public void setSelection(IStructuredSelection selection) {
- this.selection = selection;
- }
-
- public void addSourceWizardPage(IWizardPage page) {
- sourceCreationPages.add(page);
- page.setTitle("Source Data Selection Page");
- }
-
- public void addTargetWizardPage(IWizardPage page) {
- targetCreationPages.add(page);
- page.setTitle("Target Data Selection Page");
- }
-
- public void clearSourceWizardPages() {
- // for (Iterator iterator = sourceCreationPages.iterator();
- // iterator.hasNext();) {
- // IWizardPage page = (IWizardPage) iterator.next();
- // if(page != null){
- // page.dispose();
- // }
- // }
- sourceCreationPages.clear();
- }
-
- private IWizardPage getSourceCreationPage(IWizardPage page) {
- if (page == typeIDPage) {
- if (sourceCreationPages.isEmpty())
- return null;
- return (IWizardPage) sourceCreationPages.get(0);
- }
- if (sourceCreationPages.contains(page)) {
- int i = sourceCreationPages.indexOf(page);
- if ((i + 1) >= sourceCreationPages.size()) {
- return null;
- }
- return (IWizardPage) sourceCreationPages.get(i + 1);
- }
- return null;
- }
-
- private IWizardPage getTargetCreationPage(IWizardPage page) {
- if (page == typeIDPage) {
- if (targetCreationPages.isEmpty())
- return null;
- return (IWizardPage) targetCreationPages.get(0);
- }
- if (targetCreationPages.contains(page)) {
- int i = targetCreationPages.indexOf(page);
- if ((i + 1) >= targetCreationPages.size()) {
- return null;
- }
- return (IWizardPage) targetCreationPages.get(i + 1);
- }
- if (sourceCreationPages.contains(page)) {
- if (sourceCreationPages.get(sourceCreationPages.size() - 1) == page) {
- return (IWizardPage) targetCreationPages.get(0);
- }
- }
- return null;
- }
-
- @Override
- public IWizardPage getNextPage(IWizardPage page) {
- IWizardPage p = getSourceCreationPage(page);
- if (p != null)
- return p;
- p = getTargetCreationPage(page);
- if (p != null)
- return p;
- return super.getNextPage(page);
- }
-
- public void clearTargetWizardPages() {
- // for (Iterator iterator = sourceCreationPages.iterator();
- // iterator.hasNext();) {
- // IWizardPage page = (IWizardPage) iterator.next();
- // if(page != null){
- // page.dispose();
- // }
- // }
- targetCreationPages.clear();
- }
-
- public void removeSourceWIzardPage(IWizardPage page) {
- sourceCreationPages.remove(page);
- }
-
- public void removeTargetWIzardPage(IWizardPage page) {
- targetCreationPages.remove(page);
- }
+package org.jboss.tools.smooks.ui.wizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.tools.common.model.ui.ModelUIImages;
+import org.jboss.tools.smooks.graphical.util.GraphicalInformationSaver;
+import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
+import org.jboss.tools.smooks.ui.editors.SmooksFileEditorInput;
+import org.jboss.tools.smooks.ui.editors.SmooksFormEditor;
+import org.jboss.tools.smooks.ui.editors.TypeIDSelectionWizardPage;
+
+/**
+ * This is a sample new wizard. Its role is to create a new file resource in the
+ * provided container. If the container resource (a folder or a project) is
+ * selected in the workspace when the wizard is opened, it will accept it as the
+ * target container. The wizard creates one file with the extension "smooks". If
+ * a sample multi-page editor (also available as a template) is registered for
+ * the same extension, it will be able to open it.
+ */
+
+public class SmooksConfigFileNewWizard extends Wizard implements INewWizard,
+ ISmooksDataCreationAddtionWizard {
+ private SmooksConfigFileNewWizardPage page;
+ private TypeIDSelectionWizardPage typeIDPage;
+
+ private List<IWizardPage> sourceCreationPages = new ArrayList<IWizardPage>();
+
+ private List<IWizardPage> targetCreationPages = new ArrayList<IWizardPage>();
+
+ private IStructuredSelection selection;
+
+ private IWorkbench workbench;
+
+ /**
+ * Constructor for SmooksConfigFileNewWizard.
+ */
+ public SmooksConfigFileNewWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ super.setWindowTitle("New Smooks Configuration File");
+ setDefaultPageImageDescriptor(ModelUIImages.getImageDescriptor(ModelUIImages.WIZARD_NEW_PROJECT));
+ }
+
+ /**
+ * Adding the page to the wizard.
+ */
+ public void addPages() {
+ page = new SmooksConfigFileNewWizardPage("newSmooksFile1",
+ getSelection());
+ addPage(page);
+ // TODO don't use the WizardSelectionPage
+ typeIDPage = new TypeIDSelectionWizardPage("", false);
+ typeIDPage.setSelection(selection);
+ addPage(typeIDPage);
+ }
+
+ /**
+ * This method is called when 'Finish' button is pressed in the wizard. We
+ * will create an operation and run it using wizard as execution context.
+ */
+ public boolean performFinish() {
+ // final String containerName = page.getContainerName();
+ // final String fileName = page.getFileName();
+ final IFile file = page.createNewFile();
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException {
+ try {
+ doFinish(file, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+ };
+ try {
+ getContainer().run(true, false, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ Throwable realException = e.getTargetException();
+ MessageDialog.openError(getShell(), "Error", realException
+ .getMessage());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The worker method. It will find the container, create the file if missing
+ * or just replace its contents, and open the editor on the newly created
+ * file.
+ */
+
+ private void doFinish(final IFile file, IProgressMonitor monitor)
+ throws CoreException {
+ // create a sample file
+ String sourceTypeID = typeIDPage.getSourceID();
+ String targetTypeID = typeIDPage.getTargetID();
+
+ try {
+ InputStream stream = openContentStream();
+ if (file.exists()) {
+ file.setContents(stream, true, true, monitor);
+ } else {
+ file.create(stream, true, monitor);
+ }
+ stream.close();
+ GraphicalInformationSaver ginforSave = new GraphicalInformationSaver(
+ file);
+ ginforSave.doSave(monitor, sourceTypeID, targetTypeID);
+ } catch (IOException e) {
+ }
+ monitor.worked(1);
+ monitor.setTaskName("Opening file for editing...");
+ getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ try {
+ SmooksFileEditorInput input = new SmooksFileEditorInput(
+ file);
+ IWizard sourceWizard = typeIDPage
+ .getSourceDataCreationWizard();
+ IWizard targetWizard = typeIDPage
+ .getTargetDataCreationWizard();
+ if (sourceWizard != null) {
+ sourceWizard.performFinish();
+ }
+ if (targetWizard != null) {
+ targetWizard.performFinish();
+ }
+ if (sourceWizard instanceof IStructuredDataCreationWizard) {
+ Object sourceObj = ((IStructuredDataCreationWizard) sourceWizard)
+ .getTreeViewerInputContents();
+// if (sourceObj instanceof List) {
+// if (!((List) sourceObj).isEmpty()) {
+// sourceObj = ((List) sourceObj).get(0);
+// }
+// }
+ input.setSourceTreeViewerInputContents(sourceObj);
+ }
+
+ if (targetWizard instanceof IStructuredDataCreationWizard) {
+ Object targetObj = ((IStructuredDataCreationWizard) targetWizard)
+ .getTreeViewerInputContents();
+// if (targetObj instanceof List) {
+// if (!((List) targetObj).isEmpty()) {
+// targetObj = ((List) targetObj).get(0);
+// }
+// }
+ input.setTargetTreeViewerInputContents(targetObj);
+
+ }
+
+ IDE.openEditor(page, input, SmooksFormEditor.EDITOR_ID,
+ true);// openEditor(page, file, true);
+ } catch (PartInitException e) {
+ }
+ }
+ });
+ monitor.worked(1);
+ }
+
+ /**
+ * We will initialize file contents with a sample text.
+ */
+
+ private InputStream openContentStream() {
+ String contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ + " <smooks-resource-list xmlns=\"http://www.milyn.org/xsd/smooks-1.0.xsd\"/>";
+ return new ByteArrayInputStream(contents.getBytes());
+ }
+
+ private void throwCoreException(String message) throws CoreException {
+ IStatus status = new Status(IStatus.ERROR, "org.jboss.tools.smooks.ui",
+ IStatus.OK, message, null);
+ throw new CoreException(status);
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ }
+
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+ public void addSourceWizardPage(IWizardPage page) {
+ sourceCreationPages.add(page);
+ page.setTitle("Source Data Selection");
+ }
+
+ public void addTargetWizardPage(IWizardPage page) {
+ targetCreationPages.add(page);
+ page.setTitle("Target Data Selection");
+ }
+
+ public void clearSourceWizardPages() {
+ // for (Iterator iterator = sourceCreationPages.iterator();
+ // iterator.hasNext();) {
+ // IWizardPage page = (IWizardPage) iterator.next();
+ // if(page != null){
+ // page.dispose();
+ // }
+ // }
+ sourceCreationPages.clear();
+ }
+
+ private IWizardPage getSourceCreationPage(IWizardPage page) {
+ if (page == typeIDPage) {
+ if (sourceCreationPages.isEmpty())
+ return null;
+ return (IWizardPage) sourceCreationPages.get(0);
+ }
+ if (sourceCreationPages.contains(page)) {
+ int i = sourceCreationPages.indexOf(page);
+ if ((i + 1) >= sourceCreationPages.size()) {
+ return null;
+ }
+ return (IWizardPage) sourceCreationPages.get(i + 1);
+ }
+ return null;
+ }
+
+ private IWizardPage getTargetCreationPage(IWizardPage page) {
+ if (page == typeIDPage) {
+ if (targetCreationPages.isEmpty())
+ return null;
+ return (IWizardPage) targetCreationPages.get(0);
+ }
+ if (targetCreationPages.contains(page)) {
+ int i = targetCreationPages.indexOf(page);
+ if ((i + 1) >= targetCreationPages.size()) {
+ return null;
+ }
+ return (IWizardPage) targetCreationPages.get(i + 1);
+ }
+ if (sourceCreationPages.contains(page)) {
+ if (sourceCreationPages.get(sourceCreationPages.size() - 1) == page) {
+ return (IWizardPage) targetCreationPages.get(0);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ IWizardPage p = getSourceCreationPage(page);
+ if (p != null)
+ return p;
+ p = getTargetCreationPage(page);
+ if (p != null)
+ return p;
+ return super.getNextPage(page);
+ }
+
+ public void clearTargetWizardPages() {
+ // for (Iterator iterator = sourceCreationPages.iterator();
+ // iterator.hasNext();) {
+ // IWizardPage page = (IWizardPage) iterator.next();
+ // if(page != null){
+ // page.dispose();
+ // }
+ // }
+ targetCreationPages.clear();
+ }
+
+ public void removeSourceWIzardPage(IWizardPage page) {
+ sourceCreationPages.remove(page);
+ }
+
+ public void removeTargetWIzardPage(IWizardPage page) {
+ targetCreationPages.remove(page);
+ }
}
\ No newline at end of file
Modified: branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java
===================================================================
--- branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java 2008-10-21 08:50:25 UTC (rev 11032)
+++ branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java 2008-10-21 09:15:01 UTC (rev 11033)
@@ -1,37 +1,40 @@
-package org.jboss.tools.smooks.ui.wizards;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-/**
- *
- * @author dart
- *
- */
-public class SmooksConfigFileNewWizardPage extends WizardNewFileCreationPage {
- public SmooksConfigFileNewWizardPage(String pageName,
- IStructuredSelection selection) {
- super(pageName, selection);
- setFileExtension("smooks");
- }
-
- @Override
- protected boolean validatePage() {
- boolean flag = super.validatePage();
- String name = this.getFileName();
- if (name.indexOf(".") == -1)
- return flag;
- String extensionName = name.substring(name.indexOf(".") + 1, name
- .length());
- String error = null;
- if (extensionName.equalsIgnoreCase(this.getFileExtension())) {
-
- } else {
- error = "file extension must be \"smooks\"";
- }
- if (error != null) {
- this.setErrorMessage(error);
- }
- return (error == null);
- }
+package org.jboss.tools.smooks.ui.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ *
+ * @author dart
+ *
+ */
+public class SmooksConfigFileNewWizardPage extends WizardNewFileCreationPage {
+ public SmooksConfigFileNewWizardPage(String pageName,
+ IStructuredSelection selection) {
+ super(pageName, selection);
+ setFileExtension("smooks");
+ super.setTitle("Smooks Configuration");
+ super.setDescription("Create a new Smooks configuration file");
+ this.setFileName("newConfig.smooks");
+ }
+
+ @Override
+ protected boolean validatePage() {
+ boolean flag = super.validatePage();
+ String name = this.getFileName();
+ if (name.indexOf(".") == -1)
+ return flag;
+ String extensionName = name.substring(name.indexOf(".") + 1, name
+ .length());
+ String error = null;
+ if (extensionName.equalsIgnoreCase(this.getFileExtension())) {
+
+ } else {
+ error = "file extension must be \"smooks\"";
+ }
+ if (error != null) {
+ this.setErrorMessage(error);
+ }
+ return (error == null);
+ }
}
\ No newline at end of file
16 years, 2 months
JBoss Tools SVN: r11032 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test: src/org/jboss/tools/jsf/vpe/richfaces/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-10-21 04:50:25 -0400 (Tue, 21 Oct 2008)
New Revision: 11032
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/gmap.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/gmap.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/virtualEarth.xhtml.xml
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/virtualEarth.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2810, tests for rich:gmap and rich:virtualEarth.
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/gmap.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/gmap.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/gmap.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/gmap.xhtml.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/gmap.xhtml.xml 2008-10-21 08:50:25 UTC (rev 11032)
@@ -0,0 +1,5 @@
+<tests>
+ <test id="gmap">
+ <IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/gmap/gmap.gif/"/>
+ </test>
+</tests>
\ No newline at end of file
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/gmap.xhtml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/virtualEarth.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/virtualEarth.xhtml 2008-10-21 08:34:11 UTC (rev 11031)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/virtualEarth.xhtml 2008-10-21 08:50:25 UTC (rev 11032)
@@ -10,11 +10,9 @@
</head>
<body>
-<!-- Virtual earth component -->
-<rich:virtualEarth>
- <rich:toolTip>
- <h:outputText value="This is virtual earth component" />
- </rich:toolTip>
-</rich:virtualEarth>
+<f:view>
+ <rich:virtualEarth id="virtualEarth">
+ </rich:virtualEarth>
+</f:view>
</body>
</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/virtualEarth.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/virtualEarth.xhtml.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/virtualEarth.xhtml.xml 2008-10-21 08:50:25 UTC (rev 11032)
@@ -0,0 +1,5 @@
+<tests>
+ <test id="virtualEarth">
+ <IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_road.png/"/>
+ </test>
+</tests>
\ No newline at end of file
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/virtualEarth.xhtml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2008-10-21 08:34:11 UTC (rev 11031)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2008-10-21 08:50:25 UTC (rev 11032)
@@ -160,11 +160,11 @@
}
public void testGmap() throws Throwable {
- assertTrue("it is necessary to add a body of the test ", false);//$NON-NLS-1$
+ performContentTest("components/gmap.xhtml");//$NON-NLS-1$
}
public void testVirtualEarth() throws Throwable {
- assertTrue("it is necessary to add a body of the test ", false);//$NON-NLS-1$
+ performContentTest("components/virtualEarth.xhtml");//$NON-NLS-1$
}
public void testHotKey() throws Throwable {
16 years, 2 months
JBoss Tools SVN: r11031 - branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-10-21 04:34:11 -0400 (Tue, 21 Oct 2008)
New Revision: 11031
Modified:
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2925
Modified: branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
===================================================================
--- branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-10-21 08:29:53 UTC (rev 11030)
+++ branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-10-21 08:34:11 UTC (rev 11031)
@@ -342,13 +342,30 @@
link.dataChanged();
}
}
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void structureChanged(final XModelTreeEvent event) {
+ if(Display.getCurrent() != null){
+ structureChangedInternal(event);
+ }else{
+ Display.getDefault().asyncExec(new Runnable(){
+ public void run(){
+ structureChangedInternal(event);
+ }
+ });
+ }
+ }
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
- public void structureChanged(XModelTreeEvent event) {
+ public void structureChangedInternal(XModelTreeEvent event) {
if(getData() == null) return;
XModelObject diagramXML = (XModelObject)getData();
XModelObject target = event.getModelObject();
16 years, 2 months
JBoss Tools SVN: r11030 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-10-21 04:29:53 -0400 (Tue, 21 Oct 2008)
New Revision: 11030
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/fileUpload.xhtml.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2810, tests for rich:effect and rich:fileUpload.
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/fileUpload.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/fileUpload.xhtml.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/fileUpload.xhtml.xml 2008-10-21 08:29:53 UTC (rev 11030)
@@ -0,0 +1,35 @@
+<tests>
+ <test id="fileUpload">
+ <DIV CLASS="rich-fileupload-list-decor" STYLE="width: 400px;">
+ <TABLE CLASS="rich-fileupload-toolbar-decor">
+ <TR>
+ <TD>
+ <DIV CLASS="rich-fileupload-button-border" STYLE="float: left;">
+ <DIV CLASS="rich-fileupload-button rich-fileupload-font"
+ STYLE="position: relative;">
+ <DIV
+ CLASS="rich-fileupload-button-content rich-fileupload-font rich-fileupload-ico rich-fileupload-ico-add"> Add...</DIV>
+ </DIV>
+ </DIV>
+ <DIV CLASS="rich-fileupload-button-border" STYLE="float: left;">
+ <DIV
+ CLASS="rich-fileupload-button-content rich-fileupload-font rich-fileupload-ico rich-fileupload-ico-start">
+ <B> Upload</B>
+ </DIV>
+ </DIV>
+ <DIV CLASS="rich-fileupload-button-border" STYLE="float: right;">
+ <DIV CLASS="rich-fileupload-button rich-fileupload-font">
+ <A CLASS="rich-fileupload-button-selection">
+ <DIV
+ CLASS="rich-fileupload-button-content rich-fileupload-font rich-fileupload-ico rich-fileupload-ico-clear">Clear All</DIV>
+ </A>
+ </DIV>
+ </DIV>
+ </TD>
+ </TR>
+ </TABLE>
+ <DIV CLASS="rich-fileupload-list-overflow" STYLE="width: 100%; height: 210px;">
+ </DIV>
+ </DIV>
+ </test>
+</tests>
\ No newline at end of file
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/fileUpload.xhtml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
16 years, 2 months
JBoss Tools SVN: r11029 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test: src/org/jboss/tools/jsf/vpe/richfaces/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-10-21 04:28:03 -0400 (Tue, 21 Oct 2008)
New Revision: 11029
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/fileUpload.xhtml
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/effect.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2810, tests for rich:effect and rich:fileUpload.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/effect.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/effect.xhtml 2008-10-21 07:30:00 UTC (rev 11028)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/effect.xhtml 2008-10-21 08:28:03 UTC (rev 11029)
@@ -9,13 +9,14 @@
<head>
</head>
<body>
- <!-- Effect -->
- <rich:panel id="fadebox" styleClass="box">
- <f:facet name="header">Fade Effect</f:facet>
- <rich:effect event="onclick" type="Fade" />
- <rich:effect event="onclick" for="fadebox" type="Appear"
- params="delay:3.0,duration:0.5" />
- <h:outputText value="Click to Activate" />
- </rich:panel>
+<f:view>
+<div id="contentDiv">
+ ..... div content ......
+</div>
+<input type="button" onclick="hideDiv({duration:0.7})" value="Hide" />
+<input type="button" onclick="showDiv()" value="Show" />
+<rich:effect id="effect1" name="hideDiv" for="contentDiv" type="Fade" />
+<rich:effect id="effect2" name="showDiv" for="contentDiv" type="Appear" />
+</f:view>
</body>
</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/fileUpload.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/fileUpload.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2008-10-21 07:30:00 UTC (rev 11028)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2008-10-21 08:28:03 UTC (rev 11029)
@@ -152,11 +152,11 @@
}
public void testEffect() throws Throwable {
- assertTrue("it is necessary to add a body of the test ", false);//$NON-NLS-1$
+ performInvisibleTagTest("components/effect.xhtml", "effect1"); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testFileUpload() throws Throwable {
- assertTrue("it is necessary to add a body of the test ", false);//$NON-NLS-1$
+ performContentTest("components/fileUpload.xhtml");//$NON-NLS-1$
}
public void testGmap() throws Throwable {
16 years, 2 months
JBoss Tools SVN: r11028 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-10-21 03:30:00 -0400 (Tue, 21 Oct 2008)
New Revision: 11028
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropDownMenu.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropListener.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/extendedDataTable.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/menuGroup.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/menuGroup.xhtml.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2810, tests for rich:dropDownMenu, rich:menuGroup, rich:menuItem, rich:dropListener, rich:dragListener, rich:extendedDataTable.
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropDownMenu.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropDownMenu.xhtml.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropDownMenu.xhtml.xml 2008-10-21 07:30:00 UTC (rev 11028)
@@ -0,0 +1,72 @@
+<tests>
+ <test id="dropDownMenu">
+
+<UL VPE-DDM-MENU-TITLE-UL="" >
+<LI VPE-DDM-MENU-TITLE-LI="" CLASS="rich-ddmenu-label rich-ddmenu-label-unselect" STYLE="" >
+<DIV CLASS="dr-menu-top-div" >
+<SPAN CLASS="rich-label-text-decor" >
+Menu 1
+</SPAN>
+</DIV>
+<UL VPE-DDM-MENU-CHILDREN-UL="" CLASS="rich-menu-list-border rich-menu-list-bg" STYLE="" >
+<LI VPE-DDM-MENU-LI="" CLASS="rich-menu-item" STYLE="" >
+<DIV CLASS="dr-menu-item-top-div" >
+<SPAN CLASS="rich-menu-item-icon" >
+<IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/spacer.gif/" />
+
+</SPAN>
+<SPAN CLASS="rich-menu-item-label" >
+<SPAN >
+Item 1
+</SPAN>
+</SPAN>
+</DIV>
+</LI>
+<LI VPE-DDM-MENU-LI="" CLASS="rich-menu-group" STYLE="" >
+<DIV CLASS="dr-menu-group-top-div" >
+<SPAN CLASS="rich-menu-item-icon-enabled" >
+<IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/spacer.gif/" />
+
+</SPAN>
+<SPAN CLASS="rich-menu-item-label rich-menu-group-label" >
+Group 2
+</SPAN>
+<SPAN CLASS="rich-menu-item-folder rich-menu-group-folder" STYLE="" >
+<IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/arrow.gif/" />
+</SPAN>
+</DIV>
+<UL VPE-DDM-MENU-UL="" CLASS="rich-menu-list-border rich-menu-list-bg" >
+<LI VPE-DDM-MENU-LI="" CLASS="rich-menu-item" STYLE="" >
+<DIV CLASS="dr-menu-item-top-div" >
+<SPAN CLASS="rich-menu-item-icon" >
+<IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/spacer.gif/" />
+
+</SPAN>
+<SPAN CLASS="rich-menu-item-label" >
+<SPAN>
+Item 2
+</SPAN>
+</SPAN>
+</DIV>
+</LI>
+</UL>
+</LI>
+<LI VPE-DDM-MENU-LI="" CLASS="rich-menu-item" STYLE="" >
+<DIV CLASS="dr-menu-item-top-div" >
+<SPAN CLASS="rich-menu-item-icon" >
+<IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/spacer.gif/" />
+
+</SPAN>
+<SPAN CLASS="rich-menu-item-label" >
+<SPAN>
+Item 3
+</SPAN>
+</SPAN>
+</DIV>
+</LI>
+</UL>
+</LI>
+</UL>
+
+ </test>
+</tests>
\ No newline at end of file
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropDownMenu.xhtml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropListener.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropListener.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/extendedDataTable.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/extendedDataTable.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/menuGroup.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/menuGroup.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/menuGroup.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/menuGroup.xhtml.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/menuGroup.xhtml.xml 2008-10-21 07:30:00 UTC (rev 11028)
@@ -0,0 +1,35 @@
+<tests>
+ <test id="menuGroup">
+
+<LI VPE-DDM-MENU-LI="" CLASS="rich-menu-group" STYLE="" >
+<DIV CLASS="dr-menu-group-top-div" >
+<SPAN CLASS="rich-menu-item-icon-enabled" >
+<IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/spacer.gif/" />
+
+</SPAN>
+<SPAN CLASS="rich-menu-item-label rich-menu-group-label" >
+Group 2
+</SPAN>
+<SPAN CLASS="rich-menu-item-folder rich-menu-group-folder" STYLE="" >
+<IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/arrow.gif/" />
+</SPAN>
+</DIV>
+<UL VPE-DDM-MENU-UL="" CLASS="rich-menu-list-border rich-menu-list-bg" >
+<LI VPE-DDM-MENU-LI="" CLASS="rich-menu-item" STYLE="" >
+<DIV CLASS="dr-menu-item-top-div" >
+<SPAN CLASS="rich-menu-item-icon" >
+<IMG SRC="/.*org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/spacer.gif/" />
+
+</SPAN>
+<SPAN CLASS="rich-menu-item-label" >
+<SPAN>
+Item 2
+</SPAN>
+</SPAN>
+</DIV>
+</LI>
+</UL>
+</LI>
+
+ </test>
+</tests>
\ No newline at end of file
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/menuGroup.xhtml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
16 years, 2 months
JBoss Tools SVN: r11027 - trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/model.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-10-21 03:16:31 -0400 (Tue, 21 Oct 2008)
New Revision: 11027
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/model/TreeItemRelationModel.java
Log:
JBIDE-2943
Fix it
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/model/TreeItemRelationModel.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/model/TreeItemRelationModel.java 2008-10-21 07:15:20 UTC (rev 11026)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/model/TreeItemRelationModel.java 2008-10-21 07:16:31 UTC (rev 11027)
@@ -1,111 +1,115 @@
-/*******************************************************************************
- * 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.ui.gef.model;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Dart Peng
- * @Date Jul 31, 2008
- */
-public class TreeItemRelationModel extends AbstractStructuredDataModel
- implements IConnectableModel {
-
- public static final String PRO_TREE_ITEM_SELECTION_STATUS = "__pro_treeitem_selection_status";
-
- public static final String PRO_TREE_REPAINT = "__pro_tree_repaint";
-
- TreeItem treeItem = null;
- List<Object> modelSourceConnections = new ArrayList<Object>();
- List<Object> modelTargetConnections = new ArrayList<Object>();
-
- public TreeItem getTreeItem() {
- return treeItem;
- }
-
- public boolean isCollapse() {
- TreeItem item = getTreeItem();
- int y = Integer.MAX_VALUE;
- if (item != null) {
- y = item.getBounds().y;
- }
- return (y == 0);
- }
-
- public void setTreeItem(TreeItem treeItem) {
- this.treeItem = treeItem;
- }
-
- public void addSourceConnection(Object connx) {
- this.getModelSourceConnections().add(connx);
- this.firePropertyChange(P_SOURCE_CONNECTION, null, connx);
- }
-
- public void addTargetConnection(Object connx) {
- this.getModelTargetConnections().add(connx);
- this.firePropertyChange(P_TARGET_CONNECTION, null, connx);
- }
-
- public void removeSourceConnection(Object connx) {
- this.getModelSourceConnections().remove(connx);
- this.firePropertyChange(P_SOURCE_CONNECTION, connx, null);
- }
-
- public void removeTargetConnection(Object connx) {
- this.getModelTargetConnections().remove(connx);
- this.firePropertyChange(P_TARGET_CONNECTION, connx, null);
- }
-
- public List<Object> getModelSourceConnections() {
- return modelSourceConnections;
- }
-
- public void setModelSourceConnections(List<Object> modelSourceConnections) {
- this.modelSourceConnections = modelSourceConnections;
- }
-
- public List<Object> getModelTargetConnections() {
- return modelTargetConnections;
- }
-
- public void setModelTargetConnections(List<Object> modelTargetConnections) {
- this.modelTargetConnections = modelTargetConnections;
- }
-
- public boolean isSourceConnectWith(IConnectableModel target) {
- List list = this.getModelSourceConnections();
- for (Iterator iterator = list.iterator(); iterator.hasNext();) {
- LineConnectionModel connection = (LineConnectionModel) iterator
- .next();
- if (connection.getTarget() == target) {
- return true;
- }
- }
- return false;
- }
-
- public boolean isTargetConnectWith(IConnectableModel source) {
- List list = this.getModelTargetConnections();
- for (Iterator iterator = list.iterator(); iterator.hasNext();) {
- LineConnectionModel connection = (LineConnectionModel) iterator
- .next();
- if (connection.getSource() == source) {
- return true;
- }
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * 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.ui.gef.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Dart Peng
+ * @Date Jul 31, 2008
+ */
+public class TreeItemRelationModel extends AbstractStructuredDataModel
+ implements IConnectableModel {
+
+ public static final String PRO_TREE_ITEM_SELECTION_STATUS = "__pro_treeitem_selection_status";
+
+ public static final String PRO_TREE_REPAINT = "__pro_tree_repaint";
+
+ TreeItem treeItem = null;
+ List<Object> modelSourceConnections = new ArrayList<Object>();
+ List<Object> modelTargetConnections = new ArrayList<Object>();
+
+ public TreeItem getTreeItem() {
+ return treeItem;
+ }
+
+ public boolean isCollapse() {
+ TreeItem item = getTreeItem();
+ int y = Integer.MAX_VALUE;
+ if (item != null) {
+ y = item.getBounds().y;
+ // for windows
+ TreeItem parentItem = item.getParentItem();
+ if(parentItem == null) return false;
+ }
+
+ return (y == 0);
+ }
+
+ public void setTreeItem(TreeItem treeItem) {
+ this.treeItem = treeItem;
+ }
+
+ public void addSourceConnection(Object connx) {
+ this.getModelSourceConnections().add(connx);
+ this.firePropertyChange(P_SOURCE_CONNECTION, null, connx);
+ }
+
+ public void addTargetConnection(Object connx) {
+ this.getModelTargetConnections().add(connx);
+ this.firePropertyChange(P_TARGET_CONNECTION, null, connx);
+ }
+
+ public void removeSourceConnection(Object connx) {
+ this.getModelSourceConnections().remove(connx);
+ this.firePropertyChange(P_SOURCE_CONNECTION, connx, null);
+ }
+
+ public void removeTargetConnection(Object connx) {
+ this.getModelTargetConnections().remove(connx);
+ this.firePropertyChange(P_TARGET_CONNECTION, connx, null);
+ }
+
+ public List<Object> getModelSourceConnections() {
+ return modelSourceConnections;
+ }
+
+ public void setModelSourceConnections(List<Object> modelSourceConnections) {
+ this.modelSourceConnections = modelSourceConnections;
+ }
+
+ public List<Object> getModelTargetConnections() {
+ return modelTargetConnections;
+ }
+
+ public void setModelTargetConnections(List<Object> modelTargetConnections) {
+ this.modelTargetConnections = modelTargetConnections;
+ }
+
+ public boolean isSourceConnectWith(IConnectableModel target) {
+ List list = this.getModelSourceConnections();
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ LineConnectionModel connection = (LineConnectionModel) iterator
+ .next();
+ if (connection.getTarget() == target) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isTargetConnectWith(IConnectableModel source) {
+ List list = this.getModelTargetConnections();
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ LineConnectionModel connection = (LineConnectionModel) iterator
+ .next();
+ if (connection.getSource() == source) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
16 years, 2 months