Author: DartPeng
Date: 2008-10-26 09:35:53 -0400 (Sun, 26 Oct 2008)
New Revision: 11188
Added:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/SmooksTextEdtor.java
Removed:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksMultiPageEditor.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksMultiPageEditorContributor.java
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java
Log:
JBIDE-2988
add a text editor to show text contents when Smooks tools can't parse the file or
dosen't support transform data type.
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java 2008-10-26
13:32:55 UTC (rev 11187)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java 2008-10-26
13:35:53 UTC (rev 11188)
@@ -156,8 +156,7 @@
public MappingResourceConfigList analyzeMappingSmooksModel(
SmooksResourceListType listType, Object sourceObject,
Object targetObject) {
- // TODO Auto-generated method stub
- return null;
+ throw new RuntimeException("The Smooks editor doesn't support to parse the
Java2XML config file currently.The feature is coming soon..");
}
protected String getTheJavaBeanString(JavaBeanModel currentModel) {
Added:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/SmooksTextEdtor.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/SmooksTextEdtor.java
(rev 0)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/SmooksTextEdtor.java 2008-10-26
13:35:53 UTC (rev 11188)
@@ -0,0 +1,70 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.ui;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.jboss.tools.smooks.utils.SmooksGraphConstants;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksTextEdtor extends TextEditor {
+
+ private Throwable error;
+
+ public SmooksTextEdtor(Throwable error) {
+ super();
+ Assert.isNotNull(error);
+ this.error = error;
+ while(error != null && error instanceof InvocationTargetException){
+ error = ((InvocationTargetException)error).getTargetException();
+ }
+ }
+
+ public void createPartControl(Composite parent) {
+ GridLayout gridLayout = new GridLayout();
+ parent.setLayout(gridLayout);
+ Composite errorComposite = new Composite(parent, SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ errorComposite.setLayoutData(gd);
+
+ Label noticeLabel = new Label(errorComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ noticeLabel.setLayoutData(gd);
+ noticeLabel
+ .setText("Because there occurs some error during parse/load the Smooks
configuration file , the graphical editor can't be opened.Error : ");
+
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ errorComposite.setLayout(gl);
+
+ gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
+ Label imagelabel = new Label(errorComposite, SWT.NONE);
+ imagelabel.setLayoutData(gd);
+ imagelabel.setImage(SmooksUIActivator.getDefault().getImageRegistry()
+ .get(SmooksGraphConstants.IMAGE_ERROR));
+
+ Label messageLabel = new Label(errorComposite, SWT.NONE);
+ messageLabel.setText(error.getLocalizedMessage());
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ messageLabel.setLayoutData(gd);
+
+ Composite textComposite = new Composite(parent, SWT.NONE);
+ gd = new GridData(GridData.FILL_BOTH);
+ textComposite.setLayoutData(gd);
+ textComposite.setLayout(new FillLayout());
+ super.createPartControl(textComposite);
+ }
+}
Property changes on:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/SmooksTextEdtor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java 2008-10-26
13:32:55 UTC (rev 11187)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java 2008-10-26
13:35:53 UTC (rev 11188)
@@ -24,10 +24,12 @@
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
@@ -39,6 +41,7 @@
import org.jboss.tools.smooks.model.SmooksResourceListType;
import org.jboss.tools.smooks.model.provider.SmooksItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.util.SmooksResourceFactoryImpl;
+import org.jboss.tools.smooks.ui.SmooksTextEdtor;
import org.jboss.tools.smooks.utils.UIUtils;
/**
@@ -47,7 +50,7 @@
*/
public class SmooksFormEditor extends FormEditor implements
ITabbedPropertySheetPageContributor {
-
+
SmooksGraphicalFormPage graphicalPage = null;
private TabbedPropertySheetPage tabbedPropertySheetPage;
private SmooksNormalContentEditFormPage normalPage;
@@ -56,7 +59,11 @@
private AdapterFactoryEditingDomain editingDomain;
private Resource smooksResource;
+ private SmooksTextEdtor textEdtior = null;
+
private boolean forceDirty = false;
+ private boolean onlyShowTextEditor = false;
+ private Throwable showTextEditorReason = null;
public SmooksFormEditor() {
super();
@@ -81,6 +88,7 @@
@Override
protected void addPages() {
+
try {
graphicalPage = new SmooksGraphicalFormPage(this, "graph",
"Mapping");
@@ -92,22 +100,49 @@
setPageText(index, "Normal");
// Set a default NormalPacakge to Normal Page
this.refreshNormalPage(Collections.EMPTY_LIST);
+ if (onlyShowTextEditor) {
+ removeGraphicalFormPage();
+ }
} catch (Exception e) {
UIUtils.showErrorDialog(getSite().getShell(), UIUtils
.createErrorStatus(e));
}
}
+ public void setOnlyShowTextEditor(boolean onlyShowTextEditor,
+ Throwable reason) {
+ this.onlyShowTextEditor = onlyShowTextEditor;
+ this.showTextEditorReason = reason;
+ }
+
+ public void removeGraphicalFormPage() {
+ int count = this.getPageCount();
+ try {
+ if (textEdtior == null) {
+ textEdtior = new SmooksTextEdtor(showTextEditorReason);
+ this.addPage(textEdtior, getEditorInput());
+ for (int i = 0; i < count; i++) {
+ this.removePage(0);
+ }
+ }
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+
/*
* (non-Javadoc)
*
- * @see org.eclipse.ui.forms.editor.FormEditor#init(org.eclipse.ui.IEditorSite,
- * org.eclipse.ui.IEditorInput)
+ * @see
+ * org.eclipse.ui.forms.editor.FormEditor#init(org.eclipse.ui.IEditorSite,
+ * org.eclipse.ui.IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
super.init(site, input);
+ onlyShowTextEditor = false;
+ Throwable parsingException = null;
IFile file = ((IFileEditorInput) input).getFile();
String path = file.getLocation().toOSString();
if (this.getEditingDomain() != null && smooksResource == null) {
@@ -117,29 +152,39 @@
try {
smooksResource.load(Collections.EMPTY_MAP);
} catch (IOException e) {
- e.printStackTrace();
+ parsingException = e;
}
}
+
+ if (parsingException != null) {
+ onlyShowTextEditor = true;
+ showTextEditorReason = parsingException;
+ return;
+ }
+
DocumentRoot documentRoot = null;
- if(smooksResource.getContents().isEmpty()){
+ if (smooksResource.getContents().isEmpty()) {
documentRoot = SmooksFactory.eINSTANCE.createDocumentRoot();
smooksResource.getContents().add(documentRoot);
- }else{
- documentRoot = (DocumentRoot) smooksResource.getContents().get(0);
+ } else {
+ documentRoot = (DocumentRoot) smooksResource.getContents().get(
+ 0);
}
-
- SmooksResourceListType resourceList = documentRoot.getSmooksResourceList();
- if(resourceList == null){
- resourceList = SmooksFactory.eINSTANCE.createSmooksResourceListType();
+
+ SmooksResourceListType resourceList = documentRoot
+ .getSmooksResourceList();
+ if (resourceList == null) {
+ resourceList = SmooksFactory.eINSTANCE
+ .createSmooksResourceListType();
documentRoot.setSmooksResourceList(resourceList);
}
-
+
}
}
public void refreshNormalPage(List resourceHidenConfigs) {
NormalSmooksModelPackage modelPackage = createSmooksModelPackage();
- if (modelPackage != null){
+ if (modelPackage != null) {
modelPackage.setHidenSmooksElements(resourceHidenConfigs);
}
if (this.normalPage != null) {
@@ -161,6 +206,13 @@
@Override
public void doSave(IProgressMonitor monitor) {
+ if(onlyShowTextEditor){
+ if(textEdtior != null){
+ textEdtior.doSave(monitor);
+ fireEditorDirty(false);
+ return;
+ }
+ }
graphicalPage.doSave(monitor);
fireEditorDirty(false);
}
@@ -172,8 +224,11 @@
@Override
public void doSaveAs() {
- // TODO Auto-generated method stub
-
+ if(onlyShowTextEditor){
+ if(textEdtior != null){
+ textEdtior.doSaveAs();
+ }
+ }
}
@Override
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-26
13:32:55 UTC (rev 11187)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-26
13:35:53 UTC (rev 11188)
@@ -253,21 +253,6 @@
@Override
protected void createFormContent(IManagedForm managedForm) {
- try {
- this.initTransformViewerModel((IEditorSite) getSite(),
- getEditorInput());
- if (mappingResourceConfigList != null)
- callParentRefillNormalModelInfor(mappingResourceConfigList
- .getRelationgResourceConfigList());
- } catch (IOWrappedException ex) {
- MessageDialog.openWarning(getSite().getShell(), "Waring",
- "Exceptions occurd during parsing Smooks file, no worries");
- } catch (Throwable e) {
- Status status = UIUtils.createErrorStatus(e);
- ErrorDialog.openError(getSite().getShell(), "Error", "error",
- status);
- }
-
final ScrolledForm form = managedForm.getForm();
FormToolkit toolkit = managedForm.getToolkit();
@@ -927,7 +912,6 @@
.getSmooksConfigurationFileGenerateContext());
} catch (Throwable t) {
// ignore
- t.printStackTrace();
}
IFile file = ((IFileEditorInput) input).getFile();
if (sourceDataTypeID == null || targetDataTypeID == null) {
@@ -1000,8 +984,22 @@
this.targetTreeViewerInputModel = ((SmooksFileEditorInput) input)
.getTargetTreeViewerInputContents();
}
-
- // }
+ Throwable throwable = null;
+ try {
+ this.initTransformViewerModel((IEditorSite) getSite(),
+ getEditorInput());
+ if (mappingResourceConfigList != null)
+ callParentRefillNormalModelInfor(mappingResourceConfigList
+ .getRelationgResourceConfigList());
+ } catch (IOWrappedException ex) {
+ MessageDialog.openWarning(getSite().getShell(), "Waring",
+ "Exceptions occurd during parsing Smooks file, no worries");
+ } catch (Throwable e) {
+ throwable = e;
+ }
+ if (throwable != null) {
+ ((SmooksFormEditor) getEditor()).setOnlyShowTextEditor(true,throwable);
+ }
}
protected void initFormEditorWithGraphInfo(GraphInformations graph) {
@@ -1342,7 +1340,8 @@
}
updateNotifyMessage();
} catch (CoreException e) {
- UIUtils.showErrorDialog(getSite().getShell(), UIUtils.createErrorStatus(e));
+ UIUtils.showErrorDialog(getSite().getShell(), UIUtils
+ .createErrorStatus(e));
}
}
Deleted:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksMultiPageEditor.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksMultiPageEditor.java 2008-10-26
13:32:55 UTC (rev 11187)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksMultiPageEditor.java 2008-10-26
13:35:53 UTC (rev 11188)
@@ -1,241 +0,0 @@
-package org.jboss.tools.smooks.ui.editors;
-
-
-import java.io.StringWriter;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.FontDialog;
-import org.eclipse.ui.*;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.ide.IDE;
-
-/**
- * An example showing how to create a multi-page editor.
- * This example has 3 pages:
- * <ul>
- * <li>page 0 contains a nested text editor.
- * <li>page 1 allows you to change the font used in page 2
- * <li>page 2 shows the words in page 0 in sorted order
- * </ul>
- */
-public class SmooksMultiPageEditor extends MultiPageEditorPart implements
IResourceChangeListener{
-
- public final static String ID_SMOOKS_EDITOR =
"org.jboss.tools.smooks.ui.editors.SmooksMultiPageEditor";
-
- /** The text editor used in page 0. */
- private TextEditor editor;
-
- /** The font chosen in page 1. */
- private Font font;
-
- /** The text widget used in page 2. */
- private StyledText text;
- /**
- * Creates a multi-page editor example.
- */
- public SmooksMultiPageEditor() {
- super();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
- }
- /**
- * Creates page 0 of the multi-page editor,
- * which contains a text editor.
- */
- void createPage0() {
- try {
- editor = new TextEditor();
- int index = addPage(editor, getEditorInput());
- setPageText(index, editor.getTitle());
- } catch (PartInitException e) {
- ErrorDialog.openError(
- getSite().getShell(),
- "Error creating nested text editor",
- null,
- e.getStatus());
- }
- }
- /**
- * Creates page 1 of the multi-page editor,
- * which allows you to change the font used in page 2.
- */
- void createPage1() {
-
- Composite composite = new Composite(getContainer(), SWT.NONE);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- layout.numColumns = 2;
-
- Button fontButton = new Button(composite, SWT.NONE);
- GridData gd = new GridData(GridData.BEGINNING);
- gd.horizontalSpan = 2;
- fontButton.setLayoutData(gd);
- fontButton.setText("Change Font...");
-
- fontButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setFont();
- }
- });
-
- int index = addPage(composite);
- setPageText(index, "Properties");
- }
- /**
- * Creates page 2 of the multi-page editor,
- * which shows the sorted text.
- */
- void createPage2() {
- Composite composite = new Composite(getContainer(), SWT.NONE);
- FillLayout layout = new FillLayout();
- composite.setLayout(layout);
- text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
- text.setEditable(false);
-
- int index = addPage(composite);
- setPageText(index, "Preview");
- }
- /**
- * Creates the pages of the multi-page editor.
- */
- protected void createPages() {
- createPage0();
- createPage1();
- createPage2();
- }
- /**
- * The <code>MultiPageEditorPart</code> implementation of this
- * <code>IWorkbenchPart</code> method disposes all nested editors.
- * Subclasses may extend.
- */
- public void dispose() {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- super.dispose();
- }
- /**
- * Saves the multi-page editor's document.
- */
- public void doSave(IProgressMonitor monitor) {
- getEditor(0).doSave(monitor);
- }
- /**
- * Saves the multi-page editor's document as another file.
- * Also updates the text for page 0's tab, and updates this multi-page editor's
input
- * to correspond to the nested editor's.
- */
- public void doSaveAs() {
- IEditorPart editor = getEditor(0);
- editor.doSaveAs();
- setPageText(0, editor.getTitle());
- setInput(editor.getEditorInput());
- }
- /* (non-Javadoc)
- * Method declared on IEditorPart
- */
- public void gotoMarker(IMarker marker) {
- setActivePage(0);
- IDE.gotoMarker(getEditor(0), marker);
- }
- /**
- * The <code>MultiPageEditorExample</code> implementation of this method
- * checks that the input is an instance of <code>IFileEditorInput</code>.
- */
- public void init(IEditorSite site, IEditorInput editorInput)
- throws PartInitException {
- if (!(editorInput instanceof IFileEditorInput))
- throw new PartInitException("Invalid Input: Must be IFileEditorInput");
- super.init(site, editorInput);
- }
- /* (non-Javadoc)
- * Method declared on IEditorPart.
- */
- public boolean isSaveAsAllowed() {
- return true;
- }
- /**
- * Calculates the contents of page 2 when the it is activated.
- */
- protected void pageChange(int newPageIndex) {
- super.pageChange(newPageIndex);
- if (newPageIndex == 2) {
- sortWords();
- }
- }
- /**
- * Closes all project files on project close.
- */
- public void resourceChanged(final IResourceChangeEvent event){
- if(event.getType() == IResourceChangeEvent.PRE_CLOSE){
- Display.getDefault().asyncExec(new Runnable(){
- public void run(){
- IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
- for (int i = 0; i<pages.length; i++){
- if(((FileEditorInput)editor.getEditorInput()).getFile().getProject().equals(event.getResource())){
- IEditorPart editorPart = pages[i].findEditor(editor.getEditorInput());
- pages[i].closeEditor(editorPart,true);
- }
- }
- }
- });
- }
- }
- /**
- * Sets the font related data to be applied to the text in page 2.
- */
- void setFont() {
- FontDialog fontDialog = new FontDialog(getSite().getShell());
- fontDialog.setFontList(text.getFont().getFontData());
- FontData fontData = fontDialog.open();
- if (fontData != null) {
- if (font != null)
- font.dispose();
- font = new Font(text.getDisplay(), fontData);
- text.setFont(font);
- }
- }
- /**
- * Sorts the words in page 0, and shows them in page 2.
- */
- void sortWords() {
-
- String editorText =
- editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
-
- StringTokenizer tokenizer =
- new StringTokenizer(editorText, "
\t\n\r\f!@#\u0024%^&*()-_=+`~[]{};:'\",.<>/?|\\");
- ArrayList editorWords = new ArrayList();
- while (tokenizer.hasMoreTokens()) {
- editorWords.add(tokenizer.nextToken());
- }
-
- Collections.sort(editorWords, Collator.getInstance());
- StringWriter displayText = new StringWriter();
- for (int i = 0; i < editorWords.size(); i++) {
- displayText.write(((String) editorWords.get(i)));
- displayText.write(System.getProperty("line.separator"));
- }
- text.setText(displayText.toString());
- }
-}
Deleted:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksMultiPageEditorContributor.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksMultiPageEditorContributor.java 2008-10-26
13:32:55 UTC (rev 11187)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksMultiPageEditorContributor.java 2008-10-26
13:35:53 UTC (rev 11188)
@@ -1,103 +0,0 @@
-package org.jboss.tools.smooks.ui.editors;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.ide.IDEActionFactory;
-import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-/**
- * Manages the installation/deinstallation of global actions for multi-page editors.
- * Responsible for the redirection of global actions to the active editor.
- * Multi-page contributor replaces the contributors for the individual editors in the
multi-page editor.
- */
-public class SmooksMultiPageEditorContributor extends MultiPageEditorActionBarContributor
{
- private IEditorPart activeEditorPart;
- private Action sampleAction;
- /**
- * Creates a multi-page contributor.
- */
- public SmooksMultiPageEditorContributor() {
- super();
- createActions();
- }
- /**
- * Returns the action registed with the given text editor.
- * @return IAction or null if editor is null.
- */
- protected IAction getAction(ITextEditor editor, String actionID) {
- return (editor == null ? null : editor.getAction(actionID));
- }
- /* (non-JavaDoc)
- * Method declared in AbstractMultiPageEditorActionBarContributor.
- */
-
- public void setActivePage(IEditorPart part) {
- if (activeEditorPart == part)
- return;
-
- activeEditorPart = part;
-
- IActionBars actionBars = getActionBars();
- if (actionBars != null) {
-
- ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
-
- actionBars.setGlobalActionHandler(
- ActionFactory.DELETE.getId(),
- getAction(editor, ITextEditorActionConstants.DELETE));
- actionBars.setGlobalActionHandler(
- ActionFactory.UNDO.getId(),
- getAction(editor, ITextEditorActionConstants.UNDO));
- actionBars.setGlobalActionHandler(
- ActionFactory.REDO.getId(),
- getAction(editor, ITextEditorActionConstants.REDO));
- actionBars.setGlobalActionHandler(
- ActionFactory.CUT.getId(),
- getAction(editor, ITextEditorActionConstants.CUT));
- actionBars.setGlobalActionHandler(
- ActionFactory.COPY.getId(),
- getAction(editor, ITextEditorActionConstants.COPY));
- actionBars.setGlobalActionHandler(
- ActionFactory.PASTE.getId(),
- getAction(editor, ITextEditorActionConstants.PASTE));
- actionBars.setGlobalActionHandler(
- ActionFactory.SELECT_ALL.getId(),
- getAction(editor, ITextEditorActionConstants.SELECT_ALL));
- actionBars.setGlobalActionHandler(
- ActionFactory.FIND.getId(),
- getAction(editor, ITextEditorActionConstants.FIND));
- actionBars.setGlobalActionHandler(
- IDEActionFactory.BOOKMARK.getId(),
- getAction(editor, IDEActionFactory.BOOKMARK.getId()));
- actionBars.updateActionBars();
- }
- }
- private void createActions() {
- sampleAction = new Action() {
- public void run() {
- MessageDialog.openInformation(null, "Ui Plug-in", "Sample Action
Executed");
- }
- };
- sampleAction.setText("Sample Action");
- sampleAction.setToolTipText("Sample Action tool tip");
- sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
- getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
- }
- public void contributeToMenu(IMenuManager manager) {
- IMenuManager menu = new MenuManager("Editor &Menu");
- manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
- menu.add(sampleAction);
- }
- public void contributeToToolBar(IToolBarManager manager) {
- manager.add(new Separator());
- manager.add(sampleAction);
- }
-}
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java 2008-10-26
13:32:55 UTC (rev 11187)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java 2008-10-26
13:35:53 UTC (rev 11188)
@@ -47,7 +47,7 @@
public MappingResourceConfigList analyzeMappingSmooksModel(
SmooksResourceListType listType, Object sourceObject,
Object targetObject) {
- return null;
+ throw new RuntimeException("The Smooks editor doesn't support to parse the
XML2XML config file currently.The feature is coming soon...");
}
public DesignTimeAnalyzeResult[] analyzeGraphModel(