Author: DartPeng
Date: 2009-04-14 09:38:48 -0400 (Tue, 14 Apr 2009)
New Revision: 14735
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IModelProcsser.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaPropertiesSelectionDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IFieldDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaTypeFieldDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
Log:
JBIDE-4171
Add UI for editing EDI element
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -10,7 +10,10 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors;
+import java.util.List;
+
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
@@ -21,14 +24,23 @@
*/
public class FileSelectionWizard extends Wizard implements INewWizard {
- private FileSelectionWizardPage wizardPage = null;
+ private FileSelectionWizardPage fileSelectionWizardPage = null;
private String filePath = null;
+
+ private List<ViewerFilter> viewerFilters = null;
+
+ private Object[] initSelections = null;
+
+ private boolean multiSelect = false;
@Override
public void addPages() {
- wizardPage = new FileSelectionWizardPage("File Selection");
- this.addPage(wizardPage);
+ fileSelectionWizardPage = new FileSelectionWizardPage("File Selection");
+ fileSelectionWizardPage.setFilters(viewerFilters);
+ fileSelectionWizardPage.setInitSelections(getInitSelections());
+ fileSelectionWizardPage.setMultiSelect(isMultiSelect());
+ this.addPage(fileSelectionWizardPage);
}
/* (non-Javadoc)
@@ -36,7 +48,7 @@
*/
@Override
public boolean performFinish() {
- filePath = wizardPage.getFilePath();
+ filePath = fileSelectionWizardPage.getFilePath();
return true;
}
@@ -47,6 +59,22 @@
}
+ public Object[] getInitSelections() {
+ return initSelections;
+ }
+
+ public void setInitSelections(Object[] initSelections) {
+ this.initSelections = initSelections;
+ }
+
+ public boolean isMultiSelect() {
+ return multiSelect;
+ }
+
+ public void setMultiSelect(boolean multiSelect) {
+ this.multiSelect = multiSelect;
+ }
+
public String getFilePath() {
return filePath;
}
@@ -54,6 +82,14 @@
public void setFilePath(String filePath) {
this.filePath = filePath;
}
+
+ public List<ViewerFilter> getViewerFilters() {
+ return viewerFilters;
+ }
+
+ public void setViewerFilters(List<ViewerFilter> viewerFilters) {
+ this.viewerFilters = viewerFilters;
+ }
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -21,6 +21,7 @@
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
@@ -29,10 +30,10 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.uitls.IFieldDialog;
+import org.jboss.tools.smooks.configuration.editors.uitls.IModelProcsser;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.model.graphics.ext.SmooksGraphicsExtType;
import org.jboss.tools.smooks.model.javabean.BindingsType;
@@ -47,6 +48,12 @@
*/
public class PropertyUICreator implements IPropertyUICreator {
+ protected IModelProcsser fileFiledEditorModelProcess;
+
+ protected IHyperlinkListener fileFiledEditorLinkListener;
+
+ protected List<ViewerFilter> viewerFilters = null;
+
/*
* (non-Javadoc)
*
@@ -56,24 +63,19 @@
* org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
* org.eclipse.emf.ecore.EAttribute)
*/
- public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- SmooksMultiFormEditor formEditor) {
+ public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
if (isBeanIDRefFieldFeature(feature)) {
- return createBeanIDRefFieldEditor(toolkit, parent, propertyDescriptor, model,
feature,
- formEditor);
+ return createBeanIDRefFieldEditor(toolkit, parent, propertyDescriptor, model, feature,
formEditor);
}
if (isSelectorFeature(feature)) {
- return createSelectorFieldEditor(toolkit, parent, propertyDescriptor, model, feature,
- formEditor);
+ return createSelectorFieldEditor(toolkit, parent, propertyDescriptor, model, feature,
formEditor);
}
if (isJavaTypeFeature(feature)) {
- return createJavaTypeSearchEditor(toolkit, parent, propertyDescriptor, model,
feature,
- formEditor);
+ return createJavaTypeSearchEditor(toolkit, parent, propertyDescriptor, model, feature,
formEditor);
}
if (isFileSelectionFeature(feature)) {
- return createFileSelectionFieldEditor(toolkit, parent, propertyDescriptor, model,
- feature, formEditor);
+ return createFileSelectionFieldEditor(toolkit, parent, propertyDescriptor, model,
feature, formEditor);
}
if (feature == SmooksPackage.eINSTANCE.getAbstractReader_TargetProfile()) {
@@ -81,6 +83,30 @@
return null;
}
+ public IHyperlinkListener getFileFiledEditorLinkListener() {
+ return fileFiledEditorLinkListener;
+ }
+
+ public void setFileFiledEditorLinkListener(IHyperlinkListener
fileFiledEditorLinkListener) {
+ this.fileFiledEditorLinkListener = fileFiledEditorLinkListener;
+ }
+
+ public IModelProcsser getFileFiledEditorModelProcess() {
+ return fileFiledEditorModelProcess;
+ }
+
+ public void setFileFiledEditorModelProcess(IModelProcsser fileFiledEditorModelProcess)
{
+ this.fileFiledEditorModelProcess = fileFiledEditorModelProcess;
+ }
+
+ public List<ViewerFilter> getFileDialogViewerFilters() {
+ return viewerFilters;
+ }
+
+ public void setDialogViewerFilters(List<ViewerFilter> viewerFilters) {
+ this.viewerFilters = viewerFilters;
+ }
+
public IResource getResource(EObject model) {
return SmooksUIUtils.getResource(model);
}
@@ -89,61 +115,56 @@
return SmooksUIUtils.getJavaProject(model);
}
- public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
- Composite parent, Object model, SmooksMultiFormEditor formEditor) {
+ public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit, Composite parent, Object model,
+ SmooksMultiFormEditor formEditor) {
}
public boolean isFileSelectionFeature(EAttribute attribute) {
return false;
}
+
- public Composite createFileSelectionFieldEditor(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- SmooksMultiFormEditor formEditor) {
+ public Composite createFileSelectionFieldEditor(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
IFieldDialog dialog = new IFieldDialog() {
public Object open(Shell shell) {
FileSelectionWizard wizard = new FileSelectionWizard();
+ wizard.setViewerFilters(getFileDialogViewerFilters());
WizardDialog dialog = new WizardDialog(shell, wizard);
if (dialog.open() == Dialog.OK) {
- return wizard.getFilePath();
+ IModelProcsser p = getModelProcesser();
+ String path = wizard.getFilePath();
+ if (p != null) {
+ path = p.processModel(path).toString();
+ }
+ return path;
}
return null;
}
- };
- final IItemPropertyDescriptor fp = propertyDescriptor;
- final Object fm = model;
- IHyperlinkListener listener = new IHyperlinkListener() {
- public void linkActivated(HyperlinkEvent e) {
- Object value = SmooksUIUtils.getEditValue(fp, fm);
- System.out.println(value);
+ public IModelProcsser getModelProcesser() {
+ return getFileFiledEditorModelProcess();
}
- public void linkEntered(HyperlinkEvent e) {
+ public void setModelProcesser(IModelProcsser processer) {
}
- public void linkExited(HyperlinkEvent e) {
-
- }
};
-
- return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
"Browse",
- dialog, (EObject) model, true, listener);
+ return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
"Browse", dialog, (EObject) model, true,
+ getFileFiledEditorLinkListener());
}
public boolean isSelectorFeature(EAttribute attribute) {
return false;
}
- public Composite createSelectorFieldEditor(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- SmooksMultiFormEditor formEditor) {
+ public Composite createSelectorFieldEditor(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
SmooksGraphicsExtType ext = formEditor.getSmooksGraphicsExt();
if (ext != null) {
- return SmooksUIUtils.createSelectorFieldEditor(toolkit, parent, propertyDescriptor,
- model, ext);
+ return SmooksUIUtils.createSelectorFieldEditor(toolkit, parent, propertyDescriptor,
model, ext);
}
return null;
}
@@ -152,11 +173,10 @@
return false;
}
- public Composite createJavaTypeSearchEditor(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- SmooksMultiFormEditor formEditor) {
- if (model instanceof EObject) return
SmooksUIUtils.createJavaTypeSearchFieldEditor(parent,
- toolkit, propertyDescriptor, (EObject) model);
+ public Composite createJavaTypeSearchEditor(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
+ if (model instanceof EObject)
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(parent, toolkit,
propertyDescriptor, (EObject) model);
return null;
}
@@ -164,9 +184,8 @@
return false;
}
- public Composite createBeanIDRefFieldEditor(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- SmooksMultiFormEditor formEditor) {
+ public Composite createBeanIDRefFieldEditor(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
if (model instanceof EObject) {
SmooksResourceListType smooksResourceList = getSmooksResourceList((EObject) model);
if (smooksResourceList != null) {
@@ -220,11 +239,11 @@
List<AbstractResourceConfig> rlist = resourceList.getAbstractResourceConfig();
List<String> beanIdList = new ArrayList<String>();
for (Iterator<?> iterator = rlist.iterator(); iterator.hasNext();) {
- AbstractResourceConfig abstractResourceConfig = (AbstractResourceConfig) iterator
- .next();
+ AbstractResourceConfig abstractResourceConfig = (AbstractResourceConfig)
iterator.next();
if (abstractResourceConfig instanceof BindingsType) {
String beanId = ((BindingsType) abstractResourceConfig).getBeanId();
- if (beanId == null) continue;
+ if (beanId == null)
+ continue;
beanIdList.add(beanId);
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -10,12 +10,30 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.edireader;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.model.edi.EdiPackage;
/**
@@ -23,6 +41,54 @@
*/
public class EDIReaderUICreator extends PropertyUICreator {
+ public EDIReaderUICreator() {
+ }
+
+ private void openFile(IItemPropertyDescriptor propertyDescriptor, Object model) {
+ Object path = SmooksUIUtils.getEditValue(propertyDescriptor, model);
+ String p = null;
+ if (path != null && path instanceof String) {
+ p = ((String) path).trim();
+ }
+ try {
+ IResource resource = SmooksUIUtils.getResource((EObject) model);
+ IFile file1 = null;
+ if (resource != null) {
+ IProject project = resource.getProject();
+ IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject != null) {
+ IClasspathEntry[] classPathEntrys = javaProject.getRawClasspath();
+ for (int i = 0; i < classPathEntrys.length; i++) {
+ IClasspathEntry entry = classPathEntrys[i];
+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ IFolder folder =
ResourcesPlugin.getWorkspace().getRoot().getFolder(entry.getPath());
+ if (folder != null && folder.exists()) {
+ IFile file = folder.getFile(new Path(p));
+ if (file != null && file.exists()) {
+ file1 = file;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (file1 != null) {
+ IWorkbenchWindow window =
SmooksConfigurationActivator.getDefault().getWorkbench().getActiveWorkbenchWindow();
+ window.getActivePage().openEditor(new FileEditorInput(file1),
SmooksMultiFormEditor.EDITOR_ID);
+ } else {
+ String message = "Path is null";
+ if (p != null && p.length() != 0) {
+ message = "Can't find file : " + p;
+ }
+ MessageDialog.openInformation(SmooksConfigurationActivator.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Can't open editor", message);
+ }
+ }
+ } catch (Exception e) {
+
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -37,9 +103,63 @@
if (feature == EdiPackage.eINSTANCE.getEDIReader_Encoding()) {
}
if (feature == EdiPackage.eINSTANCE.getEDIReader_MappingModel()) {
+ // IResource resource =SmooksUIUtils.getResource((EObject)model);
+ // if(resource != null){
+ // final IProject project = resource.getProject();
+ // ViewerFilter viewerFilter = new ViewerFilter(){
+ // @Override
+ // public boolean select(Viewer viewer, Object parentElement, Object
+ // element) {
+ // IResource re = null;
+ // if(element instanceof IResource){
+ // re = (IResource)element;
+ // }
+ // if(element instanceof IAdaptable){
+ // re = (IResource)
+ // ((IAdaptable)element).getAdapter(IResource.class);
+ // }
+ // if(re != null){
+ // if(re.getProject() == project){
+ // return true;
+ // }
+ // }
+ // return false;
+ // }
+ // };
+ // List<ViewerFilter> list = new ArrayList<ViewerFilter>();
+ // list.add(viewerFilter);
+ // setDialogViewerFilters(list);
+ // }
+ final Object fm = model;
+ final IItemPropertyDescriptor fpd = propertyDescriptor;
+ IHyperlinkListener listener = new IHyperlinkListener() {
+
+ public void linkActivated(HyperlinkEvent e) {
+ openFile(fpd, fm);
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+
+ }
+
+ public void linkExited(HyperlinkEvent e) {
+
+ }
+
+ };
+ SmooksUIUtils.createLinkTextValueFieldEditor("Mapping Model",
(AdapterFactoryEditingDomain) formEditor.getEditingDomain(), propertyDescriptor,
+ toolkit, parent, model, false, 0, true, listener);
+ return parent;
}
-
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature,
formEditor);
}
+ @Override
+ public boolean isFileSelectionFeature(EAttribute attribute) {
+// if (attribute == EdiPackage.eINSTANCE.getEDIReader_MappingModel()) {
+// return true;
+// }
+ return super.isFileSelectionFeature(attribute);
+ }
+
}
\ No newline at end of file
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -48,7 +48,7 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createTextFieldEditor("Value", editingdomain, toolkit, parent,
model);
+ SmooksUIUtils.createMixedTextFieldEditor("Value", editingdomain, toolkit,
parent, model);
SmooksUIUtils.createCDATAFieldEditor("Template Contents", editingdomain,
toolkit, parent, model);
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -38,6 +38,7 @@
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
import org.jboss.tools.smooks.configuration.editors.uitls.IFieldDialog;
+import org.jboss.tools.smooks.configuration.editors.uitls.IModelProcsser;
import org.jboss.tools.smooks.configuration.editors.uitls.JavaPropertyUtils;
/**
@@ -195,4 +196,14 @@
return getText(element);
}
}
+
+ public IModelProcsser getModelProcesser() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setModelProcesser(IModelProcsser processer) {
+ // TODO Auto-generated method stub
+
+ }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaPropertiesSelectionDialog.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaPropertiesSelectionDialog.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaPropertiesSelectionDialog.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -38,6 +38,7 @@
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
import org.jboss.tools.smooks.configuration.editors.uitls.IFieldDialog;
+import org.jboss.tools.smooks.configuration.editors.uitls.IModelProcsser;
import org.jboss.tools.smooks.configuration.editors.uitls.JavaPropertyUtils;
/**
@@ -183,4 +184,14 @@
return getText(element);
}
}
+
+ public IModelProcsser getModelProcesser() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setModelProcesser(IModelProcsser processer) {
+ // TODO Auto-generated method stub
+
+ }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -46,7 +46,7 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createTextFieldEditor("Value", editingdomain, toolkit, parent,
model);
+ SmooksUIUtils.createMixedTextFieldEditor("Value", editingdomain, toolkit,
parent, model);
SmooksUIUtils.createCDATAFieldEditor("CDATA", editingdomain, toolkit, parent,
model);
}
}
\ No newline at end of file
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IFieldDialog.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IFieldDialog.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IFieldDialog.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -18,4 +18,6 @@
*/
public interface IFieldDialog {
Object open(Shell shell);
+ IModelProcsser getModelProcesser();
+ void setModelProcesser(IModelProcsser processer);
}
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IModelProcsser.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IModelProcsser.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IModelProcsser.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -0,0 +1,12 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors.uitls;
+
+/**
+ * @author DartPeng
+ *
+ */
+public interface IModelProcsser {
+ Object processModel(Object model);
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IModelProcsser.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaTypeFieldDialog.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaTypeFieldDialog.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaTypeFieldDialog.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -104,5 +104,15 @@
return className;
}
+ public IModelProcsser getModelProcesser() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ public void setModelProcesser(IModelProcsser processer) {
+ // TODO Auto-generated method stub
+
+ }
+
+
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -79,21 +79,18 @@
public static final String XSL_NAMESPACE = "
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" ";
- public static void createTextFieldEditor(String label,
- AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model) {
- createTextFieldEditor(label, editingdomain, toolkit, parent, model, false, 0);
+ public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
+ Object model) {
+ createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false, 0);
}
- public static void createMultiTextFieldEditor(String label,
- AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model, int height) {
- createTextFieldEditor(label, editingdomain, toolkit, parent, model, true, height);
+ public static void createMultiMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
+ Composite parent, Object model, int height) {
+ createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true,
height);
}
- public static void createTextFieldEditor(String label,
- AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model, boolean multiText, int height) {
+ public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
+ Object model, boolean multiText, int height) {
toolkit.createLabel(parent, label + " :");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
int textType = SWT.FLAT;
@@ -121,13 +118,110 @@
}
String text = SmooksModelUtils.getAnyTypeText((AnyType) fm);
if (!valueText.getText().equals(text)) {
- SmooksModelUtils.setTextToSmooksType(fEditingDomain, (AnyType) fm, valueText
- .getText());
+ SmooksModelUtils.setTextToSmooksType(fEditingDomain, (AnyType) fm,
valueText.getText());
}
}
});
}
+ /**
+ * Can't use
+ *
+ * @param editingdomain
+ * @param toolkit
+ * @param parent
+ * @param model
+ */
+ public static void createFilePathFieldEditor(AdapterFactoryEditingDomain editingdomain,
FormToolkit toolkit, Composite parent, Object model) {
+ // IHyperlinkListener link
+ }
+
+ public static void createLinkMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
+ Object model, boolean multiText, int height, boolean linkLabel, IHyperlinkListener
listener) {
+ if (linkLabel) {
+ Hyperlink link = toolkit.createHyperlink(parent, label, SWT.NONE);
+ if (listener != null) {
+ link.addHyperlinkListener(listener);
+ }
+ } else {
+ toolkit.createLabel(parent, label + " :");
+ }
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ int textType = SWT.FLAT;
+ if (multiText) {
+ textType = SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL;
+ }
+ final Text valueText = toolkit.createText(parent, "", textType);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ if (multiText && height > 0) {
+ gd.heightHint = height;
+ }
+ valueText.setLayoutData(gd);
+ if (model instanceof AnyType) {
+ String text = SmooksModelUtils.getAnyTypeText((AnyType) model);
+ if (text != null) {
+ valueText.setText(text);
+ }
+ } else {
+
+ }
+ final Object fm = model;
+ final AdapterFactoryEditingDomain fEditingDomain = editingdomain;
+ valueText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (!(fm instanceof AnyType)) {
+ return;
+ }
+ String text = SmooksModelUtils.getAnyTypeText((AnyType) fm);
+ if (!valueText.getText().equals(text)) {
+ SmooksModelUtils.setTextToSmooksType(fEditingDomain, (AnyType) fm,
valueText.getText());
+ }
+ }
+ });
+ }
+
+ public static void createLinkTextValueFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain,
+ IItemPropertyDescriptor propertyDescriptor, FormToolkit toolkit, Composite parent,
Object model, boolean multiText, int height,
+ boolean linkLabel, IHyperlinkListener listener) {
+ if (linkLabel) {
+ Hyperlink link = toolkit.createHyperlink(parent, label, SWT.NONE);
+ if (listener != null) {
+ link.addHyperlinkListener(listener);
+ }
+ } else {
+ toolkit.createLabel(parent, label + " :");
+ }
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ int textType = SWT.FLAT;
+ if (multiText) {
+ textType = SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL;
+ }
+ final Text valueText = toolkit.createText(parent, "", textType);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ if (multiText && height > 0) {
+ gd.heightHint = height;
+ }
+ valueText.setLayoutData(gd);
+ Object path = SmooksUIUtils.getEditValue(propertyDescriptor, model);
+ String string = null;
+ if (path != null) {
+ string = path.toString();
+ }
+ if (string != null) {
+ valueText.setText(string);
+ }
+ final Object fm = model;
+ final IItemPropertyDescriptor fpd = propertyDescriptor;
+ valueText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ Object text = getEditValue(fpd, fm);
+ if (!valueText.getText().equals(text)) {
+ fpd.setPropertyValue(fm, valueText.getText());
+ }
+ }
+ });
+ }
+
public static String parseFilePath(String path) throws InvocationTargetException {
int index = path.indexOf(FILE_PRIX);
if (index != -1) {
@@ -141,42 +235,45 @@
if (file.exists()) {
path = file.getLocation().toOSString();
} else {
- throw new InvocationTargetException(new Exception(
- "File : " + path + " isn't exsit")); //$NON-NLS-1$
//$NON-NLS-2$
+ throw new InvocationTargetException(new Exception("File : " + path +
" isn't exsit")); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
- throw new InvocationTargetException(new Exception(
- "This path is un-support" + path + ".")); //$NON-NLS-1$
//$NON-NLS-2$
+ throw new InvocationTargetException(new Exception("This path is un-support"
+ path + ".")); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return path;
}
- public static Composite createSelectorFieldEditor(FormToolkit toolkit, Composite
parent,
- final IItemPropertyDescriptor propertyDescriptor, Object model,
- final SmooksGraphicsExtType extType) {
- return createDialogFieldEditor(parent, toolkit, propertyDescriptor,
"Browse",
- new IFieldDialog() {
- public Object open(Shell shell) {
- SelectoreSelectionDialog dialog = new SelectoreSelectionDialog(shell, extType);
- if (dialog.open() == Dialog.OK) {
- Object currentSelection = dialog.getCurrentSelection();
- SelectorAttributes sa = dialog.getSelectorAttributes();
- if (currentSelection instanceof IXMLStructuredObject) {
- String s = SmooksUIUtils.generatePath(
- (IXMLStructuredObject) currentSelection, sa);
- return s;
- }
+ public static Composite createSelectorFieldEditor(FormToolkit toolkit, Composite parent,
final IItemPropertyDescriptor propertyDescriptor,
+ Object model, final SmooksGraphicsExtType extType) {
+ return createDialogFieldEditor(parent, toolkit, propertyDescriptor, "Browse",
new IFieldDialog() {
+ public Object open(Shell shell) {
+ SelectoreSelectionDialog dialog = new SelectoreSelectionDialog(shell, extType);
+ if (dialog.open() == Dialog.OK) {
+ Object currentSelection = dialog.getCurrentSelection();
+ SelectorAttributes sa = dialog.getSelectorAttributes();
+ if (currentSelection instanceof IXMLStructuredObject) {
+ String s = SmooksUIUtils.generatePath((IXMLStructuredObject) currentSelection,
sa);
+ return s;
}
- return null;
}
+ return null;
+ }
- }, (EObject) model);
+ public IModelProcsser getModelProcesser() {
+ return null;
+ }
+
+ public void setModelProcesser(IModelProcsser processer) {
+
+ }
+
+ }, (EObject) model);
}
public static SmooksGraphicsExtType loadSmooksGraphicsExt(IFile file) throws IOException
{
- Resource resource = new SmooksGraphicsExtResourceFactoryImpl().createResource(URI
- .createPlatformResourceURI(file.getFullPath().toPortableString(), false));
+ Resource resource = new
SmooksGraphicsExtResourceFactoryImpl().createResource(URI.createPlatformResourceURI(file.getFullPath()
+ .toPortableString(), false));
resource.load(Collections.emptyMap());
if (resource.getContents().size() > 0) {
Object obj = resource.getContents().get(0);
@@ -187,15 +284,13 @@
return null;
}
- public static void createCDATAFieldEditor(String label,
- AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model) {
+ public static void createCDATAFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
+ Object model) {
Label label1 = toolkit.createLabel(parent, label + " :");
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
label1.setLayoutData(gd);
gd = new GridData(GridData.FILL_HORIZONTAL);
- final Text cdataText = toolkit.createText(parent, "", SWT.MULTI |
SWT.H_SCROLL
- | SWT.V_SCROLL);
+ final Text cdataText = toolkit.createText(parent, "", SWT.MULTI |
SWT.H_SCROLL | SWT.V_SCROLL);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 300;
cdataText.setLayoutData(gd);
@@ -215,22 +310,19 @@
}
String text = SmooksModelUtils.getAnyTypeCDATA((AnyType) fm);
if (!cdataText.getText().equals(text)) {
- SmooksModelUtils.setCDATAToSmooksType(fEditingDomain, (AnyType) fm, cdataText
- .getText());
+ SmooksModelUtils.setCDATAToSmooksType(fEditingDomain, (AnyType) fm,
cdataText.getText());
}
}
});
}
- public static void createCommentFieldEditor(String label,
- AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model) {
+ public static void createCommentFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
+ Object model) {
Label label1 = toolkit.createLabel(parent, label + " :");
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
label1.setLayoutData(gd);
gd = new GridData(GridData.FILL_HORIZONTAL);
- final Text cdataText = toolkit.createText(parent, "", SWT.MULTI |
SWT.H_SCROLL
- | SWT.V_SCROLL);
+ final Text cdataText = toolkit.createText(parent, "", SWT.MULTI |
SWT.H_SCROLL | SWT.V_SCROLL);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 300;
cdataText.setLayoutData(gd);
@@ -250,23 +342,21 @@
}
String text = SmooksModelUtils.getAnyTypeCDATA((AnyType) fm);
if (!cdataText.getText().equals(text)) {
- SmooksModelUtils.setCommentToSmooksType(fEditingDomain, (AnyType) fm, cdataText
- .getText());
+ SmooksModelUtils.setCommentToSmooksType(fEditingDomain, (AnyType) fm,
cdataText.getText());
}
}
});
}
- public static Composite createJavaTypeSearchFieldEditor(Composite parent, FormToolkit
toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final EObject model) {
+ public static Composite createJavaTypeSearchFieldEditor(Composite parent, FormToolkit
toolkit, final IItemPropertyDescriptor propertyDescriptor,
+ final EObject model) {
if (model instanceof EObject) {
final Resource resource = ((EObject) model).eResource();
URI uri = resource.getURI();
IResource workspaceResource = null;
if (uri.isPlatformResource()) {
String path = uri.toPlatformString(true);
- workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(
- new Path(path));
+ workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new
Path(path));
JavaTypeFieldDialog dialog = new JavaTypeFieldDialog(workspaceResource);
String displayName = propertyDescriptor.getDisplayName(model);
Hyperlink link = toolkit.createHyperlink(parent, displayName + " :",
SWT.NONE);
@@ -277,8 +367,7 @@
fillLayout.marginHeight = 0;
fillLayout.marginWidth = 0;
classTextComposite.setLayout(fillLayout);
- final SearchComposite searchComposite = new SearchComposite(classTextComposite,
- toolkit, "Search Class", dialog, SWT.NONE);
+ final SearchComposite searchComposite = new SearchComposite(classTextComposite,
toolkit, "Search Class", dialog, SWT.NONE);
Object editValue = getEditValue(propertyDescriptor, model);
if (editValue != null) {
searchComposite.getText().setText(editValue.toString());
@@ -287,20 +376,16 @@
public void modifyText(ModifyEvent e) {
Object value = propertyDescriptor.getPropertyValue(model);
if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value)
- .getEditableValue(model);
+ Object editValue = ((PropertyValueWrapper) value).getEditableValue(model);
if (editValue != null) {
if (!editValue.equals(searchComposite.getText().getText())) {
- propertyDescriptor.setPropertyValue(model, searchComposite
- .getText().getText());
+ propertyDescriptor.setPropertyValue(model,
searchComposite.getText().getText());
}
} else {
- propertyDescriptor.setPropertyValue(model, searchComposite
- .getText().getText());
+ propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
}
} else {
- propertyDescriptor.setPropertyValue(model, searchComposite.getText()
- .getText());
+ propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
}
}
});
@@ -309,17 +394,17 @@
public void linkActivated(HyperlinkEvent e) {
try {
- if (fresource == null) return;
+ if (fresource == null)
+ return;
if (fresource.getProject().hasNature(JavaCore.NATURE_ID)) {
IJavaProject javaProject = JavaCore.create(fresource.getProject());
String typeName = searchComposite.getText().getText();
IJavaElement result = javaProject.findType(typeName);
- if (result != null) JavaUI.openInEditor(result);
+ if (result != null)
+ JavaUI.openInEditor(result);
else {
- MessageDialog.openInformation(classTextComposite.getShell(),
- "Can't find type", "Can't find type \"" +
typeName
- + "\" in \"" + javaProject.getProject().getName()
- + "\" project.");
+ MessageDialog.openInformation(classTextComposite.getShell(), "Can't
find type", "Can't find type \"" + typeName
+ + "\" in \"" + javaProject.getProject().getName() +
"\" project.");
}
}
} catch (PartInitException ex) {
@@ -368,17 +453,15 @@
return null;
}
- public static Composite createJavaMethodSearchFieldEditor(BindingsType container,
- Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor
propertyDescriptor,
- String buttonName, final EObject model) {
+ public static Composite createJavaMethodSearchFieldEditor(BindingsType container,
Composite parent, FormToolkit toolkit,
+ final IItemPropertyDescriptor propertyDescriptor, String buttonName, final EObject
model) {
String classString = ((BindingsType) container).getClass_();
IJavaProject project = getJavaProject(container);
try {
ProjectClassLoader classLoader = new ProjectClassLoader(project);
Class<?> clazz = classLoader.loadClass(classString);
JavaMethodsSelectionDialog dialog = new JavaMethodsSelectionDialog(project, clazz);
- return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
- "Select method", dialog, (EObject) model);
+ return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
"Select method", dialog, (EObject) model);
} catch (Exception e) {
// ignore
}
@@ -391,8 +474,10 @@
public static IXMLStructuredObject getRootParent(IXMLStructuredObject child) {
IXMLStructuredObject parent = child.getParent();
- if (child.isRootNode()) return child;
- if (parent == null || parent.isRootNode()) return child;
+ if (child.isRootNode())
+ return child;
+ if (parent == null || parent.isRootNode())
+ return child;
IXMLStructuredObject temp = parent;
while (temp != null && !temp.isRootNode()) {
parent = temp;
@@ -401,12 +486,13 @@
return parent;
}
- public static String generatePath(IXMLStructuredObject node,
- SelectorAttributes selectorAttributes) {
+ public static String generatePath(IXMLStructuredObject node, SelectorAttributes
selectorAttributes) {
String sperator = selectorAttributes.getSelectorSperator();
String policy = selectorAttributes.getSelectorPolicy();
- if (sperator == null) sperator = " ";
- if (policy == null) policy = SelectorAttributes.FULL_PATH;
+ if (sperator == null)
+ sperator = " ";
+ if (policy == null)
+ policy = SelectorAttributes.FULL_PATH;
if (policy.equals(SelectorAttributes.FULL_PATH)) {
return generateFullPath(node, sperator);
}
@@ -422,8 +508,7 @@
return generateFullPath(node, sperator);
}
- public static String generatePath(IXMLStructuredObject startNode,
- IXMLStructuredObject stopNode, final String sperator, boolean includeContext) {
+ public static String generatePath(IXMLStructuredObject startNode, IXMLStructuredObject
stopNode, final String sperator, boolean includeContext) {
String name = "";
if (startNode == stopNode) {
return startNode.getNodeName();
@@ -451,17 +536,15 @@
return name.trim();
}
- public static Composite createJavaPropertySearchFieldEditor(BindingsType container,
- Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor
propertyDescriptor,
- String buttonName, final EObject model) {
+ public static Composite createJavaPropertySearchFieldEditor(BindingsType container,
Composite parent, FormToolkit toolkit,
+ final IItemPropertyDescriptor propertyDescriptor, String buttonName, final EObject
model) {
String classString = ((BindingsType) container).getClass_();
IJavaProject project = getJavaProject(container);
try {
ProjectClassLoader classLoader = new ProjectClassLoader(project);
Class<?> clazz = classLoader.loadClass(classString);
JavaPropertiesSelectionDialog dialog = new JavaPropertiesSelectionDialog(project,
clazz);
- return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
- "Select property", dialog, (EObject) model);
+ return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
"Select property", dialog, (EObject) model);
} catch (Exception e) {
// ignore
}
@@ -477,19 +560,19 @@
return null;
}
- public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, String buttonName, IFieldDialog
dialog,
- final EObject model) {
+ public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
final IItemPropertyDescriptor propertyDescriptor,
+ String buttonName, IFieldDialog dialog, final EObject model) {
return createDialogFieldEditor(parent, toolkit, propertyDescriptor, buttonName, dialog,
model, false, null);
}
- public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, String buttonName, IFieldDialog
dialog,
- final EObject model, boolean labelLink, IHyperlinkListener listener) {
+
+ public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
final IItemPropertyDescriptor propertyDescriptor,
+ String buttonName, IFieldDialog dialog, final EObject model, boolean labelLink,
IHyperlinkListener listener) {
+
String displayName = propertyDescriptor.getDisplayName(model);
if (labelLink) {
- Hyperlink link = toolkit.createHyperlink(parent, displayName + " :",
SWT.NONE);
- if(listener != null){
+ Hyperlink link = toolkit.createHyperlink(parent, displayName + " :",
SWT.NONE);
+ if (listener != null) {
link.addHyperlinkListener(listener);
}
} else {
@@ -502,28 +585,21 @@
fillLayout.marginHeight = 0;
fillLayout.marginWidth = 0;
classTextComposite.setLayout(fillLayout);
- final SearchComposite searchComposite = new SearchComposite(classTextComposite,
toolkit,
- buttonName, dialog, SWT.NONE);
+ final SearchComposite searchComposite = new SearchComposite(classTextComposite,
toolkit, buttonName, dialog, SWT.NONE);
Object editValue = getEditValue(propertyDescriptor, model);
if (editValue != null) {
searchComposite.getText().setText(editValue.toString());
}
searchComposite.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- Object value = propertyDescriptor.getPropertyValue(model);
- if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value).getEditableValue(model);
- if (editValue != null) {
- if (!editValue.equals(searchComposite.getText().getText())) {
- propertyDescriptor.setPropertyValue(model, searchComposite.getText()
- .getText());
- }
- } else {
- propertyDescriptor.setPropertyValue(model, searchComposite.getText()
- .getText());
+ Object editValue = getEditValue(propertyDescriptor, model);
+ Object value = searchComposite.getText().getText();
+ if (editValue != null) {
+ if (!editValue.equals(value)) {
+ propertyDescriptor.setPropertyValue(model, value);
}
} else {
- propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
+ propertyDescriptor.setPropertyValue(model, value);
}
}
});
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -4,11 +4,13 @@
package org.jboss.tools.smooks.configuration.editors.xml;
import java.util.Collections;
+import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -41,11 +43,21 @@
protected boolean reasourceLoaded = false;
protected Button workspaceBrowseButton;
private String filePath = null;
-
- public AbstractFileSelectionWizardPage(String pageName) {
+ protected Object[] initSelections;
+ protected List<ViewerFilter> filters = null;
+ protected boolean multiSelect =false;
+
+ public AbstractFileSelectionWizardPage(String pageName,boolean multiSelect , Object[]
initSelections,List<ViewerFilter> filters) {
super(pageName);
- // TODO Auto-generated constructor stub
+ this.initSelections = initSelections;
+ this.filters = filters;
+ this.multiSelect = multiSelect;
}
+
+ public AbstractFileSelectionWizardPage(String pageName){
+ this(pageName,false,null,Collections.EMPTY_LIST);
+ }
+
public Object getReturnValue() {
try {
@@ -152,7 +164,7 @@
protected void openWorkSpaceSelection(Text relationT) {
IFile[] files = WorkspaceResourceDialog.openFileSelection(getShell(),
- "Select Files", "", false, null, Collections.EMPTY_LIST);
//$NON-NLS-1$ //$NON-NLS-2$
+ "Select Files", "", false, initSelections, filters);
//$NON-NLS-1$ //$NON-NLS-2$
// dialog.setInitialSelections(selectedResources);
if (files.length > 0) {
IFile file = files[0];
@@ -338,4 +350,30 @@
this.selection = selection;
}
+ public Object[] getInitSelections() {
+ return initSelections;
+ }
+
+ public void setInitSelections(Object[] initSelections) {
+ this.initSelections = initSelections;
+ }
+
+ public List<ViewerFilter> getFilters() {
+ return filters;
+ }
+
+ public void setFilters(List<ViewerFilter> filters) {
+ this.filters = filters;
+ }
+
+ public boolean isMultiSelect() {
+ return multiSelect;
+ }
+
+ public void setMultiSelect(boolean multiSelect) {
+ this.multiSelect = multiSelect;
+ }
+
+
+
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-04-14
11:30:02 UTC (rev 14734)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-04-14
13:38:48 UTC (rev 14735)
@@ -62,7 +62,7 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createTextFieldEditor("Value", editingdomain, toolkit, parent,
model);
+ SmooksUIUtils.createMixedTextFieldEditor("Value", editingdomain, toolkit,
parent, model);
SmooksUIUtils.createCDATAFieldEditor("Template Contents", editingdomain,
toolkit, parent, model);
}