Author: tfennelly
Date: 2010-08-12 10:12:33 -0400 (Thu, 12 Aug 2010)
New Revision: 24102
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InvalidInputSourceTypeException.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/messages.properties
Log:
https://jira.jboss.org/browse/JBIDE-6823
Tidy up the input type /reader type selection handling
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2010-08-12
13:55:36 UTC (rev 24101)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2010-08-12
14:12:33 UTC (rev 24102)
@@ -87,7 +87,9 @@
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
import org.jboss.tools.smooks.configuration.editors.input.InputType;
+import
org.jboss.tools.smooks.configuration.editors.input.InvalidInputSourceTypeException;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import
org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
import
org.jboss.tools.smooks.configuration.editors.wizard.StructuredDataSelectionWizard;
@@ -150,7 +152,6 @@
private CheckboxTableViewer inputDataViewer;
private TreeViewer inputModelViewer;
private Combo readerCombo;
- private List<Object> readerTypeList = new ArrayList<Object>();
private Composite readerConfigComposite;
// private ModelPanelCreator modelPanelCreator;
protected boolean lockCheck = false;
@@ -361,33 +362,20 @@
}
private void initReaderConfigSection() {
- Object reader = getCurrentReaderModel();
ISmooksModelProvider provider = getSmooksModelProvider();
- if (provider == null)
+
+ if (provider == null) {
return;
- String type = provider.getInputType();
- if (reader instanceof EObject && type != null) {
-// SmooksResourceListType list = getSmooksConfigResourceList();
-// createReaderPanel((EObject) list.getAbstractReader().get(0));
- } else {
- disposeCompositeControls(readerConfigComposite, null);
- createSimpleReaderPanel(reader);
}
+
+ addInputConfigControls();
}
- private void createSimpleReaderPanel(Object reader){
- Label formText = this.getManagedForm().getToolkit().createLabel(readerConfigComposite,
""); //$NON-NLS-1$
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 50;
- gd.horizontalSpan = 2;
- formText.setLayoutData(gd);
- if (reader instanceof XMLReader || reader instanceof JavaReader || reader instanceof
XSDReader) {
- formText.setText(Messages.SmooksReaderFormPage_Warning_Specify_Sample_Data);
- }
-
- if (reader instanceof NullReader) {
- formText.setText(Messages.SmooksReaderFormPage_Warning_Specify_Input_Type);
- }
+ private void addInputConfigControls() {
+ disposeCompositeControls(readerConfigComposite, null);
+
+ getCurrentInputType().getConfigurationContributor().addInputConfigControls(this,
readerConfigComposite);
+
readerConfigComposite.layout();
scrolledPageBook.reflow(false);
}
@@ -410,13 +398,16 @@
}
}
- private Object getCurrentReaderModel() {
- if (readerCombo == null || readerCombo.isDisposed())
- return null;
- int index = readerCombo.getSelectionIndex();
- if (index < 0)
- return null;
- return readerTypeList.get(index);
+ private InputSourceType getCurrentInputType() {
+ if (readerCombo == null || readerCombo.isDisposed()) {
+ return InputSourceType.NONE;
+ }
+
+ try {
+ return InputSourceType.fromTypeIndex(readerCombo.getSelectionIndex());
+ } catch (InvalidInputSourceTypeException e) {
+ return InputSourceType.NONE;
+ }
}
protected void createInputDataSection(FormToolkit toolkit, Composite parent) {
@@ -450,7 +441,7 @@
inputDataViewer.setCheckStateProvider(new ICheckStateProvider() {
public boolean isGrayed(Object element) {
- return isIncorrectInputType((InputType) element);
+ return !isValidInputType((InputType) element);
}
public boolean isChecked(Object element) {
@@ -467,7 +458,7 @@
return;
boolean checked = event.getChecked();
InputType inputType = (InputType) event.getElement();
- if (isIncorrectInputType(inputType)) {
+ if (!isValidInputType(inputType)) {
lockCheck = true;
inputDataViewer.setChecked(inputType, false);
lockCheck = false;
@@ -707,40 +698,20 @@
return getSmooksModelProvider().getSmooksModel();
}
- protected boolean isIncorrectInputType(InputType element) {
- if (element == null)
- return false;
- if (element instanceof InputType) {
- String type = ((InputType) element).getType();
- int index = readerCombo.getSelectionIndex();
- if (index == -1)
- return true;
+ protected boolean isValidInputType(InputType element) {
+ if (element == null) {
+ // not specified is OK...
+ return true;
+ }
+
+ String type = element.getType();
+ int selectionIndex = readerCombo.getSelectionIndex();
- Object reader = readerTypeList.get(index);
- if (reader instanceof NullReader) {
- return true;
- }
- if (reader instanceof XMLReader || reader instanceof XSDReader || reader instanceof
JavaReader) {
-
- }
-
- if (reader instanceof XMLReader) {
- if (!SmooksModelUtils.INPUT_TYPE_XML.equals(type)) {
- return true;
- }
- }
- if (reader instanceof XSDReader) {
- if (!SmooksModelUtils.INPUT_TYPE_XSD.equals(type)) {
- return true;
- }
- }
- if (reader instanceof JavaReader) {
- if (!SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
- return true;
- }
- }
+ try {
+ return InputSourceType.isValidIndexNamePair(selectionIndex, type);
+ } catch (InvalidInputSourceTypeException e) {
+ return false;
}
- return false;
}
@@ -783,16 +754,11 @@
return;
readerCombo.removeAll();
- readerTypeList.clear();
- readerCombo.add(Messages.SmooksReaderFormPage_NoInputComboText);
- readerTypeList.add(new NullReader());
- readerCombo.add(Messages.SmooksReaderFormPage_XMLReaderComboText);
- readerTypeList.add(new XMLReader());
- readerCombo.add(Messages.SmooksReaderFormPage_JavaReaderComboText);
- readerTypeList.add(new JavaReader());
- readerCombo.add(Messages.SmooksReaderFormPage_XSDReaderComboText);
- readerTypeList.add(new XSDReader());
+ readerCombo.add(Messages.SmooksReaderFormPage_NoInputComboText,
InputSourceType.NONE.getTypeIndex());
+ readerCombo.add(Messages.SmooksReaderFormPage_XMLReaderComboText,
InputSourceType.XML.getTypeIndex());
+ readerCombo.add(Messages.SmooksReaderFormPage_XSDReaderComboText,
InputSourceType.XSD.getTypeIndex());
+ readerCombo.add(Messages.SmooksReaderFormPage_JavaReaderComboText,
InputSourceType.JAVA.getTypeIndex());
}
private void initReaderCombo() {
@@ -809,45 +775,22 @@
String inputType = modelProvider.getInputType();
if (inputType == null) {
- readerCombo.select(0);
+ readerCombo.select(InputSourceType.NONE.getTypeIndex());
return;
-// // for the first time to open the file.
-// List<IComponent> compoenents = model.getModelRoot().getComponents();
-// for (Iterator<?> iterator = compoenents.iterator(); iterator.hasNext();) {
-// IComponent component = (IComponent) iterator.next();
-// }
-// if (rlist.getAbstractReader().isEmpty()) {
-// readerCombo.select(0);
-// return;
-// } else {
-// }
}
- if (SmooksModelUtils.INPUT_TYPE_XML.equals(inputType)) {
- readerCombo.select(1);
+
+ try {
+ readerCombo.select(InputSourceType.fromTypeName(inputType).getTypeIndex());
+ } catch (InvalidInputSourceTypeException e) {
+ readerCombo.select(InputSourceType.NONE.getTypeIndex());
}
- if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(inputType)) {
- readerCombo.select(2);
- }
- if (SmooksModelUtils.INPUT_TYPE_XSD.equals(inputType)) {
- readerCombo.select(3);
- }
- return;
}
private void handleReaderCombo(final Combo combo) {
combo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
- Object newreader = getCurrentReaderModel();
- if (newreader == null)
- return;
- // String type = getCurrentReaderType();
- // if (type == null) {
- //
getSmooksGraphicsExtType().eUnset(GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__INPUT_TYPE);
- // } else {
- // getSmooksGraphicsExtType().setInputType(type);
- // }
- readerChanged(newreader);
+ readerChanged();
}
public void widgetDefaultSelected(SelectionEvent e) {
@@ -857,43 +800,9 @@
});
}
- private String getCurrentReaderType() {
- Object reader = getCurrentReaderModel();
- return getReaderType(reader);
- }
-
- private String getReaderType(Object reader) {
- if (reader instanceof XMLReader) {
- return SmooksModelUtils.INPUT_TYPE_XML;
- }
- if (reader instanceof JavaReader) {
- return SmooksModelUtils.INPUT_TYPE_JAVA;
- }
- if (reader instanceof XSDReader) {
- return SmooksModelUtils.INPUT_TYPE_XSD;
- }
- if (reader instanceof EObject) {
- Object obj = ((EObject) reader);
+ private void readerChanged() {
-// if (obj instanceof CSV12Reader) {
-// return SmooksModelUtils.INPUT_TYPE_CSV;
-// }
-// if (obj instanceof EDI12Reader) {
-// return SmooksModelUtils.INPUT_TYPE_EDI_1_1;
-// }
-// if (obj instanceof Json12Reader) {
-// return SmooksModelUtils.INPUT_TYPE_JSON_1_1;
-// }
-// if (obj instanceof ReaderType) {
-// return SmooksModelUtils.INPUT_TYPE_CUSTOME;
-// }
- }
- return null;
- }
-
- private void readerChanged(Object reader) {
-
- String type = getCurrentReaderType();
+ String type = getCurrentInputType().toTypeString();
String oldType = this.getSmooksModelProvider().getInputType();
if (type == null && oldType == null) {
@@ -917,8 +826,7 @@
compoundCommand.append(addparamsCommand);
}
- IParam param = SmooksUIUtils
- .getInputTypeParam(getSmooksConfigResourceList().getModelRoot());
+ IParam param =
SmooksUIUtils.getInputTypeParam(getSmooksConfigResourceList().getModelRoot());
if (param == null) {
// add new one
param = ICoreFactory.eINSTANCE.createParam();
@@ -946,29 +854,12 @@
if (removeCommand != null && removeCommand.canExecute()) {
compoundCommand.append(removeCommand);
}
- if (readerConfigComposite != null) {
- disposeCompositeControls(readerConfigComposite, null);
- scrolledPageBook.reflow(true);
- }
- if (reader instanceof EObject) {
-// Object obj = ((EObject) reader);
-// obj = AdapterFactoryEditingDomain.unwrap(obj);
-// Command command = AddCommand.create(getEditingDomain(),
getSmooksConfigResourceList(),
-// SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP,
createReaderEntry(obj,
-// false));
-// if (command.canExecute()) {
-// compoundCommand.append(command);
-// }
- } else {
- createSimpleReaderPanel(reader);
- }
+ addInputConfigControls();
+
deactiveAllInputFile(compoundCommand);
if (!compoundCommand.isEmpty() && compoundCommand.canExecute()) {
getEditingDomain().getCommandStack().execute(compoundCommand);
- if (reader != null && reader instanceof EObject) {
-// createReaderPanel(((EObject) reader));
- }
}
if (inputDataViewer != null) {
@@ -1095,34 +986,18 @@
public void sourceChange(Object model) {
}
-
- private class NullReader {
-
- }
-
- private class XMLReader {
-
- }
-
- private class XSDReader {
-
- }
-
- private class JavaReader {
-
- }
private class InputDataViewerLabelProvider extends ExtentionInputLabelProvider
implements ITableColorProvider {
public Color getBackground(Object element, int columnIndex) {
- if (isIncorrectInputType((InputType) element)) {
+ if (!isValidInputType((InputType) element)) {
// return ColorConstants.darkGray;
}
return null;
}
public Color getForeground(Object element, int columnIndex) {
- if (isIncorrectInputType((InputType) element)) {
+ if (!isValidInputType((InputType) element)) {
return ColorConstants.lightGray;
}
return null;
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java 2010-08-12
14:12:33 UTC (rev 24102)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.input;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.editor.FormPage;
+
+/**
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public interface InputReaderConfigurationContributor {
+
+ /**
+ * Add the input configuration controls to the Input Configuration area
+ * of the input task panel.
+ * @param formPage The composite parent {@link FormPage}.
+ * @param configComposite The task panel Composite.
+ */
+ void addInputConfigControls(FormPage formPage, Composite configComposite);
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java 2010-08-12
14:12:33 UTC (rev 24102)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.input;
+
+import
org.jboss.tools.smooks.configuration.editors.input.contributors.SimpleMessageContributor;
+
+/**
+ * Smooks filter input Source type.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public enum InputSourceType {
+
+ // NOTE: If a new type is added, be sure and update the fromTypeIndex/fromTypeName
static methods !!!
+ NONE(0, new
SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Input_Type)),
+ XML(1, new
SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Sample_Data)),
+ XSD(2, new
SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Sample_Data)),
+ JAVA(3, new
SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Sample_Data));
+
+ private int typeIndex;
+ private InputReaderConfigurationContributor configurationContributor;
+
+ InputSourceType(int typeIndex, InputReaderConfigurationContributor
configurationContributor) {
+ this.typeIndex = typeIndex;
+ this.configurationContributor = configurationContributor;
+ }
+
+ public int getTypeIndex() {
+ return typeIndex;
+ }
+
+ public InputReaderConfigurationContributor getConfigurationContributor() {
+ return configurationContributor;
+ }
+
+ public boolean isType(int typeIndex) {
+ return (this.typeIndex == typeIndex);
+ }
+
+ public boolean isType(String typeString) {
+ return (name().equals(typeString) || toTypeString().equals(typeString));
+ }
+
+ public String toTypeString() {
+ return ("input." + name().toLowerCase());
+ }
+
+ public static InputSourceType fromTypeIndex(int typeIndex) throws
InvalidInputSourceTypeException {
+
+ if(InputSourceType.XML.isType(typeIndex)) {
+ return InputSourceType.XML;
+ } else if(InputSourceType.XSD.isType(typeIndex)) {
+ return InputSourceType.XSD;
+ } else if(InputSourceType.JAVA.isType(typeIndex)) {
+ return InputSourceType.JAVA;
+ } else if(InputSourceType.NONE.isType(typeIndex)) {
+ return InputSourceType.NONE;
+ }
+
+ throw new InvalidInputSourceTypeException("");
+ }
+
+ public static InputSourceType fromTypeName(String typeName) throws
InvalidInputSourceTypeException {
+
+ if(InputSourceType.XML.isType(typeName)) {
+ return InputSourceType.XML;
+ } else if(InputSourceType.XSD.isType(typeName)) {
+ return InputSourceType.XSD;
+ } else if(InputSourceType.JAVA.isType(typeName)) {
+ return InputSourceType.JAVA;
+ } else if(InputSourceType.NONE.isType(typeName)) {
+ return InputSourceType.NONE;
+ }
+
+ throw new InvalidInputSourceTypeException("");
+ }
+
+ public static boolean isValidIndexNamePair(int typeIndex, String typeName) throws
InvalidInputSourceTypeException {
+ return (fromTypeIndex(typeIndex) == fromTypeName(typeName));
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InvalidInputSourceTypeException.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InvalidInputSourceTypeException.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InvalidInputSourceTypeException.java 2010-08-12
14:12:33 UTC (rev 24102)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.input;
+
+/**
+ * Invalid Input Source Type Exception.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public class InvalidInputSourceTypeException extends Exception {
+
+ public InvalidInputSourceTypeException(String message) {
+ super(message);
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InvalidInputSourceTypeException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java 2010-08-12
14:12:33 UTC (rev 24102)
@@ -0,0 +1,17 @@
+package org.jboss.tools.smooks.configuration.editors.input;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ public static String InputSourceType_Warning_Specify_Input_Type;
+ public static String InputSourceType_Warning_Specify_Sample_Data;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(Messages.class.getPackage().getName() + ".messages",
Messages.class); //$NON-NLS-1$
+ }
+
+ private Messages() {
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java 2010-08-12
14:12:33 UTC (rev 24102)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.input.contributors;
+
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.editor.FormPage;
+import
org.jboss.tools.smooks.configuration.editors.input.InputReaderConfigurationContributor;
+
+/**
+ * Simple contributor used to add a "No type selected" warning message to the
composite.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public class SimpleMessageContributor implements InputReaderConfigurationContributor {
+
+ private String message;
+
+ public SimpleMessageContributor(String message) {
+ this.message = message;
+ }
+
+ public void addInputConfigControls(FormPage formPage, Composite configComposite) {
+ Label formText = formPage.getManagedForm().getToolkit().createLabel(configComposite,
""); //$NON-NLS-1$
+ GridData gd = new GridData(GridData.FILL_BOTH);
+
+ gd.heightHint = 50;
+ gd.horizontalSpan = 2;
+ formText.setLayoutData(gd);
+ formText.setText(message);
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties 2010-08-12
14:12:33 UTC (rev 24102)
@@ -0,0 +1,2 @@
+InputSourceType_Warning_Specify_Input_Type=Input type should be specified.
+InputSourceType_Warning_Specify_Sample_Data=Specify sample data in the Input Data
section.
\ No newline at end of file
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/messages.properties
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/messages.properties 2010-08-12
13:55:36 UTC (rev 24101)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/messages.properties 2010-08-12
14:12:33 UTC (rev 24102)
@@ -76,4 +76,4 @@
SmooksReaderFormPage_Warning_Specify_Input_Type=Input type should be specified.
SmooksReaderFormPage_Warning_Specify_Sample_Data=Specify sample data in the Input Data
section.
SmooksReaderFormPage_XMLReaderComboText=XML
-SmooksReaderFormPage_XSDReaderComboText=XSD/WSDL
+SmooksReaderFormPage_XSDReaderComboText=XSD