JBoss Tools SVN: r17550 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-14 12:36:00 -0400 (Mon, 14 Sep 2009)
New Revision: 17550
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2607
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java 2009-09-14 16:18:22 UTC (rev 17549)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java 2009-09-14 16:36:00 UTC (rev 17550)
@@ -16,6 +16,7 @@
import java.util.Set;
import java.util.StringTokenizer;
+import org.jboss.tools.common.model.ui.IAttributeErrorProvider;
import org.jboss.tools.common.model.ui.IValueChangeListener;
import org.jboss.tools.common.model.ui.IValueProvider;
import org.jboss.tools.common.model.ui.attribute.adapter.CheckListAdapter;
@@ -123,6 +124,7 @@
public void setEnabled(boolean enabled){
super.setEnabled(enabled);
+ updateErrorState();
}
public void setPropertyEditor(IPropertyEditor propertyEditor) {
@@ -133,6 +135,7 @@
contentProvider = (IContentProvider)propertyEditor.getAdapter(ITreeContentProvider.class);
labelProvider = (ILabelProvider)propertyEditor.getAdapter(ILabelProvider.class);
// Object input = propertyEditor.getInput();
+ setErrorProvider((IAttributeErrorProvider)propertyEditor.getAdapter(IAttributeErrorProvider.class));
if(propertyEditor.getInput() instanceof CheckListAdapter) {
separator = "" + ((CheckListAdapter)propertyEditor.getInput()).getSeparator();
}
@@ -142,6 +145,7 @@
int lock = 0;
public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
valueProvider.removeValueChangeListener(this);
if (IPropertyEditor.VALUE.equals(event.getPropertyName())) {
Object v = event.getNewValue();
@@ -244,4 +248,5 @@
public void delete() {
}
+
}
15 years
JBoss Tools SVN: r17549 - in trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute: editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-14 12:18:22 -0400 (Mon, 14 Sep 2009)
New Revision: 17549
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2607
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java 2009-09-14 16:17:42 UTC (rev 17548)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java 2009-09-14 16:18:22 UTC (rev 17549)
@@ -54,8 +54,9 @@
public void checkAll() {
StringBuffer sb = new StringBuffer();
+ char separator = getSeparator();
for (int i = 0; i < tags.length; i++) {
- if(i > 0) sb.append(';');
+ if(i > 0) sb.append(separator);
sb.append(tags[i]);
}
setValue(sb.toString());
@@ -138,4 +139,16 @@
return false;
}
}
+
+ public char getSeparator() {
+ XAttribute a = getAttribute();
+ if(a == null && getAttributeData() != null) {
+ a = getAttributeData().getAttribute();
+ }
+ if(a != null) {
+ String s = a.getProperty("separator");
+ if("comma".equals(s)) return ',';
+ }
+ return ';';
+ }
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java 2009-09-14 16:17:42 UTC (rev 17548)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java 2009-09-14 16:18:22 UTC (rev 17549)
@@ -12,10 +12,13 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.HashSet;
+import java.util.Set;
import java.util.StringTokenizer;
import org.jboss.tools.common.model.ui.IValueChangeListener;
import org.jboss.tools.common.model.ui.IValueProvider;
+import org.jboss.tools.common.model.ui.attribute.adapter.CheckListAdapter;
import org.jboss.tools.common.model.ui.wizards.query.list.TreeItemSelectionManager;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.viewers.IContentProvider;
@@ -42,6 +45,8 @@
private String stringValue;
private TreeViewer viewer;
+
+ String separator = ";";
public CheckListFieldEditor() {}
@@ -128,6 +133,9 @@
contentProvider = (IContentProvider)propertyEditor.getAdapter(ITreeContentProvider.class);
labelProvider = (ILabelProvider)propertyEditor.getAdapter(ILabelProvider.class);
// Object input = propertyEditor.getInput();
+ if(propertyEditor.getInput() instanceof CheckListAdapter) {
+ separator = "" + ((CheckListAdapter)propertyEditor.getInput()).getSeparator();
+ }
}
init();
}
@@ -148,15 +156,15 @@
lock++;
Tree tree = viewer.getTree();
TreeItem[] is = tree.getItems();
+ Set<String> vs = new HashSet<String>();
+ StringTokenizer values = new StringTokenizer(stringValue, ";,"); //$NON-NLS-1$
+ while(values.hasMoreTokens()) {
+ String n = values.nextToken();
+ vs.add(n);
+ }
for (int i = 0; i < is.length; i++) {
Object d = is[i].getData();
- StringTokenizer values = new StringTokenizer(stringValue, ";,"); //$NON-NLS-1$
- while(values.hasMoreTokens()) {
- String n = values.nextToken();
- if(n.equals(d)) {
- is[i].setChecked(true);
- }
- }
+ is[i].setChecked(vs.contains(d));
}
lock--;
}
@@ -182,12 +190,12 @@
if (value.equals(currentItem))
currentItemExists = true;
else {
- if(newValue.length() > 0 && !newValue.endsWith(";") && !newValue.endsWith(",")) newValue += ";"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if(newValue.length() > 0 && !newValue.endsWith(";") && !newValue.endsWith(",")) newValue += separator; //$NON-NLS-1$ //$NON-NLS-2$
newValue += value;
}
}
if (!currentItemExists) {
- if(newValue.length() > 0 && !newValue.endsWith(";") && !newValue.endsWith(",")) newValue += ";"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if(newValue.length() > 0 && !newValue.endsWith(";") && !newValue.endsWith(",")) newValue += separator; //$NON-NLS-1$ //$NON-NLS-2$
newValue += currentItem;
}
valueChanged(newValue);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java 2009-09-14 16:17:42 UTC (rev 17548)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java 2009-09-14 16:18:22 UTC (rev 17549)
@@ -256,6 +256,7 @@
SimpleContentProposalProvider cpp = new SimpleContentProposalProvider(set.toArray(new String[0]));
+ cpp.setFiltering(true);
KeyStroke ks = AttributeContentProposalProviderFactory.getCtrlSpaceKeyStroke();
ContentProposalAdapter adapter = new ContentProposalAdapter(
15 years
JBoss Tools SVN: r17548 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-09-14 12:17:42 -0400 (Mon, 14 Sep 2009)
New Revision: 17548
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeEditorPreferencesPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAnyCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4671, VPE Preference Page was remade.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.jspeditor;
import java.util.Properties;
@@ -79,7 +79,7 @@
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.editor.IVisualEditor;
import org.jboss.tools.jst.jsp.editor.IVisualEditorFactory;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
@@ -88,20 +88,13 @@
XModelTreeListener, ITextEditor, IGotoMarker, VpeTaglibManagerProvider,
IReusableEditor, ITextEditorExtension, ITextEditorExtension2,
ITextEditorExtension3, INavigationLocationProvider, IMultiPageEditor {
-
+
public static final String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
-
- //option loads preview tab
- private static final String PREVIEW_TAB="Preview"; //$NON-NLS-1$
- //visual tab
- private static final String VISUAL_SOURCE_TAB="Visual/Source"; //$NON-NLS-1$
-
- private static final String VPE_VISUAL_EDITOR_IMPL_ID="org.jboss.tools.vpe.org.jboss.tools.vpe.editor.VpeEditorPartFactory"; //$NON-NLS-1$
- //source tab
- private static final String SOURCE_TAB="Source"; //$NON-NLS-1$
-
- private static final String VISUAL_EDITOR_IMPL_EXTENSION_POINT_NAME="visulaEditorImplementations"; //$NON-NLS-1$
+ private static final String VPE_VISUAL_EDITOR_IMPL_ID = "org.jboss.tools.vpe.org.jboss.tools.vpe.editor.VpeEditorPartFactory"; //$NON-NLS-1$
+
+ private static final String VISUAL_EDITOR_IMPL_EXTENSION_POINT_NAME = "visulaEditorImplementations"; //$NON-NLS-1$
+
private IVisualEditor visualEditor;
private int visualSourceIndex;
@@ -109,19 +102,19 @@
private JSPTextEditor sourceEditor;
private int sourceIndex;
-
+
/** composite control for default web-browser */
- //private IVisualEditor previewWebBrowser;
-
+ // private IVisualEditor previewWebBrowser;
+
/** index of tab contain default web-browser */
private int previewIndex;
-// private boolean osWindows = true;
+ // private boolean osWindows = true;
protected XModelTreeListenerSWTSync syncListener = new XModelTreeListenerSWTSync(
this);
-// private int oldPage = -1;
+ // private int oldPage = -1;
private ConfigurableContentOutlinePage outlinePage = null;
@@ -135,7 +128,7 @@
static IVisualEditorFactory visualEditorFactory;
static {
- //Fix For JBIDE-2674
+ // Fix For JBIDE-2674
try {
IExtension visualEditorExtension = Platform.getExtensionRegistry()
.getExtension(JspEditorPlugin.PLUGIN_ID,
@@ -165,47 +158,23 @@
}
private void loadSelectedTab() {
- IFile file = getFile();
- try {
- String q = (file == null) ? null : file.getPersistentProperty(persistentTabQualifiedName);
- if (q == null) {
- if (VISUAL_SOURCE_TAB.equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
- .getValue()))
- selectedPageIndex = 0;
- else if (SOURCE_TAB
- .equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
- .getValue()))
- selectedPageIndex = 1;
- else if (PREVIEW_TAB
- .equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
- .getValue()))
- selectedPageIndex = 2;
- else
- selectedPageIndex = 0;
- } else {
- int qi = Integer.parseInt(q);
-
- if (qi >= 0 && qi < getTabFolder().getItemCount())
- selectedPageIndex = qi;
- }
-
- } catch (CoreException e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ String defaultVpeTab = JspEditorPlugin.getDefault()
+ .getPreferenceStore().getString(
+ IVpePreferencesPage.DEFAULT_VPE_TAB);
+ if (IVpePreferencesPage.DEFAULT_VPE_TAB_VISUAL_SOURCE_VALUE
+ .equalsIgnoreCase(defaultVpeTab)) {
selectedPageIndex = 0;
+ } else if (IVpePreferencesPage.DEFAULT_VPE_TAB_SOURCE_VALUE
+ .equalsIgnoreCase(defaultVpeTab)) {
+ selectedPageIndex = 1;
+ } else if (IVpePreferencesPage.DEFAULT_VPE_TAB_PREVIEW_VALUE
+ .equalsIgnoreCase(defaultVpeTab)) {
+ selectedPageIndex = 2;
+ } else {
+ selectedPageIndex = 0;
}
}
- private void saveSelectedTab() {
- IFile file = getFile();
- if(file == null || !file.exists()) return;
- String q = "" + selectedPageIndex; //$NON-NLS-1$
- try {
- file.setPersistentProperty(persistentTabQualifiedName, q);
- } catch (CoreException e) {
- JspEditorPlugin.getPluginLog().logWarning(e);
- }
- }
-
public void superPageChange(int newPageIndex) {
Control control = getControl(visualSourceIndex);
if (control != null) {
@@ -232,28 +201,27 @@
}
}
- protected void pageChange(int newPageIndex) {
+ public void pageChange(int newPageIndex) {
selectedPageIndex = newPageIndex;
- if(visualEditor!=null) {
- if (newPageIndex == visualSourceIndex) {
- if (visualEditor.getVisualEditor() == null) {
- visualEditor.createVisualEditor();
- }
- visualEditor.setVisualMode(IVisualEditor.VISUALSOURCE_MODE);
-
- }else if (newPageIndex == sourceIndex)
- visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
- else if (newPageIndex == previewIndex) {
- if (visualEditor.getPreviewWebBrowser() == null) {
- visualEditor.createPreviewBrowser();
- }
- visualEditor.setVisualMode(IVisualEditor.PREVIEW_MODE);
+ if (visualEditor != null) {
+ if (newPageIndex == visualSourceIndex) {
+ if (visualEditor.getVisualEditor() == null) {
+ visualEditor.createVisualEditor();
}
- }
+ visualEditor.setVisualMode(IVisualEditor.VISUALSOURCE_MODE);
+ } else if (newPageIndex == sourceIndex)
+ visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
+ else if (newPageIndex == previewIndex) {
+ if (visualEditor.getPreviewWebBrowser() == null) {
+ visualEditor.createPreviewBrowser();
+ }
+ visualEditor.setVisualMode(IVisualEditor.PREVIEW_MODE);
+ }
+ }
superPageChange(newPageIndex);
-
+
}
-
+
public void setInput(IEditorInput input) {
super.setInput(XModelObjectEditorInput.checkInput(input));
if (getEditorInput() instanceof IModelObjectEditorInput) {
@@ -264,10 +232,9 @@
&& sourceEditor.getEditorInput() != getEditorInput()
&& sourceEditor.getEditorInput() != null) {
if (sourceEditor instanceof AbstractTextEditor) {
- ((AbstractTextEditor) sourceEditor)
- .setInput(getEditorInput());
+ ((AbstractTextEditor) sourceEditor).setInput(getEditorInput());
}
- if(visualEditor!=null) {
+ if (visualEditor != null) {
visualEditor.setInput(getEditorInput());
}
updateTitle();
@@ -277,7 +244,8 @@
private void updateFile() {
IFile file = getFile();
- if (file == null) return;
+ if (file == null)
+ return;
try {
file.refreshLocal(0, null);
} catch (CoreException e) {
@@ -299,11 +267,11 @@
*
*/
private ISelectionProvider selectionProvider = null;
-
- private JSPMultiPageEditorSite site;
+ private JSPMultiPageEditorSite site;
+
protected IEditorSite createSite(IEditorPart editor) {
- site = new JSPMultiPageEditorSite(this, editor) {
+ site = new JSPMultiPageEditorSite(this, editor) {
private ISelectionChangedListener postSelectionChangedListener = null;
private ISelectionChangedListener getPostSelectionChangedListener() {
@@ -333,7 +301,7 @@
}
public String getId() {
- return getSite().getId();
+ return getSite().getId();
}
/**
@@ -373,21 +341,21 @@
}
}
-
- public void dispose() {
- ISelectionProvider provider = getSelectionProvider();
+ public void dispose() {
+ ISelectionProvider provider = getSelectionProvider();
if (provider != null) {
provider
.removeSelectionChangedListener(getSelectionChangedListener());
- }
- if (provider instanceof IPostSelectionProvider && postSelectionChangedListener != null) {
- ((IPostSelectionProvider) provider)
- .removePostSelectionChangedListener(postSelectionChangedListener);
-
- }
- postSelectionChangedListener = null;
- super.dispose();
- }
+ }
+ if (provider instanceof IPostSelectionProvider
+ && postSelectionChangedListener != null) {
+ ((IPostSelectionProvider) provider)
+ .removePostSelectionChangedListener(postSelectionChangedListener);
+
+ }
+ postSelectionChangedListener = null;
+ super.dispose();
+ }
};
return site;
}
@@ -402,51 +370,51 @@
createPagesForVPE();
loadSelectedTab();
-// if (selectedPageIndex == sourceIndex) {
-// visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
-// // switchOutlineToJSPEditor();
-// }
-// if (selectedPageIndex == 2) {
-// setActivePage(0);
-// pageChange(0);
-// if (visualEditor != null)
-// visualEditor.maximizeSource();
-// selectedPageIndex=0;
-// } else if (selectedPageIndex == 1) {
-// setActivePage(0);
-// pageChange(0);
-// if (visualEditor != null)
-// visualEditor.maximizeVisual();
-// selectedPageIndex=0;
-// } else {
-// selectedPageIndex=0;
-// setActivePage(selectedPageIndex);
-// pageChange(selectedPageIndex);
-// }
+ // if (selectedPageIndex == sourceIndex) {
+ // visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
+ // // switchOutlineToJSPEditor();
+ // }
+ // if (selectedPageIndex == 2) {
+ // setActivePage(0);
+ // pageChange(0);
+ // if (visualEditor != null)
+ // visualEditor.maximizeSource();
+ // selectedPageIndex=0;
+ // } else if (selectedPageIndex == 1) {
+ // setActivePage(0);
+ // pageChange(0);
+ // if (visualEditor != null)
+ // visualEditor.maximizeVisual();
+ // selectedPageIndex=0;
+ // } else {
+ // selectedPageIndex=0;
+ // setActivePage(selectedPageIndex);
+ // pageChange(selectedPageIndex);
+ // }
switch (selectedPageIndex) {
-
+
case 0: {
- //source/visual mode
+ // source/visual mode
setActivePage(selectedPageIndex);
pageChange(selectedPageIndex);
break;
- }
+ }
case 1: {
- //source mode
+ // source mode
setActivePage(selectedPageIndex);
pageChange(selectedPageIndex);
break;
- }
+ }
case 2: {
- //preview mode
- setActivePage(selectedPageIndex);
- pageChange(selectedPageIndex);
- break;
+ // preview mode
+ setActivePage(selectedPageIndex);
+ pageChange(selectedPageIndex);
+ break;
}
default: {
- //by default we sets source/visual mode
+ // by default we sets source/visual mode
setActivePage(0);
- pageChange(0);
+ pageChange(0);
break;
}
}
@@ -458,31 +426,32 @@
private void createPagesForVPE() {
sourceEditor = new JSPTextEditor(this);
- if(visualEditorFactory!=null) {
+ if (visualEditorFactory != null) {
visualEditor = visualEditorFactory.createVisualEditor(this,
sourceEditor, false);
}
try {
- if(visualEditor!=null) {
+ if (visualEditor != null) {
visualSourceIndex = addPage(visualEditor, getEditorInput());
- setPageText(visualSourceIndex, JSPEditorMessages.JSPMultiPageEditor_TabLabel_VisualSource);
+ setPageText(
+ visualSourceIndex,
+ JSPEditorMessages.JSPMultiPageEditor_TabLabel_VisualSource);
setPartName(visualEditor.getTitle());
}
} catch (PartInitException e) {
JspEditorPlugin.getPluginLog().logError(e);
}
- /*try {
- visualIndex = addPage(visualEditor, getEditorInput());
- setPageText(visualIndex, JSPEditorMessages
- .getString(VISUAL_TAB_LABEL));
- setPartName(visualEditor.getTitle());
- } catch (PartInitException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }*/
+ /*
+ * try { visualIndex = addPage(visualEditor, getEditorInput());
+ * setPageText(visualIndex, JSPEditorMessages
+ * .getString(VISUAL_TAB_LABEL)); setPartName(visualEditor.getTitle());
+ * } catch (PartInitException e) {
+ * JspEditorPlugin.getPluginLog().logError(e); }
+ */
try {
- String sourceTabLabel = JSPEditorMessages.JSPMultiPageEditor_TabLabel_Source;
- if(visualEditor!=null) {
+ String sourceTabLabel = JSPEditorMessages.JSPMultiPageEditor_TabLabel_Source;
+ if (visualEditor != null) {
sourceIndex = addPage(visualEditor, getEditorInput());
setPageText(sourceIndex, sourceTabLabel);
setPartName(visualEditor.getTitle());
@@ -497,9 +466,10 @@
// Add tab contain default web-browser
try {
- if(visualEditor!=null) {
+ if (visualEditor != null) {
previewIndex = addPage(visualEditor, getEditorInput());
- setPageText(previewIndex, JSPEditorMessages.JSPMultiPageEditor_TabLabel_Preview);
+ setPageText(previewIndex,
+ JSPEditorMessages.JSPMultiPageEditor_TabLabel_Preview);
setPartName(visualEditor.getTitle());
}
} catch (PartInitException e) {
@@ -530,7 +500,7 @@
sourceEditor.addPropertyListener(pcl);
sourceEditor.doSaveAs();
sourceEditor.removePropertyListener(pcl);
- try {
+ try {
if (old.isModified())
new DiscardFileHandler().executeHandler(old, new Properties());
} catch (XModelException e) {
@@ -539,8 +509,8 @@
}
public void gotoMarker(final IMarker marker) {
- //setActivePage(IVisualEditor.VISUALSOURCE_MODE);
- //pageChange(IVisualEditor.VISUALSOURCE_MODE);
+ // setActivePage(IVisualEditor.VISUALSOURCE_MODE);
+ // pageChange(IVisualEditor.VISUALSOURCE_MODE);
setActivePage(IVisualEditor.SOURCE_MODE);
pageChange(IVisualEditor.SOURCE_MODE);
IGotoMarker adapter = (IGotoMarker) sourceEditor
@@ -575,7 +545,6 @@
}
public void dispose() {
- saveSelectedTab();
IEditorActionBarContributor contributor = getEditorSite()
.getActionBarContributor();
if (contributor != null
@@ -583,18 +552,18 @@
((MultiPageEditorActionBarContributor) contributor)
.setActivePage(null);
}
- if(visualEditor!=null) {
+ if (visualEditor != null) {
visualEditor.dispose();
}
- site.dispose();
+ site.dispose();
outlinePage = null;
XModelObject o = getModelObject();
if (o != null) {
o.getModel().removeModelTreeListener(syncListener);
}
- if (syncListener != null)
- syncListener.dispose();
- syncListener=null;
+ if (syncListener != null)
+ syncListener.dispose();
+ syncListener = null;
if (o != null && o.isModified() && o.isActive()) {
try {
((FolderImpl) o.getParent()).discardChildFile(o);
@@ -607,14 +576,14 @@
public Object getAdapter(Class adapter) {
if (IContentOutlinePage.class.equals(adapter)) {
-
- if (visualEditor != null) {
+
+ if (visualEditor != null) {
if (outlinePage == null)
outlinePage = (ConfigurableContentOutlinePage) visualEditor
.getAdapter(adapter);
return outlinePage;
}
-
+
} else if (IPropertySheetPage.class.equals(adapter)) {
if (sourceEditor != null)
return sourceEditor.getAdapter(adapter);
@@ -703,10 +672,10 @@
}
public VpeTaglibManager getTaglibManager() {
- if(sourceEditor!=null) {
- if(sourceEditor.getPageContext() instanceof VpeTaglibManager)
-
- return (VpeTaglibManager)sourceEditor.getPageContext();
+ if (sourceEditor != null) {
+ if (sourceEditor.getPageContext() instanceof VpeTaglibManager)
+
+ return (VpeTaglibManager) sourceEditor.getPageContext();
}
return null;
}
@@ -793,6 +762,19 @@
}
return null;
}
+
+ public void updatePartAccordingToPreferences() {
+ String tabIndex = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getString(IVpePreferencesPage.DEFAULT_VPE_TAB);
+ try {
+ int ind = Integer.parseInt(tabIndex);
+ getTabFolder().setSelection(ind);
+ pageChange(ind);
+ } catch (NumberFormatException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ }
+
}
class ResourceChangeListener implements IResourceChangeListener {
@@ -850,8 +832,8 @@
if (e.getJspEditor() != null
&& e.getJspEditor().getEditorInput() != e
.getEditorInput()) {
- ((AbstractTextEditor) e.getJspEditor())
- .setInput(e2);
+ ((AbstractTextEditor) e.getJspEditor())
+ .setInput(e2);
}
((XModelObjectEditorInput) ei).synchronize();
}
@@ -911,4 +893,5 @@
}
return null;
}
+
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -128,7 +128,7 @@
import org.jboss.tools.jst.jsp.outline.JSPContentOutlineConfiguration;
import org.jboss.tools.jst.jsp.outline.JSPPropertySheetConfiguration;
import org.jboss.tools.jst.jsp.outline.ValueHelper;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.jsp.text.xpl.IStructuredTextOccurrenceStructureProvider;
import org.jboss.tools.jst.jsp.text.xpl.StructuredTextOccurrenceStructureProviderRegistry;
import org.jboss.tools.jst.jsp.ui.action.ExtendedFormatAction;
@@ -743,9 +743,8 @@
.getDropCommand(flavor,
JSPTagProposalFactory.getInstance());
- boolean promptAttributes = "yes" //$NON-NLS-1$
- .equals(VpePreference.ALWAYS_REQUEST_FOR_ATTRIBUTE
- .getValue());
+ boolean promptAttributes = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.ASK_TAG_ATTRIBUTES_ON_TAG_INSERT);
dropCommand
.getDefaultModel()
.setPromptForTagAttributesRequired(promptAttributes);
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.preferences;
+
+public interface IVpePreferencesPage {
+
+ static final String SHOW_BORDER_FOR_UNKNOWN_TAGS = "Show Border for Unknown Tags"; //$NON-NLS-1$
+ static final String SHOW_NON_VISUAL_TAGS = "Show non-visual tags"; //$NON-NLS-1$
+ static final String SHOW_SELECTION_TAG_BAR = "Show Selection Tag Bar"; //$NON-NLS-1$
+ static final String SHOW_RESOURCE_BUNDLES_USAGE_AS_EL = "Show Resource Bundles Usage as EL Expressions"; //$NON-NLS-1$
+ static final String ASK_TAG_ATTRIBUTES_ON_TAG_INSERT = "Ask for tag attributes during tag insert"; //$NON-NLS-1$
+ static final String ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR = "Ask for confirmation when closing Selection Bar"; //$NON-NLS-1$
+ static final String DEFAULT_VPE_TAB = "Default VPE Tab"; //$NON-NLS-1$
+ static final String VISUAL_SOURCE_EDITORS_SPLITTING = "Visual/Source Editors Splitting"; //$NON-NLS-1$
+ static final String VISUAL_SOURCE_EDITORS_WEIGHTS = "Size of Visual Editor Pane 0-100%"; //$NON-NLS-1$
+
+ static final String DEFAULT_VPE_TAB_VISUAL_SOURCE_VALUE = "0"; //$NON-NLS-1$
+ static final String DEFAULT_VPE_TAB_SOURCE_VALUE = "1"; //$NON-NLS-1$
+ static final String DEFAULT_VPE_TAB_PREVIEW_VALUE = "2"; //$NON-NLS-1$
+
+ static final String SPLITTING_VERT_TOP_SOURCE_VALUE = "1"; //$NON-NLS-1$
+ static final String SPLITTING_VERT_TOP_VISUAL_VALUE = "2"; //$NON-NLS-1$
+ static final String SPLITTING_HORIZ_LEFT_SOURCE_VALUE = "3"; //$NON-NLS-1$
+ static final String SPLITTING_HORIZ_LEFT_VISUAL_VALUE = "4"; //$NON-NLS-1$
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.vpe.editor;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
import org.eclipse.compare.Splitter;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
@@ -20,7 +17,6 @@
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jface.action.IAction;
@@ -78,8 +74,10 @@
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.util.ModelUtilities;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.editor.IVisualEditor;
import org.jboss.tools.jst.jsp.jspeditor.StorageRevisionEditorInputAdapter;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.IVpeHelpContextIds;
import org.jboss.tools.vpe.VpePlugin;
@@ -100,6 +98,7 @@
private IHandlerActivation sourceActivation,visualActivation, jumpingActivation;
private IHandler sourceMaxmin,visualMaxmin, jumping;
private Composite cmpEd;
+ private Composite cmpEdTl;
private CustomSashForm container;
protected EditorSettings editorSettings;
private StructuredTextEditor sourceEditor = null;
@@ -355,23 +354,6 @@
return sizes;
}
- protected void saveSplitterPosition(int[] weights) {
- IEditorInput input = getEditorInput();
- if (!(input instanceof IFileEditorInput))
- return;
- IFile file = ((IFileEditorInput) input).getFile();
- try {
- String s = String.valueOf(weights[0]);
- file.setPersistentProperty(SPLITTER_POSITION_KEY1, s);
- s = String.valueOf(weights[1]);
- file.setPersistentProperty(SPLITTER_POSITION_KEY2, s);
- s = String.valueOf(weights[2]);
- file.setPersistentProperty(SPLITTER_POSITION_KEY3, s);
- } catch (CoreException e) {
- VpePlugin.getPluginLog().logError(e);
- }
- }
-
public void setVisualMode(int type) {
switch (type) {
case VISUALSOURCE_MODE:
@@ -503,7 +485,7 @@
/*
* Container composite for editor part
*/
- Composite cmpEdTl = new Composite(parent, SWT.NONE);
+ cmpEdTl = new Composite(parent, SWT.NONE);
GridLayout layoutEdTl = new GridLayout(2, false);
layoutEdTl.verticalSpacing = 0;
layoutEdTl.marginHeight = 0;
@@ -570,12 +552,7 @@
}
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- String splitting = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING
- .getValue();
- if (CustomSashForm.LAYOUT_HORIZONTAL_SOURCE_LEFT
- .equalsIgnoreCase(splitting)
- || CustomSashForm.LAYOUT_VERTICAL_SOURCE_TOP
- .equalsIgnoreCase(splitting)) {
+ if (CustomSashForm.isSourceEditorFirst()) {
sourceContent = new Composite(container, SWT.NONE);
visualContent = new Composite(container, SWT.NONE);
} else {
@@ -598,24 +575,11 @@
}
};
int[] weights = loadSplitterPosition();
- if (weights != null)
+ if (weights != null) {
container.setWeights(weights);
+ }
container.setSashBorders(new boolean[] { true, true, true });
-
- final PropertyChangeListener weightsChangeListener = new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- saveSplitterPosition(container.getWeights());
- }
- };
- container.addWeightsChangeListener(weightsChangeListener);
- container.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- container.removeWeightsChangeListener(weightsChangeListener);
- container.removeDisposeListener(this);
- }
-
- });
controlListener = new ControlListener() {
public void controlMoved(ControlEvent event) {}
public void controlResized(ControlEvent event) {
@@ -813,7 +777,7 @@
};
}
- private void fillContainer() {
+ public void fillContainer() {
/*
* https://jira.jboss.org/jira/browse/JBIDE-4152
*
@@ -825,11 +789,13 @@
*/
CustomSashForm newContainer = new CustomSashForm(cmpEd, CustomSashForm
.getSplittingFromPreferences());
+ newContainer.setOrientation(CustomSashForm.getSplittingFromPreferences());
+
/*
* Reset editor's settings.
*/
if (editorSettings != null) {
- editorSettings.dispose();
+ editorSettings.clearOldSettings();
editorSettings.addSetting(new SashSetting(newContainer));
}
newContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@@ -839,12 +805,7 @@
* Correct layout by selecting the order of components adding.
* All three editors should be added to the new container.
*/
- String splitting = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING
- .getValue();
- if (CustomSashForm.LAYOUT_HORIZONTAL_SOURCE_LEFT
- .equalsIgnoreCase(splitting)
- || CustomSashForm.LAYOUT_VERTICAL_SOURCE_TOP
- .equalsIgnoreCase(splitting)) {
+ if (CustomSashForm.isSourceEditorFirst()) {
sourceContent.setParent(newContainer);
visualContent.setParent(newContainer);
} else {
@@ -860,7 +821,6 @@
if (null != container.getMaximizedControl()) {
newContainer.setMaximizedControl(container.getMaximizedControl());
}
-
/*
* Dispose the old container:
* it'll be excluded from parent composite's layout.
@@ -873,28 +833,43 @@
* Reset the container.
*/
container = newContainer;
- int[] weights = loadSplitterPosition();
- if (weights != null) {
- container.setWeights(weights);
+
+ /*
+ * Set up new sash weights
+ */
+ int defaultWeight = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getInt(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_WEIGHTS);
+ int[] weights = container.getWeights();
+ if (defaultWeight == 0) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ container.maxDown();
+ } else {
+ container.maxUp();
+ }
+ } else if (defaultWeight == 1000) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ container.maxUp();
+ } else {
+ container.maxDown();
+ }
+ } else {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ weights[0] = 1000 - defaultWeight;
+ weights[1] = defaultWeight;
+ } else {
+ weights[0] = defaultWeight;
+ weights[1] = 1000 - defaultWeight;
+ }
+ if ((weights != null) && !container.isDisposed()){
+ container.setWeights(weights);
+ }
}
+
container.setSashBorders(new boolean[] { true, true, true });
/*
* Reinit listeners on the new container.
*/
- final PropertyChangeListener weightsChangeListener = new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- saveSplitterPosition(container.getWeights());
- }
- };
- container.addWeightsChangeListener(weightsChangeListener);
- container.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- container.removeWeightsChangeListener(weightsChangeListener);
- container.removeDisposeListener(this);
- }
-
- });
controlListener = new ControlListener() {
public void controlMoved(ControlEvent event) {}
public void controlResized(ControlEvent event) {
@@ -903,9 +878,9 @@
};
/*
- * Layout parent composite.
+ * Layout the parent container for CustomSashForm, Selection Bar.
*/
- cmpEd.layout(true, true);
+ cmpEdTl.layout(true, true);
}
public void createVisualEditor() {
@@ -1142,8 +1117,9 @@
}
public VpeController getController() {
- if (visualEditor == null)
+ if (visualEditor == null) {
return null;
+ }
return visualEditor.getController();
}
@@ -1164,4 +1140,25 @@
if (container != null)
container.maxUp();
}
+
+ /*
+ * Updates current VpeEditorPart after
+ * OK/Apply button on "Visual Page Editor" preference page
+ * has been pressed.
+ */
+ public void updatePartAccordingToPreferences() {
+ /*
+ * When switching from Source view to Visual/Source
+ * controller could be null.
+ */
+ if (getController() != null) {
+ selectionBar.setVisible(selectionBar.getAlwaysVisibleOption());
+ fillContainer();
+ getController().getVisualBuilder().setShowInvisibleTags(JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_NON_VISUAL_TAGS));
+ getController().getPageContext().getBundle().updateShowBundleUsageAsEL();
+ getController().visualRefresh();
+ }
+ }
+
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -38,6 +38,8 @@
import org.eclipse.wst.xml.core.internal.document.NodeImpl;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.vpe.VpeDebug;
@@ -185,8 +187,8 @@
// faceletFile = false;
// }
- this.showInvisibleTags = Constants.YES_STRING
- .equals(VpePreference.SHOW_INVISIBLE_TAGS.getValue());
+ this.showInvisibleTags = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -47,7 +47,8 @@
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
import org.jboss.tools.vpe.VpePlugin;
@@ -64,7 +65,8 @@
private BundleEntry[] bundles = new BundleEntry[0];
private Map<String,UsedKey> usedKeys = new HashMap<String,UsedKey>();
- boolean isShowBundleUsageAsEL = "yes".equals(VpePreference.SHOW_RESOURCE_BUNDLES.getValue()); //$NON-NLS-1$
+ boolean isShowBundleUsageAsEL = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL);
XModelTreeListener modelListener = new ML();
public void init(StructuredTextEditor editor){
@@ -461,7 +463,15 @@
}
}
-
+ public void updateShowBundleUsageAsEL() {
+ boolean b = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL);
+ if(isShowBundleUsageAsEL != b) {
+ isShowBundleUsageAsEL = b;
+ refresh();
+ }
+ }
+
static class Expression {
public String prefix;
public String propertyName;
@@ -503,11 +513,7 @@
class ML implements XModelTreeListener {
public void nodeChanged(XModelTreeEvent event) {
- boolean b = "yes".equals(VpePreference.SHOW_RESOURCE_BUNDLES.getValue()); //$NON-NLS-1$
- if(isShowBundleUsageAsEL != b) {
- isShowBundleUsageAsEL = b;
- refresh();
- }
+ updateShowBundleUsageAsEL();
}
public void structureChanged(XModelTreeEvent event) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -64,8 +64,8 @@
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.ui.internal.part.StatusPart;
import org.eclipse.ui.part.EditorPart;
-import org.jboss.tools.common.model.XModelException;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.preferences.VpeEditorPreferencesPage;
@@ -78,7 +78,6 @@
import org.jboss.tools.vpe.editor.util.DocTypeUtil;
import org.jboss.tools.vpe.editor.util.FileUtil;
import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.xpl.CustomSashForm;
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.resref.core.ReferenceWizard;
import org.jboss.tools.vpe.resref.core.VpeResourcesDialog;
@@ -133,20 +132,27 @@
private String doctype;
private static Map<String, String> layoutIcons;
- private static List<String> layoutNames;
+ private static Map<String, String> layoutNames;
+ private static List<String> layoutValues;
static {
layoutIcons = new HashMap<String, String>();
- layoutIcons.put(CustomSashForm.LAYOUT_HORIZONTAL_SOURCE_LEFT, ICON_ORIENTATION_SOURCE_LEFT);
- layoutIcons.put(CustomSashForm.LAYOUT_VERTICAL_SOURCE_TOP, ICON_ORIENTATION_SOURCE_TOP);
- layoutIcons.put(CustomSashForm.LAYOUT_HORIZONTAL_VISUAL_LEFT, ICON_ORIENTATION_SOURCE_RIGHT);
- layoutIcons.put(CustomSashForm.LAYOUT_VERTICAL_VISUAL_TOP, ICON_ORIENTATION_SOURCE_BOTTOM);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE, ICON_ORIENTATION_SOURCE_LEFT);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE, ICON_ORIENTATION_SOURCE_TOP);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE, ICON_ORIENTATION_SOURCE_RIGHT);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_VERT_TOP_VISUAL_VALUE, ICON_ORIENTATION_SOURCE_BOTTOM);
- layoutNames = new ArrayList<String>();
- layoutNames.add(CustomSashForm.LAYOUT_HORIZONTAL_SOURCE_LEFT);
- layoutNames.add(CustomSashForm.LAYOUT_VERTICAL_SOURCE_TOP);
- layoutNames.add(CustomSashForm.LAYOUT_HORIZONTAL_VISUAL_LEFT);
- layoutNames.add(CustomSashForm.LAYOUT_VERTICAL_VISUAL_TOP);
+ layoutNames = new HashMap<String, String>();
+ layoutNames.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE, VpeUIMessages.SPLITTING_HORIZ_LEFT_SOURCE);
+ layoutNames.put(IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE, VpeUIMessages.SPLITTING_VERT_TOP_SOURCE);
+ layoutNames.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE, VpeUIMessages.SPLITTING_HORIZ_LEFT_VISUAL);
+ layoutNames.put(IVpePreferencesPage.SPLITTING_VERT_TOP_VISUAL_VALUE, VpeUIMessages.SPLITTING_VERT_TOP_VISUAL);
+ layoutValues= new ArrayList<String>();
+ layoutValues.add(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE);
+ layoutValues.add(IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE);
+ layoutValues.add(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE);
+ layoutValues.add(IVpePreferencesPage.SPLITTING_VERT_TOP_VISUAL_VALUE);
+
}
/**
@@ -259,46 +265,64 @@
* https://jira.jboss.org/jira/browse/JBIDE-4152
* Compute initial icon state and add it to the tool bar.
*/
- int currentOrientationIndex = layoutNames.indexOf(VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue());
+ int currentOrientationIndex = layoutValues.indexOf(JspEditorPlugin
+ .getDefault().getPreferenceStore().getString(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING));
int newIndx = currentOrientationIndex+1;
- if (newIndx == layoutNames.size()) {
- newIndx = newIndx % layoutNames.size();
+ if (newIndx == layoutValues.size()) {
+ newIndx = newIndx % layoutValues.size();
}
- String newOrientation = layoutNames.get(newIndx);
+ String newOrientation = layoutValues.get(newIndx);
final ToolItem rotateEditorsItem = createToolItem(verBar, SWT.BUTTON1,
- layoutIcons.get(newOrientation),
- ICON_ORIENTATION_SOURCE_LEFT_DISABLED, newOrientation, true);
+ layoutIcons.get(newOrientation),
+ ICON_ORIENTATION_SOURCE_LEFT_DISABLED,
+ layoutNames.get(newOrientation), true);
+
rotateEditorsItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
- try {
- /*
- * Rotate editors orientation clockwise.
- * Store this new orientation to the preferences.
- */
- int currentOrientationIndex = layoutNames.indexOf(VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue());
- int newIndx = currentOrientationIndex+1;
- if (newIndx == layoutNames.size()) {
- newIndx = newIndx % layoutNames.size();
- }
- String newOrientation = layoutNames.get(newIndx);
- VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.setValue(newOrientation);
+ /*
+ * Rotate editors orientation clockwise. Store this new
+ * orientation to the preferences.
+ */
+ int currentOrientationIndex = layoutValues
+ .indexOf(JspEditorPlugin
+ .getDefault()
+ .getPreferenceStore()
+ .getString(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING));
+ int newIndx = currentOrientationIndex + 1;
+ if (newIndx == layoutValues.size()) {
+ newIndx = newIndx % layoutValues.size();
+ }
+ String newOrientation = layoutValues.get(newIndx);
+ JspEditorPlugin.getDefault().getPreferenceStore().setValue(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING,
+ newOrientation);
- /*
- * Compute next step orientation and display appropriate icon.
- */
- currentOrientationIndex = layoutNames.indexOf(VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue());
- newIndx = currentOrientationIndex+1;
- if (newIndx == layoutNames.size()) {
- newIndx = newIndx % layoutNames.size();
- }
- newOrientation = layoutNames.get(newIndx);
- rotateEditorsItem.setImage(ImageDescriptor
- .createFromFile(MozillaEditor.class, layoutIcons.get(newOrientation)).createImage());
- rotateEditorsItem.setToolTipText(newOrientation);
- } catch (XModelException e) {
- VpePlugin.getPluginLog().logError(e);
- }
+ /*
+ * Compute next step orientation and display appropriate icon.
+ */
+ currentOrientationIndex = layoutValues
+ .indexOf(JspEditorPlugin
+ .getDefault()
+ .getPreferenceStore()
+ .getString(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING));
+ newIndx = currentOrientationIndex + 1;
+ if (newIndx == layoutValues.size()) {
+ newIndx = newIndx % layoutValues.size();
+ }
+ newOrientation = layoutValues.get(newIndx);
+ rotateEditorsItem.setImage(ImageDescriptor.createFromFile(
+ MozillaEditor.class, layoutIcons.get(newOrientation))
+ .createImage());
+ rotateEditorsItem.setToolTipText(layoutNames.get(newOrientation));
+ /*
+ * Call <code>filContainer()</code> from VpeEditorPart
+ * to redraw CustomSashForm with new layout.
+ */
+ getController().getPageContext().getEditPart().fillContainer();
}
});
@@ -356,8 +380,8 @@
// create menu item
MenuItem menuItem = new MenuItem(dropDownMenu.getDropDownMenu(), SWT.PUSH);
// get default value of flag
- boolean showInvisibleTags = Constants.YES_STRING
- .equals(VpePreference.SHOW_INVISIBLE_TAGS.getValue());
+ boolean showInvisibleTags = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
// set text
menuItem.setText(showInvisibleTags ? VpeUIMessages.HIDE_NON_VISUAL_TAGS
Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.preferences;
+
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Slider;
+
+public class SliderFieldEditor extends FieldEditor {
+
+ private static final String SLIDER_LABEL_DEFAULT_TEXT = "50% "; //$NON-NLS-1$
+ private static final String SLIDER_LABEL_MAX_SIZE_TEXT = "100% "; //$NON-NLS-1$
+ private static final int MAX_SLIDER_VALUE = 1000;
+ private static final int MIN_SLIDER_VALUE = 0;
+ private static final int INCREMENT_SLIDER_VALUE = 10;
+ private static final int DEFAULT_SLIDER_VALUE = 500;
+
+ private Composite sliderComposite;
+ private Label sliderLabel;
+ private Slider slider;
+ private int value;
+
+ public SliderFieldEditor(String name, String labelText, Composite parent) {
+ super(name, labelText, parent);
+ }
+
+ @Override
+ protected void adjustForNumColumns(int numColumns) {
+ if (numColumns > 1) {
+ Control control = getLabelControl();
+ int left = numColumns;
+ if (control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ left = left - 1;
+ }
+ if (sliderComposite != null) {
+ ((GridData)sliderComposite.getLayoutData()).horizontalSpan = left;
+ }
+ } else {
+ Control control = getLabelControl();
+ if (control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ }
+ if (sliderComposite != null) {
+ ((GridData)sliderComposite.getLayoutData()).horizontalSpan = 1;
+ }
+ }
+ }
+
+ @Override
+ protected void createControl(Composite parent) {
+ doFillIntoGrid(parent, 2);
+ }
+
+ @Override
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ int sliderSpan = 1;
+ if (numColumns > 1) {
+ sliderSpan = numColumns - 1;
+ }
+ Control control = getLabelControl(parent);
+ GridData gd = new GridData();
+ gd.horizontalSpan = 1;
+ control.setLayoutData(gd);
+ control = getSliderComposite(parent);
+ gd = new GridData();
+ gd.horizontalSpan = sliderSpan;
+ gd.horizontalAlignment = GridData.FILL;
+ control.setLayoutData(gd);
+ control.setFont(parent.getFont());
+ }
+
+ @Override
+ protected void doLoad() {
+ updateSliderForValue(getPreferenceStore().getInt(getPreferenceName()));
+ }
+
+ @Override
+ protected void doLoadDefault() {
+ updateSliderForValue(getPreferenceStore().getDefaultInt(getPreferenceName()));
+ }
+
+ @Override
+ protected void doStore() {
+ if (value < 0) {
+ getPreferenceStore().setToDefault(getPreferenceName());
+ return;
+ }
+ getPreferenceStore().setValue(getPreferenceName(), value);
+ }
+
+ @Override
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ private Composite getSliderComposite(Composite parent) {
+ if (sliderComposite == null) {
+ /*
+ * Create composite control with label and slider in it.
+ */
+ sliderComposite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.horizontalSpacing = HORIZONTAL_GAP;
+ sliderComposite.setLayout(gridLayout);
+ GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ sliderComposite.setLayoutData(gd);
+
+ /*
+ * Create slider label
+ */
+ sliderLabel = new Label(sliderComposite,SWT.NONE);
+ gd = new GridData(SWT.LEFT, SWT.NONE, false, false, 1, 1);
+ sliderLabel.setLayoutData(gd);
+ /*
+ * Compute label size
+ */
+ sliderLabel.setText(SLIDER_LABEL_MAX_SIZE_TEXT);
+ Point size = sliderLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ sliderLabel.setSize(size);
+ sliderLabel.setText(SLIDER_LABEL_DEFAULT_TEXT);
+
+ /*
+ * Create slider
+ */
+ slider = new Slider(sliderComposite, SWT.HORIZONTAL);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ slider.setLayoutData(gd);
+ slider.setMaximum(MAX_SLIDER_VALUE + slider.getThumb());
+ slider.setMinimum(MIN_SLIDER_VALUE);
+ slider.setIncrement(INCREMENT_SLIDER_VALUE);
+ slider.setSelection(DEFAULT_SLIDER_VALUE);
+
+ slider.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateSlider();
+ }
+ });
+ }
+
+ return sliderComposite;
+ }
+
+ private void updateSlider() {
+ int oldValue = value;
+ value = slider.getSelection();
+ if (oldValue != value) {
+ setPresentsDefaultValue(false);
+ String weightsString = "" + (value /10) + "%"; //$NON-NLS-1$ //$NON-NLS-2$
+ slider.setToolTipText(weightsString);
+ sliderLabel.setText(weightsString);
+ fireValueChanged(VALUE, oldValue, value);
+ }
+ }
+
+ private void updateSliderForValue(int value) {
+ if (slider != null) {
+ String weightsString = "" + (value /10) + "%"; //$NON-NLS-1$ //$NON-NLS-2$
+ this.value = value;
+ slider.setSelection(value);
+ slider.setToolTipText(weightsString);
+ sliderLabel.setText(weightsString);
+ }
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.preferences;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class VpeComboFieldEditor extends FieldEditor {
+
+ /**
+ * The <code>Combo</code> widget.
+ */
+ private Combo fCombo;
+
+ /**
+ * The value (not the name) of the currently selected item in the Combo widget.
+ */
+ private String fValue;
+
+ /**
+ * The names (labels) and underlying values to populate the combo widget. These should be
+ * arranged as: { {name1, value1}, {name2, value2}, ...}
+ */
+ private String[][] fEntryNamesAndValues;
+
+ /**
+ * Create the combo box field editor.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param entryNamesAndValues the names (labels) and underlying values to populate the combo widget. These should be
+ * arranged as: { {name1, value1}, {name2, value2}, ...}
+ * @param parent the parent composite
+ */
+ public VpeComboFieldEditor(String name, String labelText,
+ String[][] entryNamesAndValues, Composite parent) {
+ init(name, labelText);
+ Assert.isTrue(checkArray(entryNamesAndValues));
+ fEntryNamesAndValues = entryNamesAndValues;
+ createControl(parent);
+ }
+
+ /**
+ * Checks whether given <code>String[][]</code> is of "type"
+ * <code>String[][2]</code>.
+ *
+ * @return <code>true</code> if it is ok, and <code>false</code> otherwise
+ */
+ private boolean checkArray(String[][] table) {
+ if (table == null) {
+ return false;
+ }
+ for (int i = 0; i < table.length; i++) {
+ String[] array = table[i];
+ if (array == null || array.length != 2) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
+ */
+ protected void adjustForNumColumns(int numColumns) {
+ if (numColumns > 1) {
+ Control control = getLabelControl();
+ int left = numColumns;
+ if (control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ left = left - 1;
+ }
+ ((GridData)fCombo.getLayoutData()).horizontalSpan = left;
+ } else {
+ Control control = getLabelControl();
+ if (control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ }
+ ((GridData)fCombo.getLayoutData()).horizontalSpan = 1;
+ }
+ }
+
+ @Override
+ protected void createControl(Composite parent) {
+ doFillIntoGrid(parent, 1);
+ }
+
+ @Override
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ /*
+ * Label
+ */
+ Control control = getLabelControl(parent);
+ GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ control.setLayoutData(gd);
+
+ /*
+ * Combo
+ */
+ control = getComboBoxControl(parent);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ control.setLayoutData(gd);
+ control.setFont(parent.getFont());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditor#doLoad()
+ */
+ protected void doLoad() {
+ updateComboForValue(getPreferenceStore().getString(getPreferenceName()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
+ */
+ protected void doLoadDefault() {
+ updateComboForValue(getPreferenceStore().getDefaultString(getPreferenceName()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditor#doStore()
+ */
+ protected void doStore() {
+ if (fValue == null) {
+ getPreferenceStore().setToDefault(getPreferenceName());
+ return;
+ }
+ getPreferenceStore().setValue(getPreferenceName(), fValue);
+ }
+
+ /*
+ * Lazily create and return the Combo control.
+ */
+ protected Combo getComboBoxControl(Composite parent) {
+ if (fCombo == null) {
+ fCombo = new Combo(parent, SWT.READ_ONLY);
+ fCombo.setFont(parent.getFont());
+ for (int i = 0; i < fEntryNamesAndValues.length; i++) {
+ fCombo.add(fEntryNamesAndValues[i][0], i);
+ }
+
+ fCombo.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ String oldValue = fValue;
+ String name = fCombo.getText();
+ fValue = getValueForName(name);
+ setPresentsDefaultValue(false);
+ fireValueChanged(VALUE, oldValue, fValue);
+ }
+ });
+ }
+ return fCombo;
+ }
+
+ /*
+ * Given the name (label) of an entry, return the corresponding value.
+ */
+ protected String getValueForName(String name) {
+ for (int i = 0; i < fEntryNamesAndValues.length; i++) {
+ String[] entry = fEntryNamesAndValues[i];
+ if (name.equals(entry[0])) {
+ return entry[1];
+ }
+ }
+ return fEntryNamesAndValues[0][0];
+ }
+
+ /*
+ * Set the name in the combo widget to match the specified value.
+ */
+ protected void updateComboForValue(String value) {
+ fValue = value;
+ for (int i = 0; i < fEntryNamesAndValues.length; i++) {
+ if (value.equals(fEntryNamesAndValues[i][1])) {
+ fCombo.setText(fEntryNamesAndValues[i][0]);
+ return;
+ }
+ }
+ if (fEntryNamesAndValues.length > 0) {
+ fValue = fEntryNamesAndValues[0][1];
+ fCombo.setText(fEntryNamesAndValues[0][0]);
+ }
+ }
+
+ @Override
+ public int getNumberOfControls() {
+ return 2;
+ }
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeEditorPreferencesPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeEditorPreferencesPage.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeEditorPreferencesPage.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -10,24 +10,18 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.preferences;
-import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.jboss.tools.common.model.ui.preferences.TabbedPreferencesPage;
-import org.jboss.tools.common.model.ui.preferences.XMOBasedPreferencesPage;
-import org.jboss.tools.common.model.ui.util.ModelUtilities;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
-import org.jboss.tools.vpe.VpePlugin;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
public class VpeEditorPreferencesPage extends TabbedPreferencesPage implements IWorkbenchPreferencePage {
public static final String ID = "org.jboss.tools.vpe.editor"; //$NON-NLS-1$
public VpeEditorPreferencesPage() {
- addPreferencePage(new GeneralPage());
+ addPreferencePage(new VpePreferencesPage());
addPreferencePage(new TemplatesPreferencePage());
}
@@ -41,13 +35,4 @@
prefsdlg.open();
}
- static class GeneralPage extends XMOBasedPreferencesPage {
- public GeneralPage() {
- super(ModelUtilities.getPreferenceModel().getByPath(VpePreference.VPE_EDITOR_PATH));
- }
-
- public String getTitle() {
- return VpeUIMessages.GENERAL;
- }
- }
}
\ No newline at end of file
Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.preferences;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.editor.IVisualEditor;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
+import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.VpeEditorPart;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+
+public class VpePreferencesPage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage, IVpePreferencesPage {
+
+ private static final String[][] DEFAULT_VPE_TAB_COMBO_BOX_VALUES = {
+ { VpeUIMessages.DEFAULT_VPE_TAB_VISUAL_SOURCE,
+ DEFAULT_VPE_TAB_VISUAL_SOURCE_VALUE },
+ { VpeUIMessages.DEFAULT_VPE_TAB_SOURCE,
+ DEFAULT_VPE_TAB_SOURCE_VALUE },
+ { VpeUIMessages.DEFAULT_VPE_TAB_PREVIEW,
+ DEFAULT_VPE_TAB_PREVIEW_VALUE } };
+ private static final String[][] SPLITTING_COMBO_BOX_VALUES = {
+ { VpeUIMessages.SPLITTING_VERT_TOP_SOURCE,
+ SPLITTING_VERT_TOP_SOURCE_VALUE },
+ { VpeUIMessages.SPLITTING_VERT_TOP_VISUAL,
+ SPLITTING_VERT_TOP_VISUAL_VALUE },
+ { VpeUIMessages.SPLITTING_HORIZ_LEFT_SOURCE,
+ SPLITTING_HORIZ_LEFT_SOURCE_VALUE },
+ { VpeUIMessages.SPLITTING_HORIZ_LEFT_VISUAL,
+ SPLITTING_HORIZ_LEFT_VISUAL_VALUE } };
+
+ private Composite pageContainer;
+ private Group visualAppearanceGroup;
+ private Group confirmationGroup;
+ private Group tabsGroup;
+
+ public VpePreferencesPage() {
+ super();
+ setPreferenceStore(getPreferenceStore());
+ }
+
+ public void init(IWorkbench workbench) {
+ /*
+ * Do nothing
+ */
+ }
+
+ public String getTitle() {
+ return VpeUIMessages.GENERAL_TAB_TITLE;
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+
+ pageContainer = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ layout.horizontalSpacing = 10;
+ layout.verticalSpacing = 10;
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+ pageContainer.setLayout(layout);
+ pageContainer.setLayoutData(gd);
+
+ visualAppearanceGroup = new Group(pageContainer, SWT.SHADOW_ETCHED_IN);
+ visualAppearanceGroup.setText(VpeUIMessages.VISUAL_APPEARANCE_GROUP_TITLE);
+ layout = new GridLayout();
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ layout.horizontalSpacing = 10;
+ layout.verticalSpacing = 10;
+ visualAppearanceGroup.setLayout(layout);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ visualAppearanceGroup.setLayoutData(gd);
+
+ confirmationGroup = new Group(pageContainer, SWT.SHADOW_ETCHED_IN);
+ confirmationGroup.setText(VpeUIMessages.CONFIRMATION_GROUP_TITLE);
+ layout = new GridLayout();
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ layout.horizontalSpacing = 10;
+ layout.verticalSpacing = 10;
+ confirmationGroup.setLayout(layout);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ confirmationGroup.setLayoutData(gd);
+
+ tabsGroup = new Group(pageContainer, SWT.SHADOW_ETCHED_IN);
+ tabsGroup.setText(VpeUIMessages.TABS_GROUP_TITLE);
+ layout = new GridLayout();
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ tabsGroup.setLayout(layout);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ tabsGroup.setLayoutData(gd);
+
+ createFieldEditors();
+ initialize();
+ checkState();
+
+ return pageContainer;
+ }
+
+ @Override
+ protected Composite getFieldEditorParent() {
+ return pageContainer;
+ }
+
+ @Override
+ protected void createFieldEditors() {
+ addField(new BooleanFieldEditor(SHOW_BORDER_FOR_UNKNOWN_TAGS,
+ VpeUIMessages.SHOW_BORDER_FOR_UNKNOWN_TAGS, visualAppearanceGroup));
+ addField(new BooleanFieldEditor(SHOW_NON_VISUAL_TAGS,
+ VpeUIMessages.SHOW_NON_VISUAL_TAGS, visualAppearanceGroup));
+ addField(new BooleanFieldEditor(SHOW_SELECTION_TAG_BAR,
+ VpeUIMessages.SHOW_SELECTION_TAG_BAR, visualAppearanceGroup));
+ addField(new BooleanFieldEditor(SHOW_RESOURCE_BUNDLES_USAGE_AS_EL,
+ VpeUIMessages.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL, visualAppearanceGroup));
+ addField(new BooleanFieldEditor(ASK_TAG_ATTRIBUTES_ON_TAG_INSERT,
+ VpeUIMessages.ASK_TAG_ATTRIBUTES_ON_TAG_INSERT, confirmationGroup));
+ addField(new BooleanFieldEditor(ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR,
+ VpeUIMessages.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR, confirmationGroup));
+ addField(new VpeComboFieldEditor(DEFAULT_VPE_TAB,
+ VpeUIMessages.DEFAULT_VPE_TAB, DEFAULT_VPE_TAB_COMBO_BOX_VALUES, tabsGroup));
+ addField(new VpeComboFieldEditor(VISUAL_SOURCE_EDITORS_SPLITTING,
+ VpeUIMessages.VISUAL_SOURCE_EDITORS_SPLITTING, SPLITTING_COMBO_BOX_VALUES, tabsGroup));
+ addField(new SliderFieldEditor(VISUAL_SOURCE_EDITORS_WEIGHTS,
+ VpeUIMessages.VISUAL_SOURCE_EDITORS_WEIGHTS, tabsGroup));
+ }
+
+ @Override
+ public boolean performOk() {
+ super.performOk();
+ IEditorReference[] editors = VpePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+ for (IEditorReference editor : editors) {
+ IEditorPart editorPart = editor.getEditor(false);
+ if ((editorPart != null) && (editorPart instanceof JSPMultiPageEditor)) {
+ JSPMultiPageEditor mpe = (JSPMultiPageEditor)editorPart;
+ IVisualEditor visualEditor = (mpe).getVisualEditor();
+ if (visualEditor instanceof VpeEditorPart) {
+ VpeEditorPart vep = (VpeEditorPart) visualEditor;
+ /*
+ * Update visual editor
+ */
+ vep.updatePartAccordingToPreferences();
+ /*
+ * Change selected tab
+ */
+ mpe.updatePartAccordingToPreferences();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ return JspEditorPlugin.getDefault().getPreferenceStore();
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAnyCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAnyCreator.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAnyCreator.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -15,7 +15,8 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.expression.VpeExpression;
@@ -180,7 +181,8 @@
String styleString = getExprValue(pageContext, styleExpr, sourceNode);
- if ("yes".equalsIgnoreCase(VpePreference.SHOW_BORDER_FOR_UNKNOWN_TAGS.getValue())) { //$NON-NLS-1$
+ if (JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS)) {
styleString = "border: 1px solid green;" +styleString; //$NON-NLS-1$
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -29,7 +29,8 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Sash;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.vpe.messages.VpeUIMessages;
/**
@@ -45,10 +46,6 @@
public class CustomSashForm extends SashForm {
public static final String copyright = "(c) Copyright IBM Corporation 2002."; //$NON-NLS-1$
- public static final String LAYOUT_VERTICAL_SOURCE_TOP = "Vertical Source on top"; //$NON-NLS-1$
- public static final String LAYOUT_VERTICAL_VISUAL_TOP = "Vertical Visual on top"; //$NON-NLS-1$
- public static final String LAYOUT_HORIZONTAL_SOURCE_LEFT = "Horizontal Source to the left"; //$NON-NLS-1$
- public static final String LAYOUT_HORIZONTAL_VISUAL_LEFT = "Horizontal Visual to the left"; //$NON-NLS-1$
/**
* Custom style bits. They set whether max to one side of the other
* is not permitted. For example, if NO_MAX_UP, then there will be only
@@ -81,17 +78,11 @@
/*
* Init the sash weight with the default value.
*/
- String defaultWeightString = VpePreference.SOURCE_VISUAL_EDITORS_WEIGHTS.getValue();
- try {
- int defaultWeight = Integer.parseInt(defaultWeightString);
+ int defaultWeight = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getInt(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_WEIGHTS);
if (defaultWeight > 0) {
weight = defaultWeight;
}
- } catch (NumberFormatException e) {
- /*
- * Do nothing
- */
- }
}
};
@@ -382,7 +373,8 @@
if (currentSashInfo.cursorOver != i) {
currentSashInfo.cursorOver = i;
currentSashInfo.sash.redraw();
- String splitting = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue();
+ String splitting = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getString(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING);
switch (locs[ARROW_TYPE_INDEX]) {
case UP_ARROW:
case DOWN_ARROW:
@@ -393,20 +385,20 @@
* https://jira.jboss.org/jira/browse/JBIDE-4270
* Tooltip text should correspond panes position.
*/
- if (LAYOUT_HORIZONTAL_SOURCE_LEFT.equalsIgnoreCase(splitting)
- || LAYOUT_VERTICAL_SOURCE_TOP.equalsIgnoreCase(splitting)) {
- currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_VISUAL_PANE);
- } else {
- currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_SOURCE_PANE);
- }
+ if (IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE.equalsIgnoreCase(splitting)
+ || IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE.equalsIgnoreCase(splitting)) {
+ currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_VISUAL_PANE);
+ } else {
+ currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_SOURCE_PANE);
+ }
break;
case DOWN_MAX_ARROW:
- if (LAYOUT_HORIZONTAL_SOURCE_LEFT.equalsIgnoreCase(splitting)
- || LAYOUT_VERTICAL_SOURCE_TOP.equalsIgnoreCase(splitting)) {
- currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_SOURCE_PANE);
- } else {
- currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_VISUAL_PANE);
- }
+ if (IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE.equalsIgnoreCase(splitting)
+ || IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE.equalsIgnoreCase(splitting)) {
+ currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_SOURCE_PANE);
+ } else {
+ currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_VISUAL_PANE);
+ }
break;
}
}
@@ -1098,16 +1090,7 @@
gc.drawLine(x+3, y+1, x+3, y+6);
gc.drawLine(x+2, y+1, x+2, y+7);
}
-
- public int getSavedWeight() {
- if (currentSashInfo!=null)
- return currentSashInfo.weight;
- else
- return -1;
- }
-
-
protected Sash getSash() {
Control[] kids = getChildren();
for (int i = 0; i < kids.length; i++) {
@@ -1117,13 +1100,6 @@
return null;
}
- public void setCurrentSavedWeight(int weight) {
- if (weight>=0 && currentSashInfo!=null) {
- recomputeSashInfo(false);
- currentSashInfo.weight=weight;
- }
- }
-
/**
* Adds a custom sashform listener. This listener will be removed when
* this control is disposed.
@@ -1178,20 +1154,36 @@
}
public void changeOrientation() {
- int prefsOrientation = getSplittingFromPreferences();
- if (getOrientation() != prefsOrientation) {
- setOrientation(prefsOrientation);
- }
+ int prefsOrientation = getSplittingFromPreferences();
+ if (getOrientation() != prefsOrientation) {
+ setOrientation(prefsOrientation);
+ }
}
public static int getSplittingFromPreferences() {
- String splitting = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue();
- if (LAYOUT_HORIZONTAL_SOURCE_LEFT.equalsIgnoreCase(splitting)
- || LAYOUT_HORIZONTAL_VISUAL_LEFT.equalsIgnoreCase(splitting)) {
- return SWT.HORIZONTAL;
- } else {
- return SWT.VERTICAL;
- }
+ String splitting = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getString(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING);
+ if (IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE
+ .equalsIgnoreCase(splitting)
+ || IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE
+ .equalsIgnoreCase(splitting)) {
+ return SWT.HORIZONTAL;
+ } else {
+ return SWT.VERTICAL;
+ }
}
+ public static boolean isSourceEditorFirst() {
+ boolean sourceEditorFirst = false;
+ String splitting = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getString(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING);
+ if (IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE
+ .equalsIgnoreCase(splitting)
+ || IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE
+ .equalsIgnoreCase(splitting)) {
+ sourceEditorFirst = true;
+ }
+ return sourceEditorFirst;
+ }
+
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -67,6 +67,10 @@
editor=null;
}
+ public void clearOldSettings() {
+ settings.clear();
+ }
+
public void setInput(FileEditorInput input) {
file = input.getFile();
for (int i = 0; i < settings.size(); i++) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -9,8 +9,8 @@
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
-import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
@@ -30,128 +30,47 @@
private QualifiedName name;
private CustomSashForm sash;
- private ControlListener listener=null;
private Control listenedControl=null;
private int weights[];
- /**
- * Save both the current weights, and the (potential) save
- * weights. The first value is the size of the
- * current weights
- *
- * @since 1.1.0
- */
- protected void updateWeights() {
- weights = sash.getWeights();
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < weights.length; i++) {
- if (i>0)
- sb.append(EditorSettings.SEPERATOR);
- sb.append(weights[i]);
- }
- sb.append(EditorSettings.SEPERATOR);
- sb.append(-1); // seperate between current weights, and saved weights
- sb.append(EditorSettings.SEPERATOR);
- sb.append(sash.getSavedWeight());
- try {
- //fix for JBIDE-3805
- if(resource.exists()) {
- resource.setPersistentProperty(name,sb.toString());
- }
- } catch (CoreException e) {
- VpePlugin.getPluginLog().logError(e);
- }
- }
-
public SashSetting(CustomSashForm s) {
sash = s;
}
- protected void addListener() {
- if (listener==null && !sash.isDisposed()) {
- listener = new ControlListener() {
- public void controlResized(ControlEvent e) {
- updateWeights();
- }
- public void controlMoved(ControlEvent e) {
- updateWeights();
- }
- };
- listenedControl = sash.getChildren()[0];
- listenedControl.addControlListener(listener);
- }
- }
-
- protected void removeListener() {
- if (listenedControl!=null && !listenedControl.isDisposed()) {
- listenedControl.removeControlListener(listener);
- listener=null;
- listenedControl=null;
- }
- }
-
public void apply() {
- try {
- String val = resource.getPersistentProperty(name);
- if (val!=null) {
- StringTokenizer st = new StringTokenizer(val,EditorSettings.SEPERATOR);
- weights = new int[st.countTokens()];
- int index = 0;
- while(st.hasMoreTokens()) {
- String s = st.nextToken();
- weights[index++]=Integer.parseInt(s);
+ /*
+ * Set weights from the preference page
+ */
+ int defaultWeight = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getInt(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_WEIGHTS);
+ int[] weights = sash.getWeights();
+ if (weights.length > 2) {
+ if (defaultWeight == 0) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ sash.maxDown();
+ } else {
+ sash.maxUp();
}
- for (index = 0; index < weights.length; index++) {
- if (weights[index]<0)
- break;
+ } else if (defaultWeight == 1000) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ sash.maxUp();
+ } else {
+ sash.maxDown();
}
- int saved = -1;
- if (index<weights.length) {
- int w[] = new int[index];
- for (int i = 0; i < w.length; i++) {
- w[i] = weights[i];
- }
- saved = weights[index+1];
- weights=w;
- }
- sash.setWeights(weights);
- if (saved>=0)
- sash.setCurrentSavedWeight(saved);
} else {
- /*
- * Set weights from the preference page
- */
- String stringValue = VpePreference.SOURCE_VISUAL_EDITORS_WEIGHTS.getValue();
- try {
- int intValue = Integer.parseInt(stringValue);
- int[] weights = sash.getWeights();
- if (weights.length > 2) {
- if (intValue == 0) {
- sash.maxDown();
- } else if (intValue == 1000) {
- sash.maxUp();
- } else {
- weights[0] = intValue;
- weights[1] = 1000 - intValue;
- sash.setWeights(weights);
- }
- }
- } catch (NumberFormatException e) {
- // Do nothing
+ if (CustomSashForm.isSourceEditorFirst()) {
+ weights[0] = 1000 - defaultWeight;
+ weights[1] = defaultWeight;
+ } else {
+ weights[0] = defaultWeight;
+ weights[1] = 1000 - defaultWeight;
}
+ sash.setWeights(weights);
}
- } catch (CoreException e1) {
- VpePlugin.getPluginLog().logError(e1);
}
- addListener();
}
-
- public void dispose() {
- removeListener();
- }
-
public void setQualifier(String q) {
name = new QualifiedName(q,id);
}
@@ -163,4 +82,8 @@
public void setResource(IResource r) {
resource = r;
}
+
+ public void dispose() {
+
+ }
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -113,4 +113,25 @@
public static String INCLUDED_CSS_FILES_ABOUT;
public static String INCLUDED_TAG_LIBS_ABOUT;
public static String SUBSTITUTED_EL_EXPRESSIONS_ABOUT;
+
+ public static String GENERAL_TAB_TITLE;
+ public static String VPE_PREFERENCES_PAGE_DESCRIPTION;
+ public static String SHOW_BORDER_FOR_UNKNOWN_TAGS;
+ public static String SHOW_SELECTION_TAG_BAR;
+ public static String SHOW_RESOURCE_BUNDLES_USAGE_AS_EL;
+ public static String ASK_TAG_ATTRIBUTES_ON_TAG_INSERT;
+ public static String ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR;
+ public static String DEFAULT_VPE_TAB;
+ public static String VISUAL_SOURCE_EDITORS_SPLITTING;
+ public static String VISUAL_SOURCE_EDITORS_WEIGHTS;
+ public static String DEFAULT_VPE_TAB_VISUAL_SOURCE;
+ public static String DEFAULT_VPE_TAB_SOURCE;
+ public static String DEFAULT_VPE_TAB_PREVIEW;
+ public static String SPLITTING_VERT_TOP_SOURCE;
+ public static String SPLITTING_VERT_TOP_VISUAL;
+ public static String SPLITTING_HORIZ_LEFT_SOURCE;
+ public static String SPLITTING_HORIZ_LEFT_VISUAL;
+ public static String VISUAL_APPEARANCE_GROUP_TITLE;
+ public static String CONFIRMATION_GROUP_TITLE;
+ public static String TABS_GROUP_TITLE;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-09-14 16:17:42 UTC (rev 17548)
@@ -6,8 +6,8 @@
PREFERENCES=Preferences
REFRESH=Refresh
PAGE_DESIGN_OPTIONS=Page Design Options
-HIDE_SELECTION_BAR=Hide Selection Bar
-SHOW_SELECTION_BAR=Show Selection Bar
+HIDE_SELECTION_BAR=Hide selection bar
+SHOW_SELECTION_BAR=Show selection bar
MOZILLA_LOADING_ERROR=Could not open the Visual Page Editor: {0}
MOZILLA_LOADING_ERROR_LINK_TEXT=See JBoss Tools Visual Editor FAQ
# START NON-TRANSLATABLE
@@ -91,4 +91,28 @@
ACTUAL_RUN_TIME_FOLDERS_ABOUT=These options will be used by Visual Page Editor for replacing absolute and relative path values when generating a preview
INCLUDED_CSS_FILES_ABOUT=These CSS files will be linked by Visual Page Editor when generating a preview
INCLUDED_TAG_LIBS_ABOUT=These Taglibs will be used by Visual Page Editor for getting appropriate template for generating a preview, if this Taglibs doesn't included on page
-SUBSTITUTED_EL_EXPRESSIONS_ABOUT=These EL expressions will be substituted by Visual Page Editor when generating a preview
\ No newline at end of file
+SUBSTITUTED_EL_EXPRESSIONS_ABOUT=These EL expressions will be substituted by Visual Page Editor when generating a preview
+
+# Visual Page Editor Preference Page
+GENERAL_TAB_TITLE=General
+VPE_PREFERENCES_PAGE_DESCRIPTION=Visual Page Editor settings
+SHOW_BORDER_FOR_UNKNOWN_TAGS=Show border for unknown tags
+SHOW_SELECTION_TAG_BAR=Show selection tag bar
+SHOW_RESOURCE_BUNDLES_USAGE_AS_EL=Show resource bundles usage as EL expressions
+ASK_TAG_ATTRIBUTES_ON_TAG_INSERT=Ask for tag attributes during tag insert
+ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR=Ask for confirmation when closing Selection Bar
+DEFAULT_VPE_TAB=Select the default active editor's tab for files that haven't been previously opened in the VPE
+VISUAL_SOURCE_EDITORS_SPLITTING=Visual/Source editors splitting
+VISUAL_SOURCE_EDITORS_WEIGHTS=Size of the Visual Editor pane (0-100%)
+VISUAL_APPEARANCE_GROUP_TITLE=Visual appearance
+CONFIRMATION_GROUP_TITLE=Confirmation and details
+TABS_GROUP_TITLE=Tabs
+
+# Visual Page Editor Preference Page List Items
+DEFAULT_VPE_TAB_VISUAL_SOURCE=Visual/Source
+DEFAULT_VPE_TAB_SOURCE=Source
+DEFAULT_VPE_TAB_PREVIEW=Preview
+SPLITTING_VERT_TOP_SOURCE=Vertical splitting with Source Editor on the top
+SPLITTING_VERT_TOP_VISUAL=Vertical splitting with Visual Editor on the top
+SPLITTING_HORIZ_LEFT_SOURCE=Horizontal splitting with Source Editor to the left
+SPLITTING_HORIZ_LEFT_VISUAL=Horizontal splitting with Visual Editor to the left
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2009-09-14 15:06:24 UTC (rev 17547)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2009-09-14 16:17:42 UTC (rev 17548)
@@ -50,6 +50,8 @@
import org.jboss.tools.common.model.ui.attribute.adapter.AdapterFactory;
import org.jboss.tools.common.model.ui.attribute.adapter.IModelPropertyEditorAdapter;
import org.jboss.tools.common.model.ui.util.ModelUtilities;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
@@ -126,7 +128,7 @@
final Listener closeListener = new Listener() {
public void handleEvent(Event event) {
- if (!getHideWithoutPromptOption()) {
+ if (askConfirmationOnClosingSelectionBar()) {
MessageDialogWithToggle dialog = MessageDialogWithToggle
.openOkCancelConfirm(
PlatformUI.getWorkbench()
@@ -134,14 +136,13 @@
.getShell(),
VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_TITLE,
VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_MESSAGE,
- VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_TOGGLE_MESSAGE,
- false, null, null);
+// VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_TOGGLE_MESSAGE,
+ VpeUIMessages.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR,
+ askConfirmationOnClosingSelectionBar(), null, null);
if (dialog.getReturnCode() != IDialogConstants.OK_ID) {
return;
}
- if (dialog.getToggleState()) {
- setHideWithoutPromptOption(true);
- }
+ setAskConfirmationOnClosingSelectionBar(dialog.getToggleState());
}
setAlwaysVisibleOption(false);
@@ -203,24 +204,19 @@
}
public boolean getAlwaysVisibleOption() {
- return VpePreference.SHOW_SELECTION_TAG_BAR.getValue().equals(PREFERENCE_YES);
+ return JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_SELECTION_TAG_BAR);
}
- public void setHideWithoutPromptOption(boolean hideWithoutPrompt) {
- final String optionValue;
- if (hideWithoutPrompt) {
- optionValue = PREFERENCE_YES;
- } else {
- optionValue = PREFERENCE_NO;
- }
-
- setPersistentOption(VpePreference.ATT_ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT,
- optionValue);
+ public void setAskConfirmationOnClosingSelectionBar(boolean askConfirmation) {
+ JspEditorPlugin.getDefault().getPreferenceStore().setValue(
+ IVpePreferencesPage.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR,
+ askConfirmation);
}
- public boolean getHideWithoutPromptOption() {
- return VpePreference.ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT
- .getValue().equals(PREFERENCE_YES);
+ public boolean askConfirmationOnClosingSelectionBar() {
+ return JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR);
}
/**
15 years
JBoss Tools SVN: r17547 - in trunk/maven/plugins: org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-09-14 11:06:24 -0400 (Mon, 14 Sep 2009)
New Revision: 17547
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/libprov/MavenLibraryProviderInstallOperation.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4881 Maven Library Provider doesn't save correctly changes made by a user
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/libprov/MavenLibraryProviderInstallOperation.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/libprov/MavenLibraryProviderInstallOperation.java 2009-09-14 13:49:46 UTC (rev 17546)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/libprov/MavenLibraryProviderInstallOperation.java 2009-09-14 15:06:24 UTC (rev 17547)
@@ -58,14 +58,11 @@
URIConverter.WriteableOutputStream uws = null;
FileWriter fw = null;
try {
- if (providerFile.exists()) {
- url = providerFile.toURL();
- } else {
- Map<String, String> params = provider.getParams();
- String pomURLString = params.get("template"); //$NON-NLS-1$
- URL platformURL = new URL(pomURLString);
- url = FileLocator.resolve(platformURL);
- }
+ Map<String, String> params = provider.getParams();
+ String pomURLString = params.get("template"); //$NON-NLS-1$
+ URL platformURL = new URL(pomURLString);
+ url = FileLocator.resolve(platformURL);
+
libraryResource = MavenCoreActivator.loadResource(url);
libraryResource.getContents().clear();
libraryResource.getContents().add(libraryModel);
@@ -84,12 +81,16 @@
try {
uws.flush();
uws.close();
- } catch (IOException ignore) {}
+ } catch (IOException e) {
+ MavenCoreActivator.log(e);
+ }
}
if (fw != null) {
try {
fw.close();
- } catch (IOException ignore) {}
+ } catch (IOException e) {
+ MavenCoreActivator.log(e);
+ }
}
if (libraryResource != null) {
libraryResource.unload();
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java 2009-09-14 13:49:46 UTC (rev 17546)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java 2009-09-14 15:06:24 UTC (rev 17547)
@@ -67,7 +67,10 @@
composite.setLayoutData(gd);
String projectName = getDataModel().getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ IProject project = null;
+ if (projectName != null && projectName.trim().length() > 0) {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ }
boolean mavenProjectExists = false;
if (project != null && project.isOpen()) {
try {
15 years
JBoss Tools SVN: r17546 - trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/csvparser.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-09-14 09:49:46 -0400 (Mon, 14 Sep 2009)
New Revision: 17546
Modified:
trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/csvparser/CsvParserTest.java
Log:
JBIDE-4878
Change the unit test case
Modified: trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/csvparser/CsvParserTest.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/csvparser/CsvParserTest.java 2009-09-14 13:21:17 UTC (rev 17545)
+++ trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/csvparser/CsvParserTest.java 2009-09-14 13:49:46 UTC (rev 17546)
@@ -101,11 +101,11 @@
IXMLStructuredObject child = tag.getChildren().get(0);
assertEquals("csv-record", child.getNodeName());
- checkNode("a",tag);
- checkNode("b",tag);
- checkNode("c",tag);
- checkNode("d",tag);
- checkNode("e",tag);
+ checkNode("firstname",tag);
+ checkNode("lastname",tag);
+ checkNode("gender",tag);
+ checkNode("age",tag);
+ checkNode("country",tag);
}
private void checkTagList1(TagList tagList){
15 years
JBoss Tools SVN: r17545 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/project.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-14 09:21:17 -0400 (Mon, 14 Sep 2009)
New Revision: 17545
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/project/ImportProjectFoldersPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3506
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/project/ImportProjectFoldersPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/project/ImportProjectFoldersPage.java 2009-09-14 12:49:56 UTC (rev 17544)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/project/ImportProjectFoldersPage.java 2009-09-14 13:21:17 UTC (rev 17545)
@@ -79,8 +79,10 @@
XAttributeData[] ad = entityData.getAttributeData();
for (int i = 0; i < ad.length; i++) ad[i].setValue(""); //$NON-NLS-1$
- context.setServletVersion(JSFPreference.DEFAULT_JSF_IMPORT_SERVLET_VERSION.getValue());
-
+ if(context.getServletVersion() == null) {
+ context.setServletVersion(JSFPreference.DEFAULT_JSF_IMPORT_SERVLET_VERSION.getValue());
+ }
+
JSFTemplate t = new JSFTemplate();
String[] versions = t.getVersionList();
HUtil.hackAttributeConstraintList(new XEntityData[]{entityData}, 0, ATTRIBUTES[3], versions);
@@ -254,5 +256,5 @@
FieldEditor f = support.getFieldEditorByName("version"); //$NON-NLS-1$
f.setEnabled(b, supportControl);
}
-
+
}
15 years
JBoss Tools SVN: r17544 - in trunk/smooks/docs/reference/en: images/quick_start and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-09-14 08:49:56 -0400 (Mon, 14 Sep 2009)
New Revision: 17544
Added:
trunk/smooks/docs/reference/en/images/quick_start/quick_start9a.png
trunk/smooks/docs/reference/en/images/quick_start/quick_start9b.png
trunk/smooks/docs/reference/en/images/quick_start/quick_start9c.png
trunk/smooks/docs/reference/en/images/quick_start/sourcemodel_structured.jpg
trunk/smooks/docs/reference/en/images/quick_start/targetmodel_structured.jpg
Modified:
trunk/smooks/docs/reference/en/images/introduction/introduction2.png
trunk/smooks/docs/reference/en/images/quick_start/quick_start6.png
trunk/smooks/docs/reference/en/images/quick_start/quick_start9.png
trunk/smooks/docs/reference/en/images/quick_start/quick_start_6a.png
trunk/smooks/docs/reference/en/modules/quick_start.xml
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-821 -Updated Quick Start section according to the new design and functionality of the Smooks-tools. </p>
</body></html>
Modified: trunk/smooks/docs/reference/en/images/introduction/introduction2.png
===================================================================
(Binary files differ)
Modified: trunk/smooks/docs/reference/en/images/quick_start/quick_start6.png
===================================================================
(Binary files differ)
Modified: trunk/smooks/docs/reference/en/images/quick_start/quick_start9.png
===================================================================
(Binary files differ)
Added: trunk/smooks/docs/reference/en/images/quick_start/quick_start9a.png
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/docs/reference/en/images/quick_start/quick_start9a.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/smooks/docs/reference/en/images/quick_start/quick_start9b.png
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/docs/reference/en/images/quick_start/quick_start9b.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/smooks/docs/reference/en/images/quick_start/quick_start9c.png
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/docs/reference/en/images/quick_start/quick_start9c.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/smooks/docs/reference/en/images/quick_start/quick_start_6a.png
===================================================================
(Binary files differ)
Added: trunk/smooks/docs/reference/en/images/quick_start/sourcemodel_structured.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/docs/reference/en/images/quick_start/sourcemodel_structured.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/smooks/docs/reference/en/images/quick_start/targetmodel_structured.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/docs/reference/en/images/quick_start/targetmodel_structured.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/smooks/docs/reference/en/modules/quick_start.xml
===================================================================
--- trunk/smooks/docs/reference/en/modules/quick_start.xml 2009-09-14 12:36:19 UTC (rev 17543)
+++ trunk/smooks/docs/reference/en/modules/quick_start.xml 2009-09-14 12:49:56 UTC (rev 17544)
@@ -16,7 +16,7 @@
<section>
<title>Download Smooks Java-to-Java Example</title>
<para> Visit <ulink
- url="http://svn.codehaus.org/milyn/tags/Smooks_V1.1.2/smooks-examples/java-to-..."
+ url="http://www.blogjava.net/Files/reloadcn/smooks_java_java.zip"
>smooks examples page</ulink> to download the "java-to-java" example project. </para>
<tip>
<title>Tip:</title>
@@ -26,6 +26,57 @@
them into the eclipse Java project. </para>
</tip>
</section>
+ <section>
+ <title>Mapping rules</title>
+ <para>At the begining of working with Smooks tools,
+ we need to understand the Java-to-Java mapping rules of this example.
+ The transform input Java class is <emphasis><property>example.sourcemodel.Order</property></emphasis> , its structure looks like this :
+ </para>
+ <figure>
+ <title>Order class</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/quick_start/sourcemodel_structured.jpg" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>Let's describe the structure of <emphasis><property>example.sourcemodel.Order</property></emphasis> in short:</para>
+ <itemizedlist>
+ <listitem><para>Order class contains a <property>Header</property> class and a <property>List</property> class.</para></listitem>
+ <listitem><para>The <property>Header</property> class has <property>customerName</property>,<property>customerNumber</property>,<property>priority</property> as properties.</para></listitem>
+ <listitem><para>In Order class the objects of the OrderItem class are stored in the List.</para></listitem>
+ <listitem><para>OrderItem has <property>price</property>,<property>productId</property>,<property>quantity</property> as its properties.</para></listitem>
+ </itemizedlist>
+ <para>Let's look at the transform target Java class : <emphasis><property>LineOrder</property></emphasis>.</para>
+ <para>On the screen below you can see its structure:</para>
+ <figure>
+ <title>LineOrder class</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/quick_start/targetmodel_structured.jpg" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <itemizedlist>
+ <listitem><para><property>LineOrder</property> class contains 3 properties:<property>customerId</property>,<property>customerName</property>,<property>priority</property> and an array of lineItems.</para></listitem>
+ <listitem><para>The <property>Header</property> class has <property>customerName</property>,<property>customerNumber</property>,<property>priority</property> as its properties.</para></listitem>
+ <listitem><para>OrderItem objects are stored in a List.</para></listitem>
+ </itemizedlist>
+ <para>Now it's the time to define the mapping rules to transform the input source java class to the target java class:</para>
+ <itemizedlist>
+ <listitem><para>Each instance of the Order class should be mapped with an instance of the LineOrder class.</para></listitem>
+ <listitem><para>The value of <property>customerName</property> of the Header class should be assigned to the <property>customerName</property> property of a LineOrder instance.</para></listitem>
+ <listitem><para>The value of <property>customerNumber</property> of the Header class should be assigned to the <property>customerId</property> property of a LineOrder instance.</para></listitem>
+ <listitem><para>The value of <property>priority</property> of the Header class should be assigned to the <property>priority</property> property of LineOrder instance.</para></listitem>
+ <listitem><para>For the <property>orderitems</property> List of the Order instance, it's necessary to map a new lineItems array instance of LineOrder ,
+ and each OrderItem instance in the orderItems List should be transformed to a LineItem instance,
+ those instances will be put into the lineItems array.</para></listitem>
+ <listitem><para>The value of <property>productId</property> of the OrderItem instance should be assigned to the 'productCode' of LineItem.</para></listitem>
+ <listitem><para>The value of <property>price</property> of OrderItem should be assigned to the <property>unitPrice</property> of LineItem.</para></listitem>
+
+ </itemizedlist>
+ </section>
+
<section id="config_file_wizzard">
<title>Smooks Configuration File Wizard</title>
<para>Select the Smooks Java-to-Java example project that you created and right-click,
@@ -118,7 +169,14 @@
</imageobject>
</mediaobject>
</figure>
-
+ <para>On the bottom of this editor there are 5 tabs, they are :
+
+ Overview, Reader, Message Filter, Graph, Source.</para>
+ <section id="graphicaleditor_datalink">
+ <title>Adding the input data</title>
+ <para>At first, we need to add the Order class as the input data.
+ To do this, click the Reader tab, swich to the Reader/Input editor page</para>
+
<!--<para> This editor contains several parts: <table>
<title>The Smooks Editor Parts</title>
<tgroup cols="2">
@@ -188,11 +246,8 @@
</tgroup>
</table>
</para>-->
- </section>
+
- <section id="graphicaleditor_datalink">
- <title>Choosing the transform data</title>
-
<para>To choose the transform data you should open <emphasis>
<property>Reader</property></emphasis> tab and click <emphasis>
<property>Add</property></emphasis> button in the Input Data section.</para>
@@ -235,10 +290,10 @@
</mediaobject>
</figure>
- <para> Let's select the Order class from the example project as the source JavaBean class and the ListOrder class as the target JavaBean class.When you selected the necessary java classes, click <emphasis>
+ <para> Let's select the Order class from the example project as the source JavaBean class.After that click <emphasis>
<property>Finish</property>
- </emphasis> and you should see all added java classes displayed in the Input Data Section
- .</para>
+ </emphasis> and you should see the just added java class, being displayed in the Input Data Section.
+ </para>
<figure>
<title>Displaying the Structure of the Transformed Data</title>
<mediaobject>
@@ -247,8 +302,74 @@
</imageobject>
</mediaobject>
</figure>
+ </section>
+ <section>
+ <title>Adding the target Bean</title>
+ <para>After adding the input data, let's switch to the Message Filter page:</para>
+ <figure>
+ <title>Displaying the Structure of the Transformed Data</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/quick_start/quick_start9a.png" scale="90"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>Click the <property>Add</property> button, the <property>Add Child</property> wizard page will be shown, let's select the <property>Java Binding v1.2 -> Bean v1.2</property> and click <emphasis><property>OK</property></emphasis> to add the Bean :
+ </para>
+ <figure>
+ <title>Add Child wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/quick_start/quick_start9b.png" scale="90"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>Then we can find on the Message Filter page the <property>Bean v1.2</property> item added, click on it ,a Bean v1.2 section should appear to the right of the page.
+ The section represents a GUI for editing <property>Bean v1.2</property> properties:</para>
+ <figure>
+ <title>Bean v1.2 section</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/quick_start/quick_start9c.png" scale="90"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>You should input <property>
+ lineOrder</property> as the Bean's id in the "Bean Id" field.Then you should click <property>Browse</property> button
+ near the <property>Class</property> textfield and select LineOrder as the Bean's class.</para>
+ <note>
+ <para>
+ When you enter a value for the <property>Class</property> text field,
+ you can type 'Alt + /' and the content assist pop dialog will be shown,
+ so it's will increase the efficiency. If 'Alt + /' doesn't work,
+ try to use the 'Ctrl + space'('Key Assist' of Eclipse).
+ </para>
+ </note>
+ <para>Let's click the <property>Add Binding</property> link at the bottom of this page,
+ it will show a dialog to ask the binding of what Bean properties you will prefer to add.
+ Select all and click OK, you will see a list of Binding elements added under the Bean item.</para>
+ <para>Then you should add an array of beans called <property>lineItems</property> and a Bean LineItem.These two classes and Id values are:</para>
+ <para>Array Bean:</para>
+ <itemizedlist>
+ <listitem><para>BeanId : lineItems;</para></listitem>
+ <listitem><para>Class : example.trgmodel.LineItem[]</para></listitem>
+ </itemizedlist>
+ <para>LineItem Bean :</para>
+ <itemizedlist>
+ <listitem><para>BeanId : lineItem;</para></listitem>
+ <listitem><para>Class : example.trgmodel.LineItem</para></listitem>
+ </itemizedlist>
+ <note>
+ <para>
+ In Smooks , to be an array of Beans , the class value should end with '[]'. This means that this bean is an array type.
+
+ </para>
+ </note>
+ <para>To finish this work, use the <property>Add Binding</property> link to add all the bindings for the Bean.</para>
+ </section>
+
+
</section>
-
<section id="quickstart_mapping">
<title>Mapping</title>
@@ -296,7 +417,7 @@
</orderedlist>
<para> Make sense?
- You should right click Resource List , select <emphasis>
+ You should open Design tab and click Add button. In opened Add Child Wizard,please, select <emphasis>
<property>Add Smooks Resource>Java Binding>Bindings</property></emphasis>.
</para>
<para>First of all, you should bind <emphasis>
15 years
JBoss Tools SVN: r17543 - in trunk/smooks/plugins: org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12/provider and 29 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-09-14 08:36:19 -0400 (Mon, 14 Sep 2009)
New Revision: 17543
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ContainerChildrenTablePanelCreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelChildrenTablePanelCreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelMultiChildrenTabelPanelCreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/MultiContainerChildrenAddtionTablePanel.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12ReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/MessageFilterNavigator.htm
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/provider/CsvReaderItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12/provider/CSV12ReaderItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi/provider/EDIReaderItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi12/provider/EDI12ReaderItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/graphics/ext/SmooksGraphicsExtType.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/graphics/ext/impl/SmooksGraphicsExtTypeImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/impl/JsonReaderImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/provider/JsonReaderItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/provider/KeyItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/impl/Json12ReaderImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/provider/Json12ReaderItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/provider/KeyItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/ReaderTypeItemProvider.java
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/FileSelectionWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/NewOrModifySmooksElementDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationReaderPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVDataParser.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVInputDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CsvReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12InputDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderBindingPropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderMapBindingPropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataParser.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/BindingsPropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBean12PropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/rule10/Rules10RulebaseUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ConditionTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ReaderTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ResourceTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.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/wizard/ViewerInitorStore.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/SelectorValidator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/NewSmooksElementWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/EDIMapFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/TreeNodeFigure.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPaletteRootCreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
Log:
JBIDE-4878
DONE
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/provider/CsvReaderItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/provider/CsvReaderItemProvider.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/provider/CsvReaderItemProvider.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -200,10 +200,11 @@
*/
@Override
public String getText(Object object) {
- String label = ((CsvReader)object).getTargetProfile();
- return label == null || label.length() == 0 ?
- getString("_UI_CsvReader_type") :
- getString("_UI_CsvReader_type") + " " + label;
+ return "CSV";
+// String label = ((CsvReader)object).getTargetProfile();
+// return label == null || label.length() == 0 ?
+// getString("_UI_CsvReader_type") :
+// getString("_UI_CsvReader_type") + " " + label;
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12/provider/CSV12ReaderItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12/provider/CSV12ReaderItemProvider.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12/provider/CSV12ReaderItemProvider.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -299,10 +299,11 @@
* @generated
*/
public String getText(Object object) {
- String label = ((CSV12Reader)object).getRecordElementName();
- return label == null || label.length() == 0 ?
- getString("_UI_CSV12Reader_type") :
- getString("_UI_CSV12Reader_type") + " " + label;
+ return "CSV";
+// String label = ((CSV12Reader)object).getRecordElementName();
+// return label == null || label.length() == 0 ?
+// getString("_UI_CSV12Reader_type") :
+// getString("_UI_CSV12Reader_type") + " " + label;
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi/provider/EDIReaderItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi/provider/EDIReaderItemProvider.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi/provider/EDIReaderItemProvider.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -131,10 +131,11 @@
*/
@Override
public String getText(Object object) {
- String label = ((EDIReader)object).getTargetProfile();
- return label == null || label.length() == 0 ?
- getString("_UI_EDIReader_type") :
- getString("_UI_EDIReader_type") + " " + label;
+ return "EDI";
+// String label = ((EDIReader)object).getTargetProfile();
+// return label == null || label.length() == 0 ?
+// getString("_UI_EDIReader_type") :
+// getString("_UI_EDIReader_type") + " " + label;
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi12/provider/EDI12ReaderItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi12/provider/EDI12ReaderItemProvider.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi12/provider/EDI12ReaderItemProvider.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -153,10 +153,11 @@
* @generated
*/
public String getText(Object object) {
- String label = ((EDI12Reader)object).getTargetProfile();
- return label == null || label.length() == 0 ?
- getString("_UI_EDI12Reader_type") :
- getString("_UI_EDI12Reader_type") + " " + label;
+ return "EDI";
+// String label = ((EDI12Reader)object).getTargetProfile();
+// return label == null || label.length() == 0 ?
+// getString("_UI_EDI12Reader_type") :
+// getString("_UI_EDI12Reader_type") + " " + label;
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/graphics/ext/SmooksGraphicsExtType.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/graphics/ext/SmooksGraphicsExtType.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/graphics/ext/SmooksGraphicsExtType.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -139,6 +139,8 @@
* @generated
*/
void setInputType(String value);
+
+ void setInputType(String value , boolean fireEvent);
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/graphics/ext/impl/SmooksGraphicsExtTypeImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/graphics/ext/impl/SmooksGraphicsExtTypeImpl.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/graphics/ext/impl/SmooksGraphicsExtTypeImpl.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -292,6 +292,11 @@
inputType = newInputType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GraphPackage.SMOOKS_GRAPHICS_EXT_TYPE__INPUT_TYPE, oldInputType, inputType));
+ List<ISmooksGraphChangeListener> listeners = this.getChangeListeners();
+ for (Iterator<ISmooksGraphChangeListener> iterator = listeners.iterator(); iterator.hasNext();) {
+ ISmooksGraphChangeListener iSmooksGraphChangeListener = (ISmooksGraphChangeListener) iterator.next();
+ iSmooksGraphChangeListener.graphPropertyChange(GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__INPUT_TYPE, inputType);
+ }
}
/**
@@ -543,5 +548,13 @@
return changeListeners;
}
+ public void setInputType(String value, boolean fireEvent) {
+ if(fireEvent){
+ setInputType(value);
+ }else{
+ inputType = value;
+ }
+ }
+
} //SmooksGraphicsExtTypeImpl
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/impl/JsonReaderImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/impl/JsonReaderImpl.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/impl/JsonReaderImpl.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -12,6 +12,7 @@
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.jboss.tools.smooks.model.json.JsonFactory;
import org.jboss.tools.smooks.model.json.JsonPackage;
import org.jboss.tools.smooks.model.json.JsonReader;
import org.jboss.tools.smooks.model.json.KeyMap;
@@ -222,6 +223,7 @@
*/
protected JsonReaderImpl() {
super();
+ this.setKeyMap(JsonFactory.eINSTANCE.createKeyMap());
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/provider/JsonReaderItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/provider/JsonReaderItemProvider.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/provider/JsonReaderItemProvider.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -278,10 +278,11 @@
*/
@Override
public String getText(Object object) {
- String label = ((JsonReader)object).getArrayElementName();
- return label == null || label.length() == 0 ?
- getString("_UI_JsonReader_type") :
- getString("_UI_JsonReader_type") + " " + label;
+ return "JSON";
+// String label = ((JsonReader)object).getArrayElementName();
+// return label == null || label.length() == 0 ?
+// getString("_UI_JsonReader_type") :
+// getString("_UI_JsonReader_type") + " " + label;
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/provider/KeyItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/provider/KeyItemProvider.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/provider/KeyItemProvider.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -156,10 +156,16 @@
*/
@Override
public String getText(Object object) {
- String label = ((Key)object).getValue();
- return label == null || label.length() == 0 ?
- getString("_UI_Key_type") :
- getString("_UI_Key_type") + " " + label;
+ String label = ((Key)object).getTo();
+ String from = ((Key)object).getFrom();
+ String returnText = "-> ";
+ if(from != null){
+ returnText = from + " -> ";
+ }
+ if(label != null){
+ returnText = returnText + label;
+ }
+ return returnText;
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/impl/Json12ReaderImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/impl/Json12ReaderImpl.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/impl/Json12ReaderImpl.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -14,6 +14,7 @@
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.jboss.tools.smooks.model.json12.Json12Factory;
import org.jboss.tools.smooks.model.json12.Json12Package;
import org.jboss.tools.smooks.model.json12.Json12Reader;
import org.jboss.tools.smooks.model.json12.KeyMap;
@@ -255,6 +256,7 @@
*/
protected Json12ReaderImpl() {
super();
+ this.setKeyMap(Json12Factory.eINSTANCE.createKeyMap());
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/provider/Json12ReaderItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/provider/Json12ReaderItemProvider.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/provider/Json12ReaderItemProvider.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -299,10 +299,11 @@
* @generated
*/
public String getText(Object object) {
- String label = ((Json12Reader)object).getArrayElementName();
- return label == null || label.length() == 0 ?
- getString("_UI_Json12Reader_type") :
- getString("_UI_Json12Reader_type") + " " + label;
+ return "JSON";
+// String label = ((Json12Reader)object).getArrayElementName();
+// return label == null || label.length() == 0 ?
+// getString("_UI_Json12Reader_type") :
+// getString("_UI_Json12Reader_type") + " " + label;
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/provider/KeyItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/provider/KeyItemProvider.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/provider/KeyItemProvider.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -11,12 +11,9 @@
import java.util.Collection;
import java.util.List;
-
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
-
import org.eclipse.emf.common.util.ResourceLocator;
-
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -153,10 +150,16 @@
* @generated
*/
public String getText(Object object) {
- String label = ((Key)object).getValue();
- return label == null || label.length() == 0 ?
- getString("_UI_Key_type") :
- getString("_UI_Key_type") + " " + label;
+ String label = ((Key)object).getTo();
+ String from = ((Key)object).getFrom();
+ String returnText = "-> ";
+ if(from != null){
+ returnText = from + " -> ";
+ }
+ if(label != null){
+ returnText = returnText + label;
+ }
+ return returnText;
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/ReaderTypeItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/ReaderTypeItemProvider.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/ReaderTypeItemProvider.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -139,10 +139,11 @@
*/
@Override
public String getText(Object object) {
- String label = ((ReaderType)object).getTargetProfile();
- return label == null || label.length() == 0 ?
- getString("_UI_ReaderType_type") :
- getString("_UI_ReaderType_type") + " " + label;
+ return "Custom";
+// String label = ((ReaderType)object).getTargetProfile();
+// return label == null || label.length() == 0 ?
+// getString("_UI_ReaderType_type") :
+// getString("_UI_ReaderType_type") + " " + label;
}
/**
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-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -51,11 +51,13 @@
public static final String INPUT_TYPE_JAVA = "java";
+ public static final String INPUT_TYPE_CUSTOME = "custom";
+
public static final String INPUT_TYPE_JSON_1_1 = "json";
- public static final String INPUT_TYPE_CSV_1_1 = "csv";
+ public static final String INPUT_TYPE_CSV = "csv";
- public static final String INPUT_TYPE_CSV_1_2 = "csv_1_2";
+ public static final String INPUT_TYPE_CSV_1_2 = "csv";
public static final String PARAM_NAME_CLASS = "class";
@@ -76,12 +78,12 @@
public static final String BEAN_ID = "beanId";
public static final String BINDINGS = "bindings";
-
+
public static final String INPUT_TYPE_EDI_1_1 = "EDI";
- public static final String INPUT_TYPE_EDI_1_2 = "EDI_1_2";
+ public static final String INPUT_TYPE_EDI_1_2 = "EDI";
- public static final String INPUT_TYPE_JSON_1_2 = "json_1_2";
+ public static final String INPUT_TYPE_JSON_1_2 = "json";
public static EStructuralFeature ATTRIBUTE_PROPERTY = ExtendedMetaData.INSTANCE.demandFeature(null, "property",
false);
@@ -511,7 +513,7 @@
List<org.jboss.tools.smooks.model.graphics.ext.ParamType> list = input.getParam();
if (INPUT_TYPE_JAVA.equals(input.getType()) || INPUT_TYPE_XML.equals(input.getType())
|| INPUT_TYPE_XSD.equals(input.getType()) || INPUT_TYPE_JSON_1_1.equals(input.getType())
- || INPUT_TYPE_JSON_1_2.equals(input.getType()) || INPUT_TYPE_CSV_1_1.equals(input.getType())
+ || INPUT_TYPE_JSON_1_2.equals(input.getType()) || INPUT_TYPE_CSV.equals(input.getType())
|| INPUT_TYPE_EDI_1_1.equals(input.getType()) || INPUT_TYPE_EDI_1_2.equals(input.getType())
|| INPUT_TYPE_CSV_1_2.equals(input.getType())) {
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizard.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizard.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.Collection;
+
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author Dart
+ *
+ */
+public class ChildrenSelectionWizard extends Wizard {
+
+ private ChildrenSelectionWizardPage page;
+
+ private PrivateWizardDialog dialog;
+
+ public ChildrenSelectionWizard(Shell shell, Collection<?> childrenDescriptor,
+ AdapterFactoryEditingDomain editingDomain) {
+ super();
+ dialog = new PrivateWizardDialog(shell, this){
+
+ };
+ page = new ChildrenSelectionWizardPage(childrenDescriptor, editingDomain, "children selection",
+ "Select children", null);
+ page.setWizardDialog(dialog);
+ }
+
+ public CommandParameter getChildDescriptor(){
+ return (CommandParameter)page.getChild();
+ }
+
+ public int open() {
+ return dialog.open();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ this.addPage(page);
+ }
+
+ class PrivateWizardDialog extends WizardDialog{
+
+ public PrivateWizardDialog(Shell parentShell, IWizard newWizard) {
+ super(parentShell, newWizard);
+ }
+ public void pressOK(){
+ this.okPressed();
+ }
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizardPage.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+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.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.smooks.configuration.editors.ChildrenSelectionWizard.PrivateWizardDialog;
+
+/**
+ * @author Dart
+ *
+ */
+public class ChildrenSelectionWizardPage extends WizardPage {
+
+ private Collection<?> childrenDescriptor = new ArrayList<CommandParameter>();
+
+ private AdapterFactoryEditingDomain editingDomain = null;
+
+ protected Object child;
+
+ private PrivateWizardDialog dialog;
+
+ /*
+ * (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);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ mainComposite.setLayoutData(gd);
+
+ mainComposite.setLayout(new FillLayout());
+
+ final TableViewer tableViewer = new TableViewer(mainComposite, SWT.BORDER | SWT.FULL_SELECTION);
+ tableViewer.setContentProvider(new ChildrenDescriptorContentProvider());
+ tableViewer.setLabelProvider(new ChildrenDescriptorLabelProvider());
+ tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ child = null;
+ if (!((IStructuredSelection) tableViewer.getSelection()).isEmpty()) {
+ child = ((IStructuredSelection) tableViewer.getSelection()).getFirstElement();
+ updatePage();
+ }
+ }
+ });
+ tableViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ dialog.close();
+ }
+ });
+ if(childrenDescriptor != null){
+ tableViewer.setInput(childrenDescriptor);
+ }
+ updatePage();
+ setControl(mainComposite);
+ }
+
+ public Object getChild() {
+ return child;
+ }
+
+ protected void updatePage() {
+ String error = null;
+ if (child == null) {
+ error = "Please choose a child type";
+ }
+
+ this.setErrorMessage(error);
+ this.setPageComplete(error == null);
+ }
+
+ public ChildrenSelectionWizardPage(Collection<?> childrenDescriptor,
+ AdapterFactoryEditingDomain editingDomain, String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ this.childrenDescriptor = childrenDescriptor;
+ this.editingDomain = editingDomain;
+ this.setTitle("Select a Child's Type");
+ this.setDescription("Select a child's type");
+ }
+
+ public ChildrenSelectionWizardPage(Collection<?> childrenDescriptor,
+ AdapterFactoryEditingDomain editingDomain,String pageName) {
+ super(pageName);
+ this.childrenDescriptor = childrenDescriptor;
+ this.editingDomain = editingDomain;
+ this.setTitle("Select a Child's Type");
+ this.setDescription("Select a child's type");
+ }
+
+ private Object getValue(Object element) {
+ if (element instanceof CommandParameter) {
+ Object v = ((CommandParameter) element).getValue();
+ v = AdapterFactoryEditingDomain.unwrap(v);
+ return v;
+ }
+ return element;
+ }
+
+ private class ChildrenDescriptorContentProvider implements IStructuredContentProvider {
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof Collection<?>) {
+ return ((Collection<?>) inputElement).toArray();
+ }
+ return new Object[] {};
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
+ private class ChildrenDescriptorLabelProvider extends LabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ element = getValue(element);
+ IItemLabelProvider provider = (IItemLabelProvider) editingDomain.getAdapterFactory().adapt(element,
+ IItemLabelProvider.class);
+ Object img = provider.getImage(element);
+ if(img instanceof Image){
+ return ((Image)img);
+ }
+ return null;
+
+ }
+
+ @Override
+ public String getText(Object element) {
+ element = getValue(element);
+ IItemLabelProvider provider = (IItemLabelProvider) editingDomain.getAdapterFactory().adapt(element,
+ IItemLabelProvider.class);
+ return provider.getText(element);
+ }
+
+ }
+
+ public void setWizardDialog(PrivateWizardDialog dialog) {
+ this.dialog = dialog;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ChildrenSelectionWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ContainerChildrenTablePanelCreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ContainerChildrenTablePanelCreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ContainerChildrenTablePanelCreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+
+/**
+ * @author Dart
+ *
+ */
+public class ContainerChildrenTablePanelCreator extends ModelChildrenTablePanelCreator {
+
+ private EStructuralFeature containerFeature = null;
+
+ private EObject rootModel;
+
+ public ContainerChildrenTablePanelCreator(ISmooksModelProvider smooksModelProvider, EObject rootModel,
+ FormToolkit toolkit, IEditorPart editorPart) {
+ super(smooksModelProvider, null, toolkit, editorPart);
+ this.rootModel = rootModel;
+ }
+
+ public EStructuralFeature getContainerFeature() {
+ return containerFeature;
+ }
+
+ public void setContainerFeature(EStructuralFeature containerFeature) {
+ this.containerFeature = containerFeature;
+ }
+
+ public EObject getRootModel() {
+ return rootModel;
+ }
+
+ public void setRootModel(EObject rootModel) {
+ this.rootModel = rootModel;
+ }
+
+ @Override
+ protected boolean performNewChild() {
+ if (getRootModel() != null) {
+ EObject rootModel = getRootModel();
+ EStructuralFeature feature = getContainerFeature();
+ if (feature != null) {
+ Object container = rootModel.eGet(feature);
+ if (container == null) {
+ container = newContainerModel();
+ if (container != null){
+ rootModel.eSet(containerFeature, container);
+ this.setParentModel((EObject) container);
+ if(getChildrenTableViewer() != null){
+ getChildrenTableViewer().setInput(getParentModel());
+ }
+ }
+ }else{
+ this.setParentModel((EObject) container);
+ if(getChildrenTableViewer() != null){
+ getChildrenTableViewer().setInput(getParentModel());
+ }
+ }
+
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected EObject newContainerModel() {
+ return null;
+ }
+
+ @Override
+ protected void performRunRemoveCommand(CompoundCommand compoundCommand, EditingDomain editingDomain) {
+ if (this.getParentModel() != null) {
+ EObject h = getParentModel();
+ if (h.eContents().size() == 1) {
+ Command command1 = RemoveCommand.create(editingDomain, h);
+ compoundCommand.append(command1);
+ this.setParentModel(null);
+ }
+ }
+ super.performRunRemoveCommand(compoundCommand, editingDomain);
+ }
+
+ @Override
+ protected void endRemoveChild() {
+ super.endRemoveChild();
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ContainerChildrenTablePanelCreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -38,7 +38,7 @@
@Override
public void addPages() {
- fileSelectionWizardPage = new FileSelectionWizardPage("File Selection");
+ fileSelectionWizardPage = new FileSelectionWizardPage("File Selection" ,null);
fileSelectionWizardPage.setFilters(viewerFilters);
fileSelectionWizardPage.setInitSelections(getInitSelections());
fileSelectionWizardPage.setMultiSelect(isMultiSelect());
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizardPage.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizardPage.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -17,11 +17,11 @@
* @author Dart Peng (dpeng(a)redhat.com) Date Apr 13, 2009
*/
public class FileSelectionWizardPage extends AbstractFileSelectionWizardPage {
-
+
private ProtableFileStringProcessor processor = null;
-
- public FileSelectionWizardPage(String pageName) {
- super(pageName , new String[]{});
+
+ public FileSelectionWizardPage(String pageName, Object[] initSelection) {
+ super(pageName, new String[] {});
processor = new ProtableFileStringProcessor();
setFilePathProcessor(processor);
setTitle("File Selection");
@@ -40,12 +40,11 @@
return null;
}
-
@Override
protected String processFileSystemFilePath(String path) {
- if(getFilePathProcessor() != null){
+ if (getFilePathProcessor() != null) {
String s = getFilePathProcessor().processFileSystemPath(path);
- if(s != null){
+ if (s != null) {
return s;
}
}
@@ -54,18 +53,17 @@
@Override
protected String processWorkSpaceFilePath(IFile file) {
- if(getFilePathProcessor() != null){
+ if (getFilePathProcessor() != null) {
String s = getFilePathProcessor().processWorkBenchPath(file);
- if(s != null){
+ if (s != null) {
return s;
}
}
return this.processor.processWorkBenchPath(file);
}
+ private class ProtableFileStringProcessor implements IFilePathProcessor {
- private class ProtableFileStringProcessor implements IFilePathProcessor{
-
public String processWorkBenchPath(IFile file) {
String s = file.getFullPath().toPortableString();
return s;
@@ -74,7 +72,7 @@
public String processFileSystemPath(String filePath) {
return filePath;
}
-
+
}
}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelChildrenTablePanelCreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelChildrenTablePanelCreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelChildrenTablePanelCreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,407 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.MoveCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.common.AbstractAnyType;
+
+/**
+ * @author Dart
+ *
+ */
+public class ModelChildrenTablePanelCreator {
+
+ private ISmooksModelProvider smooksModelProvider;
+
+ protected TableViewer childrenTableViewer;
+
+ private Button newChildButton;
+
+ private Button removeRemoveButton;
+
+ private Button upChildButton;
+
+ private Button downChildButton;
+
+ private Button childPropertiesButton;
+
+ private EObject parentModel;
+
+ private FormToolkit toolkit;
+
+ private IEditorPart editorPart;
+
+ public ModelChildrenTablePanelCreator(ISmooksModelProvider smooksModelProvider, EObject parentModel,
+ FormToolkit toolkit, IEditorPart editorPart) {
+ this.parentModel = parentModel;
+ this.smooksModelProvider = smooksModelProvider;
+ this.toolkit = toolkit;
+ this.editorPart = editorPart;
+ }
+
+ public Composite createChildrenTablePanel(Composite parent) {
+ Composite mainComposite = toolkit.createComposite(parent);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ mainComposite.setLayout(gl);
+ createChildrenTablePanel(mainComposite, toolkit);
+ return mainComposite;
+ }
+
+ protected void createChildrenTablePanel(Composite mainComposite, FormToolkit toolkit) {
+ if (smooksModelProvider != null) {
+ AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) smooksModelProvider
+ .getEditingDomain();
+ EObject parentModel = getParentModel();
+
+ childrenTableViewer = new TableViewer(mainComposite);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ childrenTableViewer.getControl().setLayoutData(gd);
+ toolkit.paintBordersFor(mainComposite);
+ Composite buttonArea = toolkit.createComposite(mainComposite);
+ gd = new GridData(GridData.FILL_VERTICAL);
+ gd.widthHint = 30;
+ GridLayout bgl = new GridLayout();
+ buttonArea.setLayout(bgl);
+
+ newChildButton = toolkit.createButton(buttonArea, "New", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.verticalAlignment = GridData.BEGINNING;
+ newChildButton.setLayoutData(gd);
+
+ removeRemoveButton = toolkit.createButton(buttonArea, "Remove", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.verticalAlignment = GridData.BEGINNING;
+ removeRemoveButton.setLayoutData(gd);
+
+ upChildButton = toolkit.createButton(buttonArea, "Up", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.verticalAlignment = GridData.BEGINNING;
+ upChildButton.setLayoutData(gd);
+
+ downChildButton = toolkit.createButton(buttonArea, "Down", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.verticalAlignment = GridData.BEGINNING;
+ downChildButton.setLayoutData(gd);
+
+ childPropertiesButton = toolkit.createButton(buttonArea, "Properties..", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.verticalAlignment = GridData.BEGINNING;
+ childPropertiesButton.setLayoutData(gd);
+
+ childrenTableViewer
+ .setContentProvider(new AdapterFactoryContentProvider(editingDomain.getAdapterFactory()) {
+
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+ });
+
+ childrenTableViewer.setLabelProvider(new DecoratingLabelProvider(new AdapterFactoryLabelProvider(
+ editingDomain.getAdapterFactory()) {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider
+ * # getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object object) {
+ Object obj = AdapterFactoryEditingDomain.unwrap(object);
+ if (obj instanceof AbstractAnyType) {
+ return super.getText(obj);
+ }
+ return super.getText(object);
+ }
+
+ }, SmooksConfigurationActivator.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
+
+ if (parentModel != null) {
+ childrenTableViewer.setInput(parentModel);
+ }
+
+ childrenTableViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ openChildPropertiesModifyDialog();
+ }
+ });
+
+ childrenTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateButtons();
+ }
+ });
+
+ hookButtons();
+ updateButtons();
+ }
+ }
+
+ protected TableViewer getChildrenTableViewer() {
+ return childrenTableViewer;
+ }
+
+ protected EObject newChildModel() {
+ return null;
+ }
+
+ protected EStructuralFeature getChildrenFeature() {
+ return null;
+ }
+
+ protected boolean performNewChild() {
+ return true;
+ }
+
+ protected void endNewChild() {
+
+ }
+
+ protected void performRemoveChild() {
+
+ }
+
+ protected void endRemoveChild() {
+
+ }
+
+ protected void hookButtons() {
+ newChildButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (getSmooksVersion() == null) {
+ return;
+ }
+ if (performNewChild()) {
+ EObject childModel = newChildModel();
+ EObject parent = getParentModel();
+ if (parent == null || childModel == null) {
+ return;
+ }
+ EStructuralFeature profileFeature = getChildrenFeature();
+ try {
+ NewOrModifySmooksElementDialog dialog = new NewOrModifySmooksElementDialog(editorPart
+ .getEditorSite().getShell(), profileFeature, childModel, parent, toolkit,
+ smooksModelProvider, editorPart, false);
+
+ if (dialog.open() == Dialog.OK) {
+ endNewChild();
+ }
+ } catch (Throwable e1) {
+ e1.printStackTrace();
+ }
+ }
+ super.widgetSelected(e);
+ }
+
+ });
+ removeRemoveButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) childrenTableViewer.getSelection();
+ if (selection == null)
+ return;
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ performRemoveChild();
+ EObject profile = (EObject) obj;
+ EObject parent = getParentModel();
+ if (parent == null)
+ return;
+ CompoundCommand compoundCommand = new CompoundCommand();
+ Command command = RemoveCommand.create(smooksModelProvider.getEditingDomain(), profile);
+ compoundCommand.append(command);
+ performRunRemoveCommand(compoundCommand, smooksModelProvider.getEditingDomain());
+ smooksModelProvider.getEditingDomain().getCommandStack().execute(compoundCommand);
+ endRemoveChild();
+ }
+ }
+
+ });
+ upChildButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) childrenTableViewer.getSelection();
+ if (selection == null)
+ return;
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ EObject profilesType = getParentModel();
+ if (profilesType == null)
+ return;
+ EObject v = (EObject) AdapterFactoryEditingDomain.unwrap(obj);
+ EObject parent = v.eContainer();
+ int index = parent.eContents().indexOf(v);
+ Command command = MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null, obj,
+ index - 1);
+ smooksModelProvider.getEditingDomain().getCommandStack().execute(command);
+ }
+ }
+
+ });
+ downChildButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) childrenTableViewer.getSelection();
+ if (selection == null)
+ return;
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ EObject profilesType = getParentModel();
+ if (profilesType == null)
+ return;
+ EObject v = (EObject) AdapterFactoryEditingDomain.unwrap(obj);
+ EObject parent = v.eContainer();
+ int index = parent.eContents().indexOf(v);
+ Command command = MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null, obj,
+ index + 1);
+ smooksModelProvider.getEditingDomain().getCommandStack().execute(command);
+ }
+ }
+
+ });
+ childPropertiesButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ openChildPropertiesModifyDialog();
+ super.widgetSelected(e);
+ }
+
+ });
+
+ }
+
+ protected void performRunRemoveCommand(CompoundCommand compoundCommand, EditingDomain editDomain) {
+
+ }
+
+ protected void updateButtons() {
+ if (getSmooksVersion() == null) {
+ childPropertiesButton.setEnabled(false);
+ newChildButton.setEnabled(false);
+ removeRemoveButton.setEnabled(false);
+ upChildButton.setEnabled(false);
+ downChildButton.setEnabled(false);
+ return;
+ }
+ childPropertiesButton.setEnabled(true);
+ removeRemoveButton.setEnabled(true);
+ IStructuredSelection selection = (IStructuredSelection) childrenTableViewer.getSelection();
+ if (selection == null) {
+ childPropertiesButton.setEnabled(false);
+ removeRemoveButton.setEnabled(false);
+ upChildButton.setEnabled(false);
+ downChildButton.setEnabled(false);
+ } else {
+ if (selection.getFirstElement() == null) {
+ childPropertiesButton.setEnabled(false);
+ removeRemoveButton.setEnabled(false);
+ upChildButton.setEnabled(false);
+ downChildButton.setEnabled(false);
+ return;
+ }
+
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ EObject profilesType = getParentModel();
+ if (profilesType == null)
+ return;
+ EObject v = (EObject) AdapterFactoryEditingDomain.unwrap(obj);
+ EObject parent = v.eContainer();
+ int index = parent.eContents().indexOf(v);
+ Command command = MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null, obj,
+ index - 1);
+ upChildButton.setEnabled(command.canExecute());
+
+ Command command1 = MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null, obj,
+ index + 1);
+ downChildButton.setEnabled(command1.canExecute());
+ }
+
+ if (selection.size() > 1) {
+ childPropertiesButton.setEnabled(false);
+ removeRemoveButton.setEnabled(false);
+ }
+ }
+
+ }
+
+ protected void openChildPropertiesModifyDialog() {
+ IStructuredSelection selection = (IStructuredSelection) childrenTableViewer.getSelection();
+ if (selection == null)
+ return;
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ EObject child = (EObject) obj;
+ EObject parent = getParentModel();
+ EStructuralFeature childFeature = getChildrenFeature();
+
+ NewOrModifySmooksElementDialog dialog = new NewOrModifySmooksElementDialog(editorPart.getEditorSite()
+ .getShell(), childFeature, child, parent, toolkit, smooksModelProvider, editorPart, true);
+ dialog.open();
+ }
+ }
+
+ public EObject getParentModel() {
+ return parentModel;
+ }
+
+ public void setParentModel(EObject parentModel) {
+ this.parentModel = parentModel;
+ }
+
+ public String getSmooksVersion() {
+ if (this.smooksModelProvider != null) {
+ return this.smooksModelProvider.getSmooksGraphicsExt().getPlatformVersion();
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelChildrenTablePanelCreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelMultiChildrenTabelPanelCreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelMultiChildrenTabelPanelCreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelMultiChildrenTabelPanelCreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+
+/**
+ * @author Dart
+ *
+ */
+public class ModelMultiChildrenTabelPanelCreator extends ModelChildrenTablePanelCreator {
+
+ private Shell shell;
+
+ private Collection<?> children;
+
+ private AdapterFactoryEditingDomain editingDomain;
+
+ private EStructuralFeature feature;
+
+ private EObject newChild = null;
+
+ public ModelMultiChildrenTabelPanelCreator(Shell shell, Collection<?> children,
+ AdapterFactoryEditingDomain editingDomain, ISmooksModelProvider smooksModelProvider, EObject parentModel,
+ FormToolkit toolkit, IEditorPart editorPart) {
+ super(smooksModelProvider, parentModel, toolkit, editorPart);
+ this.shell = shell;
+ this.children = children;
+ this.editingDomain = editingDomain;
+ }
+
+ @Override
+ protected boolean performNewChild() {
+ List<Object> cloneChildren = new ArrayList<Object>();
+ cloneChildren.addAll(children);
+ ChildrenSelectionWizard wizard = new ChildrenSelectionWizard(shell, cloneChildren, editingDomain);
+ if (wizard.open() == Dialog.OK) {
+ CommandParameter param = wizard.getChildDescriptor();
+ if (param != null) {
+ feature = getChildFeature(param);
+ newChild = getNewChildInstance(param);
+
+ if (feature != null && newChild != null) {
+ return super.performNewChild();
+ }
+
+ }
+ }
+ return false;
+ }
+
+ protected EObject getNewChildInstance(CommandParameter param) {
+ return param.getEValue();
+ }
+
+ protected EStructuralFeature getChildFeature(CommandParameter param) {
+ return param.getEStructuralFeature();
+ }
+
+ @Override
+ protected EStructuralFeature getChildrenFeature() {
+ return feature;
+ }
+
+ @Override
+ protected EObject newChildModel() {
+ return newChild;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ModelMultiChildrenTabelPanelCreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/MultiContainerChildrenAddtionTablePanel.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/MultiContainerChildrenAddtionTablePanel.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/MultiContainerChildrenAddtionTablePanel.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+
+/**
+ * @author Dart
+ *
+ */
+public class MultiContainerChildrenAddtionTablePanel extends ContainerChildrenTablePanelCreator {
+
+ private Shell shell;
+
+ private Collection<?> children;
+
+ private AdapterFactoryEditingDomain editingDomain;
+
+ private EStructuralFeature feature;
+
+ private EObject newChild = null;
+
+ public MultiContainerChildrenAddtionTablePanel(Shell shell, Collection<?> children,
+ AdapterFactoryEditingDomain editingDomain, ISmooksModelProvider smooksModelProvider, EObject rootModel,
+ FormToolkit toolkit, IEditorPart editorPart) {
+ super(smooksModelProvider, rootModel, toolkit, editorPart);
+ this.shell = shell;
+ this.children = children;
+ this.editingDomain = editingDomain;
+ }
+
+ @Override
+ protected boolean performNewChild() {
+ List<Object> cloneChildren = new ArrayList<Object>();
+ cloneChildren.addAll(children);
+ ChildrenSelectionWizard wizard = new ChildrenSelectionWizard(shell, cloneChildren, editingDomain);
+ if (wizard.open() == Dialog.OK) {
+ CommandParameter param = wizard.getChildDescriptor();
+ if (param != null) {
+ feature = getChildFeature(param);
+ newChild = getNewChildInstance(param);
+
+ if (feature != null && newChild != null) {
+ return super.performNewChild();
+ }
+
+ }
+ }
+ return false;
+ }
+
+ protected EObject getNewChildInstance(CommandParameter parameter) {
+ if(parameter == null) return null;
+ return parameter.getEValue();
+ }
+
+ protected EStructuralFeature getChildFeature(CommandParameter parameter) {
+ if(parameter == null) return null;
+ return parameter.getEStructuralFeature();
+ }
+
+ @Override
+ protected EStructuralFeature getChildrenFeature() {
+ return feature;
+ }
+
+ @Override
+ protected EObject newChildModel() {
+ return newChild;
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/MultiContainerChildrenAddtionTablePanel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/NewOrModifySmooksElementDialog.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/NewOrModifySmooksElementDialog.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/NewOrModifySmooksElementDialog.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -12,8 +12,10 @@
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertySource;
@@ -79,7 +81,7 @@
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
String okLabel = IDialogConstants.OK_LABEL;
- if(modify){
+ if (modify) {
okLabel = "Close";
}
createButton(parent, IDialogConstants.OK_ID, okLabel, true);
@@ -120,8 +122,17 @@
try {
if (!modify && parentModel != null && modelProvider != null && feature != null) {
EditingDomain editingDomain = modelProvider.getEditingDomain();
- Command command = AddCommand.create(editingDomain, parentModel, feature, model);
- editingDomain.getCommandStack().execute(command);
+ Command command = null;
+
+ if (feature instanceof EReference) {
+ if (((EReference) feature).isMany()) {
+ command = AddCommand.create(editingDomain, parentModel, feature, model);
+ } else {
+ command = SetCommand.create(editingDomain, parentModel, feature, model);
+ }
+ }
+ if (command != null)
+ editingDomain.getCommandStack().execute(command);
}
} catch (Exception e) {
e.printStackTrace();
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -15,7 +15,11 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
@@ -149,9 +153,22 @@
public AttributeFieldEditPart createFileSelectionFieldEditor(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
ISmooksModelProvider formEditor) {
+ final ISmooksModelProvider provider = formEditor;
IFieldDialog dialog = new IFieldDialog() {
public Object open(Shell shell) {
FileSelectionWizard wizard = new FileSelectionWizard();
+ EObject model = provider.getSmooksModel();
+ if(model != null){
+ URI uri = model.eResource().getURI();
+ if(uri.isPlatformResource()){
+ String path = uri.toPlatformString(true);
+ IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
+ if(workspaceResource instanceof IFile){
+ workspaceResource = ((IFile)workspaceResource).getParent();
+ }
+ wizard.setInitSelections(new Object[]{workspaceResource});
+ }
+ }
wizard.setViewerFilters(getFileDialogViewerFilters());
WizardDialog dialog = new WizardDialog(shell, wizard);
if (dialog.open() == Dialog.OK) {
@@ -200,7 +217,7 @@
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
ISmooksModelProvider formEditor) {
if (model instanceof EObject)
- return SmooksUIUtils.createJavaTypeSearchFieldEditor(parent, toolkit, propertyDescriptor, (EObject) model);
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(parent, toolkit, propertyDescriptor, (EObject) model , formEditor);
return null;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -17,6 +17,7 @@
import org.jboss.tools.smooks.configuration.editors.csv.CsvReaderUICreator;
import org.jboss.tools.smooks.configuration.editors.csv12.Csv12ReaderBindingPropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.csv12.Csv12ReaderMapBindingPropertyUICreator;
+import org.jboss.tools.smooks.configuration.editors.csv12.Csv12ReaderUICreator;
import org.jboss.tools.smooks.configuration.editors.datasource.DataSourceJndiUICreator;
import org.jboss.tools.smooks.configuration.editors.datasource.DirectUICreator;
import org.jboss.tools.smooks.configuration.editors.dbrouting.ExecutorUICreator;
@@ -59,6 +60,7 @@
import org.jboss.tools.smooks.configuration.editors.json.JsonReaderUICreator;
import org.jboss.tools.smooks.configuration.editors.json.KeyMapUICreator;
import org.jboss.tools.smooks.configuration.editors.json.KeyUICreator;
+import org.jboss.tools.smooks.configuration.editors.json12.Json12ReaderUICreator;
import org.jboss.tools.smooks.configuration.editors.persistence12.DeleterUICreator;
import org.jboss.tools.smooks.configuration.editors.persistence12.FlusherUICreator;
import org.jboss.tools.smooks.configuration.editors.persistence12.InserterUICreator;
@@ -92,6 +94,7 @@
import org.jboss.tools.smooks.model.calc.impl.CounterImpl;
import org.jboss.tools.smooks.model.csv.impl.CsvReaderImpl;
import org.jboss.tools.smooks.model.csv12.impl.BindingImpl;
+import org.jboss.tools.smooks.model.csv12.impl.CSV12ReaderImpl;
import org.jboss.tools.smooks.model.csv12.impl.MapBindingImpl;
import org.jboss.tools.smooks.model.datasource.impl.DataSourceJndiImpl;
import org.jboss.tools.smooks.model.datasource.impl.DirectImpl;
@@ -123,6 +126,7 @@
import org.jboss.tools.smooks.model.json.impl.JsonReaderImpl;
import org.jboss.tools.smooks.model.json.impl.KeyImpl;
import org.jboss.tools.smooks.model.json.impl.KeyMapImpl;
+import org.jboss.tools.smooks.model.json12.impl.Json12ReaderImpl;
import org.jboss.tools.smooks.model.medi.impl.ComponentImpl;
import org.jboss.tools.smooks.model.medi.impl.DelimitersImpl;
import org.jboss.tools.smooks.model.medi.impl.DescriptionImpl;
@@ -249,6 +253,9 @@
map.put(KeyImpl.class, new KeyUICreator());
map.put(KeyMapImpl.class, new KeyMapUICreator());
map.put(JsonReaderImpl.class, new JsonReaderUICreator());
+
+ // for JSON 1.2
+ map.put(Json12ReaderImpl.class, new Json12ReaderUICreator());
// for CSV
map.put(CsvReaderImpl.class, new CsvReaderUICreator());
@@ -316,6 +323,7 @@
// for CSV Reader v1.2
map.put(BindingImpl.class, new Csv12ReaderBindingPropertyUICreator());
map.put(MapBindingImpl.class, new Csv12ReaderMapBindingPropertyUICreator());
+ map.put(CSV12ReaderImpl.class, new Csv12ReaderUICreator());
// for EDI Reader v1.2
map.put(EDI12ReaderImpl.class, new EDIReader12UICreator());
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -42,7 +42,6 @@
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.csv.CSVDataParser;
import org.jboss.tools.smooks.configuration.editors.edi.EDIDataParser;
import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModel;
@@ -269,7 +268,7 @@
t.printStackTrace();
}
}
- if (SmooksModelUtils.INPUT_TYPE_CSV_1_1.equals(type)
+ if (SmooksModelUtils.INPUT_TYPE_CSV.equals(type)
|| SmooksModelUtils.INPUT_TYPE_CSV_1_2.equals(type)) {
CSVDataParser parser = new CSVDataParser();
try {
@@ -351,7 +350,7 @@
}
}
} catch (Exception e) {
- SmooksConfigurationActivator.getDefault().log(e);
+// SmooksConfigurationActivator.getDefault().log(e);
}
}
return list;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -44,7 +44,6 @@
public SmooksConfigurationFormPage(FormEditor editor, String id, String title) {
super(editor, id, title);
- ((SmooksMultiFormEditor) editor).getSmooksGraphicsExt().addSmooksGraphChangeListener(this);
}
public SmooksConfigurationFormPage(String id, String title) {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -49,6 +49,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
@@ -57,6 +58,7 @@
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.ScrolledPageBook;
import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.SmooksConstants;
@@ -114,8 +116,6 @@
public SmooksConfigurationOverviewPage(FormEditor editor, String id, String title, ISmooksModelProvider provider) {
super(editor, id, title);
this.smooksModelProvider = provider;
- ((SmooksMultiFormEditor) editor).getSmooksGraphicsExt().addSmooksGraphChangeListener(this);
-
}
public SmooksConfigurationOverviewPage(String id, String title, ISmooksModelProvider provider) {
@@ -133,19 +133,27 @@
gl.marginHeight = 0;
gl.marginWidth = 0;
form.getBody().setLayout(gl);
- Composite mainComposite = toolkit.createComposite(form.getBody());
+ ScrolledPageBook pageBook = new ScrolledPageBook(form.getBody());
+ pageBook.setBackground(toolkit.getColors().getBackground());
+ Composite mainComposite = pageBook.createPage(pageBook);
+ pageBook.showPage(pageBook);
+
+ // Composite mainComposite = toolkit.createComposite(form.getBody());
+
GridData gd = new GridData(GridData.FILL_BOTH);
- mainComposite.setLayoutData(gd);
+ pageBook.setLayoutData(gd);
GridLayout mgl = new GridLayout();
mgl.numColumns = 2;
mgl.marginHeight = 13;
+ mgl.horizontalSpacing = 20;
mainComposite.setLayout(mgl);
settingSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR);
settingSection.setLayout(new FillLayout());
- settingSection.setText("Smooks config");
+ settingSection.setText("Smooks configuration");
+ settingSection.setDescription("Set the description for this Smooks configuration file.");
Composite settingComposite = toolkit.createComposite(settingSection);
settingSection.setClient(settingComposite);
gd = new GridData();
@@ -155,7 +163,7 @@
GridLayout sgl = new GridLayout();
settingComposite.setLayout(sgl);
sgl.numColumns = 2;
- sgl.verticalSpacing = 12;
+ // sgl.verticalSpacing = 8;
createSettingSection(settingComposite, toolkit);
@@ -163,6 +171,7 @@
globalParamSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR
| Section.TWISTIE | Section.EXPANDED);
+ globalParamSection.setDescription("Define the global parameters for the Smooks configuration file");
globalParamSection.setText("Global Paramters");
globalParamSection.setLayout(new FillLayout());
Composite globalParamComposite = toolkit.createComposite(globalParamSection);
@@ -181,7 +190,8 @@
generalSettingSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR
| Section.TWISTIE | Section.EXPANDED);
generalSettingSection.setLayout(new FillLayout());
- generalSettingSection.setText("Default Setting");
+ generalSettingSection.setText("Smooks Default Setting");
+ generalSettingSection.setDescription("Define the Smooks configuration file default setting");
defaultSettingComposite = toolkit.createComposite(generalSettingSection);
generalSettingSection.setClient(defaultSettingComposite);
gd = new GridData();
@@ -198,6 +208,7 @@
conditionSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR
| Section.TWISTIE);
conditionSection.setText("Conditions");
+ conditionSection.setDescription("Define the conditions");
conditionSection.setLayout(new FillLayout());
Composite conditionComposite = toolkit.createComposite(conditionSection);
conditionSection.setClient(conditionComposite);
@@ -214,6 +225,7 @@
profilesSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR
| Section.TWISTIE);
+ profilesSection.setDescription("Define the profiles");
profilesSection.setText("Profiles");
profilesSection.setLayout(new FillLayout());
Composite profilesComposite = toolkit.createComposite(profilesSection);
@@ -232,12 +244,14 @@
}
private void createSettingSection(Composite settingComposite, FormToolkit toolkit) {
- toolkit.createLabel(settingComposite, "Smooks Platform Version : ");
+ toolkit.createLabel(settingComposite, "Smooks Platform Version : ").setForeground(
+ toolkit.getColors().getColor(IFormColors.TITLE));
int type = SWT.BORDER;
if (SmooksUIUtils.isLinuxOS()) {
type = SWT.BORDER;
}
final Combo combo = new Combo(settingComposite, type | SWT.READ_ONLY);
+ combo.setEnabled(false);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(gd);
for (int i = 0; i < SmooksConstants.SMOOKS_VERSIONS.length; i++) {
@@ -258,7 +272,7 @@
}
});
- toolkit.createLabel(settingComposite, "Name : ");
+ toolkit.createLabel(settingComposite, "Name : ").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
final Text nameText = toolkit.createText(settingComposite, "", SWT.NONE);
nameText.setLayoutData(gd);
String name = smooksModelProvider.getSmooksGraphicsExt().getName();
@@ -275,7 +289,8 @@
toolkit.paintBordersFor(settingComposite);
- toolkit.createLabel(settingComposite, "Author : ");
+ toolkit.createLabel(settingComposite, "Author : ").setForeground(
+ toolkit.getColors().getColor(IFormColors.TITLE));
final Text authorText = toolkit.createText(settingComposite, "", SWT.NONE);
authorText.setLayoutData(gd);
@@ -291,6 +306,8 @@
}
});
+ toolkit.createLabel(settingComposite, "");
+
toolkit.paintBordersFor(settingComposite);
}
@@ -1195,32 +1212,21 @@
}
}
- private void createSmooksEditorNavigator(Composite mainComposite, FormToolkit toolkit) {
- Composite mainNavigatorComposite = toolkit.createComposite(mainComposite);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.verticalSpan = 5;
- mainNavigatorComposite.setLayoutData(gd);
-
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- gl.marginWidth = 0;
- gl.marginHeight = 0;
- mainNavigatorComposite.setLayout(gl);
-
- Section navigator = toolkit.createSection(mainNavigatorComposite, Section.DESCRIPTION | Section.TITLE_BAR);
- navigator.setText("Smooks Editor Navigator");
+ private void createNavigatorSection(Composite mainNavigatorComposite, FormToolkit toolkit, String title,
+ String navigatorFilePath) {
+ Section navigator = toolkit.createSection(mainNavigatorComposite, Section.TITLE_BAR);
+ navigator.setText(title);
navigator.setLayout(new FillLayout());
Composite navigatorComposite = toolkit.createComposite(navigator);
navigator.setClient(navigatorComposite);
- gd = new GridData(GridData.FILL_HORIZONTAL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.verticalAlignment = GridData.BEGINNING;
navigator.setLayoutData(gd);
FormText formText = toolkit.createFormText(navigatorComposite, true);
StringBuffer buf = new StringBuffer();
- InputStream inputStream = this.getClass().getResourceAsStream(
- "/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm");
+ InputStream inputStream = this.getClass().getResourceAsStream(navigatorFilePath);
BufferedReader reader = null;
if (inputStream != null) {
try {
@@ -1265,8 +1271,28 @@
navigatorComposite.setLayout(new GridLayout());
gd = new GridData(GridData.FILL_BOTH);
formText.setLayoutData(gd);
+
+ toolkit.createLabel(navigatorComposite, "");
}
+ private void createSmooksEditorNavigator(Composite mainComposite, FormToolkit toolkit) {
+ Composite mainNavigatorComposite = toolkit.createComposite(mainComposite);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.verticalSpan = 5;
+ mainNavigatorComposite.setLayoutData(gd);
+
+ GridLayout gl = new GridLayout();
+ // gl.numColumns = 2;
+ gl.marginWidth = 0;
+ gl.marginHeight = 0;
+ mainNavigatorComposite.setLayout(gl);
+
+ createNavigatorSection(mainNavigatorComposite, toolkit, "Configuring Smooks Input",
+ "/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm");
+ createNavigatorSection(mainNavigatorComposite, toolkit, "Configuring Message Filter(s)",
+ "/org/jboss/tools/smooks/configuration/navigator/MessageFilterNavigator.htm");
+ }
+
protected void activeNavigatorLink(String href) {
if (href == null)
return;
@@ -1323,13 +1349,15 @@
private void createDefaultSection(Composite parent, FormToolkit toolkit) {
ModelPanelCreator defaultSettingPanelCreator = getDefaultSettingPanelCreator();
EObject model = getSmooksResourceList();
- AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) smooksModelProvider
- .getEditingDomain();
- IItemPropertySource itemPropertySource = (IItemPropertySource) editingDomain.getAdapterFactory().adapt(model,
- IItemPropertySource.class);
if (model != null) {
- defaultSettingPanelCreator.createModelPanel(model, toolkit, parent, itemPropertySource,
- smooksModelProvider, getEditor());
+ AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) smooksModelProvider
+ .getEditingDomain();
+ IItemPropertySource itemPropertySource = (IItemPropertySource) editingDomain.getAdapterFactory().adapt(
+ model, IItemPropertySource.class);
+ if (model != null) {
+ defaultSettingPanelCreator.createModelPanel(model, toolkit, parent, itemPropertySource,
+ smooksModelProvider, getEditor());
+ }
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationReaderPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationReaderPage.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationReaderPage.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -51,7 +51,7 @@
public class SmooksConfigurationReaderPage extends SmooksConfigurationFormPage {
private CheckboxTableViewer inputDataViewer;
-
+
boolean lockCheck = false;
public SmooksConfigurationReaderPage(FormEditor editor, String id, String title) {
@@ -169,7 +169,8 @@
inputDataViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
- if(lockCheck) return;
+ if (lockCheck)
+ return;
boolean checked = event.getChecked();
InputType inputType = (InputType) event.getElement();
List<ParamType> params = inputType.getParam();
@@ -218,7 +219,7 @@
}
}
}
-
+
EObject ext = inputType;
while (ext != null && !(ext instanceof SmooksGraphicsExtType)) {
ext = ext.eContainer();
@@ -227,11 +228,12 @@
if (ext != null && ext instanceof SmooksGraphicsExtType) {
List<ISmooksGraphChangeListener> listeners = ((SmooksGraphicsExtType) ext).getChangeListeners();
for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
- ISmooksGraphChangeListener smooksGraphChangeListener = (ISmooksGraphChangeListener) iterator.next();
+ ISmooksGraphChangeListener smooksGraphChangeListener = (ISmooksGraphChangeListener) iterator
+ .next();
smooksGraphChangeListener.inputTypeChanged((SmooksGraphicsExtType) ext);
}
}
-
+
}
});
TableColumn header = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
@@ -306,7 +308,8 @@
}
public void inputTypeChanged(SmooksGraphicsExtType extType) {
- inputDataViewer.refresh();
+ if (inputDataViewer != null)
+ inputDataViewer.refresh();
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -24,6 +24,8 @@
import org.eclipse.ui.PartInitException;
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
import org.jboss.tools.smooks.graphical.editors.SmooksGraphicalEditorPart;
+import org.jboss.tools.smooks.model.graphics.ext.ISmooksGraphChangeListener;
+import org.jboss.tools.smooks.model.graphics.ext.SmooksGraphicsExtType;
/**
*
@@ -39,8 +41,10 @@
private SmooksConfigurationOverviewPage overViewPage;
- private SmooksConfigurationFormPage readerPage;
+ private SmooksConfigurationFormPage readerPage1;
+ private SmooksReaderFormPage readerPage;
+
private ISelection selection;
private Collection<ISelectionChangedListener> selectionChangeListener = new ArrayList<ISelectionChangedListener>();
@@ -55,6 +59,7 @@
overViewPage = createSmooksConfigurationOverviewPage();
addValidateListener(overViewPage);
addSourceSynchronizeListener(overViewPage);
+ addSmooksGraphExtetionListener(overViewPage);
try {
int index = this.addPage(overViewPage);
setPageText(index, "Overview");
@@ -62,12 +67,23 @@
e.printStackTrace();
}
- readerPage = createSmooksConfigurationReaderPage();
+// readerPage1 = createSmooksConfigurationReaderPage();
+// addValidateListener(readerPage1);
+// addSourceSynchronizeListener(readerPage1);
+// try {
+// int index = this.addPage(readerPage1);
+// setPageText(index, "Reader");
+// } catch (PartInitException e) {
+// e.printStackTrace();
+// }
+
+ readerPage = new SmooksReaderFormPage(this, "reader_page" , "Input");
addValidateListener(readerPage);
addSourceSynchronizeListener(readerPage);
+ addSmooksGraphExtetionListener(readerPage);
try {
int index = this.addPage(readerPage);
- setPageText(index, "Reader");
+ setPageText(index, "Input");
} catch (PartInitException e) {
e.printStackTrace();
}
@@ -75,6 +91,7 @@
configurationPage = createSmooksConfigurationFormPage();
addValidateListener(configurationPage);
addSourceSynchronizeListener(configurationPage);
+ addSmooksGraphExtetionListener(configurationPage);
try {
int index = this.addPage(configurationPage);
setPageText(index, "Message Filter");
@@ -82,20 +99,21 @@
e.printStackTrace();
}
- graphicalPage = new SmooksGraphicalEditorPart(this);
- addSourceSynchronizeListener(graphicalPage);
- try {
- int index = this.addPage(graphicalPage, getEditorInput());
- setPageText(index, "Graph");
- } catch (PartInitException e) {
- e.printStackTrace();
- }
+// graphicalPage = new SmooksGraphicalEditorPart(this);
+// addSourceSynchronizeListener(graphicalPage);
+// addSmooksGraphExtetionListener(graphicalPage);
+// try {
+// int index = this.addPage(graphicalPage, getEditorInput());
+// setPageText(index, "Graph");
+// } catch (PartInitException e) {
+// e.printStackTrace();
+// }
super.addPages();
}
private SmooksConfigurationReaderPage createSmooksConfigurationReaderPage() {
- return new SmooksConfigurationReaderPage(this, "reader_page", "Reader Page");
+ return new SmooksConfigurationReaderPage(this, "reader_page1", "Reader Page");
}
private SmooksConfigurationOverviewPage createSmooksConfigurationOverviewPage() {
@@ -179,4 +197,18 @@
l.selectionChanged(new SelectionChangedEvent(this, getSelection()));
}
}
+
+ public void addSmooksGraphExtetionListener(ISmooksGraphChangeListener listener){
+ SmooksGraphicsExtType ex = getSmooksGraphicsExt();
+ if(ex != null){
+ ex.addSmooksGraphChangeListener(listener);
+ }
+ }
+
+ public void removeSmooksGraphExtetionListener(ISmooksGraphChangeListener listener){
+ SmooksGraphicsExtType ex = getSmooksGraphicsExt();
+ if(ex != null){
+ ex.removeSmooksGraphChangeListener(listener);
+ }
+ }
}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,1052 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ICheckStateProvider;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.ScrolledPageBook;
+import org.eclipse.ui.forms.widgets.Section;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.configuration.editors.wizard.StructuredDataSelectionWizard;
+import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
+import org.jboss.tools.smooks.model.csv.CsvPackage;
+import org.jboss.tools.smooks.model.csv.CsvReader;
+import org.jboss.tools.smooks.model.csv12.CSV12Reader;
+import org.jboss.tools.smooks.model.csv12.Csv12Package;
+import org.jboss.tools.smooks.model.edi.EDIReader;
+import org.jboss.tools.smooks.model.edi.EdiPackage;
+import org.jboss.tools.smooks.model.edi12.EDI12Reader;
+import org.jboss.tools.smooks.model.edi12.Edi12Package;
+import org.jboss.tools.smooks.model.graphics.ext.GraphFactory;
+import org.jboss.tools.smooks.model.graphics.ext.GraphPackage;
+import org.jboss.tools.smooks.model.graphics.ext.ISmooksGraphChangeListener;
+import org.jboss.tools.smooks.model.graphics.ext.InputType;
+import org.jboss.tools.smooks.model.graphics.ext.ParamType;
+import org.jboss.tools.smooks.model.graphics.ext.SmooksGraphicsExtType;
+import org.jboss.tools.smooks.model.json.JsonPackage;
+import org.jboss.tools.smooks.model.json.JsonReader;
+import org.jboss.tools.smooks.model.json12.Json12Package;
+import org.jboss.tools.smooks.model.json12.Json12Reader;
+import org.jboss.tools.smooks.model.smooks.AbstractReader;
+import org.jboss.tools.smooks.model.smooks.DocumentRoot;
+import org.jboss.tools.smooks.model.smooks.ReaderType;
+import org.jboss.tools.smooks.model.smooks.SmooksPackage;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksReaderFormPage extends FormPage implements ISmooksModelValidateListener, ISmooksGraphChangeListener,
+ ISourceSynchronizeListener {
+
+ 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;
+
+ public SmooksReaderFormPage(FormEditor editor, String id, String title) {
+ super(editor, id, title);
+ ((SmooksMultiFormEditor) editor).getSmooksGraphicsExt().addSmooksGraphChangeListener(this);
+ }
+
+ public SmooksReaderFormPage(String id, String title) {
+ super(id, title);
+ }
+
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ final ScrolledForm form = managedForm.getForm();
+ FormToolkit toolkit = managedForm.getToolkit();
+ toolkit.decorateFormHeading(form.getForm());
+ form.setText("Input");
+ // // create master details UI
+ // createMasterDetailBlock(managedForm);
+ Composite leftComposite = toolkit.createComposite(form.getBody());
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.widthHint = 700;
+ leftComposite.setLayoutData(gd);
+
+ Composite rightComposite = toolkit.createComposite(form.getBody());
+ gd = new GridData(GridData.FILL_BOTH);
+ rightComposite.setLayoutData(gd);
+
+ GridLayout lgl = new GridLayout();
+ lgl.marginWidth = 0;
+ lgl.marginHeight = 0;
+ leftComposite.setLayout(lgl);
+
+ GridLayout rgl = new GridLayout();
+ rgl.marginWidth = 0;
+ rgl.marginHeight = 0;
+ rightComposite.setLayout(rgl);
+
+ createReaderSection(toolkit, leftComposite);
+ createInputDataSection(toolkit, rightComposite);
+ createReaderConfigSection(toolkit, leftComposite);
+ createInputModelViewerSection(toolkit, rightComposite);
+
+ handleReaderCombo(readerCombo);
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginHeight = 13;
+ gridLayout.numColumns = 2;
+ gridLayout.horizontalSpacing = 20;
+ gridLayout.makeColumnsEqualWidth = true;
+ form.getBody().setLayout(gridLayout);
+ }
+
+ private void createInputModelViewerSection(FormToolkit toolkit, Composite parent) {
+ Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.DESCRIPTION);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ // gd.verticalAlignment = GridData.BEGINNING;
+ section.setLayoutData(gd);
+ section.setText("Input Model View");
+ section.setDescription("View the XML structure model of the input data");
+ FillLayout flayout = new FillLayout();
+ section.setLayout(flayout);
+
+ Composite mainContainer = toolkit.createComposite(section);
+ GridLayout gl = new GridLayout();
+ mainContainer.setLayout(gl);
+ section.setClient(mainContainer);
+
+ Hyperlink refreshLink = toolkit.createHyperlink(mainContainer, "Refresh Input Model Viewer", SWT.NONE);
+ refreshLink.addHyperlinkListener(new IHyperlinkListener() {
+
+ public void linkExited(HyperlinkEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void linkActivated(HyperlinkEvent e) {
+ refreshInputModelView();
+ }
+ });
+
+ Composite viewerContainer = toolkit.createComposite(mainContainer);
+ gd = new GridData(GridData.FILL_BOTH);
+ viewerContainer.setLayoutData(gd);
+
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.marginHeight = 1;
+ fillLayout.marginWidth = 1;
+ viewerContainer.setBackground(GraphicsConstants.BORDER_CORLOER);
+ viewerContainer.setLayout(fillLayout);
+ inputModelViewer = new TreeViewer(viewerContainer, SWT.NONE);
+ inputModelViewer.setContentProvider(new CompoundStructuredDataContentProvider());
+ inputModelViewer.setLabelProvider(new CompoundStructuredDataLabelProvider());
+ List<Object> inputList = generateInputData();
+ inputModelViewer.setInput(inputList);
+ inputModelViewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ }
+ });
+ inputModelViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ // currentSelection = ((IStructuredSelection)
+ // event.getSelection()).getFirstElement();
+ }
+ });
+ SmooksUIUtils.expandSelectorViewer(inputList, inputModelViewer);
+
+ }
+
+ protected List<Object> generateInputData() {
+ Object obj = ((SmooksMultiFormEditor) getEditor()).getSmooksModel();
+ SmooksResourceListType resourceList = null;
+ if (obj instanceof DocumentRoot) {
+ resourceList = ((DocumentRoot) obj).getSmooksResourceList();
+ }
+ return SelectorCreationDialog.generateInputData(getSmooksGraphicsExtType(), resourceList);
+ }
+
+ private void createReaderConfigSection(FormToolkit toolkit, Composite parent) {
+ Section section = toolkit.createSection(parent, Section.TITLE_BAR);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ section.setLayoutData(gd);
+ section.setText("Input Configuration");
+ section.setDescription("Configurate the input data");
+ FillLayout flayout = new FillLayout();
+ section.setLayout(flayout);
+
+ ScrolledPageBook pageBook = new ScrolledPageBook(section);
+ pageBook.setBackground(toolkit.getColors().getBackground());
+ section.setClient(pageBook);
+
+ readerConfigComposite = pageBook.createPage(pageBook);
+ pageBook.showPage(pageBook);
+
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ readerConfigComposite.setLayout(gl);
+
+ initReaderConfigSection();
+ }
+
+ private void createReaderSection(FormToolkit toolkit, Composite parent) {
+ Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.DESCRIPTION);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.verticalAlignment = GridData.BEGINNING;
+ section.setLayoutData(gd);
+ section.setText("Input Type");
+ section.setDescription("Select the input type");
+ FillLayout flayout = new FillLayout();
+ section.setLayout(flayout);
+
+ Composite mainComposite = toolkit.createComposite(section);
+ section.setClient(mainComposite);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ mainComposite.setLayout(gl);
+
+ toolkit.createLabel(mainComposite, "Input Type : ");
+
+ readerCombo = new Combo(mainComposite, SWT.NONE | SWT.READ_ONLY);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ readerCombo.setLayoutData(gd);
+
+ toolkit.createLabel(mainComposite, " ");
+
+ bindingReaderCombo();
+
+ initReaderCombo();
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ readerCombo.setLayoutData(gd);
+
+ toolkit.paintBordersFor(mainComposite);
+ }
+
+ private void initReaderConfigSection() {
+ Object reader = getCurrentReaderModel();
+ String type = getSmooksGraphicsExtType().getInputType();
+ if (reader instanceof EObject && type != null) {
+ SmooksResourceListType list = getSmooksConfigResourceList();
+ createReaderPanel((EObject) list.getAbstractReader().get(0));
+ } else {
+ disposeCompositeControls(readerConfigComposite, null);
+ }
+ }
+
+ private void selectCorrectReaderItem(Object reader) {
+ for (int i = 0; i < readerTypeList.size(); i++) {
+ Object r = readerTypeList.get(i);
+ if (r instanceof EObject) {
+ if (r.getClass() == reader.getClass()) {
+ readerCombo.select(i);
+ break;
+ }
+ }
+ }
+ }
+
+ private String getCurrentReaderType() {
+ Object reader = getCurrentReaderModel();
+ 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);
+
+ if (obj instanceof CsvReader || obj instanceof CSV12Reader) {
+ return SmooksModelUtils.INPUT_TYPE_CSV;
+ }
+ if (obj instanceof EDIReader || obj instanceof EDI12Reader) {
+ return SmooksModelUtils.INPUT_TYPE_EDI_1_1;
+ }
+ if (obj instanceof JsonReader || obj instanceof Json12Reader) {
+ return SmooksModelUtils.INPUT_TYPE_JSON_1_1;
+ }
+ if (obj instanceof ReaderType) {
+ return SmooksModelUtils.INPUT_TYPE_CUSTOME;
+ }
+ }
+ return null;
+ }
+
+ private void initReaderCombo() {
+ if (readerCombo == null)
+ return;
+ SmooksResourceListType rlist = getSmooksConfigResourceList();
+ if (rlist == null) {
+ readerCombo.select(-1);
+ return;
+ }
+ SmooksGraphicsExtType ext = getSmooksGraphicsExtType();
+ String inputType = ext.getInputType();
+
+ if (inputType == null) {
+ // for the first time to open the file.
+ if (rlist.getAbstractReader().isEmpty()) {
+ readerCombo.select(0);
+ return;
+ } else {
+ }
+ }
+ if (SmooksModelUtils.INPUT_TYPE_XML.equals(inputType)) {
+ readerCombo.select(1);
+ }
+ if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(inputType)) {
+ readerCombo.select(2);
+ }
+ if (SmooksModelUtils.INPUT_TYPE_XSD.equals(inputType)) {
+ readerCombo.select(3);
+ }
+
+ if (SmooksModelUtils.INPUT_TYPE_CSV.equals(inputType)) {
+ if (!rlist.getAbstractReader().isEmpty()) {
+ AbstractReader reader = rlist.getAbstractReader().get(0);
+ if (CsvReader.class.isInstance(reader) || CSV12Reader.class.isInstance(reader)) {
+ selectCorrectReaderItem(reader);
+ }
+ }
+ }
+ if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(inputType)) {
+ if (!rlist.getAbstractReader().isEmpty()) {
+ AbstractReader reader = rlist.getAbstractReader().get(0);
+ if (EDIReader.class.isInstance(reader) || EDI12Reader.class.isInstance(reader)) {
+ selectCorrectReaderItem(reader);
+ }
+ }
+ }
+ if (SmooksModelUtils.INPUT_TYPE_JSON_1_1.equals(inputType)) {
+ if (!rlist.getAbstractReader().isEmpty()) {
+ AbstractReader reader = rlist.getAbstractReader().get(0);
+ if (JsonReader.class.isInstance(reader) || Json12Reader.class.isInstance(reader)) {
+ selectCorrectReaderItem(reader);
+ }
+ }
+ }
+ if (SmooksModelUtils.INPUT_TYPE_CUSTOME.equals(inputType)) {
+ if (!rlist.getAbstractReader().isEmpty()) {
+ AbstractReader reader = rlist.getAbstractReader().get(0);
+ if (ReaderType.class.isInstance(reader)) {
+ selectCorrectReaderItem(reader);
+ }
+ }
+ }
+ 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);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ }
+
+ private Object createReaderEntry(Object reader, boolean clone) {
+ if (clone) {
+ reader = EcoreUtil.copy((EObject) reader);
+ }
+ if (reader instanceof CsvReader) {
+ return FeatureMapUtil.createEntry(CsvPackage.Literals.CSV_DOCUMENT_ROOT__READER, reader);
+ }
+ if (reader instanceof CSV12Reader) {
+ return FeatureMapUtil.createEntry(Csv12Package.Literals.CSV12_DOCUMENT_ROOT__READER, reader);
+ }
+ if (reader instanceof EDIReader) {
+ return FeatureMapUtil.createEntry(EdiPackage.Literals.EDI_DOCUMENT_ROOT__READER, reader);
+ }
+ if (reader instanceof EDI12Reader) {
+ return FeatureMapUtil.createEntry(Edi12Package.Literals.EDI12_DOCUMENT_ROOT__READER, reader);
+ }
+ if (reader instanceof JsonReader) {
+ return FeatureMapUtil.createEntry(JsonPackage.Literals.JSON_DOCUMENT_ROOT__READER, reader);
+ }
+ if (reader instanceof Json12Reader) {
+ return FeatureMapUtil.createEntry(Json12Package.Literals.JSON12_DOCUMENT_ROOT__READER, reader);
+ }
+ if (reader instanceof ReaderType) {
+ return FeatureMapUtil.createEntry(SmooksPackage.Literals.DOCUMENT_ROOT__READER, reader);
+ }
+ return null;
+ }
+
+ private Command createRemoveReaderCommand() {
+ SmooksResourceListType rlist = getSmooksConfigResourceList();
+ List<AbstractReader> readerList = rlist.getAbstractReader();
+ CompoundCommand compoundCommand = new CompoundCommand();
+ for (Iterator<?> iterator = readerList.iterator(); iterator.hasNext();) {
+ AbstractReader abstractReader = (AbstractReader) iterator.next();
+ Object readerEntry = createReaderEntry(abstractReader, false);
+ if (readerEntry == null)
+ continue;
+ Command removeCommand = RemoveCommand.create(getEditingDomain(), rlist,
+ SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, readerEntry);
+ if (removeCommand.canExecute()) {
+ compoundCommand.append(removeCommand);
+ }
+ }
+ if (compoundCommand.isEmpty()) {
+ return null;
+ }
+ return compoundCommand;
+ }
+
+ private void readerChanged(Object reader) {
+
+ CompoundCommand compoundCommand = new CompoundCommand();
+ Command removeCommand = createRemoveReaderCommand();
+ if (removeCommand != null && removeCommand.canExecute()) {
+ compoundCommand.append(removeCommand);
+ }
+ if (readerConfigComposite != null) {
+ disposeCompositeControls(readerConfigComposite, null);
+ }
+ boolean hasRun = false;
+ 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);
+ }
+ if (!compoundCommand.isEmpty()) {
+ getEditingDomain().getCommandStack().execute(compoundCommand);
+ hasRun = true;
+ createReaderPanel((EObject) obj);
+ }
+ }
+
+ if (!hasRun) {
+ if (!compoundCommand.isEmpty()) {
+ getEditingDomain().getCommandStack().execute(compoundCommand);
+ }
+ }
+
+ deactiveAllInputFile();
+
+ if (inputDataViewer != null) {
+ inputDataViewer.refresh();
+ }
+ refreshInputModelView();
+ }
+
+ private void deactiveAllInputFile() {
+ SmooksGraphicsExtType ext = getSmooksGraphicsExtType();
+ List<InputType> inputList = ext.getInput();
+ for (Iterator<?> iterator = inputList.iterator(); iterator.hasNext();) {
+ InputType inputType = (InputType) iterator.next();
+ setInputDataActiveStatus(false, inputType);
+ }
+ }
+
+ private void createReaderPanel(EObject reader) {
+ disposeCompositeControls(readerConfigComposite, null);
+ try {
+ ModelPanelCreator modelPanelCreator = getModelPanelCreator();
+ IItemPropertySource ps = (IItemPropertySource) getEditingDomain().getAdapterFactory().adapt(reader,
+ IItemPropertySource.class);
+ modelPanelCreator.createModelPanel(reader, getManagedForm().getToolkit(), readerConfigComposite, ps,
+ (ISmooksModelProvider) getEditor(), getEditor());
+ readerConfigComposite.getParent().layout();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private ModelPanelCreator getModelPanelCreator() {
+ if (modelPanelCreator == null) {
+ modelPanelCreator = new ModelPanelCreator();
+ }
+ return modelPanelCreator;
+ }
+
+ private void bindingReaderCombo() {
+ if (readerCombo == null)
+ return;
+
+ readerCombo.removeAll();
+ readerTypeList.clear();
+
+ readerCombo.add("No Input");
+ readerTypeList.add(new NullReader());
+ readerCombo.add("XML");
+ readerTypeList.add(new XMLReader());
+ readerCombo.add("Java");
+ readerTypeList.add(new JavaReader());
+ readerCombo.add("XSD/WSDL");
+ readerTypeList.add(new XSDReader());
+
+ SmooksResourceListType resourceList = getSmooksConfigResourceList();
+
+ if(resourceList == null){
+ return;
+ }
+
+ AdapterFactoryEditingDomain editDomain = getEditingDomain();
+ IEditingDomainItemProvider provider = (IEditingDomainItemProvider) editDomain.getAdapterFactory().adapt(
+ resourceList, IEditingDomainItemProvider.class);
+ Collection<?> collections = provider.getNewChildDescriptors(resourceList, editDomain, null);
+
+ SmooksGraphicsExtType extType = getSmooksGraphicsExtType();
+ String version = extType.getPlatformVersion();
+ OnlyReaderViewerFilter filter = new OnlyReaderViewerFilter();
+ for (Iterator<?> iterator = collections.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ if (object instanceof CommandParameter) {
+ Object value = ((CommandParameter) object).getValue();
+
+ value = AdapterFactoryEditingDomain.unwrap(value);
+
+ if (filter.select(null, null, value)) {
+ if (SmooksUIUtils.isUnSupportElement(version, (EObject) value)) {
+ continue;
+ }
+
+ IItemLabelProvider lp = (IItemLabelProvider) editDomain.getAdapterFactory().adapt(value,
+ IItemLabelProvider.class);
+ String text = lp.getText(value);
+ readerCombo.add(text);
+ readerTypeList.add(value);
+ }
+ }
+ }
+ }
+
+ private void setInputDataActiveStatus(boolean active, InputType inputType) {
+ List<ParamType> params = inputType.getParam();
+ boolean newOne = true;
+ for (Iterator<?> iterator = params.iterator(); iterator.hasNext();) {
+ ParamType paramType = (ParamType) iterator.next();
+ if (SmooksModelUtils.PARAM_NAME_ACTIVED.equals(paramType.getName())) {
+ paramType.setValue(String.valueOf(active));
+ newOne = false;
+ break;
+ }
+ }
+ if (newOne) {
+ ParamType p = GraphFactory.eINSTANCE.createParamType();
+ p.setName(SmooksModelUtils.PARAM_NAME_ACTIVED);
+ p.setValue(String.valueOf(active));
+ inputType.getParam().add(p);
+ }
+ SmooksGraphicsExtType ext = getSmooksGraphicsExtType();
+ if (ext != null) {
+ List<ISmooksGraphChangeListener> listeners = ((SmooksGraphicsExtType) ext).getChangeListeners();
+ for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
+ ISmooksGraphChangeListener smooksGraphChangeListener = (ISmooksGraphChangeListener) iterator.next();
+ smooksGraphChangeListener.inputTypeChanged((SmooksGraphicsExtType) ext);
+ }
+ }
+ }
+
+ protected void createInputDataSection(FormToolkit toolkit, Composite parent) {
+ Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.DESCRIPTION);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ section.setLayoutData(gd);
+ section.setText("Input Data");
+ section.setDescription("Add a file to be the input data");
+ FillLayout flayout = new FillLayout();
+ section.setLayout(flayout);
+
+ Composite mainComposite = toolkit.createComposite(section, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ mainComposite.setLayout(gl);
+ section.setClient(mainComposite);
+
+ Composite tableComposite = toolkit.createComposite(mainComposite, SWT.NONE);
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.marginHeight = 1;
+ fillLayout.marginWidth = 1;
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 200;
+ tableComposite.setLayoutData(gd);
+ tableComposite.setBackground(GraphicsConstants.BORDER_CORLOER);
+ tableComposite.setLayout(fillLayout);
+
+ inputDataViewer = CheckboxTableViewer.newCheckList(tableComposite, SWT.MULTI | SWT.FULL_SELECTION);
+ // inputDataViewer.set
+ inputDataViewer.setCheckStateProvider(new ICheckStateProvider() {
+
+ public boolean isGrayed(Object element) {
+ return isIncorrectInputType((InputType) element);
+ }
+
+ public boolean isChecked(Object element) {
+ if (element instanceof InputType) {
+ List<ParamType> params = ((InputType) element).getParam();
+ for (Iterator<?> iterator = params.iterator(); iterator.hasNext();) {
+ ParamType paramType = (ParamType) iterator.next();
+ if (SmooksModelUtils.PARAM_NAME_ACTIVED.equals(paramType.getName())) {
+ String value = paramType.getValue();
+ if (value == null)
+ return false;
+ value = value.trim();
+ return "true".equalsIgnoreCase(value);
+ }
+ }
+ }
+ return false;
+ }
+ });
+ inputDataViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (lockCheck)
+ return;
+ boolean checked = event.getChecked();
+ InputType inputType = (InputType) event.getElement();
+ if (isIncorrectInputType(inputType)) {
+ lockCheck = true;
+ inputDataViewer.setChecked(inputType, false);
+ lockCheck = false;
+ return;
+ }
+ List<ParamType> params = inputType.getParam();
+
+ if (checked) {
+ boolean newOne = true;
+ for (Iterator<?> iterator = params.iterator(); iterator.hasNext();) {
+ ParamType paramType = (ParamType) iterator.next();
+ if (SmooksModelUtils.PARAM_NAME_ACTIVED.equals(paramType.getName())) {
+ paramType.setValue(String.valueOf(checked));
+ newOne = false;
+ break;
+ }
+ }
+ if (newOne) {
+ ParamType p = GraphFactory.eINSTANCE.createParamType();
+ p.setName(SmooksModelUtils.PARAM_NAME_ACTIVED);
+ p.setValue(String.valueOf(checked));
+ inputType.getParam().add(p);
+ }
+
+ Object[] checkedObjects = inputDataViewer.getCheckedElements();
+ for (int i = 0; i < checkedObjects.length; i++) {
+ InputType type = (InputType) checkedObjects[i];
+ if (type == event.getElement())
+ continue;
+ List<ParamType> params1 = type.getParam();
+ for (Iterator<?> iterator = params1.iterator(); iterator.hasNext();) {
+ ParamType paramType = (ParamType) iterator.next();
+ if (SmooksModelUtils.PARAM_NAME_ACTIVED.equals(paramType.getName())) {
+ paramType.setValue(String.valueOf(!checked));
+ break;
+ }
+ }
+ lockCheck = true;
+ inputDataViewer.setChecked(type, false);
+ lockCheck = false;
+ }
+
+ } else {
+ for (Iterator<?> iterator = params.iterator(); iterator.hasNext();) {
+ ParamType paramType = (ParamType) iterator.next();
+ if (SmooksModelUtils.PARAM_NAME_ACTIVED.equals(paramType.getName())) {
+ paramType.setValue(String.valueOf(checked));
+ break;
+ }
+ }
+ }
+
+ SmooksGraphicsExtType ext = getSmooksGraphicsExtType();
+ if (ext != null) {
+ List<ISmooksGraphChangeListener> listeners = ((SmooksGraphicsExtType) ext).getChangeListeners();
+ for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
+ ISmooksGraphChangeListener smooksGraphChangeListener = (ISmooksGraphChangeListener) iterator
+ .next();
+ smooksGraphChangeListener.inputTypeChanged((SmooksGraphicsExtType) ext);
+ }
+ }
+
+ }
+ });
+ TableColumn header = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
+ header.setText("Type");
+ header.setWidth(100);
+ TableColumn pathColumn = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
+ pathColumn.setText("Path");
+ pathColumn.setWidth(300);
+
+ // TableColumn extColumn = new TableColumn(inputDataViewer.getTable(),
+ // SWT.NONE);
+ // extColumn.setText("Extension Paramers");
+ // extColumn.setWidth(400);
+ inputDataViewer.setContentProvider(new ExtentionInputContentProvider());
+ inputDataViewer.setLabelProvider(new InputDataViewerLabelProvider());
+ inputDataViewer.getTable().setHeaderVisible(true);
+ inputDataViewer.getTable().setLinesVisible(true);
+ SmooksGraphicsExtType extType = getSmooksGraphicsExtType();
+ if (extType != null) {
+ inputDataViewer.setInput(extType);
+ }
+ Composite buttonComposite = toolkit.createComposite(mainComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_VERTICAL);
+ buttonComposite.setLayoutData(gd);
+ GridLayout l = new GridLayout();
+ buttonComposite.setLayout(l);
+
+ Button addButton = toolkit.createButton(buttonComposite, "Add", SWT.FLAT);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ addButton.setLayoutData(gd);
+ addButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ showInputDataWizard();
+ }
+
+ });
+
+ Button removeButton = toolkit.createButton(buttonComposite, "Delete", SWT.FLAT);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ removeButton.setLayoutData(gd);
+ removeButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) inputDataViewer.getSelection();
+ if (selection != null) {
+ SmooksGraphicsExtType extType = getSmooksGraphicsExtType();
+ if (extType != null) {
+ boolean canSave = false;
+ Object[] objs = selection.toArray();
+ for (int i = 0; i < objs.length; i++) {
+ Object obj = objs[i];
+ if (obj instanceof InputType) {
+ extType.getInput().remove(obj);
+ canSave = true;
+ }
+ }
+
+ if (!canSave)
+ return;
+
+ List<ISmooksGraphChangeListener> listeners = extType.getChangeListeners();
+ for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
+ ISmooksGraphChangeListener smooksGraphChangeListener = (ISmooksGraphChangeListener) iterator
+ .next();
+ smooksGraphChangeListener.inputTypeChanged(extType);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ protected SmooksGraphicsExtType getSmooksGraphicsExtType() {
+ SmooksGraphicsExtType extType = ((SmooksMultiFormEditor) getEditor()).getSmooksGraphicsExt();
+ return extType;
+ }
+
+ protected AdapterFactoryEditingDomain getEditingDomain() {
+ AdapterFactoryEditingDomain editDomain = (AdapterFactoryEditingDomain) ((SmooksMultiFormEditor) this
+ .getEditor()).getEditingDomain();
+ return editDomain;
+ }
+
+ protected SmooksResourceListType getSmooksConfigResourceList() {
+ EObject doc = ((SmooksMultiFormEditor) this.getEditor()).getSmooksModel();
+ if (doc instanceof DocumentRoot) {
+ return ((DocumentRoot) doc).getSmooksResourceList();
+ }
+ return null;
+ }
+
+ protected void showInputDataWizard() {
+ StructuredDataSelectionWizard wizard = new StructuredDataSelectionWizard();
+ wizard.setInput(getEditorInput());
+ wizard.setSite(getEditorSite());
+ wizard.setForcePreviousAndNextButtons(true);
+ StructuredDataSelectionWizardDailog dialog = new StructuredDataSelectionWizardDailog(
+ getEditorSite().getShell(), wizard, getSmooksGraphicsExtType(), (SmooksMultiFormEditor) getEditor());
+ if (dialog.show() == Dialog.OK) {
+ SmooksGraphicsExtType extType = getSmooksGraphicsExtType();
+ String type = dialog.getType();
+ String path = dialog.getPath();
+ Properties pros = dialog.getProperties();
+ SmooksUIUtils.recordInputDataInfomation(null, extType, type, path, pros);
+ }
+ }
+
+ private void refreshInputModelView() {
+ if (inputModelViewer != null) {
+ List<Object> input = generateInputData();
+ inputModelViewer.setInput(input);
+ SmooksUIUtils.expandSelectorViewer(input, inputModelViewer);
+ }
+ }
+
+ public void inputTypeChanged(SmooksGraphicsExtType extType) {
+ if (inputDataViewer != null)
+ inputDataViewer.refresh();
+ refreshInputModelView();
+ }
+
+ protected void disposeCompositeControls(Composite composite, Control[] ignoreControl) {
+ if (composite != null) {
+ Control[] children = composite.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if (ignoreControl != null) {
+ for (int j = 0; j < ignoreControl.length; j++) {
+ if (child == ignoreControl[j]) {
+ continue;
+ }
+ }
+ }
+ child.dispose();
+ child = null;
+ }
+ }
+ }
+
+ private Object getCurrentReaderModel() {
+ if (readerCombo == null || readerCombo.isDisposed())
+ return null;
+ int index = readerCombo.getSelectionIndex();
+ if (index < 0)
+ return null;
+ return readerTypeList.get(index);
+ }
+
+ public void sourceChange(Object model) {
+ SmooksResourceListType list = getSmooksConfigResourceList();
+ SmooksGraphicsExtType ext = getSmooksGraphicsExtType();
+ if (list == null) {
+ ext.setInputType(null, false);
+ } else {
+ if (list.getAbstractReader().isEmpty()) {
+ ext.setInputType(null, false);
+ } else {
+ AbstractReader reader = list.getAbstractReader().get(0);
+ if (CsvReader.class.isInstance(reader) || CSV12Reader.class.isInstance(reader)) {
+ ext.setInputType(SmooksModelUtils.INPUT_TYPE_CSV);
+ }
+ if (EDIReader.class.isInstance(reader) || EDI12Reader.class.isInstance(reader)) {
+ ext.setInputType(SmooksModelUtils.INPUT_TYPE_EDI_1_1);
+ }
+ if (JsonReader.class.isInstance(reader) || Json12Reader.class.isInstance(reader)) {
+ ext.setInputType(SmooksModelUtils.INPUT_TYPE_JSON_1_1);
+ }
+ if (ReaderType.class.isInstance(reader)) {
+ ext.setInputType(SmooksModelUtils.INPUT_TYPE_CUSTOME);
+ }
+ }
+
+ }
+ bindingReaderCombo();
+ initReaderCombo();
+ initReaderConfigSection();
+ deactiveAllInputFile();
+ if (inputDataViewer != null) {
+ inputDataViewer.refresh();
+ }
+ refreshInputModelView();
+ }
+
+ public void graphChanged(SmooksGraphicsExtType extType) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void graphPropertyChange(EStructuralFeature featre, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void validateEnd(List<Diagnostic> diagnosticResult) {
+ Object model = getCurrentReaderModel();
+ if (model == null)
+ return;
+ if (model instanceof EObject) {
+ this.getModelPanelCreator().markPropertyUI(diagnosticResult, (EObject) model);
+ }
+ }
+
+ public void validateStart() {
+
+ }
+
+ 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;
+
+ 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;
+ }
+ }
+
+ if (reader instanceof EObject) {
+ Object obj = ((EObject) reader);
+ obj = AdapterFactoryEditingDomain.unwrap(obj);
+ if (obj instanceof EDIReader || obj instanceof EDI12Reader) {
+ if (!SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(type)) {
+ return true;
+ }
+ }
+ if (obj instanceof CsvReader || obj instanceof CSV12Reader) {
+ if (!SmooksModelUtils.INPUT_TYPE_CSV.equals(type)) {
+ return true;
+ }
+ }
+ if (obj instanceof JsonReader || obj instanceof Json12Reader) {
+ if (!SmooksModelUtils.INPUT_TYPE_JSON_1_1.equals(type)) {
+ return true;
+ }
+ }
+ if (obj instanceof ReaderType) {
+ if (!SmooksModelUtils.INPUT_TYPE_CUSTOME.equals(type)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ 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)) {
+ // return ColorConstants.darkGray;
+ }
+ return null;
+ }
+
+ public Color getForeground(Object element, int columnIndex) {
+ if (isIncorrectInputType((InputType) element)) {
+ return ColorConstants.lightGray;
+ }
+ return null;
+ }
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVDataParser.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVDataParser.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVDataParser.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -29,10 +29,8 @@
import org.jboss.tools.smooks.model.csv.CsvReader;
import org.jboss.tools.smooks.model.csv12.CSV12Reader;
import org.jboss.tools.smooks.model.graphics.ext.InputType;
-import org.jboss.tools.smooks.model.graphics.ext.ParamType;
import org.jboss.tools.smooks.model.smooks.AbstractReader;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
-import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
import org.milyn.Smooks;
import org.milyn.csv.CSVReaderConfigurator;
import org.milyn.payload.StringResult;
@@ -99,85 +97,30 @@
public TagList parseCSV(InputStream stream, InputType inputType, SmooksResourceListType resourceList)
throws DocumentException, ParserConfigurationException {
- String type = inputType.getType();
- List<ParamType> paramList = inputType.getParam();
- String fields = null;
- String separator = null;
- String quoteChar = null;
- String skiplines = null;
- String encoding = null;
- String rootName = null;
- String recordName = null;
-
- for (Iterator<?> iterator = paramList.iterator(); iterator.hasNext();) {
- ParamType paramType = (ParamType) iterator.next();
- if (paramType.getName().equals(LINK_CSV_READER)) {
- if (paramType.getValue().equalsIgnoreCase("true") && resourceList != null) {
- List<AbstractReader> readers = resourceList.getAbstractReader();
- int count = 0;
- int index = -1;
- for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
- AbstractReader abstractReader = (AbstractReader) iterator2.next();
- if (SmooksModelUtils.INPUT_TYPE_CSV_1_1.equals(type)) {
- if (abstractReader instanceof CsvReader) {
- count++;
- if (index == -1) {
- index = readers.indexOf(abstractReader);
- }
- }
- }
-
- if (SmooksModelUtils.INPUT_TYPE_CSV_1_2.equals(type)) {
- if (abstractReader instanceof CSV12Reader) {
- count++;
- if (index == -1) {
- index = readers.indexOf(abstractReader);
- }
- }
- }
- }
-
- if (count > 1) {
- // throw new
- // RuntimeException("The smooks config file should have only one JSON reader");
- }
- if (index != -1) {
- return parseCSV(stream, readers.get(index));
- // return parseJsonFile(stream, (JsonReader)
- // readers.get(index));
- }
-
+ List<AbstractReader> readers = resourceList.getAbstractReader();
+ int count = 0;
+ int index = -1;
+ for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
+ AbstractReader abstractReader = (AbstractReader) iterator2.next();
+ if (abstractReader instanceof CsvReader || abstractReader instanceof CSV12Reader) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
}
}
- if (paramType.getName().equals(FIELDS)) {
- fields = paramType.getValue();
- try {
- // fields = fields.replace(';', ',');
- } catch (Throwable t) {
- }
- }
- if (paramType.getName().equals(SEPARATOR)) {
- separator = paramType.getValue();
- }
- if (paramType.getName().equals(SKIPLINES)) {
- skiplines = paramType.getValue();
- }
- if (paramType.getName().equals(QUOTECHAR)) {
- quoteChar = paramType.getValue();
- }
- if (paramType.getName().equals(ENCODING)) {
- encoding = paramType.getValue();
- }
- if (paramType.getName().equals(ROOT_ELEMENT_NAME)) {
- rootName = paramType.getValue();
- }
- if (paramType.getName().equals(RECORD_NAME)) {
- recordName = paramType.getValue();
- }
}
- return this.parseCSV(stream, fields, rootName, recordName, separator, quoteChar, skiplines, encoding);
+ if (count > 1) {
+ // throw new
+ // RuntimeException("The smooks config file should have only one JSON reader");
+ }
+ if (index != -1) {
+ return parseCSV(stream, readers.get(index));
+ // return parseJsonFile(stream, (JsonReader)
+ // readers.get(index));
+ }
+ return null;
}
public TagList parseCSV(String filePath, String fields, String rootName, String recordName, String separator,
@@ -224,9 +167,9 @@
if (recordName != null) {
readerConfigurator.setRecordElementName(recordName);
}
-
+
readerConfigurator.setEncoding(Charset.forName(encoding));
-// readerConfigurator.setIndent(indent)
+ // readerConfigurator.setIndent(indent)
smooks.setReaderConfig(readerConfigurator);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVInputDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVInputDataWizard.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVInputDataWizard.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -46,22 +46,22 @@
public CSVInputDataWizard() {
super();
- this.setWindowTitle("CSV Input Data Wizard (version 1.1)");
+ this.setWindowTitle("CSV Input Data Wizard");
}
@Override
public void addPages() {
- if (configPage == null) {
- configPage = new CSVDataConfigurationWizardPage("CSV Configurations Page");
- configPage.setSmooksResourceList(resourceList);
- }
+// if (configPage == null) {
+// configPage = new CSVDataConfigurationWizardPage("CSV Configurations Page");
+// configPage.setSmooksResourceList(resourceList);
+// }
if (pathPage == null) {
- pathPage = new CSVDataPathWizardPage("CSV Path Page", new String[] {},configPage);
+ pathPage = new CSVDataPathWizardPage("CSV Path Page", new String[] {"csv"},configPage);
}
this.addPage(pathPage);
- this.addPage(configPage);
+// this.addPage(configPage);
super.addPages();
}
@@ -123,6 +123,9 @@
}
public boolean canFinish() {
+ if(pathPage != null){
+ return pathPage.isPageComplete();
+ }
if (configPage != null && pathPage != null) {
if (configPage.isPageComplete() && pathPage.isPageComplete())
return true;
@@ -149,7 +152,7 @@
* IStructuredDataSelectionWizard#getInputDataTypeID()
*/
public String getInputDataTypeID() {
- return SmooksModelUtils.INPUT_TYPE_CSV_1_1;
+ return SmooksModelUtils.INPUT_TYPE_CSV;
}
/*
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CsvReaderUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CsvReaderUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CsvReaderUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -10,13 +10,35 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.csv;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Item;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.model.csv.CsvPackage;
@@ -25,6 +47,14 @@
*/
public class CsvReaderUICreator extends PropertyUICreator {
+ private TableViewer fieldsViewer;
+
+ private List<FieldText> fieldsList = new ArrayList<FieldText>();
+
+ private Button addButton;
+
+ private Button removeButton;
+
/*
* (non-Javadoc)
*
@@ -34,9 +64,10 @@
* org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
* org.eclipse.emf.ecore.EAttribute)
*/
- public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent, IItemPropertyDescriptor propertyDescriptor, Object model,
- EAttribute feature, ISmooksModelProvider formEditor, IEditorPart part) {
-
+ public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
+ ISmooksModelProvider formEditor, IEditorPart part) {
+
if (feature == CsvPackage.eINSTANCE.getCsvReader_Encoding()) {
}
if (feature == CsvPackage.eINSTANCE.getCsvReader_Fields()) {
@@ -48,7 +79,244 @@
if (feature == CsvPackage.eINSTANCE.getCsvReader_SkipLines()) {
}
- return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor,part);
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
}
+ @Override
+ public boolean ignoreProperty(EAttribute feature) {
+ if (feature.equals(CsvPackage.Literals.CSV_READER__FIELDS)) {
+ return true;
+ }
+ return super.ignoreProperty(feature);
+ }
+
+ @Override
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, ISmooksModelProvider formEditor, IEditorPart editorPart) {
+ createFiledsComposite(editingdomain, toolkit, parent, model, formEditor);
+ return super.createExtendUIOnBottom(editingdomain, toolkit, parent, model, formEditor, editorPart);
+ }
+
+ private void createFiledsComposite(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
+ Composite parent, Object model, ISmooksModelProvider formEditor) {
+ fieldsList.clear();
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 200;
+ gd.horizontalSpan = 2;
+ Group fieldsComposite = new Group(parent, SWT.NONE);
+ fieldsComposite.setBackground(toolkit.getColors().getBackground());
+ fieldsComposite.setText("Fields");
+ fieldsComposite.setLayoutData(gd);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ fieldsComposite.setLayout(gl);
+
+ IItemPropertySource propertySource = (IItemPropertySource) editingdomain.getAdapterFactory().adapt(model,
+ IItemPropertySource.class);
+ final IItemPropertyDescriptor descriptor = propertySource.getPropertyDescriptor(model,
+ CsvPackage.Literals.CSV_READER__FIELDS);
+
+ final Object readOnlyMoel = model;
+
+ String fields = (String) SmooksUIUtils.getEditValue(descriptor, model);
+
+ gd = new GridData(GridData.FILL_BOTH);
+ fieldsViewer = new TableViewer(fieldsComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+ fieldsViewer.getControl().setLayoutData(gd);
+ fieldsViewer.getTable().setLinesVisible(true);
+ fieldsViewer.setContentProvider(new FieldsContentProvider());
+ fieldsViewer.setLabelProvider(new FieldsLabelProvider());
+
+ CellEditor fieldCellEditor = new TextCellEditor(fieldsViewer.getTable(), SWT.BORDER);
+
+ fieldsViewer.getTable().setLinesVisible(true);
+
+ fieldsViewer.setCellEditors(new CellEditor[] { fieldCellEditor });
+
+ fieldsViewer.setColumnProperties(new String[] { "field" });
+
+ fieldsViewer.setCellModifier(new ICellModifier() {
+
+ public void modify(Object element, String property, Object value) {
+ Object el = null;
+ if (element instanceof Item) {
+ el = ((Item) element).getData();
+ }
+ if (el == null)
+ return;
+ if (el instanceof FieldText && value instanceof String) {
+ if (property.equals("field")) {
+
+ if (value.toString().equals(((FieldText) el).getText())) {
+ return;
+ }
+ ((FieldText) el).setText(value.toString());
+
+ fieldsViewer.refresh(el);
+ setFieldsValue(readOnlyMoel, descriptor);
+ }
+
+ }
+ }
+
+ public Object getValue(Object element, String property) {
+ if (element instanceof FieldText) {
+ if (property.equals("field")) {
+ return ((FieldText) element).getText();
+ }
+ }
+
+ return null;
+ }
+
+ public boolean canModify(Object element, String property) {
+ if (element instanceof FieldText) {
+ if (property.equals("field")) {
+ return true;
+ }
+ }
+ return false;
+ }
+ });
+ if (fields == null) {
+ fields = "";
+ }
+ fillFieldsList(fields);
+ fieldsViewer.setInput(fieldsList);
+
+ Composite buttonComposite = toolkit.createComposite(fieldsComposite);
+ gd = new GridData(GridData.FILL_VERTICAL);
+ gd.widthHint = 100;
+ buttonComposite.setLayoutData(gd);
+
+ GridLayout bgl = new GridLayout();
+ buttonComposite.setLayout(bgl);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ addButton = new Button(buttonComposite, SWT.NONE);
+ addButton.setLayoutData(gd);
+ addButton.setText("Add Field");
+
+ removeButton = new Button(buttonComposite, SWT.NONE);
+ removeButton.setLayoutData(gd);
+ removeButton.setText("Remove");
+
+ this.addButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ addButton.setEnabled(false);
+ try {
+ FieldText field = new FieldText("field");
+ fieldsList.add(field);
+ fieldsViewer.refresh();
+ setFieldsValue(readOnlyMoel, descriptor);
+ } catch (Throwable t) {
+
+ } finally {
+ addButton.setEnabled(true);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ this.removeButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection s = (IStructuredSelection) fieldsViewer.getSelection();
+ fieldsList.removeAll(s.toList());
+ fieldsViewer.refresh();
+ setFieldsValue(readOnlyMoel, descriptor);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+ }
+
+ private void setFieldsValue(Object model, IItemPropertyDescriptor ps) {
+ String fieldsString = "";
+ for (int i = 0; i < fieldsList.size(); i++) {
+ FieldText fieldText = fieldsList.get(i);
+ fieldsString += fieldText.getText();
+ if (i < fieldsList.size() - 1) {
+ fieldsString += ",";
+ }
+ }
+ ps.setPropertyValue(model, fieldsString);
+ }
+
+ private void fillFieldsList(String fieldsString) {
+ if (fieldsString == null)
+ return;
+ String input = fieldsString.toString();
+ input = input.trim();
+ if (input.indexOf(",") != -1) {
+ String[] fields = input.split(",");
+ if (fields != null && fields.length > 0) {
+ for (int i = 0; i < fields.length; i++) {
+ String field = fields[i];
+ if (field != null) {
+ field = field.trim();
+ fieldsList.add(new FieldText(field));
+ }
+ }
+ }
+ }else{
+ fieldsList.add(new FieldText(input));
+ }
+ }
+
+ private class FieldsLabelProvider extends LabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof FieldText) {
+ return ((FieldText) element).getText();
+ }
+ return super.getText(element);
+ }
+
+ }
+
+ private class FieldsContentProvider implements IStructuredContentProvider {
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List<?>) {
+ return ((List<?>) inputElement).toArray();
+ }
+ return new Object[] {};
+ }
+ }
+
+ private class FieldText {
+ private String text = null;
+
+ public FieldText(String t) {
+ setText(t);
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ }
}
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12InputDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12InputDataWizard.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12InputDataWizard.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -45,25 +45,26 @@
private CSV12DataConfigurationWizardPage configPage;
private CSV12DataPathWizardPage pathPage;
-
+
public CSV12InputDataWizard() {
super();
- this.setWindowTitle("CSV Input Data Wizard (version 1.2)");
+ this.setWindowTitle("CSV Input Data Wizard");
}
@Override
public void addPages() {
- if (configPage == null) {
- configPage = new CSV12DataConfigurationWizardPage("CSV Configurations Page");
- configPage.setSmooksResourceList(resourceList);
- }
-
+ // if (configPage == null) {
+ // configPage = new
+ // CSV12DataConfigurationWizardPage("CSV Configurations Page");
+ // configPage.setSmooksResourceList(resourceList);
+ // }
+
if (pathPage == null) {
- pathPage = new CSV12DataPathWizardPage("CSV Path Page", new String[] {},configPage);
+ pathPage = new CSV12DataPathWizardPage("CSV Path Page", new String[] { "csv" }, configPage);
}
-
+
this.addPage(pathPage);
- this.addPage(configPage);
+ // this.addPage(configPage);
super.addPages();
}
@@ -93,22 +94,22 @@
}
if (skip >= 0) {
- reader.setSkipLines(BigInteger.valueOf(skip));
+ reader.setSkipLines(BigInteger.valueOf(skip));
}
String quoteChar = configPage.getQuoteChar();
reader.setQuote(quoteChar);
-
+
String rootName = configPage.getRootName();
- if(rootName != null){
+ if (rootName != null) {
reader.setRootElementName(rootName);
}
-
+
String recordName = configPage.getRecordName();
- if(recordName != null){
+ if (recordName != null) {
reader.setRecordElementName(recordName);
}
-
+
String indent = configPage.getIndent();
if (indent != null && indent.length() != 0) {
boolean indentValue = Boolean.valueOf(indent).booleanValue();
@@ -138,8 +139,11 @@
}
return true;
}
-
+
public boolean canFinish() {
+ if (pathPage != null) {
+ return pathPage.isPageComplete();
+ }
if (configPage != null && pathPage != null) {
if (configPage.isPageComplete() && pathPage.isPageComplete())
return true;
@@ -166,7 +170,7 @@
* IStructuredDataSelectionWizard#getInputDataTypeID()
*/
public String getInputDataTypeID() {
- return SmooksModelUtils.INPUT_TYPE_CSV_1_2;
+ return SmooksModelUtils.INPUT_TYPE_CSV;
}
/*
@@ -223,12 +227,12 @@
if (quoteChar != null && quoteChar.length() != 0) {
pro.put(CSVDataParser.QUOTECHAR, quoteChar);
}
-
+
String rootName = configPage.getRootName();
if (rootName != null && rootName.length() != 0) {
pro.put(CSVDataParser.ROOT_ELEMENT_NAME, rootName);
}
-
+
String recordName = configPage.getRecordName();
if (recordName != null && recordName.length() != 0) {
pro.put(CSVDataParser.RECORD_NAME, recordName);
@@ -238,7 +242,7 @@
if (skiplines != null && skiplines.length() != 0) {
pro.put(CSVDataParser.SKIPLINES, skiplines);
}
-
+
String indent = configPage.getIndent();
if (indent != null && indent.length() != 0) {
pro.setProperty(JsonInputDataParser.INDENT, indent);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderBindingPropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderBindingPropertyUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderBindingPropertyUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.csv12;
+
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
@@ -58,13 +59,13 @@
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
ISmooksModelProvider formEditor, IEditorPart part) {
if (feature == Csv12Package.Literals.BINDING__CLASS) {
- return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model);
+ return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model , formEditor);
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
}
protected AttributeFieldEditPart createBeanClassTextWithButton(Composite composite, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final Object model) {
- return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model);
+ final IItemPropertyDescriptor propertyDescriptor, final Object model , ISmooksModelProvider provider) {
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model , provider);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderMapBindingPropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderMapBindingPropertyUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderMapBindingPropertyUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -57,13 +57,13 @@
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
ISmooksModelProvider formEditor, IEditorPart part) {
if (feature == Csv12Package.Literals.BINDING__CLASS) {
- return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model);
+ return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model , formEditor);
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
}
protected AttributeFieldEditPart createBeanClassTextWithButton(Composite composite, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final Object model) {
- return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model);
+ final IItemPropertyDescriptor propertyDescriptor, final Object model , ISmooksModelProvider provider) {
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model , provider);
}
}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderUICreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,357 @@
+/*******************************************************************************
+ * 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.csv12;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
+import org.jboss.tools.smooks.configuration.editors.ModelMultiChildrenTabelPanelCreator;
+import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.csv12.CSV12Reader;
+import org.jboss.tools.smooks.model.csv12.Csv12Package;
+
+/**
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
+ */
+public class Csv12ReaderUICreator extends PropertyUICreator {
+
+ private TableViewer fieldsViewer;
+
+ private List<FieldText> fieldsList = new ArrayList<FieldText>();
+
+ private Button addButton;
+
+ private Button removeButton;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.IPropertyUICreator#
+ * createPropertyUI(org.eclipse.ui.forms.widgets.FormToolkit,
+ * org.eclipse.swt.widgets.Composite,
+ * org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
+ * org.eclipse.emf.ecore.EAttribute)
+ */
+ public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
+ ISmooksModelProvider formEditor, IEditorPart part) {
+
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
+ }
+
+ @Override
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, ISmooksModelProvider formEditor, IEditorPart editorPart) {
+ createFiledsComposite(editingdomain, toolkit, parent, model, formEditor);
+ createParametersGroup(parent, (CSV12Reader) model, toolkit, formEditor, editorPart);
+ return super.createExtendUIOnBottom(editingdomain, toolkit, parent, model, formEditor, editorPart);
+ }
+
+ @Override
+ public boolean ignoreProperty(EAttribute feature) {
+ if (feature.equals(Csv12Package.Literals.CSV12_READER__FIELDS)) {
+ return true;
+ }
+ return super.ignoreProperty(feature);
+ }
+
+ private void createParametersGroup(Composite parent, CSV12Reader reader, FormToolkit toolkit,
+ ISmooksModelProvider modelProvider, IEditorPart editorPart) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Features");
+ group.setBackground(ColorConstants.white);
+ FillLayout fl = new FillLayout();
+ group.setLayout(fl);
+ final AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) modelProvider
+ .getEditingDomain();
+ final Shell shell = parent.getShell();
+ IEditingDomainItemProvider p = (IEditingDomainItemProvider) editingDomain.getAdapterFactory().adapt(reader,
+ IEditingDomainItemProvider.class);
+ final Collection<?> children = p.getNewChildDescriptors(reader, editingDomain, null);
+
+ ModelMultiChildrenTabelPanelCreator creator = new ModelMultiChildrenTabelPanelCreator(shell, children,
+ editingDomain, modelProvider, reader, toolkit, editorPart) {
+ //
+ // @Override
+ // protected EStructuralFeature getChildFeature(CommandParameter
+ // model) {
+ // return model.getEStructuralFeature();
+ // }
+ //
+ // @Override
+ // protected EObject getNewChildInstance(CommandParameter feature2)
+ // {
+ // return feature2.getEValue();
+ // }
+
+ };
+
+ creator.createChildrenTablePanel(group);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 180;
+ gd.horizontalSpan = 2;
+ group.setLayoutData(gd);
+ }
+
+ private void createFiledsComposite(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
+ Composite parent, Object model, ISmooksModelProvider formEditor) {
+ fieldsList.clear();
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 150;
+ gd.horizontalSpan = 2;
+ Group fieldsComposite = new Group(parent, SWT.NONE);
+ fieldsComposite.setBackground(toolkit.getColors().getBackground());
+ fieldsComposite.setText("Fields");
+ fieldsComposite.setLayoutData(gd);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ fieldsComposite.setLayout(gl);
+
+ IItemPropertySource propertySource = (IItemPropertySource) editingdomain.getAdapterFactory().adapt(model,
+ IItemPropertySource.class);
+ final IItemPropertyDescriptor descriptor = propertySource.getPropertyDescriptor(model,
+ Csv12Package.Literals.CSV12_READER__FIELDS);
+
+ final Object readOnlyMoel = model;
+
+ String fields = (String) SmooksUIUtils.getEditValue(descriptor, model);
+
+ gd = new GridData(GridData.FILL_BOTH);
+ fieldsViewer = new TableViewer(fieldsComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+ fieldsViewer.getControl().setLayoutData(gd);
+ fieldsViewer.getTable().setLinesVisible(true);
+ fieldsViewer.setContentProvider(new FieldsContentProvider());
+ fieldsViewer.setLabelProvider(new FieldsLabelProvider());
+
+ CellEditor fieldCellEditor = new TextCellEditor(fieldsViewer.getTable(), SWT.BORDER);
+
+ fieldsViewer.getTable().setLinesVisible(true);
+
+ fieldsViewer.setCellEditors(new CellEditor[] { fieldCellEditor });
+
+ fieldsViewer.setColumnProperties(new String[] { "field" });
+
+ fieldsViewer.setCellModifier(new ICellModifier() {
+
+ public void modify(Object element, String property, Object value) {
+ Object el = null;
+ if (element instanceof Item) {
+ el = ((Item) element).getData();
+ }
+ if (el == null)
+ return;
+ if (el instanceof FieldText && value instanceof String) {
+ if (property.equals("field")) {
+
+ if (value.toString().equals(((FieldText) el).getText())) {
+ return;
+ }
+ ((FieldText) el).setText(value.toString());
+
+ fieldsViewer.refresh(el);
+ setFieldsValue(readOnlyMoel, descriptor);
+ }
+
+ }
+ }
+
+ public Object getValue(Object element, String property) {
+ if (element instanceof FieldText) {
+ if (property.equals("field")) {
+ return ((FieldText) element).getText();
+ }
+ }
+
+ return null;
+ }
+
+ public boolean canModify(Object element, String property) {
+ if (element instanceof FieldText) {
+ if (property.equals("field")) {
+ return true;
+ }
+ }
+ return false;
+ }
+ });
+ if (fields == null) {
+ fields = "";
+ }
+ fillFieldsList(fields);
+ fieldsViewer.setInput(fieldsList);
+
+ Composite buttonComposite = toolkit.createComposite(fieldsComposite);
+ gd = new GridData(GridData.FILL_VERTICAL);
+ gd.widthHint = 100;
+ buttonComposite.setLayoutData(gd);
+
+ GridLayout bgl = new GridLayout();
+ buttonComposite.setLayout(bgl);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ addButton = new Button(buttonComposite, SWT.NONE);
+ addButton.setLayoutData(gd);
+ addButton.setText("Add Field");
+
+ removeButton = new Button(buttonComposite, SWT.NONE);
+ removeButton.setLayoutData(gd);
+ removeButton.setText("Remove");
+
+ this.addButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ // addButton.setEnabled(false);
+ try {
+ FieldText field = new FieldText("field");
+ fieldsList.add(field);
+ fieldsViewer.refresh();
+ setFieldsValue(readOnlyMoel, descriptor);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ } finally {
+ // addButton.setEnabled(true);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ this.removeButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection s = (IStructuredSelection) fieldsViewer.getSelection();
+ fieldsList.removeAll(s.toList());
+ fieldsViewer.refresh();
+ setFieldsValue(readOnlyMoel, descriptor);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+ }
+
+ private void setFieldsValue(Object model, IItemPropertyDescriptor ps) {
+ String fieldsString = "";
+ for (int i = 0; i < fieldsList.size(); i++) {
+ FieldText fieldText = fieldsList.get(i);
+ fieldsString += fieldText.getText();
+ if (i < fieldsList.size() - 1) {
+ fieldsString += ",";
+ }
+ }
+ ps.setPropertyValue(model, fieldsString);
+ }
+
+ private void fillFieldsList(String fieldsString) {
+ if (fieldsString == null)
+ return;
+ String input = fieldsString.toString();
+ input = input.trim();
+ if (input.indexOf(",") != -1) {
+ String[] fields = input.split(",");
+ if (fields != null && fields.length > 0) {
+ for (int i = 0; i < fields.length; i++) {
+ String field = fields[i];
+ if (field != null) {
+ field = field.trim();
+ fieldsList.add(new FieldText(field));
+ }
+ }
+ }
+ }else{
+ fieldsList.add(new FieldText(input));
+ }
+ }
+
+ private class FieldsLabelProvider extends LabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof FieldText) {
+ return ((FieldText) element).getText();
+ }
+ return super.getText(element);
+ }
+
+ }
+
+ private class FieldsContentProvider implements IStructuredContentProvider {
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List<?>) {
+ return ((List<?>) inputElement).toArray();
+ }
+ return new Object[] {};
+ }
+ }
+
+ private class FieldText {
+ private String text = null;
+
+ public FieldText(String t) {
+ setText(t);
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderUICreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataParser.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataParser.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataParser.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -108,58 +108,32 @@
public TagList parseEDIFile(InputStream stream, InputType inputType, SmooksResourceListType resourceList)
throws IOException, DocumentException {
-
- List<ParamType> paramList = inputType.getParam();
- String encoding = null;
- String mappingModel = null;
- String validate = null;
- String type = inputType.getType();
-
- for (Iterator<?> iterator = paramList.iterator(); iterator.hasNext();) {
- ParamType paramType = (ParamType) iterator.next();
- if (paramType.getName().equals(USE_AVAILABEL_READER)) {
- if (paramType.getValue().equalsIgnoreCase("true") && resourceList != null) {
- List<AbstractReader> readers = resourceList.getAbstractReader();
- int count = 0;
- int index = -1;
- for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
- AbstractReader abstractReader = (AbstractReader) iterator2.next();
- if (abstractReader instanceof EDIReader && SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(type)) {
- count++;
- if (index == -1) {
- index = readers.indexOf(abstractReader);
- }
- }
- if (abstractReader instanceof EDI12Reader && SmooksModelUtils.INPUT_TYPE_EDI_1_2.equals(type)) {
- count++;
- if (index == -1) {
- index = readers.indexOf(abstractReader);
- }
- }
- }
-
- if (count > 1) {
- // throw new
- // RuntimeException("The smooks config file should have only one JSON reader");
- }
- if (index != -1) {
- return parseEDIFile(stream, (EObject) readers.get(index));
- }
-
+// String encoding = null;
+// String mappingModel = null;
+// String validate = null;
+// String type = inputType.getType();
+ List<AbstractReader> readers = resourceList.getAbstractReader();
+ int count = 0;
+ int index = -1;
+ for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
+ AbstractReader abstractReader = (AbstractReader) iterator2.next();
+ if (abstractReader instanceof EDIReader || abstractReader instanceof EDI12Reader) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
}
}
- if (paramType.getName().equals(ENCODING)) {
- encoding = paramType.getValue();
- }
- if (paramType.getName().equals(MAPPING_MODEL)) {
- mappingModel = paramType.getValue();
- }
- if (paramType.getName().equals(VALIDATE)) {
- validate = paramType.getValue();
- }
}
- return parseEDIFile(stream, mappingModel, encoding,validate, resourceList);
+ if (count > 1) {
+ // throw new
+ // RuntimeException("The smooks config file should have only one JSON reader");
+ }
+ if (index != -1) {
+ return parseEDIFile(stream, (EObject) readers.get(index));
+ }
+ return null;
+// return parseEDIFile(stream, mappingModel, encoding,validate, resourceList);
}
public TagList parseEDIFile(InputStream ediInputStream, EObject readerObj, IProject project) throws IOException,
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -49,11 +49,12 @@
@Override
public void addPages() {
- ediFilePage = new EDIDataPathWizardPage("EDI Data Page", new String[] {});
+ ediFilePage = new EDIDataPathWizardPage("EDI Data Page", new String[] {"edi"});
this.addPage(ediFilePage);
- mappingFilePage = new EDIMappingDataPathWizardPage("EDI Config Page", null);
- this.addPage(mappingFilePage);
+ // mappingFilePage = new EDIMappingDataPathWizardPage("EDI Config Page",
+ // null);
+ // this.addPage(mappingFilePage);
super.addPages();
}
@@ -64,20 +65,22 @@
*/
@Override
public boolean performFinish() {
- if (mappingFilePage.isUseAvaliableReader()) {
- return true;
+ if (mappingFilePage != null) {
+ if (mappingFilePage.isUseAvaliableReader()) {
+ return true;
+ }
+ if (mappingFilePage.isCreateNewReader()) {
+ String encoding = mappingFilePage.getEncoding();
+ String path = mappingFilePage.getFilePath();
+ EDIReader reader = EdiFactory.eINSTANCE.createEDIReader();
+ reader.setEncoding(encoding);
+ reader.setMappingModel(path);
+ Command command = AddCommand.create(editingDomain, resourceList,
+ SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
+ .createEntry(EdiPackage.Literals.EDI_DOCUMENT_ROOT__READER, reader));
+ editingDomain.getCommandStack().execute(command);
+ }
}
- if (mappingFilePage.isCreateNewReader()) {
- String encoding = mappingFilePage.getEncoding();
- String path = mappingFilePage.getFilePath();
- EDIReader reader = EdiFactory.eINSTANCE.createEDIReader();
- reader.setEncoding(encoding);
- reader.setMappingModel(path);
- Command command = AddCommand.create(editingDomain, resourceList,
- SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
- .createEntry(EdiPackage.Literals.EDI_DOCUMENT_ROOT__READER, reader));
- editingDomain.getCommandStack().execute(command);
- }
return true;
}
@@ -111,14 +114,17 @@
*/
public Properties getProperties() {
Properties pros = new Properties();
- if (mappingFilePage.isUseAvaliableReader() || mappingFilePage.isCreateNewReader()) {
- pros.put(EDIDataParser.USE_AVAILABEL_READER, "true");
- return pros;
+ if (mappingFilePage != null) {
+ if (mappingFilePage.isUseAvaliableReader() || mappingFilePage.isCreateNewReader()) {
+ pros.put(EDIDataParser.USE_AVAILABEL_READER, "true");
+ return pros;
+ }
+
+ String encoding = mappingFilePage.getEncoding();
+ pros.put(EDIDataParser.ENCODING, encoding);
+ String path = mappingFilePage.getFilePath();
+ pros.put(EDIDataParser.MAPPING_MODEL, path);
}
- String encoding = mappingFilePage.getEncoding();
- pros.put(EDIDataParser.ENCODING, encoding);
- String path = mappingFilePage.getFilePath();
- pros.put(EDIDataParser.MAPPING_MODEL, path);
return pros;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/BindingsPropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/BindingsPropertyUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/BindingsPropertyUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -98,7 +98,7 @@
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
ISmooksModelProvider formEditor, IEditorPart part) {
if (feature == JavabeanPackage.eINSTANCE.getBindingsType_Class()) {
- return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model);
+ return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model , formEditor);
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
}
@@ -295,7 +295,7 @@
}
protected AttributeFieldEditPart createBeanClassTextWithButton(Composite composite, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final Object model) {
- return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model);
+ final IItemPropertyDescriptor propertyDescriptor, final Object model , ISmooksModelProvider provider) {
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model , provider);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBean12PropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBean12PropertyUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBean12PropertyUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -103,7 +103,7 @@
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
ISmooksModelProvider formEditor, IEditorPart part) {
if (feature == Javabean12Package.eINSTANCE.getBeanType_Class()) {
- return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model);
+ return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model , formEditor);
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
}
@@ -300,7 +300,7 @@
}
protected AttributeFieldEditPart createBeanClassTextWithButton(Composite composite, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final Object model) {
- return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model);
+ final IItemPropertyDescriptor propertyDescriptor, final Object model , ISmooksModelProvider provider) {
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model , provider);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -59,6 +59,9 @@
}
public boolean canFinish() {
+ if(pathPage != null){
+ return pathPage.isPageComplete();
+ }
if (configPage != null && pathPage != null) {
if (configPage.isPageComplete() && pathPage.isPageComplete())
return true;
@@ -75,15 +78,15 @@
public void addPages() {
super.addPages();
if (pathPage == null) {
- pathPage = new JsonDataPathWizardPage("Json Input Data Selection ", new String[] {});
+ pathPage = new JsonDataPathWizardPage("JSON Input Data Selection ", new String[] {"jsn"});
}
- if (configPage == null) {
- configPage = new JsonDataConfiguraitonWizardPage("Json data configuration page");
- configPage.setSmooksResourceList(resourceList);
- }
+// if (configPage == null) {
+// configPage = new JsonDataConfiguraitonWizardPage("Json data configuration page");
+// configPage.setSmooksResourceList(resourceList);
+// }
this.addPage(pathPage);
- this.addPage(configPage);
+// this.addPage(configPage);
}
/*
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonReaderUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonReaderUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonReaderUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -10,15 +10,28 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.json;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
+import org.jboss.tools.smooks.configuration.editors.ModelChildrenTablePanelCreator;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.json.JsonFactory;
import org.jboss.tools.smooks.model.json.JsonPackage;
+import org.jboss.tools.smooks.model.json.JsonReader;
/**
* @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
@@ -54,4 +67,40 @@
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
}
+ @Override
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, ISmooksModelProvider formEditor, IEditorPart editorPart) {
+ if (model instanceof JsonReader) {
+ EObject keyMap = ((JsonReader) model).getKeyMap();
+ if (keyMap != null) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Key Maps");
+ group.setBackground(ColorConstants.white);
+ FillLayout fl = new FillLayout();
+ group.setLayout(fl);
+
+ ModelChildrenTablePanelCreator creator = new ModelChildrenTablePanelCreator(formEditor, keyMap,
+ toolkit, editorPart) {
+
+ @Override
+ protected EStructuralFeature getChildrenFeature() {
+ return JsonPackage.Literals.KEY_MAP__KEY;
+ }
+
+ @Override
+ protected EObject newChildModel() {
+ return JsonFactory.eINSTANCE.createKey();
+ }
+ };
+ creator.createChildrenTablePanel(group);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 200;
+ gd.horizontalSpan = 2;
+ group.setLayoutData(gd);
+ }
+ }
+
+ return super.createExtendUIOnBottom(editingdomain, toolkit, parent, model, formEditor, editorPart);
+ }
+
}
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -55,10 +55,13 @@
public Json12DataWizard() {
super();
- this.setWindowTitle("JSON Input Data Wizard (version 1.2)");
+ this.setWindowTitle("JSON Input Data Wizard");
}
public boolean canFinish() {
+ if(pathPage != null){
+ return pathPage.isPageComplete();
+ }
if (configPage != null && pathPage != null) {
if (configPage.isPageComplete() && pathPage.isPageComplete())
return true;
@@ -78,12 +81,12 @@
pathPage = new Json12DataPathWizardPage("Json Input Data Selection ", new String[] {});
}
- if (configPage == null) {
- configPage = new Json12DataConfiguraitonWizardPage("Json data configuration page");
- configPage.setSmooksResourceList(resourceList);
- }
+// if (configPage == null) {
+// configPage = new Json12DataConfiguraitonWizardPage("Json data configuration page");
+// configPage.setSmooksResourceList(resourceList);
+// }
this.addPage(pathPage);
- this.addPage(configPage);
+// this.addPage(configPage);
}
/*
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12ReaderUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12ReaderUICreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12ReaderUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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.json12;
+
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
+import org.jboss.tools.smooks.configuration.editors.ModelChildrenTablePanelCreator;
+import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.json12.Json12Factory;
+import org.jboss.tools.smooks.model.json12.Json12Package;
+import org.jboss.tools.smooks.model.json12.Json12Reader;
+
+/**
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
+ */
+public class Json12ReaderUICreator extends PropertyUICreator {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.IPropertyUICreator#
+ * createPropertyUI(org.eclipse.ui.forms.widgets.FormToolkit,
+ * org.eclipse.swt.widgets.Composite,
+ * org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
+ * org.eclipse.emf.ecore.EAttribute)
+ */
+ public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
+ ISmooksModelProvider formEditor, IEditorPart part) {
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
+ }
+
+ @Override
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, ISmooksModelProvider formEditor, IEditorPart editorPart) {
+ if (model instanceof Json12Reader) {
+ EObject keyMap = ((Json12Reader) model).getKeyMap();
+ if (keyMap != null) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Key Maps");
+ group.setBackground(ColorConstants.white);
+ FillLayout fl = new FillLayout();
+ group.setLayout(fl);
+
+ ModelChildrenTablePanelCreator creator = new ModelChildrenTablePanelCreator(formEditor, keyMap,
+ toolkit, editorPart) {
+
+ @Override
+ protected EStructuralFeature getChildrenFeature() {
+ return Json12Package.Literals.KEY_MAP__KEY;
+ }
+
+ @Override
+ protected EObject newChildModel() {
+ return Json12Factory.eINSTANCE.createKey();
+ }
+ };
+ creator.createChildrenTablePanel(group);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 200;
+ gd.horizontalSpan = 2;
+ group.setLayoutData(gd);
+ }
+ }
+
+ return super.createExtendUIOnBottom(editingdomain, toolkit, parent, model, formEditor, editorPart);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12ReaderUICreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/rule10/Rules10RulebaseUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/rule10/Rules10RulebaseUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/rule10/Rules10RulebaseUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -55,13 +55,13 @@
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
ISmooksModelProvider formEditor, IEditorPart part) {
if (feature == Rules10Package.Literals.RULE_BASE__PROVIDER) {
- return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model);
+ return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model , formEditor);
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
}
protected AttributeFieldEditPart createBeanClassTextWithButton(Composite composite, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final Object model) {
- return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model);
+ final IItemPropertyDescriptor propertyDescriptor, final Object model , ISmooksModelProvider provider) {
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model , provider);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ConditionTypeUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ConditionTypeUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ConditionTypeUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -47,18 +47,18 @@
*/
public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- ISmooksModelProvider formEditor,IEditorPart part) {
+ ISmooksModelProvider modelProvider,IEditorPart part) {
if (feature == SmooksPackage.eINSTANCE.getConditionType_Value()) {
}
if (feature == SmooksPackage.eINSTANCE.getConditionType_Evaluator()) {
- return SmooksUIUtils.createJavaTypeSearchFieldEditor(parent, toolkit, propertyDescriptor, (EObject) model);
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(parent, toolkit, propertyDescriptor, (EObject) model , modelProvider);
}
if (feature == SmooksPackage.eINSTANCE.getConditionType_Id()) {
}
if (feature == SmooksPackage.eINSTANCE.getConditionType_IdRef()) {
}
- return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor,part);
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, modelProvider,part);
}
/*
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ReaderTypeUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ReaderTypeUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ReaderTypeUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -10,14 +10,32 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.smooks;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
+import org.jboss.tools.smooks.configuration.editors.ContainerChildrenTablePanelCreator;
+import org.jboss.tools.smooks.configuration.editors.MultiContainerChildrenAddtionTablePanel;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.smooks.ReaderType;
+import org.jboss.tools.smooks.model.smooks.SmooksFactory;
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
/**
@@ -36,8 +54,8 @@
*/
public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- ISmooksModelProvider formEditor,IEditorPart part) {
- return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor,part);
+ ISmooksModelProvider formEditor, IEditorPart part) {
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
}
@Override
@@ -47,5 +65,135 @@
}
return super.isJavaTypeFeature(attribute);
}
-
+
+ @Override
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, ISmooksModelProvider formEditor, IEditorPart editorPart) {
+ if (model instanceof ReaderType) {
+ createHandlerGroup(parent, (ReaderType) model, toolkit, formEditor, editorPart);
+ createFeaturesGroup(parent, (ReaderType) model, toolkit, formEditor, editorPart);
+ createParametersGroup(parent, (ReaderType) model, toolkit, formEditor, editorPart);
+ }
+
+ return super.createExtendUIOnBottom(editingdomain, toolkit, parent, model, formEditor, editorPart);
+ }
+
+ private void createParametersGroup(Composite parent, ReaderType reader, FormToolkit toolkit,
+ ISmooksModelProvider modelProvider, IEditorPart editorPart) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Parameters");
+ group.setBackground(ColorConstants.white);
+ FillLayout fl = new FillLayout();
+ group.setLayout(fl);
+
+ ContainerChildrenTablePanelCreator creator = new ContainerChildrenTablePanelCreator(modelProvider, reader,
+ toolkit, editorPart) {
+
+ @Override
+ protected EObject newContainerModel() {
+ return SmooksFactory.eINSTANCE.createParamsType();
+ }
+
+ @Override
+ protected EStructuralFeature getChildrenFeature() {
+ return SmooksPackage.Literals.PARAMS_TYPE__PARAM;
+ }
+
+ @Override
+ protected EObject newChildModel() {
+ return SmooksFactory.eINSTANCE.createParamType();
+ }
+ };
+ creator.setParentModel(reader.getParams());
+ creator.setContainerFeature(SmooksPackage.Literals.READER_TYPE__PARAMS);
+ creator.createChildrenTablePanel(group);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 180;
+ gd.horizontalSpan = 2;
+ group.setLayoutData(gd);
+ }
+
+ private void createFeaturesGroup(Composite parent, ReaderType reader, FormToolkit toolkit,
+ ISmooksModelProvider modelProvider, IEditorPart editorPart) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Features");
+ group.setBackground(ColorConstants.white);
+ FillLayout fl = new FillLayout();
+ group.setLayout(fl);
+ final AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) modelProvider
+ .getEditingDomain();
+ final Shell shell = parent.getShell();
+ Object temp = SmooksFactory.eINSTANCE.createFeaturesType();
+ IEditingDomainItemProvider p = (IEditingDomainItemProvider) editingDomain.getAdapterFactory().adapt(temp,
+ IEditingDomainItemProvider.class);
+ final Collection<?> children = p.getNewChildDescriptors(temp, editingDomain, null);
+
+ MultiContainerChildrenAddtionTablePanel creator = new MultiContainerChildrenAddtionTablePanel(shell, children,
+ editingDomain, modelProvider, reader, toolkit, editorPart) {
+
+ @Override
+ protected EStructuralFeature getChildFeature(CommandParameter cp) {
+ return cp.getEStructuralFeature();
+ }
+
+ @Override
+ protected EObject getNewChildInstance(CommandParameter cp) {
+ Object feature = cp.getEStructuralFeature();
+ if (feature.equals(SmooksPackage.Literals.FEATURES_TYPE__SET_ON))
+ return SmooksFactory.eINSTANCE.createSetOnType();
+ if (feature.equals(SmooksPackage.Literals.FEATURES_TYPE__SET_OFF))
+ return SmooksFactory.eINSTANCE.createSetOffType();
+ return null;
+ }
+
+ @Override
+ protected EObject newContainerModel() {
+ return SmooksFactory.eINSTANCE.createFeaturesType();
+ }
+
+ };
+ creator.setParentModel(reader.getFeatures());
+ creator.setContainerFeature(SmooksPackage.Literals.READER_TYPE__FEATURES);
+ creator.createChildrenTablePanel(group);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 180;
+ gd.horizontalSpan = 2;
+ group.setLayoutData(gd);
+ }
+
+ private void createHandlerGroup(Composite parent, ReaderType reader, FormToolkit toolkit,
+ ISmooksModelProvider modelProvider, IEditorPart editorPart) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Handlers");
+ group.setBackground(ColorConstants.white);
+ FillLayout fl = new FillLayout();
+ group.setLayout(fl);
+
+ ContainerChildrenTablePanelCreator creator = new ContainerChildrenTablePanelCreator(modelProvider, reader,
+ toolkit, editorPart) {
+
+ @Override
+ protected EObject newContainerModel() {
+ return SmooksFactory.eINSTANCE.createHandlersType();
+ }
+
+ @Override
+ protected EStructuralFeature getChildrenFeature() {
+ return SmooksPackage.Literals.HANDLERS_TYPE__HANDLER;
+ }
+
+ @Override
+ protected EObject newChildModel() {
+ return SmooksFactory.eINSTANCE.createHandlerType();
+ }
+ };
+ creator.setParentModel(reader.getHandlers());
+ creator.setContainerFeature(SmooksPackage.Literals.READER_TYPE__HANDLERS);
+ creator.createChildrenTablePanel(group);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 180;
+ gd.horizontalSpan = 2;
+ group.setLayoutData(gd);
+ }
+
}
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ResourceTypeUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ResourceTypeUICreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ResourceTypeUICreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -38,13 +38,13 @@
*/
public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- ISmooksModelProvider formEditor, IEditorPart part) {
+ ISmooksModelProvider modelProvider, IEditorPart part) {
if (feature == SmooksPackage.eINSTANCE.getResourceType_Value()) {
- return SmooksUIUtils.createJavaTypeSearchFieldEditor(parent, toolkit, propertyDescriptor, (EObject) model);
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(parent, toolkit, propertyDescriptor, (EObject) model , modelProvider);
}
if (feature == SmooksPackage.eINSTANCE.getResourceType_Type()) {
}
- return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor,part);
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, modelProvider,part);
}
}
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -25,7 +25,6 @@
import org.jboss.tools.smooks.configuration.editors.xml.TagList;
import org.jboss.tools.smooks.configuration.editors.xml.XMLObjectAnalyzer;
import org.jboss.tools.smooks.model.graphics.ext.InputType;
-import org.jboss.tools.smooks.model.graphics.ext.ParamType;
import org.jboss.tools.smooks.model.json.JsonReader;
import org.jboss.tools.smooks.model.json.Key;
import org.jboss.tools.smooks.model.json.KeyMap;
@@ -33,7 +32,6 @@
import org.jboss.tools.smooks.model.json12.Json12Reader;
import org.jboss.tools.smooks.model.smooks.AbstractReader;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
-import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
import org.milyn.Smooks;
import org.milyn.cdr.Parameter;
import org.milyn.json.JSONReaderConfigurator;
@@ -120,91 +118,28 @@
public IXMLStructuredObject parseJsonFile(InputStream stream, InputType inputType,
SmooksResourceListType resourceList) throws FileNotFoundException, ParserConfigurationException,
DocumentException, InvocationTargetException {
- List<ParamType> paramList = inputType.getParam();
- String rootName = null;
- String arrayElementName = null;
- String keyWhitspaceReplacement = null;
- String keyPrefixOnNumeric = null;
- String illegalElementNameCharReplacement = null;
- String nullValueReplacement = null;
- String encoding = null;
- String indent = null;
- String type = inputType.getType();
-
- Map<String, String> keyMap = new HashMap<String, String>();
-
- for (Iterator<?> iterator = paramList.iterator(); iterator.hasNext();) {
- ParamType paramType = (ParamType) iterator.next();
- if (paramType.getName().equals(LINK_JSON_READER)) {
- if (paramType.getValue().equalsIgnoreCase("true") && resourceList != null) {
- List<AbstractReader> readers = resourceList.getAbstractReader();
- int count = 0;
- int index = -1;
- for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
- AbstractReader abstractReader = (AbstractReader) iterator2.next();
- if (SmooksModelUtils.INPUT_TYPE_JSON_1_1.equals(type)) {
- if (abstractReader instanceof JsonReader) {
- count++;
- if (index == -1) {
- index = readers.indexOf(abstractReader);
- }
- }
- }
- if (SmooksModelUtils.INPUT_TYPE_JSON_1_2.equals(type)) {
- if (abstractReader instanceof Json12Reader) {
- count++;
- if (index == -1) {
- index = readers.indexOf(abstractReader);
- }
- }
- }
- }
-
- if (count > 1) {
- // throw new
- // RuntimeException("The smooks config file should have only one JSON reader");
- }
- if (index != -1) {
- return parseJsonFile(stream, readers.get(index));
- }
-
+ List<AbstractReader> readers = resourceList.getAbstractReader();
+ int count = 0;
+ int index = -1;
+ for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
+ AbstractReader abstractReader = (AbstractReader) iterator2.next();
+ if (abstractReader instanceof JsonReader || abstractReader instanceof Json12Reader) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
}
}
- if (paramType.getName().equals(ROOT_NAME)) {
- rootName = paramType.getValue();
- }
- if (paramType.getName().startsWith(KEY)) {
- String name = paramType.getName().substring(KEY.length(), paramType.getName().length());
- String value = paramType.getValue();
- keyMap.put(name, value);
- }
- if (paramType.getName().equals(ARRAY_ELEMENT_NAME)) {
- arrayElementName = paramType.getValue();
- }
- if (paramType.getName().equals(ILLEGAL_REPLACE)) {
- illegalElementNameCharReplacement = paramType.getValue();
- }
- if (paramType.getName().equals(PREFIX_ON_NUMERIC)) {
- keyPrefixOnNumeric = paramType.getValue();
- }
- if (paramType.getName().equals(SPACE_REPLACE)) {
- keyWhitspaceReplacement = paramType.getValue();
- }
- if (paramType.getName().equals(ENCODING2)) {
- encoding = paramType.getValue();
- }
- if (paramType.getName().equals(NULL_REPLACE)) {
- nullValueReplacement = paramType.getValue();
- }
-
- if (paramType.getName().equals(INDENT)) {
- indent = paramType.getValue();
- }
}
- return this.parseJsonFile(stream, rootName, arrayElementName, keyWhitspaceReplacement, keyPrefixOnNumeric,
- illegalElementNameCharReplacement, nullValueReplacement, keyMap, indent, encoding);
+ if (count > 1) {
+ // throw new
+ // RuntimeException("The smooks config file should have only one JSON reader");
+ }
+ if (index != -1) {
+ return parseJsonFile(stream, readers.get(index));
+ }
+ return null;
}
public IXMLStructuredObject parseJsonFile(String filePath, InputType inputType, SmooksResourceListType resourceList)
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-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -134,15 +134,20 @@
import org.jboss.tools.smooks.contentassist.TypeContentProposalProvider;
import org.jboss.tools.smooks.contentassist.TypeProposalLabelProvider;
import org.jboss.tools.smooks.core.SmooksCoreActivator;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.gef.tree.editparts.TreeNodeEditPart;
import org.jboss.tools.smooks.gef.tree.model.TreeNodeModel;
import org.jboss.tools.smooks.model.calc.CalcPackage;
import org.jboss.tools.smooks.model.calc.Counter;
import org.jboss.tools.smooks.model.csv.CsvPackage;
+import org.jboss.tools.smooks.model.csv.CsvReader;
+import org.jboss.tools.smooks.model.csv12.CSV12Reader;
import org.jboss.tools.smooks.model.csv12.Csv12Package;
import org.jboss.tools.smooks.model.datasource.DatasourcePackage;
import org.jboss.tools.smooks.model.datasource.Direct;
+import org.jboss.tools.smooks.model.edi.EDIReader;
import org.jboss.tools.smooks.model.edi.EdiPackage;
+import org.jboss.tools.smooks.model.edi12.EDI12Reader;
import org.jboss.tools.smooks.model.edi12.Edi12Package;
import org.jboss.tools.smooks.model.esbrouting.EsbroutingPackage;
import org.jboss.tools.smooks.model.esbrouting.RouteBean;
@@ -171,12 +176,15 @@
import org.jboss.tools.smooks.model.jmsrouting12.JMS12Router;
import org.jboss.tools.smooks.model.jmsrouting12.Jmsrouting12Package;
import org.jboss.tools.smooks.model.json.JsonPackage;
+import org.jboss.tools.smooks.model.json.JsonReader;
import org.jboss.tools.smooks.model.json12.Json12Package;
+import org.jboss.tools.smooks.model.json12.Json12Reader;
import org.jboss.tools.smooks.model.persistence12.Persistence12Package;
import org.jboss.tools.smooks.model.rules10.Rules10Package;
import org.jboss.tools.smooks.model.smooks.AbstractReader;
import org.jboss.tools.smooks.model.smooks.AbstractResourceConfig;
import org.jboss.tools.smooks.model.smooks.ConditionType;
+import org.jboss.tools.smooks.model.smooks.ReaderType;
import org.jboss.tools.smooks.model.smooks.ResourceConfigType;
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
@@ -1103,10 +1111,15 @@
}
public static AttributeFieldEditPart createJavaTypeSearchFieldEditor(Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final EObject model) {
+ final IItemPropertyDescriptor propertyDescriptor, final EObject model , ISmooksModelProvider modelProvider) {
if (model instanceof EObject) {
AttributeFieldEditPart editpart = new AttributeFieldEditPart();
- final Resource resource = ((EObject) model).eResource();
+ Resource r = ((EObject) model).eResource();
+ if(r == null){
+ r = modelProvider.getSmooksModel().eResource();
+ }
+ final Resource resource = r;
+ if(resource == null) return null;
URI uri = resource.getURI();
IResource workspaceResource = null;
if (uri.isPlatformResource()) {
@@ -2334,6 +2347,7 @@
}
public static IXMLStructuredObject getChildNodeWithName(String name, IXMLStructuredObject parent) {
+ if(parent == null) return null;
String tempName = name;
boolean isAttribute = false;
if (isAttributeName(tempName)) {
@@ -2825,4 +2839,30 @@
}
return SmooksConstants.VERSION_1_2;
}
+
+ public static String judgeInputType(EObject smooksModel) {
+ String inputType = null;
+ if (smooksModel instanceof DocumentRoot) {
+ return null;
+ }
+
+ if (smooksModel instanceof org.jboss.tools.smooks.model.smooks.DocumentRoot) {
+ SmooksResourceListType rlist = ((org.jboss.tools.smooks.model.smooks.DocumentRoot)smooksModel).getSmooksResourceList();
+ if(rlist.getAbstractReader().isEmpty()) return null;
+ AbstractReader reader = rlist.getAbstractReader().get(0);
+ if (CsvReader.class.isInstance(reader) || CSV12Reader.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_CSV;
+ }
+ if (EDIReader.class.isInstance(reader) || EDI12Reader.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_EDI_1_1;
+ }
+ if (JsonReader.class.isInstance(reader) || Json12Reader.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_JSON_1_1;
+ }
+ if (ReaderType.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_CUSTOME;
+ }
+ }
+ return inputType;
+ }
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -144,7 +144,7 @@
// for json 1.1
BaseViewerInitor jsonViewerInitor = new BaseViewerInitor();
- String name = "Json 1.1";
+ String name = "JSON";
String description = "Select Json data file as the input data.";
String iconPath = null;
String typeID = SmooksModelUtils.INPUT_TYPE_JSON_1_1;
@@ -174,7 +174,8 @@
json12ViewerInitor.setTreeContentProvider(new XMLStructuredDataContentProvider());
json12ViewerInitor.setStructuredDataLoadWizard(new Json12DataWizard());
json12ViewerInitor.setWizardIconPath(GraphicsConstants.IMAGE_JAVA_FILE);
- map.put(typeID, json12ViewerInitor);
+ // don't add this
+// map.put(typeID, json12ViewerInitor);
// for java
@@ -232,10 +233,10 @@
// for Csv 1.1
BaseViewerInitor csvViewerInitor = new BaseViewerInitor();
- name = "CSV 1.1";
- description = "Select CSV data file as the input data (version 1.1).";
+ name = "CSV";
+ description = "Select CSV data file as the input data.";
iconPath = null;
- typeID = SmooksModelUtils.INPUT_TYPE_CSV_1_1;
+ typeID = SmooksModelUtils.INPUT_TYPE_CSV;
csvViewerInitor.setName(name);
csvViewerInitor.setDescription(description);
@@ -260,11 +261,11 @@
csv12ViewerInitor.setLabelProvider(new XMLStructuredDataLabelProvider());
csv12ViewerInitor.setTreeContentProvider(new XMLStructuredDataContentProvider());
csv12ViewerInitor.setStructuredDataLoadWizard(new CSV12InputDataWizard());
- map.put(typeID, csv12ViewerInitor);
+// map.put(typeID, csv12ViewerInitor);
// for EDI 1.1
BaseViewerInitor ediViewerInitor = new BaseViewerInitor();
- name = "EDI 1.1";
+ name = "EDI";
description = "Select EDI data file as the input data.";
iconPath = null;
typeID = SmooksModelUtils.INPUT_TYPE_EDI_1_1;
@@ -294,7 +295,7 @@
edi12ViewerInitor.setTreeContentProvider(new XMLStructuredDataContentProvider());
edi12ViewerInitor.setStructuredDataLoadWizard(new EDIReader12DataWizard());
// jsonViewerInitor.setWizardIconPath(GraphicsConstants.IMAGE_JAVA_FILE);
- map.put(typeID, edi12ViewerInitor);
+// map.put(typeID, edi12ViewerInitor);
return map;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm 2009-09-14 12:36:19 UTC (rev 17543)
@@ -1,18 +1,7 @@
<form>
-<p>Overview : Define the <a
- href="overview_default_setting">default setting</a> , edit the <a
- href="overview_global_param">global paramters</a> and define the <a
- href="overview_condition">condition</a>, <a
- href="overview_profile">profile</a>.</p>
-<p><a href="reader_page">Reader</a> : Edit the 'Reader' of Smooks in this
-page. Reader page can also add/remove <a href="reader_input_data">input
-message</a>. <br/>
-Smooks tools generate the 'selector' via the input data and smooks reader , open the <a href="selector_dialog">SelectorDialog</a>,
-User can<br/> select the element node to generate 'selector' for it.</p>
-<p>
-<a href="message_filter_page">Message Filter</a> : Add/Remove Java bean binding , Routers and so on.
-</p>
+<p><a href="reader_page">Input</a> : Define a new input type
+and edit the input type configurations.</p>
+<p>Input Messages: Specify the sample messages to use for Smooks Input</p>
<!-- <p>
<a href="source_page">Source</a> : User can also edit the configuration file directly via source page.
-</p> -->
-</form>
\ No newline at end of file
+</p> --></form>
\ No newline at end of file
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/MessageFilterNavigator.htm
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/MessageFilterNavigator.htm (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/MessageFilterNavigator.htm 2009-09-14 12:36:19 UTC (rev 17543)
@@ -0,0 +1,5 @@
+<form>
+<p><a href="message_filter_page">Message Filter</a> : Specify beans for binding message data, routing messages, and so on.</p>
+<!-- <p>
+<a href="source_page">Source</a> : User can also edit the configuration file directly via source page.
+</p> --></form>
\ No newline at end of file
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/MessageFilterNavigator.htm
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/SelectorValidator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/SelectorValidator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/SelectorValidator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -150,15 +150,19 @@
.getActiveWorkbenchWindow();
IWorkbenchPage activePage = window.getActivePage();
if (activePage != null) {
- IEditorPart part = activePage.findEditor(input);
- if (part != null && part instanceof AbstractSmooksFormEditor) {
- extType = ((AbstractSmooksFormEditor) part).getSmooksGraphicsExt();
- if (extType != null) {
- List<Object> l = SelectorCreationDialog.generateInputData(extType, finalList);
- if (l != null) {
- list.addAll(l);
+ try {
+ IEditorPart part = activePage.findEditor(input);
+ if (part != null && part instanceof AbstractSmooksFormEditor) {
+ extType = ((AbstractSmooksFormEditor) part).getSmooksGraphicsExt();
+ if (extType != null) {
+ List<Object> l = SelectorCreationDialog.generateInputData(extType, finalList);
+ if (l != null) {
+ list.addAll(l);
+ }
}
}
+ } catch (Throwable t) {
+ t.printStackTrace();
}
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/NewSmooksElementWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/NewSmooksElementWizardPage.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/NewSmooksElementWizardPage.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -41,13 +41,10 @@
import org.jboss.tools.smooks.configuration.editors.actions.Database11ActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.Datasources11ActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.FragmentRouting11ActionGrouper;
-import org.jboss.tools.smooks.configuration.editors.actions.FragmentRouting12ActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.ISmooksActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.JavaBean11ActionGrouper;
-import org.jboss.tools.smooks.configuration.editors.actions.JavaBean12ActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.PersistenceActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.Reader11ActionGrouper;
-import org.jboss.tools.smooks.configuration.editors.actions.Reader12ActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.Scripting11ActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.Templating11ActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.Validation10ActionGrouper;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -59,7 +59,7 @@
containerSelectionPage = new SmooksFileContainerSelectionPage("Smooks Configuration File",
(IStructuredSelection) selection);
addPage(containerSelectionPage);
-
+
versionSelectionPage = new SmooksVersionSelectionPage("Smooks Version Selection");
addPage(versionSelectionPage);
}
@@ -126,7 +126,7 @@
}
stream.close();
// create ext file:
- createExtentionFile(extFile,version, monitor);
+ createExtentionFile(extFile, version, null, monitor);
} catch (IOException e) {
SmooksConfigurationActivator.getDefault().log(e);
}
@@ -145,12 +145,13 @@
});
monitor.worked(1);
}
-
- public static void createExtentionFile(IFile file , String version , IProgressMonitor monitor) throws CoreException, IOException{
- if(monitor == null){
+
+ public static void createExtentionFile(IFile file, String version, String inputType, IProgressMonitor monitor)
+ throws CoreException, IOException {
+ if (monitor == null) {
monitor = new NullProgressMonitor();
}
- InputStream stream1 = createExtContentStream(version);
+ InputStream stream1 = createExtContentStream(version, inputType);
if (file.exists()) {
file.setContents(stream1, true, true, monitor);
} else {
@@ -159,9 +160,21 @@
stream1.close();
}
- public static InputStream createExtContentStream(String version) {
- String contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + " <smooks-graphics-ext platformVersion = \""+version+"\" xmlns=\"http://www.jboss.org/jbosstools/smooks/smooks-graphics-ext.xsd\"/>";
+ public static InputStream createExtContentStream(String version, String inputType) {
+ String typeContents = null;
+ if (inputType != null) {
+ typeContents = "inputType = \"" + inputType + "\"";
+ }
+ String contents= "";
+ if (typeContents == null) {
+ contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ + " <smooks-graphics-ext platformVersion = \"" + version
+ + "\" xmlns=\"http://www.jboss.org/jbosstools/smooks/smooks-graphics-ext.xsd\"/>";
+ }else{
+ contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ + " <smooks-graphics-ext platformVersion = \"" + version
+ + "\" "+typeContents+" xmlns=\"http://www.jboss.org/jbosstools/smooks/smooks-graphics-ext.xsd\"/>";
+ }
return new ByteArrayInputStream(contents.getBytes());
}
@@ -192,8 +205,7 @@
}
private void throwCoreException(String message) throws CoreException {
- IStatus status = new Status(IStatus.ERROR, SmooksConfigurationActivator.PLUGIN_ID, IStatus.OK,
- message, null);
+ IStatus status = new Status(IStatus.ERROR, SmooksConfigurationActivator.PLUGIN_ID, IStatus.OK, message, null);
throw new CoreException(status);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/EDIMapFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/EDIMapFormPage.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/EDIMapFormPage.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -1036,7 +1036,8 @@
public List<TreeNodeModel> createLinkModel() {
if (graphicalRootModel != null && segments != null) {
List<Segment> segmentList = segments.getSegment();
- return linkNode(segmentList);
+ List<TreeNodeModel> links = linkNode(segmentList);
+ return links;
}
return Collections.emptyList();
}
@@ -1124,7 +1125,7 @@
if (data == model) {
return treeNodeModel;
}
- AbstractSmooksGraphicalModel m = findEDIGraphicalModel(model, treeNodeModel.getChildrenWithoutDynamic());
+ AbstractSmooksGraphicalModel m = findEDIGraphicalModel(model, treeNodeModel.getChildren());
if (m != null) {
return m;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -89,10 +89,10 @@
import org.jboss.tools.smooks10.model.smooks.util.SmooksResourceFactoryImpl;
public class AbstractSmooksFormEditor extends FormEditor implements IEditingDomainProvider,
- ISmooksModelValidateListener , ISmooksModelProvider , ISmooksGraphChangeListener{
-
+ ISmooksModelValidateListener, ISmooksModelProvider, ISmooksGraphChangeListener {
+
protected List<ISourceSynchronizeListener> sourceSynchronizeListener = new ArrayList<ISourceSynchronizeListener>();
-
+
public static final String EDITOR_ID = "org.jboss.tools.smooks.edimap.editors.MultiPageEditor";
protected StructuredTextEditor textEditor = null;
@@ -123,12 +123,12 @@
super();
initEditingDomain();
}
-
- public void addSourceSynchronizeListener(ISourceSynchronizeListener listener){
+
+ public void addSourceSynchronizeListener(ISourceSynchronizeListener listener) {
this.sourceSynchronizeListener.add(listener);
}
-
- public void removeSourceSynchronizeListener(ISourceSynchronizeListener listener){
+
+ public void removeSourceSynchronizeListener(ISourceSynchronizeListener listener) {
this.sourceSynchronizeListener.remove(listener);
}
@@ -222,7 +222,7 @@
protected void initEditingDomain() {
adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
-
+
// add smooks 1.1.2 EMF item provider model
adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new XslItemProviderAdapterFactory());
@@ -243,7 +243,7 @@
adapterFactory.addAdapterFactory(new FileRoutingItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new EsbroutingItemProviderAdapterFactory());
-
+
// add smooks 1.2 EMF itemprovider
adapterFactory.addAdapterFactory(new Json12ItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new Edi12ItemProviderAdapterFactory());
@@ -253,7 +253,7 @@
adapterFactory.addAdapterFactory(new Validation10ItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new Jmsrouting12ItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new Persistence12ItemProviderAdapterFactory());
-
+
BasicCommandStack commandStack = new BasicCommandStack();
handleCommandStack(commandStack);
editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
@@ -278,14 +278,14 @@
*/
@Override
protected void addPages() {
-// configurationPage = createSmooksConfigurationFormPage();
-// addValidateListener(configurationPage);
-// try {
-// int index = this.addPage(configurationPage);
-// setPageText(index, "Design");
-// } catch (PartInitException e) {
-// e.printStackTrace();
-// }
+ // configurationPage = createSmooksConfigurationFormPage();
+ // addValidateListener(configurationPage);
+ // try {
+ // int index = this.addPage(configurationPage);
+ // setPageText(index, "Design");
+ // } catch (PartInitException e) {
+ // e.printStackTrace();
+ // }
textEditor = createTextEditor();
try {
@@ -304,7 +304,8 @@
}
/**
- * @param smooksGraphicsExt the smooksGraphicsExt to set
+ * @param smooksGraphicsExt
+ * the smooksGraphicsExt to set
*/
public void setSmooksGraphicsExt(SmooksGraphicsExtType smooksGraphicsExt) {
this.smooksGraphicsExt = smooksGraphicsExt;
@@ -361,8 +362,8 @@
};
return xmlEditor;
}
-
- protected void createNewModelViaTextPage(){
+
+ protected void createNewModelViaTextPage() {
IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
String conents = document.get();
Resource resource = editingDomain.getResourceSet().getResources().get(0);
@@ -372,13 +373,13 @@
this.smooksModel = resource.getContents().get(0);
} catch (IOException e) {
smooksModel = null;
- SmooksConfigurationActivator.getDefault().log(e);
+ // SmooksConfigurationActivator.getDefault().log(e);
}
for (Iterator<?> iterator = this.sourceSynchronizeListener.iterator(); iterator.hasNext();) {
ISourceSynchronizeListener l = (ISourceSynchronizeListener) iterator.next();
- try{
- l.sourceChange(smooksModel);
- }catch(Exception e){
+ try {
+ l.sourceChange(smooksModel);
+ } catch (Exception e) {
e.printStackTrace();
}
}
@@ -386,12 +387,18 @@
protected void handleDocumentChange() {
createNewModelViaTextPage();
- validator.startValidate(smooksModel.eResource().getContents(), editingDomain);
+ try {
+ validator.startValidate(smooksModel.eResource().getContents(), editingDomain);
+ } catch (Throwable e) {
+
+ }
}
-// protected SmooksConfigurationFormPage createSmooksConfigurationFormPage() {
-// return new SmooksConfigurationFormPage(this, "DesignPage", "Design Page");
-// }
+ // protected SmooksConfigurationFormPage createSmooksConfigurationFormPage()
+ // {
+ // return new SmooksConfigurationFormPage(this, "DesignPage",
+ // "Design Page");
+ // }
protected void initSaveOptions(Map<?, ?> options) {
@@ -410,7 +417,7 @@
if (activeEditor != null && activeEditor == textEditor) {
textEditor.doSave(monitor);
((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
-
+
} else {
Map<?, ?> options = Collections.emptyMap();
initSaveOptions(options);
@@ -431,7 +438,7 @@
}
getSmooksGraphicsExt().eResource().save(Collections.emptyMap());
graphChanged = false;
-
+
firePropertyChange(PROP_DIRTY);
if (this.smooksModel != null) {
validator.startValidate(smooksModel.eResource().getContents(), editingDomain);
@@ -471,7 +478,8 @@
if (extFile != null && !extFile.exists()) {
try {
String version = SmooksUIUtils.judgeSmooksPlatformVersion(smooksModel);
- SmooksConfigurationFileNewWizard.createExtentionFile(extFile, version , null);
+ String inputType = SmooksUIUtils.judgeInputType(smooksModel);
+ SmooksConfigurationFileNewWizard.createExtentionFile(extFile, version, inputType, null);
} catch (Throwable t) {
// ignore
}
@@ -567,19 +575,20 @@
}
public void graphChanged(SmooksGraphicsExtType extType) {
-
+
}
public void inputTypeChanged(SmooksGraphicsExtType extType) {
- graphChanged = true;
+ graphChanged = true;
firePropertyChange(PROP_DIRTY);
}
public void graphPropertyChange(EStructuralFeature featre, Object value) {
- if(featre.equals(GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__AUTHOR) ||
- featre.equals(GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__PLATFORM_VERSION) ||
- featre.equals(GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__NAME)){
- graphChanged = true;
+ if (featre.equals(GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__AUTHOR)
+ || featre.equals(GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__PLATFORM_VERSION)
+ || featre.equals(GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__NAME)
+ || featre.equals(GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__INPUT_TYPE)) {
+ graphChanged = true;
firePropertyChange(PROP_DIRTY);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/TreeNodeFigure.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/TreeNodeFigure.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/TreeNodeFigure.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -54,9 +54,9 @@
private boolean expand = false;
private TreeNodeModel model;
-
+
private boolean focus;
-
+
private boolean selected;
public TreeNodeFigure(TreeNodeModel model) {
@@ -79,7 +79,7 @@
public TreeNodeModel getModel() {
return model;
}
-
+
public boolean isExpand() {
return expand;
}
@@ -87,11 +87,10 @@
public void setModel(TreeNodeModel model) {
this.model = model;
}
-
+
public Label getLabel() {
return label;
}
-
/**
* @return the focus
@@ -101,7 +100,8 @@
}
/**
- * @param focus the focus to set
+ * @param focus
+ * the focus to set
*/
public void setFocus(boolean focus) {
this.focus = focus;
@@ -116,7 +116,8 @@
}
/**
- * @param selected the selected to set
+ * @param selected
+ * the selected to set
*/
public void setSelected(boolean selected) {
this.selected = selected;
@@ -128,21 +129,22 @@
ToolbarLayout layout = new ToolbarLayout();
layout.setVertical(false);
panelFigure.setLayoutManager(layout);
- Figure spaceFigure = new Figure(){
+ Figure spaceFigure = new Figure() {
@Override
public Dimension getPreferredSize(int hint, int hint2) {
return new Dimension(SPACE_INT, 0);
}
};
panelFigure.add(spaceFigure);
- contentFigure = new Figure(){
+ contentFigure = new Figure() {
@Override
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
-// graphics.drawRectangle(getBounds().x + 1 , getBounds().y + 1 , getBounds().width - 2 ,getBounds().height - 2 );
+ // graphics.drawRectangle(getBounds().x + 1 , getBounds().y + 1
+ // , getBounds().width - 2 ,getBounds().height - 2 );
}
-
+
};
panelFigure.add(contentFigure);
contentFigure.setLayoutManager(new ToolbarLayout());
@@ -156,21 +158,25 @@
@Override
public Dimension getPreferredSize(int hint, int hint2) {
if (expand) {
-// contentFigure.setSize(-1, -1);
-// LayoutManager manager = contentFigure.getLayoutManager();
-// if(manager != null){
-// manager.invalidate();
-// }
+ // contentFigure.setSize(-1, -1);
+ // LayoutManager manager = contentFigure.getLayoutManager();
+ // if(manager != null){
+ // manager.invalidate();
+ // }
return super.getPreferredSize(hint, hint2);
} else {
LayoutManager layout = labelContainer.getLayoutManager();
if (layout != null)
layout.invalidate();
labelContainer.invalidateTree();
- Dimension size = labelContainer.getPreferredSize(hint, hint2);
- Insets insets = getBorder().getInsets(null);
- return new Dimension(size.width + insets.left + insets.right,
- size.height + insets.bottom + insets.top);
+ try {
+ Dimension size = labelContainer.getPreferredSize(hint, hint2);
+ Insets insets = getBorder().getInsets(null);
+ return new Dimension(size.width + insets.left + insets.right, size.height + insets.bottom + insets.top);
+ } catch (Throwable t) {
+ return new Dimension(100,100);
+ }
+// return super.getPreferredSize(hint, hint2);
}
}
@@ -196,35 +202,34 @@
}
});
- ((Clickable) clickNode)
- .addMouseMotionListener(new MouseMotionListener() {
+ ((Clickable) clickNode).addMouseMotionListener(new MouseMotionListener() {
- public void mouseDragged(MouseEvent me) {
- }
+ public void mouseDragged(MouseEvent me) {
+ }
- public void mouseEntered(MouseEvent me) {
- boolean hasChildren = model.hasChildren();
- if (!hasChildren)
- return;
- mouseEnter = true;
- clickNode.repaint();
- }
+ public void mouseEntered(MouseEvent me) {
+ boolean hasChildren = model.hasChildren();
+ if (!hasChildren)
+ return;
+ mouseEnter = true;
+ clickNode.repaint();
+ }
- public void mouseExited(MouseEvent me) {
- boolean hasChildren = model.hasChildren();
- if (!hasChildren)
- return;
- mouseEnter = false;
- clickNode.repaint();
- }
+ public void mouseExited(MouseEvent me) {
+ boolean hasChildren = model.hasChildren();
+ if (!hasChildren)
+ return;
+ mouseEnter = false;
+ clickNode.repaint();
+ }
- public void mouseHover(MouseEvent me) {
- }
+ public void mouseHover(MouseEvent me) {
+ }
- public void mouseMoved(MouseEvent me) {
- }
+ public void mouseMoved(MouseEvent me) {
+ }
- });
+ });
clickNode.setSize(new Dimension(CLICKNODE_WIDTH, CLICKNODE_HEIGHT));
Figure imageFigure = new Figure() {
@@ -235,15 +240,14 @@
Image i = model.getImage();
if (i != null)
;
- graphics.drawImage(i, getBounds().getTopLeft().x,
- getBounds().getTopLeft().y + 2);
+ graphics.drawImage(i, getBounds().getTopLeft().x, getBounds().getTopLeft().y + 2);
}
}
};
imageFigure.setSize(new Dimension(18, 18));
label = new Label();
- if(isFocus()){
+ if (isFocus()) {
}
if (model != null) {
label.setText(model.getText());
@@ -270,17 +274,17 @@
public void setLabelText(String text) {
label.setText(text);
}
-
- public void paint(Graphics graphics){
- if(isFocus()){
+
+ public void paint(Graphics graphics) {
+ if (isFocus()) {
label.setForegroundColor(ColorConstants.blue);
- }else{
+ } else {
label.setForegroundColor(ColorConstants.black);
}
-
- if(isSelected()){
+
+ if (isSelected()) {
label.setForegroundColor(ColorConstants.lightBlue);
- }else{
+ } else {
label.setForegroundColor(ColorConstants.black);
}
super.paint(graphics);
@@ -294,20 +298,16 @@
boolean hasChildren = model.hasChildren();
if (hasChildren) {
if (expand) {
- Point point1 = new Point(center.x - width / 2, center.y - width
- / 4);
+ Point point1 = new Point(center.x - width / 2, center.y - width / 4);
Point point2 = new Point(point1.x + width, point1.y);
- Point point3 = new Point(point1.x + width / 2, point1.y + width
- / 2);
+ Point point3 = new Point(point1.x + width / 2, point1.y + width / 2);
pointList.addPoint(point1);
pointList.addPoint(point2);
pointList.addPoint(point3);
} else {
- Point point1 = new Point(center.x - width / 4, center.y - width
- / 2);
+ Point point1 = new Point(center.x - width / 4, center.y - width / 2);
Point point2 = new Point(point1.x, point1.y + width);
- Point point3 = new Point(point1.x + width / 2, point1.y + width
- / 2);
+ Point point3 = new Point(point1.x + width / 2, point1.y + width / 2);
pointList.addPoint(point1);
pointList.addPoint(point2);
pointList.addPoint(point3);
@@ -321,13 +321,13 @@
graphics.popState();
}
}
-
- public void expandNode(){
+
+ public void expandNode() {
expand = false;
changeTreeExpansionState();
}
-
- public void collapsedNode(){
+
+ public void collapsedNode() {
expand = true;
changeTreeExpansionState();
}
@@ -344,12 +344,9 @@
if (parent != null) {
Rectangle oldRectangle = parent.getClientArea();
expand = !expand;
- for (Iterator<ITreeFigureListener> iterator = this.treeListener
- .iterator(); iterator.hasNext();) {
- ITreeFigureListener listener = (ITreeFigureListener) iterator
- .next();
- TreeFigureExpansionEvent event = new TreeFigureExpansionEvent(
- this);
+ for (Iterator<ITreeFigureListener> iterator = this.treeListener.iterator(); iterator.hasNext();) {
+ ITreeFigureListener listener = (ITreeFigureListener) iterator.next();
+ TreeFigureExpansionEvent event = new TreeFigureExpansionEvent(this);
if (!expand) {
listener.treeCollapsed(event);
} else {
@@ -366,15 +363,15 @@
Rectangle newRectangle = parent.getClientArea();
int w = Math.max(oldRectangle.width, newRectangle.width);
int h = Math.max(oldRectangle.height, newRectangle.height);
-// IFigure currentParent = contentFigure.getParent();
-// currentParent.invalidateTree();
-// LayoutManager layout = currentParent.getLayoutManager();
-// if(layout != null){
-// layout.layout(currentParent);
-// }
+ // IFigure currentParent = contentFigure.getParent();
+ // currentParent.invalidateTree();
+ // LayoutManager layout = currentParent.getLayoutManager();
+ // if(layout != null){
+ // layout.layout(currentParent);
+ // }
IFigure panel = parent.getParent();
if (panel != null) {
-// panel.repaint();
+ // panel.repaint();
panel.repaint(oldRectangle.x, oldRectangle.y, w, h);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPaletteRootCreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPaletteRootCreator.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPaletteRootCreator.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -10,36 +10,124 @@
******************************************************************************/
package org.jboss.tools.smooks.graphical.editors;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.gef.palette.ConnectionCreationToolEntry;
+import org.eclipse.gef.palette.CreationToolEntry;
import org.eclipse.gef.palette.MarqueeToolEntry;
import org.eclipse.gef.palette.PaletteDrawer;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.SelectionToolEntry;
import org.eclipse.gef.requests.CreationFactory;
+import org.jboss.tools.smooks.configuration.editors.actions.Calc11ActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.Database11ActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.Datasources11ActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.FragmentRouting11ActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.ISmooksActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.JavaBean11ActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.PersistenceActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.Reader11ActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.Scripting11ActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.Templating11ActionGrouper;
+import org.jboss.tools.smooks.configuration.editors.actions.Validation10ActionGrouper;
import org.jboss.tools.smooks.gef.tree.model.TreeNodeConnection;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
/**
* @author Dart dpeng(a)redhat.com
- *
+ *
*/
public class SmooksGraphicalEditorPaletteRootCreator {
- public PaletteRoot createPaletteRoot(){
- PaletteRoot root= new PaletteRoot();
- PaletteDrawer drawer = new PaletteDrawer("Tools");
+
+ protected AdapterFactoryEditingDomain editingDomain;
+
+ protected SmooksResourceListType resourceList;
+
+ public SmooksGraphicalEditorPaletteRootCreator(AdapterFactoryEditingDomain editingDomain,
+ SmooksResourceListType resourceList) {
+ this.editingDomain = editingDomain;
+ this.resourceList = resourceList;
+ }
+
+ public PaletteRoot createPaletteRoot() {
+ PaletteRoot root = new PaletteRoot();
+ PaletteDrawer drawer = new PaletteDrawer("Noraml Tools");
drawer.add(new SelectionToolEntry());
drawer.add(new MarqueeToolEntry());
CreationFactory factory = new CreationFactory() {
-
+
public Object getObjectType() {
return TreeNodeConnection.class;
}
-
+
public Object getNewObject() {
return null;
}
};
drawer.add(new ConnectionCreationToolEntry("Link", "Link", factory, null, null));
root.add(drawer);
+
+ createPaletteDrawer(root);
+
return root;
}
+
+ private void createPaletteDrawer(PaletteRoot root) {
+ if(resourceList == null) return;
+
+ IEditingDomainItemProvider provider = (IEditingDomainItemProvider) editingDomain.getAdapterFactory().adapt(
+ this.resourceList, IEditingDomainItemProvider.class);
+ if (provider != null) {
+ Collection<?> newChildrenDescripter = provider.getNewChildDescriptors(this.resourceList, editingDomain,
+ null);
+ List<ISmooksActionGrouper> grouperList = getSmooksActionGrouper();
+ for (Iterator<?> iterator = grouperList.iterator(); iterator.hasNext();) {
+ ISmooksActionGrouper iSmooksActionGrouper = (ISmooksActionGrouper) iterator.next();
+ PaletteDrawer drawer = new PaletteDrawer(iSmooksActionGrouper.getGroupName());
+ fillDrawer(drawer, newChildrenDescripter, iSmooksActionGrouper);
+ root.add(drawer);
+ }
+ }
+ }
+
+ private void fillDrawer(PaletteDrawer drawer, Collection<?> allchildren, ISmooksActionGrouper grouper) {
+ for (Iterator<?> iterator = allchildren.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+
+ if (grouper.belongsToGroup(object)) {
+ if (object instanceof CommandParameter) {
+ Object v = ((CommandParameter) object).getValue();
+ v = AdapterFactoryEditingDomain.unwrap(v);
+ EClass clazz = ((EObject) v).eClass();
+ CreationToolEntry toolEntry = new CreationToolEntry(clazz.getName(), "", null, null, null);
+ drawer.add(toolEntry);
+ }
+ }
+ }
+ }
+
+ private List<ISmooksActionGrouper> getSmooksActionGrouper() {
+ List<ISmooksActionGrouper> grouperList = new ArrayList<ISmooksActionGrouper>();
+
+ grouperList.add(new JavaBean11ActionGrouper());
+ grouperList.add(new Reader11ActionGrouper());
+ grouperList.add(new Calc11ActionGrouper());
+ grouperList.add(new Database11ActionGrouper());
+ grouperList.add(new Datasources11ActionGrouper());
+ grouperList.add(new FragmentRouting11ActionGrouper());
+ grouperList.add(new Scripting11ActionGrouper());
+ grouperList.add(new Templating11ActionGrouper());
+ grouperList.add(new PersistenceActionGrouper());
+ grouperList.add(new Validation10ActionGrouper());
+ return grouperList;
+ }
+
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-09-13 21:39:20 UTC (rev 17542)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-09-14 12:36:19 UTC (rev 17543)
@@ -73,6 +73,7 @@
import org.jboss.tools.smooks.graphical.editors.model.JavaBeanGraphModel;
import org.jboss.tools.smooks.model.graphics.ext.FigureType;
import org.jboss.tools.smooks.model.graphics.ext.GraphType;
+import org.jboss.tools.smooks.model.graphics.ext.ISmooksGraphChangeListener;
import org.jboss.tools.smooks.model.graphics.ext.SmooksGraphicsExtType;
import org.jboss.tools.smooks.model.smooks.DocumentRoot;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
@@ -83,7 +84,7 @@
*
*/
public class SmooksGraphicalEditorPart extends GraphicalEditorWithPalette implements ISelectionChangedListener,
- ISourceSynchronizeListener {
+ ISourceSynchronizeListener, ISmooksGraphChangeListener {
public static final int EXECUTE_COMMAND = 0;
@@ -509,6 +510,32 @@
}
}
+ protected List<AbstractSmooksGraphicalModel> createInputDataGraphModel() {
+ List<AbstractSmooksGraphicalModel> inputGraphModel = new ArrayList<AbstractSmooksGraphicalModel>();
+ if (inputDataList != null && root != null) {
+ for (Iterator<?> iterator = inputDataList.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ ITreeContentProvider contentProvider = new XMLStructuredDataContentProvider();
+ ILabelProvider labelProvider = new XMLStructuredDataLabelProvider();
+ InputDataRootModel containerModel = new InputDataRootModel();
+
+ if (object instanceof JavaBeanModel) {
+ contentProvider = new JavabeanContentProvider();
+ labelProvider = new JavabeanlabelProvider();
+
+ }
+ containerModel.getChildren().add((IXMLStructuredObject) object);
+ if (containerModel != null) {
+ TreeContainerModel container = new InputDataContianerModel(containerModel, contentProvider,
+ labelProvider);
+ root.addTreeNode(container);
+ inputGraphModel.add(container);
+ }
+ }
+ }
+ return inputGraphModel;
+ }
+
@Override
protected void hookGraphicalViewer() {
// super.hookGraphicalViewer();
@@ -524,27 +551,11 @@
}
Object obj = smooksModelProvider.getSmooksModel();
+ if(obj == null) return;
AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) smooksModelProvider
.getEditingDomain();
if (inputDataList != null && obj != null && obj instanceof DocumentRoot && editingDomain != null) {
- for (Iterator<?> iterator = inputDataList.iterator(); iterator.hasNext();) {
- Object object = (Object) iterator.next();
- ITreeContentProvider contentProvider = new XMLStructuredDataContentProvider();
- ILabelProvider labelProvider = new XMLStructuredDataLabelProvider();
- InputDataRootModel containerModel = new InputDataRootModel();
-
- if (object instanceof JavaBeanModel) {
- contentProvider = new JavabeanContentProvider();
- labelProvider = new JavabeanlabelProvider();
-
- }
- containerModel.getChildren().add((IXMLStructuredObject) object);
- if (containerModel != null) {
- TreeContainerModel container = new InputDataContianerModel(containerModel, contentProvider,
- labelProvider);
- root.addTreeNode(container);
- }
- }
+ createInputDataGraphModel();
SmooksResourceListType listType = ((DocumentRoot) obj).getSmooksResourceList();
List<?> arcList = listType.getAbstractResourceConfig();
for (Iterator<?> iterator = arcList.iterator(); iterator.hasNext();) {
@@ -693,7 +704,7 @@
}
protected void expandConnectedModels(Collection<TreeNodeConnection> connections) {
- if (connections == null)
+ if (connections == null || connections.isEmpty())
return;
List<TreeNodeModel> expanedTreeNodeList = new ArrayList<TreeNodeModel>();
for (Iterator<?> iterator = connections.iterator(); iterator.hasNext();) {
@@ -785,7 +796,63 @@
@Override
protected PaletteRoot getPaletteRoot() {
- SmooksGraphicalEditorPaletteRootCreator creator = new SmooksGraphicalEditorPaletteRootCreator();
+ SmooksGraphicalEditorPaletteRootCreator creator = new SmooksGraphicalEditorPaletteRootCreator(
+ (AdapterFactoryEditingDomain) this.smooksModelProvider.getEditingDomain(), getSmooksResourceListType());
return creator.createPaletteRoot();
}
+
+ private SmooksResourceListType getSmooksResourceListType(){
+ if(smooksModelProvider != null){
+ Object obj = smooksModelProvider.getSmooksModel();
+ smooksResourceList = null;
+ if (obj instanceof DocumentRoot) {
+ smooksResourceList = ((DocumentRoot) obj).getSmooksResourceList();
+ }
+ return smooksResourceList;
+ }
+ return null;
+ }
+
+ public void graphChanged(SmooksGraphicsExtType extType) {
+
+ }
+
+ public void graphPropertyChange(EStructuralFeature featre, Object value) {
+
+ }
+
+ public void inputTypeChanged(SmooksGraphicsExtType extType) {
+ if (root != null) {
+ List<Object> newInputDataList = SelectorCreationDialog.generateInputData(smooksModelProvider
+ .getSmooksGraphicsExt(), getSmooksResourceListType());
+
+ List<InputDataContianerModel> inputs = new ArrayList<InputDataContianerModel>();
+ List<AbstractSmooksGraphicalModel> children = root.getChildren();
+ // remove all input data graph model
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ AbstractSmooksGraphicalModel abstractSmooksGraphicalModel = (AbstractSmooksGraphicalModel) iterator
+ .next();
+ if (abstractSmooksGraphicalModel instanceof InputDataContianerModel) {
+ inputs.add((InputDataContianerModel) abstractSmooksGraphicalModel);
+ }
+ }
+
+ for (Iterator<?> iterator = inputs.iterator(); iterator.hasNext();) {
+ InputDataContianerModel inputModel = (InputDataContianerModel) iterator.next();
+ AbstractSmooksGraphicalModel.disconnectAllConnections(inputModel);
+ root.removeTreeNode(inputModel);
+ }
+
+ inputDataList.clear();
+ inputDataList.addAll(newInputDataList);
+
+ // renew input data graph model
+ List<AbstractSmooksGraphicalModel> inputGraphModel = createInputDataGraphModel();
+ if (inputGraphModel != null && !inputGraphModel.isEmpty()) {
+ List<TreeNodeConnection> connections = createConnectionModel();
+ createConnection(inputGraphModel, connections);
+ expandConnectedModels(connections);
+ }
+ }
+ }
}
15 years
JBoss Tools SVN: r17542 - in trunk: portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/preferences and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-09-13 17:39:20 -0400 (Sun, 13 Sep 2009)
New Revision: 17542
Modified:
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencePage.java
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/preferences/JBossPortletPreferencePage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4871 JBoss Portlet preferences aren't saved after restarting Eclipse
Modified: trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencePage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencePage.java 2009-09-13 06:39:14 UTC (rev 17541)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencePage.java 2009-09-13 21:39:20 UTC (rev 17542)
@@ -66,8 +66,14 @@
@Override
protected void performDefaults() {
configureSeamButton.setSelection(MavenSeamActivator.CONFIGURE_SEAM_VALUE);
+ configureSeamRuntimeButton.setSelection(MavenSeamActivator.CONFIGURE_SEAM_RUNTIME_VALUE);
+ configureSeamArtifactsButton.setSelection(MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS_VALUE);
IPreferenceStore store = MavenSeamActivator.getDefault().getPreferenceStore();
store.setValue(MavenSeamActivator.CONFIGURE_SEAM, MavenSeamActivator.CONFIGURE_SEAM_VALUE);
+ store.setValue(MavenSeamActivator.CONFIGURE_SEAM_RUNTIME, MavenSeamActivator.CONFIGURE_SEAM_RUNTIME_VALUE);
+ store.setValue(MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS, MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS_VALUE);
+ configureSeamRuntimeButton.setEnabled(configureSeamButton.getSelection());
+ configureSeamArtifactsButton.setEnabled(configureSeamButton.getSelection());
super.performDefaults();
}
@@ -75,6 +81,8 @@
public boolean performOk() {
IPreferenceStore store = MavenSeamActivator.getDefault().getPreferenceStore();
store.setValue(MavenSeamActivator.CONFIGURE_SEAM, configureSeamButton.getSelection());
+ store.setValue(MavenSeamActivator.CONFIGURE_SEAM_RUNTIME, configureSeamRuntimeButton.getSelection());
+ store.setValue(MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS, configureSeamArtifactsButton.getSelection());
return super.performOk();
}
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/preferences/JBossPortletPreferencePage.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/preferences/JBossPortletPreferencePage.java 2009-09-13 06:39:14 UTC (rev 17541)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/preferences/JBossPortletPreferencePage.java 2009-09-13 21:39:20 UTC (rev 17542)
@@ -39,13 +39,17 @@
@Override
protected void performDefaults() {
button.setSelection(PortletCoreActivator.DEFAULT_CHECK_RUNTIMES);
+ Preferences preferences = PortletCoreActivator.getDefault().getPluginPreferences();
+ preferences.setValue(PortletCoreActivator.CHECK_RUNTIMES, PortletCoreActivator.DEFAULT_CHECK_RUNTIMES);
+ PortletCoreActivator.getDefault().savePluginPreferences();
super.performDefaults();
}
@Override
public boolean performOk() {
Preferences preferences = PortletCoreActivator.getDefault().getPluginPreferences();
- preferences.setDefault(PortletCoreActivator.CHECK_RUNTIMES, button.getSelection());
+ preferences.setValue(PortletCoreActivator.CHECK_RUNTIMES, button.getSelection());
+ PortletCoreActivator.getDefault().savePluginPreferences();
return super.performOk();
}
15 years
JBoss Tools SVN: r17541 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-09-13 02:39:14 -0400 (Sun, 13 Sep 2009)
New Revision: 17541
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/criteriaeditor.png
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/hqlcriteriaquicknavigation.png
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/hqlpropertycodecompletion.png
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/inlinequeryvalidation.png
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/overlaycontenttypes.png
Log:
some images were converted to indexed 64 colors to be 5K instead of 400K
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/criteriaeditor.png
===================================================================
(Binary files differ)
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/hqlcriteriaquicknavigation.png
===================================================================
(Binary files differ)
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/hqlpropertycodecompletion.png
===================================================================
(Binary files differ)
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/inlinequeryvalidation.png
===================================================================
(Binary files differ)
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/doc/newandnoteworthy/overlaycontenttypes.png
===================================================================
(Binary files differ)
15 years