Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Opening XText Editor Programmatically(Opening XText Editor Programmatically)
Opening XText Editor Programmatically [message #640830] Tue, 23 November 2010 05:24 Go to next message
Dani is currently offline Dani
Messages: 41
Registered: October 2010
Member
Hi All,
I want to open XText Editor Programmatically. I am using this command to open it but it give error can any one help me?

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(new StringEditorInput(""),editorId, true);

it gives following ERROR!

java.lang.IllegalArgumentException: Couldn't create EMF Resource for input com.eadsiw.modelicaml.tabbedproperties.utils.StringEditorInp ut @dc7d5f
at org.eclipse.xtext.ui.editor.model.ResourceForIEditorInputFac tory.createResource(ResourceForIEditorInputFactory.java:56)
at org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.setD ocumentContent(XtextDocumentProvider.java:102)
at org.eclipse.ui.editors.text.StorageDocumentProvider.createDo cument(StorageDocumentProvider.java:229)
at org.eclipse.ui.editors.text.StorageDocumentProvider.createEl ementInfo(StorageDocumentProvider.java:261)
at org.eclipse.ui.editors.text.FileDocumentProvider.createEleme ntInfo(FileDocumentProvider.java:770)
at org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.crea teElementInfo(XtextDocumentProvider.java:131)
at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(A bstractDocumentProvider.java:400)
at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(Abst ractTextEditor.java:4056)
at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(Status TextEditor.java:217)
at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetI nput(AbstractDecoratedTextEditor.java:1444)
at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor .java:169)
at org.eclipse.xtext.ui.editor.XtextEditor.doSetInput(XtextEdit or.java:149)
at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(Abstract TextEditor.java:3043)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:372)
at org.eclipse.jface.window.ApplicationWindow$1.run(Application Window.java:759)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:756)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2600)
at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(Ab stractTextEditor.java:3061)
at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTe xtEditor.java:3088)
at org.eclipse.xtext.ui.editor.XtextEditor.init(XtextEditor.jav a:169)
at org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:798)
at org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:647)
at org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:465)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:595)
at org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:289)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2863)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2768)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPag e.java:2760)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.j ava:2711)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2707)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2691)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2682)
at com.eadsiw.modelicaml.tabbedproperties.sections.ModelicaCode Section.createControls(ModelicaCodeSection.java:104)
at org.eclipse.ui.views.properties.tabbed.TabContents$1.run(Tab Contents.java:109)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:17 5)
at org.eclipse.ui.views.properties.tabbed.TabContents.createCon trols(TabContents.java:112)
at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPa ge$SelectionChangedListener.selectionChanged(TabbedPropertyS heetPage.java:206)
at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:17 5)
at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer .java:160)
at org.eclipse.jface.viewers.StructuredViewer.updateSelection(S tructuredViewer.java:2162)
at org.eclipse.jface.viewers.StructuredViewer.handleSelect(Stru cturedViewer.java:1190)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected( StructuredViewer.java:1220)
at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenS trategy.java:228)
at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.ja va:222)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:389)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 74)
at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedP ropertyList.select(TabbedPropertyList.java:664)
at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedP ropertyList$2.mouseUp(TabbedPropertyList.java:156)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:213)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:613)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)


I tried to open ordinary Editors they are working fine but not XText waiting for your reply


