Author: DartPeng
Date: 2009-03-13 01:50:58 -0400 (Fri, 13 Mar 2009)
New Revision: 14202
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/DocumentResourceTypeDetailPage.java
Log:
JBIDE-3953
When select "ftl" type , the parameter table will be hidden ; when select
"xsl" , the table will be shown.
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/DocumentResourceTypeDetailPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/DocumentResourceTypeDetailPage.java 2009-03-13
05:28:48 UTC (rev 14201)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/DocumentResourceTypeDetailPage.java 2009-03-13
05:50:58 UTC (rev 14202)
@@ -3,8 +3,11 @@
*/
package org.jboss.tools.smooks.ui.editors;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -26,6 +29,7 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.events.HyperlinkEvent;
@@ -45,7 +49,7 @@
*/
public class DocumentResourceTypeDetailPage extends
AbstractSmooksModelDetailPage implements ParamaterChangeLitener {
-
+ private List tempParameterList = null;
private static final int INNER = 0;
private static final int EXTERNAL = 1;
private Text text;
@@ -62,6 +66,7 @@
// private static final String PARAM_VALUE_PRO = "__param_value_pro";
private ParamaterTableViewerCreator creator;
+ private Label parameterLabel;
public DocumentResourceTypeDetailPage(SmooksFormEditor parentEditor,
EditingDomain domain) {
@@ -196,6 +201,7 @@
typeCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
+ if(!canFireChange) return;
resetResourceType();
}
@@ -238,23 +244,40 @@
if (type != null) {
type = type.trim();
}
-
ResourceType resource = resourceConfig.getResource();
if (resource != null) {
resource.setType(type);
+ if (type.equals("ftl") && creator != null) {
+ creator.setVisible(false);
+ parameterLabel.setVisible(false);
+ tempParameterList = new ArrayList(resourceConfig.getParam());
+ resourceConfig.getParam().clear();
+ } else {
+ creator.setVisible(true);
+ parameterLabel.setVisible(true);
+ if(tempParameterList != null){
+ for (Iterator iterator = tempParameterList.iterator(); iterator
+ .hasNext();) {
+ ParamType obj = (ParamType) iterator.next();
+ resourceConfig.getParam().add(obj);
+ }
+ tempParameterList.clear();
+ tempParameterList = null;
+ }
+ }
parentEditor.fireEditorDirty(true);
}
+
}
protected void createParamerTable(Composite parent) {
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- formToolKit.createLabel(parent, "Paramater List : ").setLayoutData(gd);
- creator = new ParamaterTableViewerCreator(
- parent, formToolKit, SWT.NONE);
+ parameterLabel = formToolKit.createLabel(parent, "Parameter List : ");
+ parameterLabel.setLayoutData(gd);
+ creator = new ParamaterTableViewerCreator(parent, formToolKit, SWT.NONE);
creator.addParamaterListener(this);
}
-
protected void createInnerContentsGUI(Composite parent) {
GridData gd = new GridData(GridData.BEGINNING);
gd.verticalAlignment = GridData.BEGINNING;
@@ -268,6 +291,7 @@
innerContentText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
+ if(!canFireChange) return;
resetCDATA();
}
@@ -312,6 +336,7 @@
SmooksModelUtils.setTextToAnyType(resource, text);
}
}
+ if(!canFireChange) return;
this.parentEditor.fireEditorDirty(true);
}
@@ -348,7 +373,15 @@
String type = resource.getType();
if (type != null) {
typeCombo.setText(type);
+ if (type.equals("ftl")) {
+ creator.setVisible(false);
+ parameterLabel.setVisible(false);
+ } else {
+ creator.setVisible(true);
+ parameterLabel.setVisible(true);
+ }
}
+
if (isInit) {
creator.setInput(resourceConfig);
creator.setResourceConfig(resourceConfig);
Show replies by date