Author: DartPeng
Date: 2009-06-23 05:14:04 -0400 (Tue, 23 Jun 2009)
New Revision: 16130
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/TextTypeSwicher.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/BeanIdRefValidator.java
Log:
JBIDE-4283
Add two radio button to control the "Text value text" and "CDATA value
text".
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-06-23
09:01:15 UTC (rev 16129)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-06-23
09:14:04 UTC (rev 16130)
@@ -285,8 +285,11 @@
public static String getAnyTypeText(AnyType anyType) {
Object value =
anyType.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, true);
if (value != null) {
- if (value instanceof List && !((List) value).isEmpty()) {
- return ((List) value).get(0).toString().trim();
+ if (value instanceof List && !((List<?>) value).isEmpty()) {
+ Object v = ((List<?>) value).get(0);
+ if (v != null) {
+ return v.toString().trim();
+ }
}
// return value.toString();
}
@@ -297,7 +300,10 @@
Object value =
anyType.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, true);
if (value != null) {
if (value instanceof List && !((List) value).isEmpty()) {
- return ((List) value).get(0).toString().trim();
+ Object v = ((List) value).get(0);
+ if (v != null) {
+ return v.toString().trim();
+ }
}
// return value.toString();
}
@@ -307,8 +313,11 @@
public static String getAnyTypeComment(AnyType anyType) {
Object value =
anyType.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, true);
if (value != null) {
- if (value instanceof List && !((List) value).isEmpty()) {
- return ((List) value).get(0).toString().trim();
+ if (value instanceof List && !((List<?>) value).isEmpty()) {
+ Object v = ((List<?>) value).get(0);
+ if (v != null) {
+ return v.toString().trim();
+ }
}
// return value.toString();
}
@@ -417,11 +426,21 @@
smooksModel.getMixed().add(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA,
text);
}
+ /**
+ * @deprecated
+ * @param smooksModel
+ * @param text
+ */
public static void setTextToAnyType(AnyType smooksModel, String text) {
cleanTextToSmooksType(smooksModel);
appendTextToSmooksType(smooksModel, text);
}
+ /**
+ * @deprecated
+ * @param smooksModel
+ * @param text
+ */
public static void setCDATAToAnyType(AnyType smooksModel, String text) {
cleanCDATAToSmooksType(smooksModel);
appendCDATAToSmooksType(smooksModel, text);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-06-23
09:01:15 UTC (rev 16129)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-06-23
09:14:04 UTC (rev 16130)
@@ -30,6 +30,7 @@
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.FieldAssistDisposer;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.configuration.editors.uitls.TextTypeSwicher;
import org.jboss.tools.smooks.model.freemarker.FreemarkerPackage;
/**
@@ -63,6 +64,9 @@
// OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model,
// SmooksUIUtils.VALUE_TYPE_COMMENT, "flt");
+ TextTypeSwicher swicher = new TextTypeSwicher();
+ swicher.createSwicherGUI("External Template File", "Inline
Template", parent, toolkit);
+
AttributeFieldEditPart cdatatext = SmooksUIUtils.createCDATAFieldEditor("Inline
Template", editingdomain,
toolkit, parent, model, openCDATAEditorAction, true);
Control c = cdatatext.getContentControl();
@@ -93,8 +97,14 @@
openCDATAEditorAction.setRelateText((Text) cdatatext.getContentControl());
// openCommentEditorAction.setRelateText((Text)commenttext.getContentControl());
- list.add(SmooksUIUtils.createFileSelectionTextFieldEditor("External Template
File", parent, editingdomain,
- toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT, null, null));
+ AttributeFieldEditPart textFieldEditPart =
SmooksUIUtils.createFileSelectionTextFieldEditor(
+ "External Template File", parent, editingdomain, toolkit, null, model,
SmooksUIUtils.VALUE_TYPE_TEXT,
+ null, null);
+
+ list.add(textFieldEditPart);
+
+ swicher.hookSwicher(textFieldEditPart, cdatatext, editingdomain, model);
+
list.add(SmooksUIUtils.createStringFieldEditor(parent, toolkit,
getPropertyDescriptor(editingdomain,
FreemarkerPackage.eINSTANCE.getTemplate_Encoding(), model), model, false, false,
null));
return list;
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-06-23
09:01:15 UTC (rev 16129)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-06-23
09:14:04 UTC (rev 16130)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.smooks;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EAttribute;
@@ -22,6 +22,7 @@
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.configuration.editors.uitls.TextTypeSwicher;
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
/**
@@ -39,7 +40,8 @@
* org.eclipse.emf.ecore.EAttribute)
*/
public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute
feature,SmooksMultiFormEditor formEditor) {
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
+ SmooksMultiFormEditor formEditor) {
if (feature == SmooksPackage.eINSTANCE.getParamType_Name()) {
}
if (feature == SmooksPackage.eINSTANCE.getParamType_Type()) {
@@ -48,11 +50,109 @@
}
@Override
- public List<AttributeFieldEditPart>
createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
- Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model , false , 500,false,false,null,null);
- SmooksUIUtils.createCDATAFieldEditor("CDATA Value", editingdomain, toolkit,
parent, model,null);
+ public List<AttributeFieldEditPart>
createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, SmooksMultiFormEditor formEditor)
{
+ List<AttributeFieldEditPart> list = new
ArrayList<AttributeFieldEditPart>();
+ TextTypeSwicher swicher = new TextTypeSwicher();
+ swicher.createSwicherGUI("Text Value", "CDATA Value", parent,
toolkit);
+// GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+// gd.horizontalSpan = 2;
+// gd.heightHint = 2;
+// toolkit.createCompositeSeparator(parent).setLayoutData(gd);
+//
+// final Button textButton = toolkit.createButton(parent, "Text Value",
SWT.RADIO);
+// final Button cdataButton = toolkit.createButton(parent, "CDATA Value",
SWT.RADIO);
+// String cdata = SmooksModelUtils.getAnyTypeCDATA((AnyType) model);
+// String text = SmooksModelUtils.getAnyTypeText((AnyType) model);
+
+ final AttributeFieldEditPart tp = SmooksUIUtils.createMixedTextFieldEditor("Text
Value", editingdomain,
+ toolkit, parent, model, false, 500, false, false, null, null);
+ final AttributeFieldEditPart cp = SmooksUIUtils.createCDATAFieldEditor("CDATA
Value", editingdomain, toolkit,
+ parent, model, null);
+ list.add(tp);
+ list.add(cp);
+ swicher.hookSwicher(tp, cp, editingdomain, model);
- return Collections.emptyList();
+
+// textButton.setSelection(true);
+// cdataButton.setSelection(false);
+// if ((cdata == null || cdata.length() == 0) && (text == null || text.length()
== 0)) {
+// textButton.setSelection(true);
+// cdataButton.setSelection(false);
+// } else {
+// if ((text == null || text.length() == 0)) {
+// textButton.setSelection(false);
+// cdataButton.setSelection(true);
+// }
+// }
+// tp.getContentControl().setEnabled(textButton.getSelection());
+// cp.getContentControl().setEnabled(cdataButton.getSelection());
+// final AnyType fm = (AnyType) model;
+// final AdapterFactoryEditingDomain fd = editingdomain;
+// textButton.addSelectionListener(new SelectionListener() {
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see
+// * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected
+// * (org.eclipse.swt.events.SelectionEvent)
+// */
+// public void widgetDefaultSelected(SelectionEvent e) {
+//
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see
+// * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
+// * .swt.events.SelectionEvent)
+// */
+// public void widgetSelected(SelectionEvent e) {
+// tp.getContentControl().setEnabled(textButton.getSelection());
+// cp.getContentControl().setEnabled(cdataButton.getSelection());
+// SmooksModelUtils.setCDATAToSmooksType(fd, fm, null);
+// Text t = (Text) tp.getContentControl();
+// String text = t.getText();
+// if(text != null && text.length() == 0) text = null;
+// SmooksModelUtils.setTextToSmooksType(fd,fm, text);
+// }
+//
+// });
+//
+// cdataButton.addSelectionListener(new SelectionListener() {
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see
+// * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected
+// * (org.eclipse.swt.events.SelectionEvent)
+// */
+// public void widgetDefaultSelected(SelectionEvent e) {
+//
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see
+// * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
+// * .swt.events.SelectionEvent)
+// */
+// public void widgetSelected(SelectionEvent e) {
+// tp.getContentControl().setEnabled(textButton.getSelection());
+// cp.getContentControl().setEnabled(cdataButton.getSelection());
+// SmooksModelUtils.setTextToSmooksType(fd,fm, null);
+// Text t = (Text) cp.getContentControl();
+// String text = t.getText();
+// if(text != null && text.length() == 0) text = null;
+// SmooksModelUtils.setCDATAToSmooksType(fd,fm, text);
+// }
+//
+// });
+
+ return list;
}
}
\ No newline at end of file
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-06-23
09:01:15 UTC (rev 16129)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-06-23
09:14:04 UTC (rev 16130)
@@ -221,22 +221,22 @@
return beanIdList;
}
- public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain,
+ public static AttributeFieldEditPart createMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain,
FormToolkit toolkit, Composite parent, Object model, boolean linkLabel,
IHyperlinkListener listener) {
- createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false, 0,
linkLabel, false, listener,
+ return createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false,
0, linkLabel, false, listener,
null);
}
- public static void createMultiMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain,
+ public static AttributeFieldEditPart createMultiMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain,
FormToolkit toolkit, Composite parent, Object model, int height,
OpenEditorEditInnerContentsAction action) {
- createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true, height,
false, false, null,
+ return createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true,
height, false, false, null,
action);
}
- public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain,
+ public static AttributeFieldEditPart createMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain,
FormToolkit toolkit, Composite parent, Object model, boolean multiText, int height,
boolean linkLabel,
boolean openFile, IHyperlinkListener listener, OpenEditorEditInnerContentsAction
action) {
- createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, multiText,
linkLabel, openFile,
+ return createStringFieldEditor(label, parent, editingdomain, toolkit, null, model,
multiText, linkLabel, openFile,
height, listener, VALUE_TYPE_TEXT, action);
}
@@ -623,9 +623,9 @@
}
if (editValue != null && valueIsSet) {
valueText.setText(editValue);
- // if (editValue.length() > 0 && section != null) {
- // section.setExpanded(true);
- // }
+ if (editValue.length() > 0 && section != null) {
+ section.setExpanded(true);
+ }
}
if (valueType == VALUE_TYPE_TEXT && model instanceof AnyType &&
fEditingDomain != null) {
valueText.addModifyListener(new ModifyListener() {
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/TextTypeSwicher.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/TextTypeSwicher.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/TextTypeSwicher.java 2009-06-23
09:14:04 UTC (rev 16130)
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.uitls;
+
+import org.eclipse.emf.ecore.xml.type.AnyType;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class TextTypeSwicher {
+
+ private Button textButton;
+ private Button cdataButton;
+
+ public void hookSwicher(AttributeFieldEditPart textFieldEditPart, AttributeFieldEditPart
cdataFieldEditPart,
+ AdapterFactoryEditingDomain editingdomain, Object model) {
+ String cdata = SmooksModelUtils.getAnyTypeCDATA((AnyType) model);
+ String text = SmooksModelUtils.getAnyTypeText((AnyType) model);
+
+ textButton.setSelection(true);
+ cdataButton.setSelection(false);
+ if ((cdata == null || cdata.length() == 0) && (text == null || text.length() ==
0)) {
+ textButton.setSelection(true);
+ cdataButton.setSelection(false);
+ } else {
+ if ((text == null || text.length() == 0)) {
+ textButton.setSelection(false);
+ cdataButton.setSelection(true);
+ }
+ }
+ final AttributeFieldEditPart tp = textFieldEditPart;
+ final AttributeFieldEditPart cp = cdataFieldEditPart;
+ tp.getContentControl().setEnabled(textButton.getSelection());
+ cp.getContentControl().setEnabled(cdataButton.getSelection());
+ final AnyType fm = (AnyType) model;
+ final AdapterFactoryEditingDomain fd = editingdomain;
+ textButton.addSelectionListener(new SelectionListener() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected
+ * (org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+ tp.getContentControl().setEnabled(textButton.getSelection());
+ cp.getContentControl().setEnabled(cdataButton.getSelection());
+ SmooksModelUtils.setCDATAToSmooksType(fd, fm, null);
+ Text t = (Text) tp.getContentControl();
+ String text = t.getText();
+ if (text != null) {
+ text = text.replaceAll("\r", "");
+ }
+ if (text.length() == 0)
+ text = null;
+ SmooksModelUtils.setTextToSmooksType(fd, fm, text);
+ }
+
+ });
+
+ cdataButton.addSelectionListener(new SelectionListener() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected
+ * (org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+ tp.getContentControl().setEnabled(textButton.getSelection());
+ cp.getContentControl().setEnabled(cdataButton.getSelection());
+ SmooksModelUtils.setTextToSmooksType(fd, fm, null);
+ Text t = (Text) cp.getContentControl();
+ String text = t.getText();
+ if (text != null) {
+ text = text.replaceAll("\r", "");
+ }
+ if (text.length() == 0)
+ text = null;
+ SmooksModelUtils.setCDATAToSmooksType(fd, fm, text);
+ }
+
+ });
+ }
+
+ public void createSwicherGUI(String textString, String cdataString, Composite parent,
FormToolkit toolkit) {
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = 15;
+
+ toolkit.createSeparator(parent, SWT.HORIZONTAL).setLayoutData(gd);
+
+ textButton = toolkit.createButton(parent, textString, SWT.RADIO);
+ cdataButton = toolkit.createButton(parent, cdataString, SWT.RADIO);
+ }
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/TextTypeSwicher.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-06-23
09:01:15 UTC (rev 16129)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-06-23
09:14:04 UTC (rev 16130)
@@ -25,6 +25,7 @@
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.configuration.editors.uitls.TextTypeSwicher;
import org.jboss.tools.smooks.model.xsl.XslPackage;
/**
@@ -79,16 +80,23 @@
// OpenEditorEditInnerContentsAction openCommentEditorAction = new
// OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model,
// SmooksUIUtils.VALUE_TYPE_COMMENT, "xsl");
- AttributeFieldEditPart text1 = SmooksUIUtils.createCDATAFieldEditor("Inline
Template", editingdomain, toolkit,
- parent, model, openCdataEditorAction,true);
+ TextTypeSwicher swicher = new TextTypeSwicher();
+ swicher.createSwicherGUI("External Template File", "Inline
Template", parent, toolkit);
+ AttributeFieldEditPart cdataFieldEditPart =
SmooksUIUtils.createCDATAFieldEditor("Inline Template", editingdomain, toolkit,
+ parent, model, openCdataEditorAction, true);
// AttributeFieldEditPart text2 =
// SmooksUIUtils.createCommentFieldEditor("Template Contents (Comment)",
// editingdomain, toolkit, parent, model, openCommentEditorAction);
- openCdataEditorAction.setRelateText((Text) text1.getContentControl());
+ openCdataEditorAction.setRelateText((Text) cdataFieldEditPart.getContentControl());
// openCommentEditorAction.setRelateText((Text)text2.getContentControl());
- list.add(SmooksUIUtils.createFileSelectionTextFieldEditor("External Template
File", parent, editingdomain,
- toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT, null, null));
- list.add(text1);
+ AttributeFieldEditPart textFieldEditPart =
SmooksUIUtils.createFileSelectionTextFieldEditor(
+ "External Template File", parent, editingdomain, toolkit, null, model,
SmooksUIUtils.VALUE_TYPE_TEXT,
+ null, null);
+ list.add(textFieldEditPart);
+ list.add(cdataFieldEditPart);
+
+ swicher.hookSwicher(textFieldEditPart, cdataFieldEditPart, editingdomain, model);
+
list.add(SmooksUIUtils.createStringFieldEditor(parent, toolkit,
getPropertyDescriptor(editingdomain,
XslPackage.eINSTANCE.getTemplate_Encoding(), model), model, false, false, null));
return list;
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/BeanIdRefValidator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/BeanIdRefValidator.java 2009-06-23
09:01:15 UTC (rev 16129)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/BeanIdRefValidator.java 2009-06-23
09:14:04 UTC (rev 16130)
@@ -41,7 +41,7 @@
*/
@Override
protected void preStartValidation() {
-
+
}
/*
@@ -59,10 +59,12 @@
if (obj instanceof DocumentRoot) {
SmooksResourceListType listType = ((DocumentRoot) obj).getSmooksResourceList();
List<String> ids = SmooksUIUtils.getBeanIdStringList(listType);
- idList.addAll(ids);
+ if (ids != null){
+ idList.addAll(ids);
+ }
}
if (idList.isEmpty()) {
-// return null;
+ // return null;
}
return super.validate(selectedObjects, editingDomain);
}
@@ -83,9 +85,9 @@
JavabeanPackage.Literals.WIRING_TYPE__BEAN_ID_REF);
}
}
-
- if(model instanceof JmsRouter){
- String idRef = ((JmsRouter)model).getBeanId();
+
+ if (model instanceof JmsRouter) {
+ String idRef = ((JmsRouter) model).getBeanId();
if (!idList.contains(idRef)) {
return newWaringDiagnostic("Reference BeanId '" + idRef + "'
dosen't exist.", model,
JmsroutingPackage.Literals.JMS_ROUTER__BEAN_ID);