/Dani
Re: Opening XText Editor Programmatically [message #640881 is a reply to message #640830] Tue, 23 November 2010 07:23 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2809
Registered: July 2009
Senior Member
Hi Dani,

I'm assuming your StringEditorInput is a custom implemenation. You'll
have to enhance the default impl of the ResourceForEditorInputFactory
and handle your custom editor input there.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 23.11.10 11:24, schrieb Dani:
> Hi All,
> I want to open XText Editor Programmatically. I am using this command to
> open it but it give error can any one help me?
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi
> vePage().openEditor(new StringEditorInput(""),editorId, true);
>
> it gives following ERROR!
>
> java.lang.IllegalArgumentException: Couldn't create EMF Resource for
> input
> mailto: com.eadsiw.modelicaml.tabbedproperties.utils.StringEditorInp ut @dc7d5f
>
> at org.eclipse.xtext.ui.editor.model.ResourceForIEditorInputFac
> tory.createResource(ResourceForIEditorInputFactory.java:56)
> at org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.setD
> ocumentContent(XtextDocumentProvider.java:102)
> at org.eclipse.ui.editors.text.StorageDocumentProvider.createDo
> cument(StorageDocumentProvider.java:229)
> at org.eclipse.ui.editors.text.StorageDocumentProvider.createEl
> ementInfo(StorageDocumentProvider.java:261)
> at org.eclipse.ui.editors.text.FileDocumentProvider.createEleme
> ntInfo(FileDocumentProvider.java:770)
> at org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.crea
> teElementInfo(XtextDocumentProvider.java:131)
> at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(A
> bstractDocumentProvider.java:400)
> at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(Abst
> ractTextEditor.java:4056)
> at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(Status
> TextEditor.java:217)
> at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetI
> nput(AbstractDecoratedTextEditor.java:1444)
> at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor .java:169)
> at org.eclipse.xtext.ui.editor.XtextEditor.doSetInput(XtextEdit
> or.java:149)
> at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(Abstract
> TextEditor.java:3043)
> at org.eclipse.jface.operation.ModalContext.runInCurrentThread(
> ModalContext.java:464)
> at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:372)
> at org.eclipse.jface.window.ApplicationWindow$1.run(Application
> Window.java:759)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
> at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi
> ndow.java:756)
> at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2600)
> at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(Ab
> stractTextEditor.java:3061)
> at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTe
> xtEditor.java:3088)
> at org.eclipse.xtext.ui.editor.XtextEditor.init(XtextEditor.jav a:169)
> at org.eclipse.ui.internal.EditorManager.createSite(EditorManag
> er.java:798)
> at org.eclipse.ui.internal.EditorReference.createPartHelper(Edi
> torReference.java:647)
> at org.eclipse.ui.internal.EditorReference.createPart(EditorRef
> erence.java:465)
> at org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb
> enchPartReference.java:595)
> at org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe
> rence.java:289)
> at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(
> WorkbenchPage.java:2863)
> at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben
> chPage.java:2768)
> at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPag
> e.java:2760)
> at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.j ava:2711)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa
> ge.java:2707)
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa
> ge.java:2691)
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa
> ge.java:2682)
> at com.eadsiw.modelicaml.tabbedproperties.sections.ModelicaCode
> Section.createControls(ModelicaCodeSection.java:104)
> at org.eclipse.ui.views.properties.tabbed.TabContents$1.run(Tab
> Contents.java:109)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
> at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:17 5)
> at org.eclipse.ui.views.properties.tabbed.TabContents.createCon
> trols(TabContents.java:112)
> at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPa
> ge$SelectionChangedListener.selectionChanged(TabbedPropertyS
> heetPage.java:206)
> at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
> at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:17 5)
> at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer .java:160)
> at org.eclipse.jface.viewers.StructuredViewer.updateSelection(S
> tructuredViewer.java:2162)
> at org.eclipse.jface.viewers.StructuredViewer.handleSelect(Stru
> cturedViewer.java:1190)
> at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(
> StructuredViewer.java:1220)
> at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenS
> trategy.java:228)
> at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.ja va:222)
> at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate
> gy.java:389)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
> at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 74)
> at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedP
> ropertyList.select(TabbedPropertyList.java:664)
> at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedP
> ropertyList$2.mouseUp(TabbedPropertyList.java:156)
> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe
> ner.java:213)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault
> (Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work
> bench.java:664)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at org.eclipse.ui.internal.ide.application.IDEApplication.start
> (IDEApplication.java:115)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips
> eAppHandle.java:196)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher
> .runApplication(EclipseAppLauncher.java:110)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher
> .start(EclipseAppLauncher.java:79)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS
> tarter.java:369)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS
> tarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
> ssorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
> thodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:613)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
>
>
> I tried to open ordinary Editors they are working fine but not XText
> waiting for your reply
>
>
> /Dani
Re: Opening XText Editor Programmatically [message #640962 is a reply to message #640881] Tue, 23 November 2010 12:10 Go to previous messageGo to next message
Dani is currently offline Dani
Messages: 41
Registered: October 2010
Member
Hi Sebastian,
Can you please point me some example of "ResourceForEditorInputFactory" or any application using it?


/Dani
Re: Opening XText Editor Programmatically [message #641942 is a reply to message #640881] Mon, 29 November 2010 05:40 Go to previous messageGo to next message
Dani is currently offline Dani
Messages: 41
Registered: October 2010
Member
Hi Sebastian,
I now have "ResourceForEditorInputFactory" I have a class like StringEditorInput which is EditorInput, but I dont know how to get uri for a simple Xtext Editor to pass to the function as following....
EditorInput(URI uri, String name). what will be the uri? I find in many examples but it is for diagrams can it be without diagram?? please reply me if you have any suggestion waiting for your reply.


/Dani
Re: Opening XText Editor Programmatically [message #642112 is a reply to message #641942] Mon, 29 November 2010 16:40 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 101
Registered: August 2010
Senior Member
Hi Dani,

This code might help you. This is how I open a file programmatically for my Xtext Editor.


	/**
	 * Open the given file in an appropriate editor.
	 * @param file - The file to open.
	 */
	public static void openFileInEditor(IFile file) {
		// Get the active page.
		IWorkbenchPage page = MyHLMPlugin.getActivePage();
		// Figure out the default editor for the file type based on extension.
		IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
		if (desc == null) {
			MyHLMUtils.popupError("Editor open error", "Unable to find a suitable editor to open file.");
		} else {
			// Try opening the page in the editor.
			try {
				page.openEditor(new FileEditorInput(file), desc.getId());
			} catch (PartInitException e) {
				MyHLMPlugin.log(e);
			}
		}
	}
	
Re: Opening XText Editor Programmatically [message #645549 is a reply to message #642112] Fri, 17 December 2010 14:50 Go to previous messageGo to next message
Rafael Angarita is currently offline Rafael Angarita
Messages: 94
Registered: November 2010
Member
Hello all,

I have to open a Xtext editor programmatically.

I'm following this post and I get the following exeption:

!MESSAGE Unable to create editor ID org.xtext.mylanguage: Editor could not be initialized.
!STACK 0
java.lang.IllegalArgumentException: Couldn't create EMF Resource for input altagracia.ejemplos.StringEditorInput@a93a16


I was wondering what kind of object is "MyHLMPlugin" from the next line of code of the last post:

IWorkbenchPage page = MyHLMPlugin.getActivePage();


I'll appreciate any help and advise you guys can give me.

Thank you very much.
Re: Opening XText Editor Programmatically [message #645627 is a reply to message #645549] Sat, 18 December 2010 20:19 Go to previous messageGo to next message
Dani is currently offline Dani
Messages: 41
Registered: October 2010
Member
Hi Rafael Angarita,
you need to create file at opening of you editor because XText did not open with out resources! So firstly create XText File create my self.

IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject("NewProject");
IFolder folder = project.getFolder("NewFolder");
file = folder.getFile("hell.MyDsl");
if (!project.exists())
try {
project.create(null);
} catch (CoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (!project.isOpen())
try {
project.open(null);
} catch (CoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (!folder.exists())
try {
folder.create(IResource.NONE, true, null);
} catch (CoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
byte[] bytes = "File contents".getBytes();
InputStream source = new ByteArrayInputStream(bytes);
try {
file.create(source, IResource.NONE, null);

} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

then open your editor like this

IDE.openEditor (page, file, editorId)

editor id will be the ID of your XText



/Dani

Re: Opening XText Editor Programmatically [message #645978 is a reply to message #640830] Tue, 21 December 2010 08:00 Go to previous messageGo to next message
Rafael Angarita is currently offline Rafael Angarita
Messages: 94
Registered: November 2010
Member
Thank you very much, Dani!!!!

It worked perfectly!

Cheers!
Re: Opening XText Editor Programmatically [message #1042819 is a reply to message #645978] Tue, 16 April 2013 19:16 Go to previous messageGo to next message
Roza Ghamari is currently offline Roza Ghamari
Messages: 46
Registered: January 2013
Member
I have a related question. I'd like to use the Xtext editor, but I am not creating any IProject or IWorkspace in my application. Does this mean that I cannot get the Xtext editor? Is there any way to mock iproject or create a dummy iproject?

Thanks for your help in advance.
Re: Opening XText Editor Programmatically [message #1051099 is a reply to message #1042819] Sun, 28 April 2013 03:38 Go to previous message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1327
Registered: July 2009
Senior Member
On 04/17/2013 01:16 AM, Roza Ghamari wrote:
> I have a related question. I'd like to use the Xtext editor, but I am
> not creating any IProject or IWorkspace in my application. Does this
> mean that I cannot get the Xtext editor? Is there any way to mock
> iproject or create a dummy iproject?
>
> Thanks for your help in advance.
>

Hi there

I once did that by creating automatically a project in the workspace
(hidden) and then create a file in that project with some specific
contents and then open the Xtext editor on that file.

The scenario was using Xtext editors in the Bpel designer.

That was the solution I found at that time (see this old project
http://code.google.com/a/eclipselabs.org/p/bpel-xtext/).

Since Xtext introduced the embedded xtext editor, I switched to that
solution (embeddable Xtext editors in the bpel designer is going to be
part of the bpel designer, it's already in the git repo of bpel project,
see the discussion here

http://dev.eclipse.org/mhonarc/lists/bpel-dev/msg01550.html

hope this helps
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Previous Topic:Customizing Help Labels
Next Topic:Classes not being resolved when exporting as plugin
Goto Forum:
  


Current Time: Tue Sep 02 07:55:25 EDT 2014

Powered by FUDForum. Page generated in 0.02124 seconds