Author: DartPeng
Date: 2008-10-27 06:33:57 -0400 (Mon, 27 Oct 2008)
New Revision: 11195
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/JavaBeanPropertiesSection.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java
Log:
JBIDE-2992
Add new property section to edit the "beanclass"
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-10-27 10:00:41 UTC (rev
11194)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-10-27 10:33:57 UTC (rev
11195)
@@ -31,6 +31,14 @@
<input
type="org.jboss.tools.smooks.ui.gef.model.LineConnectionModel">
</input>
+ </propertySection>
+ <propertySection
+
class="org.jboss.tools.smooks.javabean.ui.JavaBeanPropertiesSection"
+ id="org.jboss.tools.smooks.ui.javabean.propertyTab.Section"
+ tab="org.jboss.tools.smooks.ui.javabean.propertyTab">
+ <input
+
type="org.jboss.tools.smooks.ui.gef.model.LineConnectionModel">
+ </input>
</propertySection>
</propertySections>
</extension>
@@ -51,6 +59,11 @@
category="connection"
id="org.jboss.tools.smooks.ui.connection.propertyTab"
label="Mapping Properties">
+ </propertyTab>
+ <propertyTab
+ category="connection"
+ id="org.jboss.tools.smooks.ui.javabean.propertyTab"
+ label="JavaBean Properties">
</propertyTab>
</propertyTabs>
</extension>
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java 2008-10-27
10:00:41 UTC (rev 11194)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java 2008-10-27
10:33:57 UTC (rev 11195)
@@ -156,7 +156,7 @@
public MappingResourceConfigList analyzeMappingSmooksModel(
SmooksResourceListType listType, Object sourceObject,
Object targetObject) {
- throw new RuntimeException("The Smooks editor doesn't support to parse the
Java2XML config file currently.The feature is coming soon..");
+ throw new RuntimeException("The Smooks editor doesn't support to parse the
Java2XML config file currently.");
}
protected String getTheJavaBeanString(JavaBeanModel currentModel) {
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/JavaBeanPropertiesSection.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/JavaBeanPropertiesSection.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/JavaBeanPropertiesSection.java 2008-10-27
10:33:57 UTC (rev 11195)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.javabean.ui;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.jboss.tools.smooks.javabean.model.JavaBeanModel;
+import org.jboss.tools.smooks.ui.gef.model.AbstractStructuredDataModel;
+import org.jboss.tools.smooks.ui.gef.model.LineConnectionModel;
+
+/**
+ * @author Dart Peng
+ * @Date : Oct 27, 2008
+ */
+public class JavaBeanPropertiesSection extends AbstractPropertySection {
+
+ private Text beanClassText;
+
+ @Override
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage tabbedPropertySheetPage) {
+ super.createControls(parent, tabbedPropertySheetPage);
+ TabbedPropertySheetWidgetFactory factory = tabbedPropertySheetPage
+ .getWidgetFactory();
+ Composite main = factory.createComposite(parent);
+ FillLayout fill = new FillLayout();
+ fill.marginHeight = 8;
+ fill.marginWidth = 8;
+ main.setLayout(fill);
+
+ Section section = factory.createSection(main, Section.TITLE_BAR);
+ section.setText("JavaBean Properties");
+ Composite controlComposite = factory.createComposite(section);
+ section.setClient(controlComposite);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+
+ controlComposite.setLayout(gl);
+
+ factory.createLabel(controlComposite, "BeanClass");
+
+ beanClassText = factory.createText(controlComposite, "");
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ beanClassText.setLayoutData(gd);
+ }
+
+ public void refresh() {
+ super.refresh();
+ beanClassText.setEnabled(false);
+ IStructuredSelection selection = (IStructuredSelection) this
+ .getSelection();
+ Object obj = selection.getFirstElement();
+ if (obj == null)
+ return;
+ if (obj instanceof EditPart) {
+ Object model = ((EditPart) obj).getModel();
+ if (model instanceof LineConnectionModel) {
+ AbstractStructuredDataModel target = (AbstractStructuredDataModel)
((LineConnectionModel) model)
+ .getTarget();
+ Object referenceObj = target.getReferenceEntityModel();
+ if(referenceObj instanceof JavaBeanModel){
+ beanClassText.setEnabled(true);
+ String className = ((JavaBeanModel)referenceObj).getBeanClass().getName();
+ beanClassText.setText(className);
+ }
+ }
+ }
+ }
+
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/JavaBeanPropertiesSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-27
10:00:41 UTC (rev 11194)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-27
10:33:57 UTC (rev 11195)
@@ -276,9 +276,9 @@
SashForm sashForm = new SashForm(mainComposite, SWT.VERTICAL);
GridData sashFormLd = new GridData(GridData.FILL_BOTH);
sashForm.setLayoutData(sashFormLd);
+// sashForm.
+// sashForm.setSashWidth(1);
- sashForm.setSashWidth(1);
-
designTimeAnalyzeResultRegion = toolkit.createComposite(sashForm);
GridLayout ngl = new GridLayout();
ngl.numColumns = 2;
@@ -286,7 +286,8 @@
designTimeAnalyzeResultRegion.setLayout(ngl);
SashForm mappingMainComposite = new SashForm(sashForm, SWT.NONE);
- mappingMainComposite.setSashWidth(1);
+ // under the eclipse3.3
+// mappingMainComposite.setSashWidth(1);
GridData sgd = new GridData(GridData.FILL_BOTH);
section.setLayoutData(sgd);
{
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java 2008-10-27
10:00:41 UTC (rev 11194)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java 2008-10-27
10:33:57 UTC (rev 11195)
@@ -47,7 +47,7 @@
public MappingResourceConfigList analyzeMappingSmooksModel(
SmooksResourceListType listType, Object sourceObject,
Object targetObject) {
- throw new RuntimeException("The Smooks editor doesn't support to parse the
XML2XML config file currently.The feature is coming soon...");
+ throw new RuntimeException("The Smooks editor doesn't support to parse the
XML2XML config file currently.");
}
public DesignTimeAnalyzeResult[] analyzeGraphModel(