Author: DartPeng
Date: 2009-04-16 03:47:06 -0400 (Thu, 16 Apr 2009)
New Revision: 14766
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/milyn/
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/freemarker/TemplateUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.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/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
Log:
JBIDE-4192
mission complete
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-15
18:23:04 UTC (rev 14765)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java 2009-04-16
07:47:06 UTC (rev 14766)
@@ -10,27 +10,15 @@
******************************************************************************/
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;
@@ -52,38 +40,7 @@
}
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);
- }
- }
+ SmooksUIUtils.openFile(p, resource.getProject(), SmooksMultiFormEditor.EDITOR_ID);
} catch (Exception e) {
}
@@ -103,33 +60,6 @@
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() {
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-15
18:23:04 UTC (rev 14765)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-04-16
07:47:06 UTC (rev 14766)
@@ -10,15 +10,21 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.freemarker;
+import org.eclipse.core.resources.IResource;
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
+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.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.model.freemarker.FreemarkerPackage;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
* @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
@@ -34,9 +40,8 @@
* 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 (feature == FreemarkerPackage.eINSTANCE.getTemplate_Value()) {
}
if (feature == FreemarkerPackage.eINSTANCE.getTemplate_Encoding()) {
@@ -46,9 +51,35 @@
}
@Override
- public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
- Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model);
+ public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit, Composite parent, Object model,
+ SmooksMultiFormEditor formEditor) {
+ final Object path = SmooksModelUtils.getAnyTypeText((AnyType)model);
+ final Object fm = model;
+ IHyperlinkListener listener = new IHyperlinkListener() {
+
+ public void linkActivated(HyperlinkEvent e) {
+ String p = null;
+ if (path != null && path instanceof String) {
+ p = ((String) path).trim();
+ }
+ try {
+ IResource resource = SmooksUIUtils.getResource((EObject) fm);
+ SmooksUIUtils.openFile(p, resource.getProject(),null);
+ } catch (Exception e1) {
+
+ }
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+
+ }
+
+ public void linkExited(HyperlinkEvent e) {
+
+ }
+
+ };
+ SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model,true,listener);
SmooksUIUtils.createCDATAFieldEditor("Template Contents(CDATA)",
editingdomain, toolkit, parent, model);
SmooksUIUtils.createCommentFieldEditor("Template Contents(Comment)",
editingdomain, toolkit, parent, model);
}
@@ -60,7 +91,5 @@
}
return super.ignoreProperty(feature);
}
-
-
}
\ No newline at end of file
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java 2009-04-15
18:23:04 UTC (rev 14765)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java 2009-04-16
07:47:06 UTC (rev 14766)
@@ -10,12 +10,18 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.smooks;
+import org.eclipse.core.resources.IResource;
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.swt.widgets.Composite;
+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.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
/**
@@ -35,6 +41,35 @@
public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute
feature,SmooksMultiFormEditor formEditor) {
if (feature == SmooksPackage.eINSTANCE.getImportType_File()) {
+ final Object fm = model;
+ final Object path = SmooksUIUtils.getEditValue(propertyDescriptor, model);
+ IHyperlinkListener listener = new IHyperlinkListener() {
+ public void linkActivated(HyperlinkEvent e) {
+ String p = null;
+ if (path != null && path instanceof String) {
+ p = ((String) path).trim();
+ }
+ try {
+ IResource resource = SmooksUIUtils.getResource((EObject) fm);
+ SmooksUIUtils.openFile(p, resource.getProject(),null);
+ } catch (Exception e1) {
+
+ }
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+
+ }
+
+ public void linkExited(HyperlinkEvent e) {
+
+ }
+
+ };
+ SmooksUIUtils.createLinkTextValueFieldEditor(null, (AdapterFactoryEditingDomain)
formEditor.getEditingDomain(), propertyDescriptor,
+ toolkit, parent, model, false, 0, true, listener);
+
+ return parent;
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature,
formEditor);
}
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-15
18:23:04 UTC (rev 14765)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-04-16
07:47:06 UTC (rev 14766)
@@ -46,7 +46,7 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model , false , 500);
+ SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model , false , 500,false,null);
SmooksUIUtils.createCDATAFieldEditor("CDATA Value", 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/SmooksUIUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-15
18:23:04 UTC (rev 14765)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-16
07:47:06 UTC (rev 14766)
@@ -18,6 +18,7 @@
import java.util.List;
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;
@@ -32,6 +33,7 @@
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper;
+import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -53,6 +55,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.events.HyperlinkEvent;
@@ -60,6 +63,8 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
import org.jboss.tools.smooks.configuration.editors.SelectorAttributes;
@@ -89,17 +94,17 @@
public static final String XSL_NAMESPACE = "
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" ";
public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
- Object model) {
- createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false, 0);
+ Object model,boolean linkLabel, IHyperlinkListener listener) {
+ createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false,
0,linkLabel,listener);
}
public static void createMultiMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
Composite parent, Object model, int height) {
- createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true,
height);
+ createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true,
height,false,null);
}
public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
- Object model, boolean multiText, int height) {
+ Object model, boolean multiText, int height, boolean linkLabel, IHyperlinkListener
listener) {
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
Section section = null;
Composite textContainer = null;
@@ -123,7 +128,14 @@
section.setLayoutData(gd);
textContainer = textComposite;
} else {
- toolkit.createLabel(parent, label + "
:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ if (linkLabel) {
+ Hyperlink link = toolkit.createHyperlink(parent, label + " :", SWT.NONE);
+ if (listener != null) {
+ link.addHyperlinkListener(listener);
+ }
+ } else {
+ toolkit.createLabel(parent, label + "
:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ }
textContainer = parent;
}
gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -237,14 +249,13 @@
public static void createLinkTextValueFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain,
IItemPropertyDescriptor propertyDescriptor, FormToolkit toolkit, Composite parent,
Object model, boolean multiText, int height,
boolean linkLabel, IHyperlinkListener listener) {
+ Control control = createFiledEditorLabel(parent, toolkit, propertyDescriptor, model,
linkLabel);
if (linkLabel) {
- Hyperlink link = toolkit.createHyperlink(parent, label, SWT.NONE);
+ Hyperlink link = (Hyperlink)control;
if (listener != null) {
link.addHyperlinkListener(listener);
}
- } else {
- toolkit.createLabel(parent, label + "
:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- }
+ }
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
int textType = SWT.FLAT;
if (multiText) {
@@ -762,6 +773,51 @@
return classTextComposite;
}
+ public static void openFile(String uri, IProject project) throws PartInitException {
+ openFile(uri, project, null);
+ }
+
+ public static void openFile(String uri, IProject project, String editorID) throws
PartInitException {
+ if (uri.charAt(0) == '\\' || uri.charAt(0) == '/') {
+ uri = uri.substring(1);
+ }
+ IFile file = project.getFile(uri);
+ IWorkbenchWindow window =
SmooksConfigurationActivator.getDefault().getWorkbench().getActiveWorkbenchWindow();
+ // it's workspace resource
+ if (file.exists()) {
+
+ } else {
+ // maybe it's a classpath resource
+ try {
+ IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject != null) {
+ IClasspathEntry[] classPathEntrys = javaProject.getRawClasspath();
+ for (int i = 0; i < classPathEntrys.length; i++) {
+ IClasspathEntry entry = classPathEntrys[i];
+ IFolder folder =
ResourcesPlugin.getWorkspace().getRoot().getFolder(entry.getPath());
+ if (folder != null && folder.exists()) {
+ IFile temp = folder.getFile(new Path(uri));
+ if (temp != null && temp.exists()) {
+ file = temp;
+ break;
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+
+ }
+ }
+ if (file.exists()) {
+ FileEditorInput editorInput = new FileEditorInput(file);
+ if (editorID != null) {
+ window.getActivePage().openEditor(editorInput, editorID);
+ } else {
+ IDE.openEditor(window.getActivePage(), file);
+ }
+ }
+ }
+
public static void showErrorDialog(Shell shell, Status status) {
ErrorDialog.openError(shell, "Error", "error", status);
//$NON-NLS-1$ //$NON-NLS-2$
}
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-15
18:23:04 UTC (rev 14765)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-04-16
07:47:06 UTC (rev 14766)
@@ -10,15 +10,21 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.xsl;
+import org.eclipse.core.resources.IResource;
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
+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.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.model.xsl.XslPackage;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
* @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
@@ -34,8 +40,8 @@
* 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 (feature == XslPackage.eINSTANCE.getTemplate_Value()) {
}
if (feature == XslPackage.eINSTANCE.getTemplate_Encoding()) {
@@ -43,11 +49,13 @@
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature,
formEditor);
}
-
-
- /* (non-Javadoc)
- * @see
org.jboss.tools.smooks.configuration.editors.PropertyUICreator#ignoreProperty(org.eclipse.emf.ecore.EAttribute)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.smooks.configuration.editors.PropertyUICreator#ignoreProperty
+ * (org.eclipse.emf.ecore.EAttribute)
*/
@Override
public boolean ignoreProperty(EAttribute feature) {
@@ -57,12 +65,36 @@
return super.ignoreProperty(feature);
}
+ @Override
+ public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit, Composite parent, Object model,
+ SmooksMultiFormEditor formEditor) {
+ final Object path = SmooksModelUtils.getAnyTypeText((AnyType) model);
+ final Object fm = model;
+ IHyperlinkListener listener = new IHyperlinkListener() {
+ public void linkActivated(HyperlinkEvent e) {
+ String p = null;
+ if (path != null && path instanceof String) {
+ p = ((String) path).trim();
+ }
+ try {
+ IResource resource = SmooksUIUtils.getResource((EObject) fm);
+ SmooksUIUtils.openFile(p, resource.getProject(), null);
+ } catch (Exception e1) {
- @Override
- public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
- Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model);
+ }
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+
+ }
+
+ public void linkExited(HyperlinkEvent e) {
+
+ }
+
+ };
+ SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model, true, listener);
SmooksUIUtils.createCDATAFieldEditor("Template Contents (CDATA)",
editingdomain, toolkit, parent, model);
SmooksUIUtils.createCommentFieldEditor("Template Contents (Comment)",
editingdomain, toolkit, parent, model);
}