Author: DartPeng
Date: 2009-10-09 03:04:02 -0400 (Fri, 09 Oct 2009)
New Revision: 17992
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CsvReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
Log:
JBIDE-4819
done
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-10-09
04:41:52 UTC (rev 17991)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-10-09
07:04:02 UTC (rev 17992)
@@ -28,7 +28,8 @@
org.eclipse.gef,
org.eclipse.jdt.launching,
org.eclipse.zest.core,
- org.eclipse.zest.layouts
+ org.eclipse.zest.layouts,
+ org.eclipse.core.filesystem
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-10-09
04:41:52 UTC (rev 17991)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-10-09
07:04:02 UTC (rev 17992)
@@ -16,6 +16,11 @@
import java.util.List;
import java.util.Properties;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Path;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
@@ -32,7 +37,12 @@
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -57,6 +67,10 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
@@ -67,6 +81,7 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.ScrolledPageBook;
import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.ide.IDE;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import
org.jboss.tools.smooks.configuration.editors.wizard.StructuredDataSelectionWizard;
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
@@ -789,6 +804,62 @@
}
});
+ inputDataViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Object element = selection.getFirstElement();
+ if (element instanceof InputType) {
+ String type = ((InputType) element).getType();
+ String filePath = SmooksModelUtils.getInputPath((InputType) element);
+ if (type != null && filePath != null) {
+ if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
+ IFile file = ((IFileEditorInput) getEditorInput()).getFile();
+ IJavaProject javaProject = JavaCore.create(file.getProject());
+ if (javaProject != null) {
+ try {
+ if(filePath.endsWith("[]")){
+ filePath = filePath.substring(0,filePath.length() - 2);
+ }
+ IJavaElement result = javaProject.findType(filePath);
+ if (result != null)
+ JavaUI.openInEditor(result);
+ else {
+ MessageDialog.openError(getSite().getWorkbenchWindow().getShell(),
+ "Can't find type", "Can't find type \"" +
filePath + "\" in \""
+ + javaProject.getProject().getName() + "\" project.");
+ }
+ } catch (Exception e) {
+
+ }
+ }
+ } else {
+ try {
+ filePath = SmooksUIUtils.parseFilePath(filePath);
+ if (filePath != null) {
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(filePath));
+ IFileInfo fetchInfo = fileStore.fetchInfo();
+ if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
+ IWorkbenchWindow window = getSite().getWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+ try {
+ IDE.openEditorOnFileStore(page, fileStore);
+ } catch (PartInitException e) {
+ MessageDialog.open(MessageDialog.ERROR, window.getShell(), "Open
File",
+ "Can't open the file : '" + filePath + "'",
SWT.SHEET);
+ }
+ } else {
+ }
+ }
+ } catch (Exception e) {
+ MessageDialog.open(MessageDialog.ERROR,
getSite().getWorkbenchWindow().getShell(),
+ "Open File", "Can't open the file : '" + filePath +
"'", SWT.SHEET);
+ }
+ }
+ }
+ }
+ }
+ });
TableColumn header = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
header.setText("Type");
header.setWidth(100);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CsvReaderUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CsvReaderUICreator.java 2009-10-09
04:41:52 UTC (rev 17991)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CsvReaderUICreator.java 2009-10-09
07:04:02 UTC (rev 17992)
@@ -47,14 +47,10 @@
*/
public class CsvReaderUICreator extends PropertyUICreator {
- private TableViewer fieldsViewer;
private List<FieldText> fieldsList = new ArrayList<FieldText>();
- private Button addButton;
- private Button removeButton;
-
/*
* (non-Javadoc)
*
@@ -121,7 +117,7 @@
String fields = (String) SmooksUIUtils.getEditValue(descriptor, model);
gd = new GridData(GridData.FILL_BOTH);
- fieldsViewer = new TableViewer(fieldsComposite, SWT.BORDER | SWT.MULTI |
SWT.FULL_SELECTION);
+ final TableViewer fieldsViewer = new TableViewer(fieldsComposite, SWT.BORDER |
SWT.MULTI | SWT.FULL_SELECTION);
fieldsViewer.getControl().setLayoutData(gd);
fieldsViewer.getTable().setLinesVisible(true);
fieldsViewer.setContentProvider(new FieldsContentProvider());
@@ -194,15 +190,15 @@
gd = new GridData(GridData.FILL_HORIZONTAL);
- addButton = new Button(buttonComposite, SWT.NONE);
+ final Button addButton = new Button(buttonComposite, SWT.NONE);
addButton.setLayoutData(gd);
addButton.setText("Add Field");
- removeButton = new Button(buttonComposite, SWT.NONE);
+ final Button removeButton = new Button(buttonComposite, SWT.NONE);
removeButton.setLayoutData(gd);
removeButton.setText("Remove");
- this.addButton.addSelectionListener(new SelectionListener() {
+ addButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
addButton.setEnabled(false);
@@ -224,7 +220,7 @@
}
});
- this.removeButton.addSelectionListener(new SelectionListener() {
+ removeButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
IStructuredSelection s = (IStructuredSelection) fieldsViewer.getSelection();
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderUICreator.java 2009-10-09
04:41:52 UTC (rev 17991)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Csv12ReaderUICreator.java 2009-10-09
07:04:02 UTC (rev 17992)
@@ -54,14 +54,10 @@
*/
public class Csv12ReaderUICreator extends PropertyUICreator {
- private TableViewer fieldsViewer;
private List<FieldText> fieldsList = new ArrayList<FieldText>();
- private Button addButton;
- private Button removeButton;
-
/*
* (non-Javadoc)
*
@@ -156,7 +152,7 @@
String fields = (String) SmooksUIUtils.getEditValue(descriptor, model);
gd = new GridData(GridData.FILL_BOTH);
- fieldsViewer = new TableViewer(fieldsComposite, SWT.BORDER | SWT.MULTI |
SWT.FULL_SELECTION);
+ final TableViewer fieldsViewer = new TableViewer(fieldsComposite, SWT.BORDER |
SWT.MULTI | SWT.FULL_SELECTION);
fieldsViewer.getControl().setLayoutData(gd);
fieldsViewer.getTable().setLinesVisible(true);
fieldsViewer.setContentProvider(new FieldsContentProvider());
@@ -229,15 +225,15 @@
gd = new GridData(GridData.FILL_HORIZONTAL);
- addButton = new Button(buttonComposite, SWT.NONE);
+ final Button addButton = new Button(buttonComposite, SWT.NONE);
addButton.setLayoutData(gd);
addButton.setText("Add Field");
- removeButton = new Button(buttonComposite, SWT.NONE);
+ final Button removeButton = new Button(buttonComposite, SWT.NONE);
removeButton.setLayoutData(gd);
removeButton.setText("Remove");
- this.addButton.addSelectionListener(new SelectionListener() {
+ addButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
// addButton.setEnabled(false);
@@ -259,7 +255,7 @@
}
});
- this.removeButton.addSelectionListener(new SelectionListener() {
+ removeButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
IStructuredSelection s = (IStructuredSelection) fieldsViewer.getSelection();
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonReaderUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonReaderUICreator.java 2009-10-09
04:41:52 UTC (rev 17991)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonReaderUICreator.java 2009-10-09
07:04:02 UTC (rev 17992)
@@ -74,7 +74,7 @@
EObject keyMap = ((JsonReader) model).getKeyMap();
if (keyMap != null) {
Group group = new Group(parent, SWT.NONE);
- group.setText("Key Maps");
+ group.setText("Keys Map");
group.setBackground(ColorConstants.white);
FillLayout fl = new FillLayout();
group.setLayout(fl);
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-10-09
04:41:52 UTC (rev 17991)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-10-09
07:04:02 UTC (rev 17992)
@@ -1215,11 +1215,14 @@
if (fresource.getProject().hasNature(JavaCore.NATURE_ID)) {
IJavaProject javaProject = JavaCore.create(fresource.getProject());
String typeName = searchComposite.getText().getText();
+ if(typeName.endsWith("[]")){
+ typeName = typeName.substring(0,typeName.length() - 2);
+ }
IJavaElement result = javaProject.findType(typeName);
if (result != null)
JavaUI.openInEditor(result);
else {
- MessageDialog.openInformation(classTextComposite.getShell(), "Can't
find type",
+ MessageDialog.openError(classTextComposite.getShell(), "Can't find
type",
"Can't find type \"" + typeName + "\" in
\""
+ javaProject.getProject().getName() + "\" project.");
}