Author: DartPeng
Date: 2009-11-28 14:45:06 -0500 (Sat, 28 Nov 2009)
New Revision: 18907
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
Log:
JBIDE-5297
synchronize the option page with the source page.
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-11-28
19:23:31 UTC (rev 18906)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2009-11-28
19:45:06 UTC (rev 18907)
@@ -58,7 +58,8 @@
* @author Dart
*
*/
-public class SmooksConfigurationOverviewPage extends FormPage implements
ISmooksModelValidateListener, ISourceSynchronizeListener {
+public class SmooksConfigurationOverviewPage extends FormPage implements
ISmooksModelValidateListener,
+ ISourceSynchronizeListener {
private ISmooksModelProvider smooksModelProvider;
private ModelPanelCreator defaultSettingPanelCreator;
@@ -68,33 +69,33 @@
private Combo streamFilterTypeCombo;
private Button defaultSerializationOnCheckbox;
+ private Combo versionCombo;
// unused fields for now
-// private Button newParamButton;
-// private Button removeParamButton;
-// private Button upParamButton;
-// private Button downParamButton;
-// private Button paramPropertiesButton;
-// private TableViewer paramViewer;
-// private TableViewer conditionViewer;
-// private Button newConditionButton;
-// private Button removeConditionButton;
-// private Button upConditionButton;
-// private Button downConditionButton;
-// private Button conditionPropertiesButton;
-// private Composite defaultSettingComposite;
-// private Button newProfileButton;
-// private Button removeProfileButton;
-// private Button upProfileButton;
-// private Button downProfileButton;
-// private Button profilePropertiesButton;
-// private TableViewer profileViewer;
-// private Section generalSettingSection;
-// private Section conditionSection;
-// private Section profilesSection;
-// private Text smooksNameText;
-// private Text smooksAuthorText;
-
+ // private Button newParamButton;
+ // private Button removeParamButton;
+ // private Button upParamButton;
+ // private Button downParamButton;
+ // private Button paramPropertiesButton;
+ // private TableViewer paramViewer;
+ // private TableViewer conditionViewer;
+ // private Button newConditionButton;
+ // private Button removeConditionButton;
+ // private Button upConditionButton;
+ // private Button downConditionButton;
+ // private Button conditionPropertiesButton;
+ // private Composite defaultSettingComposite;
+ // private Button newProfileButton;
+ // private Button removeProfileButton;
+ // private Button upProfileButton;
+ // private Button downProfileButton;
+ // private Button profilePropertiesButton;
+ // private TableViewer profileViewer;
+ // private Section generalSettingSection;
+ // private Section conditionSection;
+ // private Section profilesSection;
+ // private Text smooksNameText;
+ // private Text smooksAuthorText;
public SmooksConfigurationOverviewPage(FormEditor editor, String id, String title,
ISmooksModelProvider provider) {
super(editor, id, title);
@@ -146,8 +147,8 @@
createSettingSection(settingComposite, toolkit);
- globalParamSection = toolkit.createSection(mainComposite, Section.TITLE_BAR
- | Section.TWISTIE | Section.EXPANDED);
+ globalParamSection = toolkit.createSection(mainComposite, Section.TITLE_BAR |
Section.TWISTIE
+ | Section.EXPANDED);
globalParamSection.setText("Filter Settings");
globalParamSection.setLayout(new FillLayout());
Composite globalParamComposite = toolkit.createComposite(globalParamSection);
@@ -163,60 +164,67 @@
createGlobalParamterSection(globalParamComposite, toolkit);
- // Have disabled the more open methods for applying "global" properties for
now
-// generalSettingSection = toolkit.createSection(mainComposite, Section.DESCRIPTION |
Section.TITLE_BAR
-// | Section.TWISTIE | Section.EXPANDED);
-// generalSettingSection.setLayout(new FillLayout());
-// generalSettingSection.setText("Smooks Default Setting");
-// generalSettingSection.setDescription("Define the Smooks configuration file
default setting");
-// defaultSettingComposite = toolkit.createComposite(generalSettingSection);
-// generalSettingSection.setClient(defaultSettingComposite);
-// gd = new GridData();
-// gd.widthHint = 500;
-// generalSettingSection.setLayoutData(gd);
-//
-// GridLayout ggl = new GridLayout();
-// defaultSettingComposite.setLayout(ggl);
-// ggl.numColumns = 2;
-// ggl.verticalSpacing = 0;
-//
-// createDefaultSection(defaultSettingComposite, toolkit);
-//
-// 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);
-// gd = new GridData();
-// gd.verticalAlignment = GridData.BEGINNING;
-// gd.widthHint = 500;
-// conditionSection.setLayoutData(gd);
-//
-// GridLayout cgl = new GridLayout();
-// conditionComposite.setLayout(cgl);
-// cgl.numColumns = 2;
-//
-// createConditionsSection(conditionComposite, toolkit);
-//
-// 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);
-// profilesSection.setClient(profilesComposite);
-// gd = new GridData();
-// gd.verticalAlignment = GridData.BEGINNING;
-// gd.widthHint = 500;
-// profilesSection.setLayoutData(gd);
-//
-// GridLayout pgl = new GridLayout();
-// profilesComposite.setLayout(pgl);
-// pgl.numColumns = 2;
-//
-// createProfilesSection(profilesComposite, toolkit);
+ // Have disabled the more open methods for applying "global" properties
+ // for now
+ // generalSettingSection = toolkit.createSection(mainComposite,
+ // Section.DESCRIPTION | Section.TITLE_BAR
+ // | Section.TWISTIE | Section.EXPANDED);
+ // generalSettingSection.setLayout(new FillLayout());
+ // generalSettingSection.setText("Smooks Default Setting");
+ // generalSettingSection.setDescription("Define the Smooks configuration file
default setting");
+ // defaultSettingComposite =
+ // toolkit.createComposite(generalSettingSection);
+ // generalSettingSection.setClient(defaultSettingComposite);
+ // gd = new GridData();
+ // gd.widthHint = 500;
+ // generalSettingSection.setLayoutData(gd);
+ //
+ // GridLayout ggl = new GridLayout();
+ // defaultSettingComposite.setLayout(ggl);
+ // ggl.numColumns = 2;
+ // ggl.verticalSpacing = 0;
+ //
+ // createDefaultSection(defaultSettingComposite, toolkit);
+ //
+ // 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);
+ // gd = new GridData();
+ // gd.verticalAlignment = GridData.BEGINNING;
+ // gd.widthHint = 500;
+ // conditionSection.setLayoutData(gd);
+ //
+ // GridLayout cgl = new GridLayout();
+ // conditionComposite.setLayout(cgl);
+ // cgl.numColumns = 2;
+ //
+ // createConditionsSection(conditionComposite, toolkit);
+ //
+ // 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);
+ // profilesSection.setClient(profilesComposite);
+ // gd = new GridData();
+ // gd.verticalAlignment = GridData.BEGINNING;
+ // gd.widthHint = 500;
+ // profilesSection.setLayoutData(gd);
+ //
+ // GridLayout pgl = new GridLayout();
+ // profilesComposite.setLayout(pgl);
+ // pgl.numColumns = 2;
+ //
+ // createProfilesSection(profilesComposite, toolkit);
}
@@ -227,75 +235,27 @@
if (SmooksUIUtils.isLinuxOS()) {
type = SWT.BORDER;
}
- final Combo combo = new Combo(settingComposite, type | SWT.READ_ONLY);
- combo.setEnabled(false);
+ versionCombo = new Combo(settingComposite, type | SWT.READ_ONLY);
+ versionCombo.setEnabled(false);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- combo.setLayoutData(gd);
+ versionCombo.setLayoutData(gd);
for (int i = 0; i < SmooksConstants.SMOOKS_VERSIONS.length; i++) {
String version = SmooksConstants.SMOOKS_VERSIONS[i];
- combo.add(version);
+ versionCombo.add(version);
}
String version = getSmooksVersion();
if (version != null)
- combo.setText(version);
- combo.addModifyListener(new ModifyListener() {
+ versionCombo.setText(version);
+ versionCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- String v = combo.getText();
-// if (smooksModelProvider != null) {
-// smooksModelProvider.getSmooksGraphicsExt().setPlatformVersion(v);
-// }
+ // if (smooksModelProvider != null) {
+ // smooksModelProvider.getSmooksGraphicsExt().setPlatformVersion(v);
+ // }
}
});
- // have hidden the Name & Author bits
-// toolkit.createLabel(settingComposite, "Name :
").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-// smooksNameText = toolkit.createText(settingComposite, "", SWT.NONE);
-// smooksNameText.setLayoutData(gd);
-// String name = smooksModelProvider.getSmooksGraphicsExt().getName();
-// if (name != null)
-// smooksNameText.setText(name);
-// smooksNameText.addModifyListener(new ModifyListener() {
-//
-// public void modifyText(ModifyEvent e) {
-// if (lockEventFire)
-// return;
-// if (smooksModelProvider != null) {
-// Command setCommand = SetCommand.create(smooksModelProvider.getEditingDomain(),
smooksModelProvider
-// .getSmooksGraphicsExt(), GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__NAME,
-// smooksNameText.getText());
-// smooksModelProvider.getEditingDomain().getCommandStack().execute(setCommand);
-// }
-// }
-// });
-//
-// toolkit.paintBordersFor(settingComposite);
-//
-// toolkit.createLabel(settingComposite, "Author : ").setForeground(
-// toolkit.getColors().getColor(IFormColors.TITLE));
-// smooksAuthorText = toolkit.createText(settingComposite, "", SWT.NONE);
-// smooksAuthorText.setLayoutData(gd);
-//
-// String author = smooksModelProvider.getSmooksGraphicsExt().getAuthor();
-// if (author != null)
-// smooksAuthorText.setText(author);
-// smooksAuthorText.addModifyListener(new ModifyListener() {
-//
-// public void modifyText(ModifyEvent e) {
-// if (lockEventFire)
-// return;
-// if (smooksModelProvider != null) {
-// Command setCommand = SetCommand.create(smooksModelProvider.getEditingDomain(),
smooksModelProvider
-// .getSmooksGraphicsExt(),
GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__AUTHOR,
-// smooksAuthorText.getText());
-// smooksModelProvider.getEditingDomain().getCommandStack().execute(setCommand);
-// }
-// }
-// });
-//
-// toolkit.createLabel(settingComposite, "");
-
toolkit.paintBordersFor(settingComposite);
}
@@ -324,7 +284,7 @@
if (parent != null) {
EList<?> parmList = parent.getParam();
for (int i = 0; i < parmList.size(); i++) {
- param = (ParamType)parmList.get(i);
+ param = (ParamType) parmList.get(i);
if (param.getName().equals(propertyID)) {
foundProperty = true;
break;
@@ -359,64 +319,48 @@
editingDomain.getCommandStack().execute(command);
((SmooksResourceListType) resource).setParams((ParamsType) parent);
}
-
+
private void createGlobalParamterSection(Composite globalParamComposite, FormToolkit
toolkit) {
- // ModelPanelCreator creator = new ModelPanelCreator();
if (smooksModelProvider != null) {
-// AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain)
smooksModelProvider
-// .getEditingDomain();
- ParamsType m = getParamsType();
- // if (m == null)
- // return;
- toolkit.createLabel(globalParamComposite, "Stream Filter
Type:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ toolkit.createLabel(globalParamComposite, "Stream Filter
Type:").setForeground(
+ toolkit.getColors().getColor(IFormColors.TITLE));
GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
- streamFilterTypeCombo = new Combo(globalParamComposite, SWT.DROP_DOWN | SWT.READ_ONLY
);
- streamFilterTypeCombo.setItems(new String[] {"SAX", "DOM"});
+ streamFilterTypeCombo = new Combo(globalParamComposite, SWT.DROP_DOWN |
SWT.READ_ONLY);
+ streamFilterTypeCombo.setItems(new String[] { "SAX", "DOM" });
streamFilterTypeCombo.setLayoutData(gd);
- toolkit.createLabel(globalParamComposite, "Default Serialization is
On:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ toolkit.createLabel(globalParamComposite, "Default Serialization is
On:").setForeground(
+ toolkit.getColors().getColor(IFormColors.TITLE));
gd = new GridData(SWT.FILL, SWT.NONE, true, false);
defaultSerializationOnCheckbox = toolkit.createButton(globalParamComposite,
"", SWT.CHECK);
defaultSerializationOnCheckbox.setLayoutData(gd);
- if (m != null) {
- EList<?> parmList = m.getParam();
- for (int i = 0; i < parmList.size(); i++) {
- ParamType param = (ParamType)parmList.get(i);
- if (param.getName().equals("stream.filter.type")) {
- streamFilterTypeCombo.setText(param.getStringValue());
- }
- else if (param.getName().equals("default.serialization.on")) {
- Boolean boolValue = Boolean.valueOf(param.getStringValue());
- defaultSerializationOnCheckbox.setSelection(boolValue.booleanValue());
- }
- }
- }
- else { // set defaults
- streamFilterTypeCombo.setText("SAX");
- defaultSerializationOnCheckbox.setSelection(true);
- }
+ initGlobalSettingControls();
toolkit.paintBordersFor(globalParamComposite);
-
- streamFilterTypeCombo.addSelectionListener( new SelectionListener() {
-
+
+ streamFilterTypeCombo.addSelectionListener(new SelectionListener() {
+
public void widgetSelected(SelectionEvent e) {
+ if (lockEventFire)
+ return;
String value = streamFilterTypeCombo.getText();
- updateGlobalProperty ("stream.filter.type", value);
+ updateGlobalProperty("stream.filter.type", value);
}
-
+
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
-
- defaultSerializationOnCheckbox.addSelectionListener( new SelectionListener() {
+ defaultSerializationOnCheckbox.addSelectionListener(new SelectionListener() {
+
public void widgetDefaultSelected(SelectionEvent e) {
+ if (lockEventFire)
+ return;
String value = Boolean.toString(defaultSerializationOnCheckbox.getSelection());
- updateGlobalProperty ("default.serialization.on", value);
+ updateGlobalProperty("default.serialization.on", value);
}
public void widgetSelected(SelectionEvent e) {
@@ -425,97 +369,127 @@
});
// am hiding the more open Global Parameters method for now
-// paramViewer = new TableViewer(globalParamComposite);
-// GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
-// paramViewer.getControl().setLayoutData(gd);
-// toolkit.paintBordersFor(globalParamComposite);
-// Composite buttonArea = toolkit.createComposite(globalParamComposite);
-// gd = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL);
-// gd.widthHint = 200;
-// GridLayout bgl = new GridLayout();
-// buttonArea.setLayout(bgl);
-//
-// newParamButton = toolkit.createButton(buttonArea, "New", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// newParamButton.setLayoutData(gd);
-//
-// removeParamButton = toolkit.createButton(buttonArea, "Remove", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// removeParamButton.setLayoutData(gd);
-//
-// upParamButton = toolkit.createButton(buttonArea, "Up", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// upParamButton.setLayoutData(gd);
-//
-// downParamButton = toolkit.createButton(buttonArea, "Down", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// downParamButton.setLayoutData(gd);
-//
-// paramPropertiesButton = toolkit.createButton(buttonArea, "Properties..",
SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// paramPropertiesButton.setLayoutData(gd);
-//
-// paramViewer.setContentProvider(new
AdapterFactoryContentProvider(editingDomain.getAdapterFactory()) {
-//
-// @Override
-// public boolean hasChildren(Object object) {
-// return false;
-// }
-//
-// });
-//
-// paramViewer.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 (m != null) {
-// paramViewer.setInput(m);
-// }
-//
-// paramViewer.addDoubleClickListener(new IDoubleClickListener() {
-//
-// public void doubleClick(DoubleClickEvent event) {
-// openParamPropertiesModifyDialog();
-// }
-// });
-//
-// paramViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-//
-// public void selectionChanged(SelectionChangedEvent event) {
-// updateParamButtons();
-// }
-// });
-//
-// hookGlobalParamterButtons();
-// updateParamButtons();
+ // paramViewer = new TableViewer(globalParamComposite);
+ // GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ // paramViewer.getControl().setLayoutData(gd);
+ // toolkit.paintBordersFor(globalParamComposite);
+ // Composite buttonArea =
+ // toolkit.createComposite(globalParamComposite);
+ // gd = new GridData(GridData.FILL_VERTICAL |
+ // GridData.FILL_HORIZONTAL);
+ // gd.widthHint = 200;
+ // GridLayout bgl = new GridLayout();
+ // buttonArea.setLayout(bgl);
+ //
+ // newParamButton = toolkit.createButton(buttonArea, "New",
+ // SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // newParamButton.setLayoutData(gd);
+ //
+ // removeParamButton = toolkit.createButton(buttonArea, "Remove",
+ // SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // removeParamButton.setLayoutData(gd);
+ //
+ // upParamButton = toolkit.createButton(buttonArea, "Up", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // upParamButton.setLayoutData(gd);
+ //
+ // downParamButton = toolkit.createButton(buttonArea, "Down",
+ // SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // downParamButton.setLayoutData(gd);
+ //
+ // paramPropertiesButton = toolkit.createButton(buttonArea,
+ // "Properties..", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // paramPropertiesButton.setLayoutData(gd);
+ //
+ // paramViewer.setContentProvider(new
+ // AdapterFactoryContentProvider(editingDomain.getAdapterFactory())
+ // {
+ //
+ // @Override
+ // public boolean hasChildren(Object object) {
+ // return false;
+ // }
+ //
+ // });
+ //
+ // paramViewer.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 (m != null) {
+ // paramViewer.setInput(m);
+ // }
+ //
+ // paramViewer.addDoubleClickListener(new IDoubleClickListener() {
+ //
+ // public void doubleClick(DoubleClickEvent event) {
+ // openParamPropertiesModifyDialog();
+ // }
+ // });
+ //
+ // paramViewer.addSelectionChangedListener(new
+ // ISelectionChangedListener() {
+ //
+ // public void selectionChanged(SelectionChangedEvent event) {
+ // updateParamButtons();
+ // }
+ // });
+ //
+ // hookGlobalParamterButtons();
+ // updateParamButtons();
}
}
-// public void graphChanged(SmooksGraphicsExtType extType) {
-//
-// }
+ // public void graphChanged(SmooksGraphicsExtType extType) {
+ //
+ // }
public void graphPropertyChange(EStructuralFeature featre, Object value) {
}
+ protected void initGlobalSettingControls() {
+ ParamsType m = getParamsType();
+ if (m != null) {
+ EList<?> parmList = m.getParam();
+ for (int i = 0; i < parmList.size(); i++) {
+ ParamType param = (ParamType) parmList.get(i);
+ if (param.getName().equals("stream.filter.type")) {
+ streamFilterTypeCombo.setText(param.getStringValue());
+ } else if (param.getName().equals("default.serialization.on")) {
+ Boolean boolValue = Boolean.valueOf(param.getStringValue());
+ defaultSerializationOnCheckbox.setSelection(boolValue.booleanValue());
+ }
+ }
+ } else { // set defaults
+ streamFilterTypeCombo.setText("SAX");
+ defaultSerializationOnCheckbox.setSelection(true);
+ }
+ }
+
public ModelPanelCreator getDefaultSettingPanelCreator() {
if (defaultSettingPanelCreator == null) {
defaultSettingPanelCreator = new ModelPanelCreator();
@@ -523,9 +497,9 @@
return defaultSettingPanelCreator;
}
-// public void inputTypeChanged(SmooksGraphicsExtType extType) {
-//
-// }
+ // public void inputTypeChanged(SmooksGraphicsExtType extType) {
+ //
+ // }
public void validateEnd(List<Diagnostic> diagnosticResult) {
ModelPanelCreator creator = getDefaultSettingPanelCreator();
@@ -538,28 +512,47 @@
public void sourceChange(Object model) {
lockEventFire = true;
-// SmooksGraphicsExtType extType = smooksModelProvider.getSmooksGraphicsExt();
-// if (extType == null) {
-// return;
-// }
+ streamFilterTypeCombo.setEnabled(true);
+ defaultSerializationOnCheckbox.setEnabled(true);
+ String version = getSmooksVersion();
+ if (version == null)
+ version = "";
+ versionCombo.setText(version);
-// String name = extType.getName();
-// if (name != null)
-// smooksNameText.setText(name);
-//
-// String author = extType.getAuthor();
-// if (author != null)
-// smooksAuthorText.setText(author);
+ if (model == null) {
+ // the file was broken
+ streamFilterTypeCombo.setEnabled(false);
+ defaultSerializationOnCheckbox.setEnabled(false);
+ defaultSerializationOnCheckbox.setSelection(false);
+ } else {
+ initGlobalSettingControls();
+ }
+
+ // SmooksGraphicsExtType extType =
+ // smooksModelProvider.getSmooksGraphicsExt();
+ // if (extType == null) {
+ // return;
+ // }
+
+ // String name = extType.getName();
+ // if (name != null)
+ // smooksNameText.setText(name);
+ //
+ // String author = extType.getAuthor();
+ // if (author != null)
+ // smooksAuthorText.setText(author);
+
lockEventFire = false;
-// disposeDefaultSettingCompositeControls();
-// createDefaultSection(defaultSettingComposite, this.getManagedForm().getToolkit());
-// defaultSettingComposite.getParent().layout();
-//
-// paramViewer.setInput(getParamsType());
-// conditionViewer.setInput(getConditionsType());
-// profileViewer.setInput(getProfilesType());
+ // disposeDefaultSettingCompositeControls();
+ // createDefaultSection(defaultSettingComposite,
+ // this.getManagedForm().getToolkit());
+ // defaultSettingComposite.getParent().layout();
+ //
+ // paramViewer.setInput(getParamsType());
+ // conditionViewer.setInput(getConditionsType());
+ // profileViewer.setInput(getProfilesType());
}
protected void disposeCompositeControls(Composite composite, Control[] ignoreControl) {
@@ -595,824 +588,920 @@
private String getSmooksVersion() {
if (smooksModelProvider != null) {
return smooksModelProvider.getPlatformVersion();
-// if (ext != null) {
-// return ext.getPlatformVersion();
-// }
+ // if (ext != null) {
+ // return ext.getPlatformVersion();
+ // }
}
return null;
}
-/*
- * The following code has been commented out for now. We may add more properties as they
become necessary,
- * but for now, this is just extraneous code and confusing UI for the user that
doesn't add much
- * functionality.
- */
-// protected void createProfilesSection(Composite profilesComposite, FormToolkit toolkit)
{
-// if (smooksModelProvider != null) {
-// AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain)
smooksModelProvider
-// .getEditingDomain();
-// EObject profiles = getProfilesType();
-// // if (m == null)
-// // return;
-//
-// profileViewer = new TableViewer(profilesComposite);
-// GridData gd = new GridData(GridData.FILL_BOTH);
-// profileViewer.getControl().setLayoutData(gd);
-// toolkit.paintBordersFor(profilesComposite);
-// Composite buttonArea = toolkit.createComposite(profilesComposite);
-// gd = new GridData(GridData.FILL_VERTICAL);
-// gd.widthHint = 30;
-// GridLayout bgl = new GridLayout();
-// buttonArea.setLayout(bgl);
-//
-// newProfileButton = toolkit.createButton(buttonArea, "New", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// newProfileButton.setLayoutData(gd);
-//
-// removeProfileButton = toolkit.createButton(buttonArea, "Remove",
SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// removeProfileButton.setLayoutData(gd);
-//
-// upProfileButton = toolkit.createButton(buttonArea, "Up", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// upProfileButton.setLayoutData(gd);
-//
-// downProfileButton = toolkit.createButton(buttonArea, "Down", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// downProfileButton.setLayoutData(gd);
-//
-// profilePropertiesButton = toolkit.createButton(buttonArea, "Properties..",
SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// profilePropertiesButton.setLayoutData(gd);
-//
-// profileViewer.setContentProvider(new
AdapterFactoryContentProvider(editingDomain.getAdapterFactory()) {
-//
-// @Override
-// public boolean hasChildren(Object object) {
-// return false;
-// }
-//
-// });
-//
-// profileViewer.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 (profiles != null) {
-// profileViewer.setInput(profiles);
-// }
-//
-// profileViewer.addDoubleClickListener(new IDoubleClickListener() {
-//
-// public void doubleClick(DoubleClickEvent event) {
-// openProfilePropertiesModifyDialog();
-// }
-// });
-//
-// profileViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-//
-// public void selectionChanged(SelectionChangedEvent event) {
-// updateProfilesButtons();
-// }
-// });
-//
-// hookProfilesButtons();
-// updateProfilesButtons();
-// }
-// }
-//
-// protected void openProfilePropertiesModifyDialog() {
-// IStructuredSelection selection = (IStructuredSelection)
profileViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof EObject) {
-// EObject profile = (EObject) obj;
-// EObject parent = getProfilesType();
-// EStructuralFeature profileFeature = null;
-// if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
-// profileFeature =
org.jboss.tools.smooks10.model.smooks.SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
-// }
-// if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
-// profileFeature = SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
-// }
-//
-// NewOrModifySmooksElementDialog dialog = new
NewOrModifySmooksElementDialog(getEditorSite().getShell(),
-// profileFeature, profile, parent, getManagedForm().getToolkit(),
smooksModelProvider,
-// SmooksConfigurationOverviewPage.this, true);
-// dialog.open();
-// }
-// }
-//
-// protected void updateProfilesButtons() {
-// if (getSmooksVersion() == null) {
-// profilePropertiesButton.setEnabled(false);
-// newProfileButton.setEnabled(false);
-// removeProfileButton.setEnabled(false);
-// upProfileButton.setEnabled(false);
-// downProfileButton.setEnabled(false);
-// return;
-// }
-// profilePropertiesButton.setEnabled(true);
-// removeProfileButton.setEnabled(true);
-// IStructuredSelection selection = (IStructuredSelection)
profileViewer.getSelection();
-// if (selection == null) {
-// profilePropertiesButton.setEnabled(false);
-// removeProfileButton.setEnabled(false);
-// upProfileButton.setEnabled(false);
-// downProfileButton.setEnabled(false);
-// } else {
-// if (selection.getFirstElement() == null) {
-// profilePropertiesButton.setEnabled(false);
-// removeProfileButton.setEnabled(false);
-// upProfileButton.setEnabled(false);
-// downProfileButton.setEnabled(false);
-// return;
-// }
-//
-// Object obj = selection.getFirstElement();
-// if (obj instanceof EObject) {
-// EObject profilesType = getProfilesType();
-// 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);
-// upProfileButton.setEnabled(command.canExecute());
-//
-// Command command1 = MoveCommand.create(smooksModelProvider.getEditingDomain(),
parent, null, obj,
-// index + 1);
-// downProfileButton.setEnabled(command1.canExecute());
-// }
-//
-// if (selection.size() > 1) {
-// profilePropertiesButton.setEnabled(false);
-// removeProfileButton.setEnabled(false);
-// }
-// }
-//
-// }
-//
-// protected void hookProfilesButtons() {
-// newProfileButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// if (getSmooksVersion() == null) {
-// return;
-// }
-// EObject model = null;
-// if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
-// model =
org.jboss.tools.smooks10.model.smooks.SmooksFactory.eINSTANCE.createProfileType();
-// }
-// if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
-// model = SmooksFactory.eINSTANCE.createProfileType();
-// }
-// EObject parent = getProfilesType();
-// boolean newParent = false;
-// if (parent == null) {
-// newParent = true;
-// if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
-// parent =
org.jboss.tools.smooks10.model.smooks.SmooksFactory.eINSTANCE.createProfilesType();
-// }
-// if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
-// parent = SmooksFactory.eINSTANCE.createProfilesType();
-// }
-// }
-// EStructuralFeature profileFeature = null;
-// if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
-// profileFeature =
org.jboss.tools.smooks10.model.smooks.SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
-// }
-// if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
-// profileFeature = SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
-// }
-// NewOrModifySmooksElementDialog dialog = new
NewOrModifySmooksElementDialog(getEditorSite().getShell(),
-// profileFeature, model, parent, getManagedForm().getToolkit(),
smooksModelProvider,
-// SmooksConfigurationOverviewPage.this, false);
-//
-// EStructuralFeature profilesFeature = null;
-// if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
-// profilesFeature =
org.jboss.tools.smooks10.model.smooks.SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__PROFILES;
-// }
-// if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
-// profilesFeature = SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__PROFILES;
-// }
-// if (dialog.open() == Dialog.OK && newParent) {
-// EObject resource = getSmooksResourceList();
-// if (resource == null)
-// return;
-// Command command = SetCommand.create(smooksModelProvider.getEditingDomain(),
resource,
-// profilesFeature, parent);
-// if (command.canExecute()) {
-// smooksModelProvider.getEditingDomain().getCommandStack().execute(command);
-// profileViewer.setInput(parent);
-// }
-// }
-// super.widgetSelected(e);
-// }
-//
-// });
-// removeProfileButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// IStructuredSelection selection = (IStructuredSelection)
profileViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof EObject) {
-// EObject profile = (EObject) obj;
-// EObject parent = getProfilesType();
-// if (parent == null)
-// return;
-// CompoundCommand compoundCommand = new CompoundCommand();
-// Command command = RemoveCommand.create(smooksModelProvider.getEditingDomain(),
profile);
-// compoundCommand.append(command);
-// if (parent.eContents().size() == 1) {
-// // remove parent;
-// Command command1 = RemoveCommand.create(smooksModelProvider.getEditingDomain(),
parent);
-// compoundCommand.append(command1);
-// }
-// smooksModelProvider.getEditingDomain().getCommandStack().execute(compoundCommand);
-// }
-// }
-//
-// });
-// upProfileButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// IStructuredSelection selection = (IStructuredSelection)
profileViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof EObject) {
-// EObject profilesType = getProfilesType();
-// 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);
-// }
-// }
-//
-// });
-// downProfileButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// IStructuredSelection selection = (IStructuredSelection)
profileViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof EObject) {
-// EObject profilesType = getProfilesType();
-// 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);
-// }
-// }
-//
-// });
-// profilePropertiesButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// openProfilePropertiesModifyDialog();
-// super.widgetSelected(e);
-// }
-//
-// });
-//
-// }
-//
-// private EObject getProfilesType() {
-// if (smooksModelProvider != null) {
-// EObject smooksModel = smooksModelProvider.getSmooksModel();
-// if (smooksModel instanceof DocumentRoot) {
-// EObject m = ((DocumentRoot) smooksModel).getSmooksResourceList().getProfiles();
-// return m;
-// }
-// if (smooksModel instanceof org.jboss.tools.smooks10.model.smooks.DocumentRoot) {
-// EObject m = ((org.jboss.tools.smooks10.model.smooks.DocumentRoot)
smooksModel).getSmooksResourceList()
-// .getProfiles();
-// return m;
-// }
-// }
-// return null;
-// }
-//
-// private ConditionsType getConditionsType() {
-// if (smooksModelProvider != null) {
-// EObject smooksModel = smooksModelProvider.getSmooksModel();
-// if (smooksModel instanceof DocumentRoot) {
-// EObject m = ((DocumentRoot) smooksModel).getSmooksResourceList().getConditions();
-// return (ConditionsType) m;
-// }
-// }
-// return null;
-// }
-//
-// private void createConditionsSection(Composite conditionComposite, FormToolkit
toolkit) {
-// if (smooksModelProvider != null) {
-// AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain)
smooksModelProvider
-// .getEditingDomain();
-// ConditionsType conditions = getConditionsType();
-// // if (m == null)
-// // return;
-//
-// conditionViewer = new TableViewer(conditionComposite);
-// GridData gd = new GridData(GridData.FILL_BOTH);
-// conditionViewer.getControl().setLayoutData(gd);
-// toolkit.paintBordersFor(conditionComposite);
-// Composite buttonArea = toolkit.createComposite(conditionComposite);
-// gd = new GridData(GridData.FILL_VERTICAL);
-// gd.widthHint = 30;
-// GridLayout bgl = new GridLayout();
-// buttonArea.setLayout(bgl);
-//
-// newConditionButton = toolkit.createButton(buttonArea, "New", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// newConditionButton.setLayoutData(gd);
-//
-// removeConditionButton = toolkit.createButton(buttonArea, "Remove",
SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// removeConditionButton.setLayoutData(gd);
-//
-// upConditionButton = toolkit.createButton(buttonArea, "Up", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// upConditionButton.setLayoutData(gd);
-//
-// downConditionButton = toolkit.createButton(buttonArea, "Down", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// downConditionButton.setLayoutData(gd);
-//
-// conditionPropertiesButton = toolkit.createButton(buttonArea,
"Properties..", SWT.NONE);
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// conditionPropertiesButton.setLayoutData(gd);
-//
-// conditionViewer.setContentProvider(new
AdapterFactoryContentProvider(editingDomain.getAdapterFactory()) {
-//
-// @Override
-// public boolean hasChildren(Object object) {
-// return false;
-// }
-//
-// });
-//
-// conditionViewer.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 (conditions != null) {
-// conditionViewer.setInput(conditions);
-// }
-//
-// conditionViewer.addDoubleClickListener(new IDoubleClickListener() {
-//
-// public void doubleClick(DoubleClickEvent event) {
-// openConditionPropertiesModifyDialog();
-// }
-// });
-//
-// conditionViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-//
-// public void selectionChanged(SelectionChangedEvent event) {
-// updateConditionsButtons();
-// }
-// });
-//
-// hookConditionsButtons();
-// updateConditionsButtons();
-// }
-// }
-//
-// protected void hookConditionsButtons() {
-// newConditionButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// if (getSmooksVersion() == null ||
getSmooksVersion().equals(SmooksConstants.VERSION_1_0)) {
-// return;
-// }
-// ConditionType condition = SmooksFactory.eINSTANCE.createConditionType();
-// ConditionsType parent = getConditionsType();
-// boolean newParent = false;
-// if (parent == null) {
-// newParent = true;
-// parent = SmooksFactory.eINSTANCE.createConditionsType();
-//
-// }
-// NewOrModifySmooksElementDialog dialog = new
NewOrModifySmooksElementDialog(getEditorSite().getShell(),
-// SmooksPackage.Literals.CONDITIONS_TYPE__CONDITION, condition, parent,
getManagedForm()
-// .getToolkit(), smooksModelProvider, SmooksConfigurationOverviewPage.this,
false);
-// if (dialog.open() == Dialog.OK && newParent) {
-// EObject resource = getSmooksResourceList();
-// if (resource == null)
-// return;
-// Command command = SetCommand.create(smooksModelProvider.getEditingDomain(),
resource,
-// SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__CONDITIONS, parent);
-// if (command.canExecute()) {
-// smooksModelProvider.getEditingDomain().getCommandStack().execute(command);
-// conditionViewer.setInput(parent);
-// }
-// }
-// super.widgetSelected(e);
-// }
-//
-// });
-// removeConditionButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// IStructuredSelection selection = (IStructuredSelection)
conditionViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ConditionType) {
-// ConditionType condition = (ConditionType) obj;
-// ConditionsType parent = getConditionsType();
-// if (parent == null)
-// return;
-// CompoundCommand compoundCommand = new CompoundCommand();
-// Command command = RemoveCommand.create(smooksModelProvider.getEditingDomain(),
condition);
-// compoundCommand.append(command);
-// if (parent.getCondition().size() == 1) {
-// // remove parent;
-// Command command1 = RemoveCommand.create(smooksModelProvider.getEditingDomain(),
parent);
-// compoundCommand.append(command1);
-// }
-// smooksModelProvider.getEditingDomain().getCommandStack().execute(compoundCommand);
-// }
-// }
-//
-// });
-// upConditionButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// IStructuredSelection selection = (IStructuredSelection)
conditionViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ConditionType) {
-// ConditionsType conditionsType = getConditionsType();
-// if (conditionsType == 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);
-// }
-// }
-//
-// });
-// downConditionButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// IStructuredSelection selection = (IStructuredSelection)
conditionViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ConditionType) {
-// ConditionsType conditionsType = getConditionsType();
-// if (conditionsType == 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);
-// }
-// }
-//
-// });
-// conditionPropertiesButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// openConditionPropertiesModifyDialog();
-// super.widgetSelected(e);
-// }
-//
-// });
-//
-// }
-//
-// protected void updateConditionsButtons() {
-// if (getSmooksVersion() == null ||
getSmooksVersion().equals(SmooksConstants.VERSION_1_0)) {
-// conditionPropertiesButton.setEnabled(false);
-// newConditionButton.setEnabled(false);
-// removeConditionButton.setEnabled(false);
-// upConditionButton.setEnabled(false);
-// downConditionButton.setEnabled(false);
-// return;
-// }
-// conditionPropertiesButton.setEnabled(true);
-// removeConditionButton.setEnabled(true);
-// IStructuredSelection selection = (IStructuredSelection)
conditionViewer.getSelection();
-// if (selection == null) {
-// conditionPropertiesButton.setEnabled(false);
-// removeConditionButton.setEnabled(false);
-// upConditionButton.setEnabled(false);
-// downConditionButton.setEnabled(false);
-// } else {
-// if (selection.getFirstElement() == null) {
-// conditionPropertiesButton.setEnabled(false);
-// removeConditionButton.setEnabled(false);
-// upConditionButton.setEnabled(false);
-// downConditionButton.setEnabled(false);
-// return;
-// }
-//
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ConditionType) {
-// ConditionsType conditionsType = getConditionsType();
-// if (conditionsType == 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);
-// upConditionButton.setEnabled(command.canExecute());
-//
-// Command command1 = MoveCommand.create(smooksModelProvider.getEditingDomain(),
parent, null, obj,
-// index + 1);
-// downConditionButton.setEnabled(command1.canExecute());
-// }
-//
-// if (selection.size() > 1) {
-// conditionPropertiesButton.setEnabled(false);
-// removeConditionButton.setEnabled(false);
-// }
-// }
-// }
-//
-// protected void openConditionPropertiesModifyDialog() {
-// IStructuredSelection selection = (IStructuredSelection)
conditionViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ConditionType) {
-// ConditionType condition = (ConditionType) obj;
-// ConditionsType parent = getConditionsType();
-// NewOrModifySmooksElementDialog dialog = new
NewOrModifySmooksElementDialog(getEditorSite().getShell(),
-// SmooksPackage.Literals.CONDITIONS_TYPE__CONDITION, condition, parent,
-// getManagedForm().getToolkit(), smooksModelProvider,
SmooksConfigurationOverviewPage.this, true);
-// dialog.open();
-// }
-// }
-//
-// protected void updateParamButtons() {
-// if (getSmooksVersion() == null ||
getSmooksVersion().equals(SmooksConstants.VERSION_1_0)) {
-// paramPropertiesButton.setEnabled(false);
-// newParamButton.setEnabled(false);
-// removeParamButton.setEnabled(false);
-// upParamButton.setEnabled(false);
-// downParamButton.setEnabled(false);
-// return;
-// }
-// paramPropertiesButton.setEnabled(true);
-// removeParamButton.setEnabled(true);
-// IStructuredSelection selection = (IStructuredSelection) paramViewer.getSelection();
-// if (selection == null) {
-// paramPropertiesButton.setEnabled(false);
-// removeParamButton.setEnabled(false);
-// upParamButton.setEnabled(false);
-// downParamButton.setEnabled(false);
-// } else {
-// if (selection.getFirstElement() == null) {
-// paramPropertiesButton.setEnabled(false);
-// removeParamButton.setEnabled(false);
-// upParamButton.setEnabled(false);
-// downParamButton.setEnabled(false);
-// return;
-// }
-//
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ParamType) {
-// ParamsType paramsType = getParamsType();
-// if (paramsType == 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);
-// upParamButton.setEnabled(command.canExecute());
-//
-// Command command1 = MoveCommand.create(smooksModelProvider.getEditingDomain(),
parent, null, obj,
-// index + 1);
-// downParamButton.setEnabled(command1.canExecute());
-// }
-//
-// if (selection.size() > 1) {
-// paramPropertiesButton.setEnabled(false);
-// removeParamButton.setEnabled(false);
-// }
-// }
-//
-// }
-//
-// private void hookGlobalParamterButtons() {
-// newParamButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// if (getSmooksVersion() == null ||
getSmooksVersion().equals(SmooksConstants.VERSION_1_0)) {
-// return;
-// }
-// ParamType param = SmooksFactory.eINSTANCE.createParamType();
-// ParamsType parent = getParamsType();
-// boolean newParent = false;
-// if (parent == null) {
-// newParent = true;
-// parent = SmooksFactory.eINSTANCE.createParamsType();
-// EObject resource = getSmooksResourceList();
-// if (resource == null)
-// return;
-// Command command = SetCommand.create(smooksModelProvider.getEditingDomain(),
resource,
-// SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__PARAMS, parent);
-// if (command.canExecute()) {
-// ((SmooksResourceListType) resource).setParams((ParamsType) parent);
-// paramViewer.setInput(parent);
-// }
-// }
-// NewOrModifySmooksElementDialog dialog = new
NewOrModifySmooksElementDialog(getEditorSite().getShell(),
-// SmooksPackage.Literals.PARAMS_TYPE__PARAM, param, parent,
getManagedForm().getToolkit(),
-// smooksModelProvider, SmooksConfigurationOverviewPage.this, false);
-// if (dialog.open() == Dialog.CANCEL && newParent) {
-// EObject resource = getSmooksResourceList();
-// ((SmooksResourceListType) resource).setParams(null);
-// paramViewer.setInput(null);
-// }
-// super.widgetSelected(e);
-// }
-//
-// });
-// removeParamButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// IStructuredSelection selection = (IStructuredSelection)
paramViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ParamType) {
-// ParamType param = (ParamType) obj;
-// ParamsType parent = getParamsType();
-// if (parent == null)
-// return;
-// CompoundCommand compoundCommand = new CompoundCommand();
-// Command command = RemoveCommand.create(smooksModelProvider.getEditingDomain(),
param);
-// compoundCommand.append(command);
-// if (parent.getParam().size() == 1) {
-// // remove parent;
-// Command command1 = RemoveCommand.create(smooksModelProvider.getEditingDomain(),
parent);
-// compoundCommand.append(command1);
-// }
-// smooksModelProvider.getEditingDomain().getCommandStack().execute(compoundCommand);
-// }
-// }
-//
-// });
-// upParamButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// IStructuredSelection selection = (IStructuredSelection)
paramViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ParamType) {
-// ParamsType paramsType = getParamsType();
-// if (paramsType == 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);
-// }
-// }
-//
-// });
-// downParamButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// IStructuredSelection selection = (IStructuredSelection)
paramViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ParamType) {
-// ParamsType paramsType = getParamsType();
-// if (paramsType == 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);
-// }
-// }
-//
-// });
-// paramPropertiesButton.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// openParamPropertiesModifyDialog();
-// super.widgetSelected(e);
-// }
-//
-// });
-// }
-//
-// protected void openParamPropertiesModifyDialog() {
-// IStructuredSelection selection = (IStructuredSelection) paramViewer.getSelection();
-// if (selection == null)
-// return;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ParamType) {
-// ParamType param = (ParamType) obj;
-// ParamsType parent = getParamsType();
-// NewOrModifySmooksElementDialog dialog = new
NewOrModifySmooksElementDialog(getEditorSite().getShell(),
-// SmooksPackage.Literals.PARAMS_TYPE__PARAM, param, parent,
getManagedForm().getToolkit(),
-// smooksModelProvider, SmooksConfigurationOverviewPage.this, true);
-// dialog.open();
-// }
-// }
-//
-// private void createDefaultSection(Composite parent, FormToolkit toolkit) {
-// ModelPanelCreator defaultSettingPanelCreator = getDefaultSettingPanelCreator();
-// EObject model = getSmooksResourceList();
-// if (model != null) {
-// 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());
-// }
-// }
-//
-// }
-//
-// private void disposeDefaultSettingCompositeControls() {
-// disposeCompositeControls(defaultSettingComposite, null);
-// }
+ /*
+ * The following code has been commented out for now. We may add more
+ * properties as they become necessary, but for now, this is just extraneous
+ * code and confusing UI for the user that doesn't add much functionality.
+ */
+ // protected void createProfilesSection(Composite profilesComposite,
+ // FormToolkit toolkit) {
+ // if (smooksModelProvider != null) {
+ // AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain)
+ // smooksModelProvider
+ // .getEditingDomain();
+ // EObject profiles = getProfilesType();
+ // // if (m == null)
+ // // return;
+ //
+ // profileViewer = new TableViewer(profilesComposite);
+ // GridData gd = new GridData(GridData.FILL_BOTH);
+ // profileViewer.getControl().setLayoutData(gd);
+ // toolkit.paintBordersFor(profilesComposite);
+ // Composite buttonArea = toolkit.createComposite(profilesComposite);
+ // gd = new GridData(GridData.FILL_VERTICAL);
+ // gd.widthHint = 30;
+ // GridLayout bgl = new GridLayout();
+ // buttonArea.setLayout(bgl);
+ //
+ // newProfileButton = toolkit.createButton(buttonArea, "New", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // newProfileButton.setLayoutData(gd);
+ //
+ // removeProfileButton = toolkit.createButton(buttonArea, "Remove",
+ // SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // removeProfileButton.setLayoutData(gd);
+ //
+ // upProfileButton = toolkit.createButton(buttonArea, "Up", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // upProfileButton.setLayoutData(gd);
+ //
+ // downProfileButton = toolkit.createButton(buttonArea, "Down", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // downProfileButton.setLayoutData(gd);
+ //
+ // profilePropertiesButton = toolkit.createButton(buttonArea,
+ // "Properties..", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // profilePropertiesButton.setLayoutData(gd);
+ //
+ // profileViewer.setContentProvider(new
+ // AdapterFactoryContentProvider(editingDomain.getAdapterFactory()) {
+ //
+ // @Override
+ // public boolean hasChildren(Object object) {
+ // return false;
+ // }
+ //
+ // });
+ //
+ // profileViewer.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 (profiles != null) {
+ // profileViewer.setInput(profiles);
+ // }
+ //
+ // profileViewer.addDoubleClickListener(new IDoubleClickListener() {
+ //
+ // public void doubleClick(DoubleClickEvent event) {
+ // openProfilePropertiesModifyDialog();
+ // }
+ // });
+ //
+ // profileViewer.addSelectionChangedListener(new ISelectionChangedListener()
+ // {
+ //
+ // public void selectionChanged(SelectionChangedEvent event) {
+ // updateProfilesButtons();
+ // }
+ // });
+ //
+ // hookProfilesButtons();
+ // updateProfilesButtons();
+ // }
+ // }
+ //
+ // protected void openProfilePropertiesModifyDialog() {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // profileViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof EObject) {
+ // EObject profile = (EObject) obj;
+ // EObject parent = getProfilesType();
+ // EStructuralFeature profileFeature = null;
+ // if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ // profileFeature =
+ // org.jboss.tools.smooks10.model.smooks.SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
+ // }
+ // if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ // profileFeature = SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
+ // }
+ //
+ // NewOrModifySmooksElementDialog dialog = new
+ // NewOrModifySmooksElementDialog(getEditorSite().getShell(),
+ // profileFeature, profile, parent, getManagedForm().getToolkit(),
+ // smooksModelProvider,
+ // SmooksConfigurationOverviewPage.this, true);
+ // dialog.open();
+ // }
+ // }
+ //
+ // protected void updateProfilesButtons() {
+ // if (getSmooksVersion() == null) {
+ // profilePropertiesButton.setEnabled(false);
+ // newProfileButton.setEnabled(false);
+ // removeProfileButton.setEnabled(false);
+ // upProfileButton.setEnabled(false);
+ // downProfileButton.setEnabled(false);
+ // return;
+ // }
+ // profilePropertiesButton.setEnabled(true);
+ // removeProfileButton.setEnabled(true);
+ // IStructuredSelection selection = (IStructuredSelection)
+ // profileViewer.getSelection();
+ // if (selection == null) {
+ // profilePropertiesButton.setEnabled(false);
+ // removeProfileButton.setEnabled(false);
+ // upProfileButton.setEnabled(false);
+ // downProfileButton.setEnabled(false);
+ // } else {
+ // if (selection.getFirstElement() == null) {
+ // profilePropertiesButton.setEnabled(false);
+ // removeProfileButton.setEnabled(false);
+ // upProfileButton.setEnabled(false);
+ // downProfileButton.setEnabled(false);
+ // return;
+ // }
+ //
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof EObject) {
+ // EObject profilesType = getProfilesType();
+ // 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);
+ // upProfileButton.setEnabled(command.canExecute());
+ //
+ // Command command1 =
+ // MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null,
+ // obj,
+ // index + 1);
+ // downProfileButton.setEnabled(command1.canExecute());
+ // }
+ //
+ // if (selection.size() > 1) {
+ // profilePropertiesButton.setEnabled(false);
+ // removeProfileButton.setEnabled(false);
+ // }
+ // }
+ //
+ // }
+ //
+ // protected void hookProfilesButtons() {
+ // newProfileButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // if (getSmooksVersion() == null) {
+ // return;
+ // }
+ // EObject model = null;
+ // if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ // model =
+ // org.jboss.tools.smooks10.model.smooks.SmooksFactory.eINSTANCE.createProfileType();
+ // }
+ // if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ // model = SmooksFactory.eINSTANCE.createProfileType();
+ // }
+ // EObject parent = getProfilesType();
+ // boolean newParent = false;
+ // if (parent == null) {
+ // newParent = true;
+ // if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ // parent =
+ // org.jboss.tools.smooks10.model.smooks.SmooksFactory.eINSTANCE.createProfilesType();
+ // }
+ // if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ // parent = SmooksFactory.eINSTANCE.createProfilesType();
+ // }
+ // }
+ // EStructuralFeature profileFeature = null;
+ // if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ // profileFeature =
+ // org.jboss.tools.smooks10.model.smooks.SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
+ // }
+ // if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ // profileFeature = SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
+ // }
+ // NewOrModifySmooksElementDialog dialog = new
+ // NewOrModifySmooksElementDialog(getEditorSite().getShell(),
+ // profileFeature, model, parent, getManagedForm().getToolkit(),
+ // smooksModelProvider,
+ // SmooksConfigurationOverviewPage.this, false);
+ //
+ // EStructuralFeature profilesFeature = null;
+ // if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ // profilesFeature =
+ //
org.jboss.tools.smooks10.model.smooks.SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__PROFILES;
+ // }
+ // if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ // profilesFeature =
+ // SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__PROFILES;
+ // }
+ // if (dialog.open() == Dialog.OK && newParent) {
+ // EObject resource = getSmooksResourceList();
+ // if (resource == null)
+ // return;
+ // Command command =
+ // SetCommand.create(smooksModelProvider.getEditingDomain(), resource,
+ // profilesFeature, parent);
+ // if (command.canExecute()) {
+ // smooksModelProvider.getEditingDomain().getCommandStack().execute(command);
+ // profileViewer.setInput(parent);
+ // }
+ // }
+ // super.widgetSelected(e);
+ // }
+ //
+ // });
+ // removeProfileButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // profileViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof EObject) {
+ // EObject profile = (EObject) obj;
+ // EObject parent = getProfilesType();
+ // if (parent == null)
+ // return;
+ // CompoundCommand compoundCommand = new CompoundCommand();
+ // Command command =
+ // RemoveCommand.create(smooksModelProvider.getEditingDomain(), profile);
+ // compoundCommand.append(command);
+ // if (parent.eContents().size() == 1) {
+ // // remove parent;
+ // Command command1 =
+ // RemoveCommand.create(smooksModelProvider.getEditingDomain(), parent);
+ // compoundCommand.append(command1);
+ // }
+ // smooksModelProvider.getEditingDomain().getCommandStack().execute(compoundCommand);
+ // }
+ // }
+ //
+ // });
+ // upProfileButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // profileViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof EObject) {
+ // EObject profilesType = getProfilesType();
+ // 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);
+ // }
+ // }
+ //
+ // });
+ // downProfileButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // profileViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof EObject) {
+ // EObject profilesType = getProfilesType();
+ // 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);
+ // }
+ // }
+ //
+ // });
+ // profilePropertiesButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // openProfilePropertiesModifyDialog();
+ // super.widgetSelected(e);
+ // }
+ //
+ // });
+ //
+ // }
+ //
+ // private EObject getProfilesType() {
+ // if (smooksModelProvider != null) {
+ // EObject smooksModel = smooksModelProvider.getSmooksModel();
+ // if (smooksModel instanceof DocumentRoot) {
+ // EObject m = ((DocumentRoot)
+ // smooksModel).getSmooksResourceList().getProfiles();
+ // return m;
+ // }
+ // if (smooksModel instanceof
+ // org.jboss.tools.smooks10.model.smooks.DocumentRoot) {
+ // EObject m = ((org.jboss.tools.smooks10.model.smooks.DocumentRoot)
+ // smooksModel).getSmooksResourceList()
+ // .getProfiles();
+ // return m;
+ // }
+ // }
+ // return null;
+ // }
+ //
+ // private ConditionsType getConditionsType() {
+ // if (smooksModelProvider != null) {
+ // EObject smooksModel = smooksModelProvider.getSmooksModel();
+ // if (smooksModel instanceof DocumentRoot) {
+ // EObject m = ((DocumentRoot)
+ // smooksModel).getSmooksResourceList().getConditions();
+ // return (ConditionsType) m;
+ // }
+ // }
+ // return null;
+ // }
+ //
+ // private void createConditionsSection(Composite conditionComposite,
+ // FormToolkit toolkit) {
+ // if (smooksModelProvider != null) {
+ // AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain)
+ // smooksModelProvider
+ // .getEditingDomain();
+ // ConditionsType conditions = getConditionsType();
+ // // if (m == null)
+ // // return;
+ //
+ // conditionViewer = new TableViewer(conditionComposite);
+ // GridData gd = new GridData(GridData.FILL_BOTH);
+ // conditionViewer.getControl().setLayoutData(gd);
+ // toolkit.paintBordersFor(conditionComposite);
+ // Composite buttonArea = toolkit.createComposite(conditionComposite);
+ // gd = new GridData(GridData.FILL_VERTICAL);
+ // gd.widthHint = 30;
+ // GridLayout bgl = new GridLayout();
+ // buttonArea.setLayout(bgl);
+ //
+ // newConditionButton = toolkit.createButton(buttonArea, "New", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // newConditionButton.setLayoutData(gd);
+ //
+ // removeConditionButton = toolkit.createButton(buttonArea, "Remove",
+ // SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // removeConditionButton.setLayoutData(gd);
+ //
+ // upConditionButton = toolkit.createButton(buttonArea, "Up", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // upConditionButton.setLayoutData(gd);
+ //
+ // downConditionButton = toolkit.createButton(buttonArea, "Down", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // downConditionButton.setLayoutData(gd);
+ //
+ // conditionPropertiesButton = toolkit.createButton(buttonArea,
+ // "Properties..", SWT.NONE);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // conditionPropertiesButton.setLayoutData(gd);
+ //
+ // conditionViewer.setContentProvider(new
+ // AdapterFactoryContentProvider(editingDomain.getAdapterFactory()) {
+ //
+ // @Override
+ // public boolean hasChildren(Object object) {
+ // return false;
+ // }
+ //
+ // });
+ //
+ // conditionViewer.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 (conditions != null) {
+ // conditionViewer.setInput(conditions);
+ // }
+ //
+ // conditionViewer.addDoubleClickListener(new IDoubleClickListener() {
+ //
+ // public void doubleClick(DoubleClickEvent event) {
+ // openConditionPropertiesModifyDialog();
+ // }
+ // });
+ //
+ // conditionViewer.addSelectionChangedListener(new
+ // ISelectionChangedListener() {
+ //
+ // public void selectionChanged(SelectionChangedEvent event) {
+ // updateConditionsButtons();
+ // }
+ // });
+ //
+ // hookConditionsButtons();
+ // updateConditionsButtons();
+ // }
+ // }
+ //
+ // protected void hookConditionsButtons() {
+ // newConditionButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // if (getSmooksVersion() == null ||
+ // getSmooksVersion().equals(SmooksConstants.VERSION_1_0)) {
+ // return;
+ // }
+ // ConditionType condition = SmooksFactory.eINSTANCE.createConditionType();
+ // ConditionsType parent = getConditionsType();
+ // boolean newParent = false;
+ // if (parent == null) {
+ // newParent = true;
+ // parent = SmooksFactory.eINSTANCE.createConditionsType();
+ //
+ // }
+ // NewOrModifySmooksElementDialog dialog = new
+ // NewOrModifySmooksElementDialog(getEditorSite().getShell(),
+ // SmooksPackage.Literals.CONDITIONS_TYPE__CONDITION, condition, parent,
+ // getManagedForm()
+ // .getToolkit(), smooksModelProvider, SmooksConfigurationOverviewPage.this,
+ // false);
+ // if (dialog.open() == Dialog.OK && newParent) {
+ // EObject resource = getSmooksResourceList();
+ // if (resource == null)
+ // return;
+ // Command command =
+ // SetCommand.create(smooksModelProvider.getEditingDomain(), resource,
+ // SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__CONDITIONS, parent);
+ // if (command.canExecute()) {
+ // smooksModelProvider.getEditingDomain().getCommandStack().execute(command);
+ // conditionViewer.setInput(parent);
+ // }
+ // }
+ // super.widgetSelected(e);
+ // }
+ //
+ // });
+ // removeConditionButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // conditionViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ConditionType) {
+ // ConditionType condition = (ConditionType) obj;
+ // ConditionsType parent = getConditionsType();
+ // if (parent == null)
+ // return;
+ // CompoundCommand compoundCommand = new CompoundCommand();
+ // Command command =
+ // RemoveCommand.create(smooksModelProvider.getEditingDomain(), condition);
+ // compoundCommand.append(command);
+ // if (parent.getCondition().size() == 1) {
+ // // remove parent;
+ // Command command1 =
+ // RemoveCommand.create(smooksModelProvider.getEditingDomain(), parent);
+ // compoundCommand.append(command1);
+ // }
+ // smooksModelProvider.getEditingDomain().getCommandStack().execute(compoundCommand);
+ // }
+ // }
+ //
+ // });
+ // upConditionButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // conditionViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ConditionType) {
+ // ConditionsType conditionsType = getConditionsType();
+ // if (conditionsType == 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);
+ // }
+ // }
+ //
+ // });
+ // downConditionButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // conditionViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ConditionType) {
+ // ConditionsType conditionsType = getConditionsType();
+ // if (conditionsType == 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);
+ // }
+ // }
+ //
+ // });
+ // conditionPropertiesButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // openConditionPropertiesModifyDialog();
+ // super.widgetSelected(e);
+ // }
+ //
+ // });
+ //
+ // }
+ //
+ // protected void updateConditionsButtons() {
+ // if (getSmooksVersion() == null ||
+ // getSmooksVersion().equals(SmooksConstants.VERSION_1_0)) {
+ // conditionPropertiesButton.setEnabled(false);
+ // newConditionButton.setEnabled(false);
+ // removeConditionButton.setEnabled(false);
+ // upConditionButton.setEnabled(false);
+ // downConditionButton.setEnabled(false);
+ // return;
+ // }
+ // conditionPropertiesButton.setEnabled(true);
+ // removeConditionButton.setEnabled(true);
+ // IStructuredSelection selection = (IStructuredSelection)
+ // conditionViewer.getSelection();
+ // if (selection == null) {
+ // conditionPropertiesButton.setEnabled(false);
+ // removeConditionButton.setEnabled(false);
+ // upConditionButton.setEnabled(false);
+ // downConditionButton.setEnabled(false);
+ // } else {
+ // if (selection.getFirstElement() == null) {
+ // conditionPropertiesButton.setEnabled(false);
+ // removeConditionButton.setEnabled(false);
+ // upConditionButton.setEnabled(false);
+ // downConditionButton.setEnabled(false);
+ // return;
+ // }
+ //
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ConditionType) {
+ // ConditionsType conditionsType = getConditionsType();
+ // if (conditionsType == 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);
+ // upConditionButton.setEnabled(command.canExecute());
+ //
+ // Command command1 =
+ // MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null,
+ // obj,
+ // index + 1);
+ // downConditionButton.setEnabled(command1.canExecute());
+ // }
+ //
+ // if (selection.size() > 1) {
+ // conditionPropertiesButton.setEnabled(false);
+ // removeConditionButton.setEnabled(false);
+ // }
+ // }
+ // }
+ //
+ // protected void openConditionPropertiesModifyDialog() {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // conditionViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ConditionType) {
+ // ConditionType condition = (ConditionType) obj;
+ // ConditionsType parent = getConditionsType();
+ // NewOrModifySmooksElementDialog dialog = new
+ // NewOrModifySmooksElementDialog(getEditorSite().getShell(),
+ // SmooksPackage.Literals.CONDITIONS_TYPE__CONDITION, condition, parent,
+ // getManagedForm().getToolkit(), smooksModelProvider,
+ // SmooksConfigurationOverviewPage.this, true);
+ // dialog.open();
+ // }
+ // }
+ //
+ // protected void updateParamButtons() {
+ // if (getSmooksVersion() == null ||
+ // getSmooksVersion().equals(SmooksConstants.VERSION_1_0)) {
+ // paramPropertiesButton.setEnabled(false);
+ // newParamButton.setEnabled(false);
+ // removeParamButton.setEnabled(false);
+ // upParamButton.setEnabled(false);
+ // downParamButton.setEnabled(false);
+ // return;
+ // }
+ // paramPropertiesButton.setEnabled(true);
+ // removeParamButton.setEnabled(true);
+ // IStructuredSelection selection = (IStructuredSelection)
+ // paramViewer.getSelection();
+ // if (selection == null) {
+ // paramPropertiesButton.setEnabled(false);
+ // removeParamButton.setEnabled(false);
+ // upParamButton.setEnabled(false);
+ // downParamButton.setEnabled(false);
+ // } else {
+ // if (selection.getFirstElement() == null) {
+ // paramPropertiesButton.setEnabled(false);
+ // removeParamButton.setEnabled(false);
+ // upParamButton.setEnabled(false);
+ // downParamButton.setEnabled(false);
+ // return;
+ // }
+ //
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ParamType) {
+ // ParamsType paramsType = getParamsType();
+ // if (paramsType == 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);
+ // upParamButton.setEnabled(command.canExecute());
+ //
+ // Command command1 =
+ // MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null,
+ // obj,
+ // index + 1);
+ // downParamButton.setEnabled(command1.canExecute());
+ // }
+ //
+ // if (selection.size() > 1) {
+ // paramPropertiesButton.setEnabled(false);
+ // removeParamButton.setEnabled(false);
+ // }
+ // }
+ //
+ // }
+ //
+ // private void hookGlobalParamterButtons() {
+ // newParamButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // if (getSmooksVersion() == null ||
+ // getSmooksVersion().equals(SmooksConstants.VERSION_1_0)) {
+ // return;
+ // }
+ // ParamType param = SmooksFactory.eINSTANCE.createParamType();
+ // ParamsType parent = getParamsType();
+ // boolean newParent = false;
+ // if (parent == null) {
+ // newParent = true;
+ // parent = SmooksFactory.eINSTANCE.createParamsType();
+ // EObject resource = getSmooksResourceList();
+ // if (resource == null)
+ // return;
+ // Command command =
+ // SetCommand.create(smooksModelProvider.getEditingDomain(), resource,
+ // SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__PARAMS, parent);
+ // if (command.canExecute()) {
+ // ((SmooksResourceListType) resource).setParams((ParamsType) parent);
+ // paramViewer.setInput(parent);
+ // }
+ // }
+ // NewOrModifySmooksElementDialog dialog = new
+ // NewOrModifySmooksElementDialog(getEditorSite().getShell(),
+ // SmooksPackage.Literals.PARAMS_TYPE__PARAM, param, parent,
+ // getManagedForm().getToolkit(),
+ // smooksModelProvider, SmooksConfigurationOverviewPage.this, false);
+ // if (dialog.open() == Dialog.CANCEL && newParent) {
+ // EObject resource = getSmooksResourceList();
+ // ((SmooksResourceListType) resource).setParams(null);
+ // paramViewer.setInput(null);
+ // }
+ // super.widgetSelected(e);
+ // }
+ //
+ // });
+ // removeParamButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // paramViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ParamType) {
+ // ParamType param = (ParamType) obj;
+ // ParamsType parent = getParamsType();
+ // if (parent == null)
+ // return;
+ // CompoundCommand compoundCommand = new CompoundCommand();
+ // Command command =
+ // RemoveCommand.create(smooksModelProvider.getEditingDomain(), param);
+ // compoundCommand.append(command);
+ // if (parent.getParam().size() == 1) {
+ // // remove parent;
+ // Command command1 =
+ // RemoveCommand.create(smooksModelProvider.getEditingDomain(), parent);
+ // compoundCommand.append(command1);
+ // }
+ // smooksModelProvider.getEditingDomain().getCommandStack().execute(compoundCommand);
+ // }
+ // }
+ //
+ // });
+ // upParamButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // paramViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ParamType) {
+ // ParamsType paramsType = getParamsType();
+ // if (paramsType == 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);
+ // }
+ // }
+ //
+ // });
+ // downParamButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // paramViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ParamType) {
+ // ParamsType paramsType = getParamsType();
+ // if (paramsType == 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);
+ // }
+ // }
+ //
+ // });
+ // paramPropertiesButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // openParamPropertiesModifyDialog();
+ // super.widgetSelected(e);
+ // }
+ //
+ // });
+ // }
+ //
+ // protected void openParamPropertiesModifyDialog() {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // paramViewer.getSelection();
+ // if (selection == null)
+ // return;
+ // Object obj = selection.getFirstElement();
+ // if (obj instanceof ParamType) {
+ // ParamType param = (ParamType) obj;
+ // ParamsType parent = getParamsType();
+ // NewOrModifySmooksElementDialog dialog = new
+ // NewOrModifySmooksElementDialog(getEditorSite().getShell(),
+ // SmooksPackage.Literals.PARAMS_TYPE__PARAM, param, parent,
+ // getManagedForm().getToolkit(),
+ // smooksModelProvider, SmooksConfigurationOverviewPage.this, true);
+ // dialog.open();
+ // }
+ // }
+ //
+ // private void createDefaultSection(Composite parent, FormToolkit toolkit)
+ // {
+ // ModelPanelCreator defaultSettingPanelCreator =
+ // getDefaultSettingPanelCreator();
+ // EObject model = getSmooksResourceList();
+ // if (model != null) {
+ // 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());
+ // }
+ // }
+ //
+ // }
+ //
+ // private void disposeDefaultSettingCompositeControls() {
+ // disposeCompositeControls(defaultSettingComposite, null);
+ // }
}