scala-ide / scala-ide-play2

Play 2 support for Scala IDE
107 stars 32 forks source link

twirl library update in play2 plugin #253

Closed wpopielarski closed 9 years ago

wpopielarski commented 9 years ago

Because Play2.4 is using Twirl version 1.1.1 lib to process templates in contrary to Play2.3 which uses Twirl version 1.0.4 there is a need to deliver Twirl functionalities as plugins to Scala IDE Play2 Plugin. So now it is possible to choose a Play version in Play Plugin preference page and then correct Twirl delivers appropriate implementation of template parser and compiler.

Implementation notes:

Usage notes:

ghprb-bot commented 9 years ago

Can one of the admins verify this patch?

kiritsuku commented 9 years ago

add to whitelist

dragos commented 9 years ago

add to whitelist

ghprb-bot commented 9 years ago

Refer to this link for build results (access rights to CI server needed):

https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-play-validator/92/ https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-play-for-ide-master/93/ Test PASSed.

wpopielarski commented 9 years ago

Came to my head that I could make code more dry with structural types. Are you ok with it?

kiritsuku commented 9 years ago

On 09/22/2015 03:45 PM, Wiesław Popielarski wrote:

Came to my head that I could make code more dry with structural types. Are you ok with it?

No, I would like to avoid structural types whenever possible. They have a performance penalty in Scala.

dotta commented 9 years ago

@wpopielarski I haven't forgot about you, but need to wrap up some stuff on the Play side first. I'll have a look at this PR by tomorrow.

kiritsuku commented 9 years ago

Since I don't find much more to criticize I have to criticize that there is only one commit. I can see at least four of them:

wpopielarski commented 9 years ago

Sorry but I was somehow inspired by Mirco's branch which was thought as a general solution. I agree that the listed commits are the most correct. But for the sake of time please leave it as it is because anyway we deliver a complex solution.

dragos commented 9 years ago

@dotta if you're busy, it'd be great even if you just try it out on your use case and see if it solves the problem!

dotta commented 9 years ago

@dragos I'll review it today, promised :-) About trying it out, it should be enough to import a Play project and open a view. No errors should be reported by the presentation compiler. @wpopielarski have you tried?

EDIT: Even better, I think we should have a test for this (I haven't looked at the PR, so maybe it's already the case. But if it isn't, then it'd be good to add one for Play 2.4 and one for 2.3).

wpopielarski commented 9 years ago

yes I tried it

2015-09-25 10:25 GMT+02:00 Mirco Dotta notifications@github.com:

@dragos https://github.com/dragos I'll review it today, promised :-) About trying it out, it should be enough to import a Play project and open a view. No errors should be reported by the presentation compiler. @wpopielarski https://github.com/wpopielarski have you tried?

— Reply to this email directly or view it on GitHub https://github.com/scala-ide/scala-ide-play2/pull/253#issuecomment-143158950 .

kiritsuku commented 9 years ago

I got the following exception when I tried to open a *.scala.html file:

java.util.NoSuchElementException: None.get
    at scala.None$.get(Option.scala:347)
    at scala.None$.get(Option.scala:345)
    at org.scalaide.play2.templateeditor.processing.TemplateProcessingProvider$.templateProcessing(TemplateProcessingProvider.scala:22)
    at org.scalaide.play2.templateeditor.lexical.TemplateParsing$.handleTemplateCode(TemplateParsing.scala:34)
    at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.getScalaCommentAndPlainRegions(TemplatePartitionTokeniser.scala:29)
    at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.tokenise(TemplatePartitionTokeniser.scala:71)
    at org.scalaide.play2.templateeditor.sse.lexical.TemplateTextRegionsComputer.tokens$lzycompute(TemplateRegionParser.scala:97)
    at org.scalaide.play2.templateeditor.sse.lexical.TemplateTextRegionsComputer.tokens(TemplateRegionParser.scala:95)
    at org.scalaide.play2.templateeditor.sse.lexical.TemplateTextRegionsComputer.<init>(TemplateRegionParser.scala:127)
    at org.scalaide.play2.templateeditor.sse.lexical.TemplateRegionParser.reset(TemplateRegionParser.scala:83)
    at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.resetParser(BasicStructuredDocument.java:2433)
    at org.eclipse.wst.sse.core.internal.text.StructuredDocumentReParser._core_reparse_text(StructuredDocumentReParser.java:354)
    at org.eclipse.wst.sse.core.internal.text.StructuredDocumentReParser.core_reparse(StructuredDocumentReParser.java:752)
    at org.eclipse.wst.sse.core.internal.text.StructuredDocumentReParser.reparse(StructuredDocumentReParser.java:1401)
    at org.eclipse.wst.sse.core.internal.text.StructuredDocumentReParser.reparse(StructuredDocumentReParser.java:1333)
    at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.updateModel(BasicStructuredDocument.java:2713)
    at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1923)
    at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2423)
    at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.set(BasicStructuredDocument.java:2935)
    at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.setDocumentContent(ResourceTextFileBuffer.java:580)
    at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.initializeFileBufferContent(ResourceTextFileBuffer.java:288)
    at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.create(ResourceFileBuffer.java:247)
    at org.eclipse.core.internal.filebuffers.TextFileBufferManager.connect(TextFileBufferManager.java:112)
    at org.eclipse.ui.editors.text.TextFileDocumentProvider.createFileInfo(TextFileDocumentProvider.java:559)
    at org.eclipse.ui.editors.text.TextFileDocumentProvider.connect(TextFileDocumentProvider.java:478)
    at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4233)
    at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:237)
    at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1480)
    at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor.java:169)
    at org.eclipse.wst.sse.ui.StructuredTextEditor.doSetInput(StructuredTextEditor.java:1943)
    at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(AbstractTextEditor.java:3220)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:466)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:374)
    at org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:2157)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2153)
    at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3238)
    at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3265)
    at org.eclipse.wst.sse.ui.StructuredTextEditor.init(StructuredTextEditor.java:2620)
    at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:390)
    at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:305)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:888)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:869)
    at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:120)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:337)
    at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:258)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:104)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:73)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:55)
    at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:127)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:983)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:662)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:766)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:737)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:731)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:715)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:95)
    at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:187)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:156)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:4590)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:218)
    at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36)
    at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
    at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
    at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
    at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
    at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
    at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:59)
    at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
    at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
    at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:488)
    at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:454)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:705)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:392)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1145)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3210)
    at org.eclipse.ui.internal.WorkbenchPage.access$23(WorkbenchPage.java:3125)
    at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:3107)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3102)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3066)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3056)
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:541)
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:500)
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:360)
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:167)
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:268)
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:233)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
    at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376)
    at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:538)
    at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
    at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:853)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
    at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:850)
    at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1142)
    at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1249)
    at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:278)
    at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:272)
    at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:313)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4454)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3409)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
dotta commented 9 years ago

@wpopielarski I know it's mentioned in the PR's description, but I don't understand why the duplication is necessary. Template24Compiler and Template23Compiler seem to be exactly the same, and I don't see why you need two identical implementations of GeneratedSource (i.e., Template23GeneratedSource and Template24GeneratedSource). What am I missing? :-)

dotta commented 9 years ago

there is one global setting for Play version. So if user wants to work on projects of more than one Play version it is recommended to do it in different workspaces. The bottleneck is Twirl parser to which is quite hard to pass the project settings (in future cosider thread local?)

As a user, I would find this limitation quite annoying. Can you elaborate more on what is the problem with configuring Twirl (maybe we can fix it). The Play version should really be a project config setting, and not a global one.

kiritsuku commented 9 years ago

On 09/25/2015 11:12 AM, Mirco Dotta wrote:

@wpopielarski https://github.com/wpopielarski I know it's mentioned in the PR's description, but I don't understand why the duplication is necessary. |Template24Compiler| and |Template23Compiler| seem to be exactly the same, and I don't see why you need two identical implementations of |GeneratedSource| (i.e., |Template23GeneratedSource| and |Template24GeneratedSource|). What am I missing? :-)

I guess it is because the plugin.xml is different. Nevertheless, we could get away with one project as far as I see it when we generate the plugin.xml with maven. One can put the plugin.xml in a resource directory and then during the build let maven copy it to the root directory and modify the contents in the necessary way. We do such a thing already in scala-ide but I wonder if it would simplify anything in this case.

wpopielarski commented 9 years ago

@sshaef, two potential causes: the play version not set or bundle not found

dotta commented 9 years ago

I guess it is because the plugin.xml is different.

To me they don't really look different. But even if they are, I'm confident we can still extract the common bits and reuse it in the two implementations, and hence avoid code duplication.

The only difference I can spot between the two implementations is in the POM, where one declares a dependency on twirl 1.0.4, and the other on 1.1.1.

wpopielarski commented 9 years ago

@dotta

  1. duplication is made because there is not common model exposed by Twirl. So I cannot create 'common' code compiled in separate project and just two other which set appropriate Twirl lib version. I thought about structural types but @sschaef opposed it. Maybe there is other way to solve it.
  2. As I wrote in commit description. It's quite hard to pass current project to Twirl parser when it is run from editor. I asked about thread local to convey it but not sure.

EDIT: saying 'editor' I mean exactly call flow shown by Simon, thanks S :) EDIT2: exactly, the difference is in twirl libs in pom right now. I tried to isolate play2 bundle from model/types coming from twirl EDIT3: guys just a question, that what I did is correct in assumption?

wpopielarski commented 9 years ago

@sschaef you scared me with exception, still problems?

kiritsuku commented 9 years ago

On 09/25/2015 11:24 AM, Wiesław Popielarski wrote:

@sshaef, two potential causes: the play version not set or bundle not found

The play version that is shown in the project preferences is 2.4. The bundle org.scala-ide.play2_0.5.0.qualifier is marked as active.

wpopielarski commented 9 years ago

@sschaef and you have installed template24 bundle too? Plugin name is "Twirl Templates for Play 2.4"

kiritsuku commented 9 years ago

No, I didn't. It now works, thanks. Instead of calling get it would be good if a better error message is shown even though it is unlikely that users will ever see it.

kiritsuku commented 9 years ago

The templates bundle should have version 0.5.0, the same as the other bundles.

wpopielarski commented 9 years ago

@sschaef cool, going to add more meaningful text to exception, also line up versions but on other hand these bundle can lead their own life @dotta is my explanation clear?

dotta commented 9 years ago

@wpopielarski Yep, explanation clear, and I definitely see your point now. I also see that using structural types wouldn't really help in general, so let's forget about them.

I'm truly battled. On the one hand, I'd like to say that we could generate the two projects at build time, starting from a common template (there must be a maven template for doing it). On the other hand, we risk that if in the future something changes in the play-twirl implementation, we will need to go back to your current solution and duplicate the code.

ghprb-bot commented 9 years ago

Refer to this link for build results (access rights to CI server needed):

https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-play-validator/93/ https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-play-for-ide-master/94/ Test PASSed.

dotta commented 9 years ago

@wpopielarski I've built your branch locally and wanted to install the play-eclipse support, but I can't find an update-site that contains the templates extension. Where are they?

wpopielarski commented 9 years ago

Well, I don't know how to expose plugins as update site... I just run eclipse from eclipse. let me check it

2015-09-25 15:30 GMT+02:00 Mirco Dotta notifications@github.com:

@wpopielarski https://github.com/wpopielarski I've built your branch locally and wanted to install the play-eclipse support, but I can't find an update-site that contains the templates extension. Where are they?

— Reply to this email directly or view it on GitHub https://github.com/scala-ide/scala-ide-play2/pull/253#issuecomment-143223575 .

wpopielarski commented 9 years ago

ok, I added them to features. Again please take my apologies.

2015-09-25 15:50 GMT+02:00 Wieslaw Popielarski wpopielarski@gmail.com:

Well, I don't know how to expose plugins as update site... I just run eclipse from eclipse. let me check it

2015-09-25 15:30 GMT+02:00 Mirco Dotta notifications@github.com:

@wpopielarski https://github.com/wpopielarski I've built your branch locally and wanted to install the play-eclipse support, but I can't find an update-site that contains the templates extension. Where are they?

— Reply to this email directly or view it on GitHub https://github.com/scala-ide/scala-ide-play2/pull/253#issuecomment-143223575 .

wpopielarski commented 9 years ago

Guys, take it and check it please

kiritsuku commented 9 years ago

I tried to access Play > Template > Syntax Coloring but got the following error:

2015-09-30 19:08:24,560 DEBUG [main] - System.out - java.lang.IllegalStateException: Cannot find template processing for Play version: version not found.
    at org.scalaide.play2.templateeditor.processing.TemplateProcessingProvider$.templateProcessing(TemplateProcessingProvider.scala:23)
    at org.scalaide.play2.templateeditor.lexical.TemplateParsing$.handleTemplateCode(TemplateParsing.scala:34)
    at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.getScalaCommentAndPlainRegions(TemplatePartitionTokeniser.scala:29)
    at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.tokenise(TemplatePartitionTokeniser.scala:71)
    at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.tokenise(TemplatePartitionTokeniser.scala:65)
    at org.scalaide.play2.lexical.PlayDocumentPartitioner.connect(PlayDocumentPartitioner.scala:17)
    at org.eclipse.jface.text.TextUtilities.addDocumentPartitioners(TextUtilities.java:348)
    at org.scalaide.ui.internal.preferences.PreviewerFactory.createPreviewer(PreviewerFactory.scala:43)
    at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createPreviewer(BaseSyntaxColoringPreferencePage.scala:282)
    at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createSyntaxPage(BaseSyntaxColoringPreferencePage.scala:228)
    at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createContents(BaseSyntaxColoringPreferencePage.scala:79)
    at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:233)
    at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1537)
    at org.eclipse.jface.preference.PreferenceDialog$13.run(PreferenceDialog.java:1289)
wpopielarski commented 9 years ago

good to know it, editors in eclipse are the nightmare. Looks like in many places the public API is not used but specific implementations.

EDIT: sorry for my ignorance. This is ok so no need to blame eclipse. Unfortunately it works for me. I'm trying to reproduce it. Generally how I see it, this part is NOT related with any project so there is NO configuration for parser in this very editor. So I don't know. Maybe the DEFAULT one could be used? Is it ok Mirco?

EDIT2: reproduced. Funny thing, it works when you previously open any template. Then its version is kept in thread local and Play syntax coloring is using this settings (I don't clean the thread local). I'm not sure but seems to be a bigger feature. So my advice is to keep global settings of Play Version. Mirco should decide.

EDIT3: Meantime I fix this gap with DEFAULT if version not found

2015-09-30 19:09 GMT+02:00 Simon Schäfer notifications@github.com:

I tried to access Play > Template > Syntax Coloring but got the following error:

2015-09-30 19:08:24,560 DEBUG [main] - System.out - java.lang.IllegalStateException: Cannot find template processing for Play version: version not found. at org.scalaide.play2.templateeditor.processing.TemplateProcessingProvider$.templateProcessing(TemplateProcessingProvider.scala:23) at org.scalaide.play2.templateeditor.lexical.TemplateParsing$.handleTemplateCode(TemplateParsing.scala:34) at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.getScalaCommentAndPlainRegions(TemplatePartitionTokeniser.scala:29) at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.tokenise(TemplatePartitionTokeniser.scala:71) at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.tokenise(TemplatePartitionTokeniser.scala:65) at org.scalaide.play2.lexical.PlayDocumentPartitioner.connect(PlayDocumentPartitioner.scala:17) at org.eclipse.jface.text.TextUtilities.addDocumentPartitioners(TextUtilities.java:348) at org.scalaide.ui.internal.preferences.PreviewerFactory.createPreviewer(PreviewerFactory.scala:43) at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createPreviewer(BaseSyntaxColoringPreferencePage.scala:282) at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createSyntaxPage(BaseSyntaxColoringPreferencePage.scala:228) at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createContents(BaseSyntaxColoringPreferencePage.scala:79) at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:233) at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1537) at org.eclipse.jface.preference.PreferenceDialog$13.run(PreferenceDialog.java:1289)

— Reply to this email directly or view it on GitHub https://github.com/scala-ide/scala-ide-play2/pull/253#issuecomment-144479324 .

ghprb-bot commented 9 years ago

Refer to this link for build results (access rights to CI server needed):

https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-play-validator/97/ https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-play-for-ide-master/98/ Test PASSed.

kiritsuku commented 9 years ago

@dotta Do you have the time to have another look at this?

dotta commented 9 years ago

Hard at the moment, sorry guys, but I won't be able to look at it any time soon. If you are happy with it, it's more important to push it out so that users can profit. If something isn't good from a functional perspective, they will tell you.

dragos commented 9 years ago

Ok, let's merge it. Please don't forget to bump the version number to 0.5.1

dotta commented 9 years ago

@dragos Handy PR for bumping the version number https://github.com/scala-ide/scala-ide-play2/pull/255

By the way, I'm locally building the PR and will give it a try since I need to work on a Play 2.4 project. But don't wait for me, go ahead, and if I spot any problem I'll open a ticket.

kiritsuku commented 9 years ago

The preferences still do not work for me. I get:

2015-10-10 23:33:13,837 DEBUG [main] - System.out - java.lang.IllegalStateException: Cannot find template processing for Play version: 2.4.
    at org.scalaide.play2.templateeditor.processing.TemplateProcessingProvider$.templateProcessing(TemplateProcessingProvider.scala:28)
    at org.scalaide.play2.templateeditor.lexical.TemplateParsing$.handleTemplateCode(TemplateParsing.scala:34)
    at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.getScalaCommentAndPlainRegions(TemplatePartitionTokeniser.scala:29)
    at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.tokenise(TemplatePartitionTokeniser.scala:71)
    at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.tokenise(TemplatePartitionTokeniser.scala:65)
    at org.scalaide.play2.lexical.PlayDocumentPartitioner.connect(PlayDocumentPartitioner.scala:17)
    at org.eclipse.jface.text.TextUtilities.addDocumentPartitioners(TextUtilities.java:348)
    at org.scalaide.ui.internal.preferences.PreviewerFactory.createPreviewer(PreviewerFactory.scala:43)
    at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createPreviewer(BaseSyntaxColoringPreferencePage.scala:282)
    at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createSyntaxPage(BaseSyntaxColoringPreferencePage.scala:228)
    at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createContents(BaseSyntaxColoringPreferencePage.scala:79)
    at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:233)
    at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1537)
wpopielarski commented 9 years ago

check please if you have installed template plugins. Tbh they should be found with update site.

2015-10-10 23:34 GMT+02:00 Simon Schäfer notifications@github.com:

The preferences still do not work for me. I get:

2015-10-10 23:33:13,837 DEBUG [main] - System.out - java.lang.IllegalStateException: Cannot find template processing for Play version: 2.4. at org.scalaide.play2.templateeditor.processing.TemplateProcessingProvider$.templateProcessing(TemplateProcessingProvider.scala:28) at org.scalaide.play2.templateeditor.lexical.TemplateParsing$.handleTemplateCode(TemplateParsing.scala:34) at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.getScalaCommentAndPlainRegions(TemplatePartitionTokeniser.scala:29) at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.tokenise(TemplatePartitionTokeniser.scala:71) at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.tokenise(TemplatePartitionTokeniser.scala:65) at org.scalaide.play2.lexical.PlayDocumentPartitioner.connect(PlayDocumentPartitioner.scala:17) at org.eclipse.jface.text.TextUtilities.addDocumentPartitioners(TextUtilities.java:348) at org.scalaide.ui.internal.preferences.PreviewerFactory.createPreviewer(PreviewerFactory.scala:43) at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createPreviewer(BaseSyntaxColoringPreferencePage.scala:282) at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createSyntaxPage(BaseSyntaxColoringPreferencePage.scala:228) at org.scalaide.ui.syntax.preferences.BaseSyntaxColoringPreferencePage.createContents(BaseSyntaxColoringPreferencePage.scala:79) at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:233) at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1537)

— Reply to this email directly or view it on GitHub https://github.com/scala-ide/scala-ide-play2/pull/253#issuecomment-147127417 .

kiritsuku commented 9 years ago

Ok, LGTM now. I only introduced merge errors. Would you please fix them and update the versions for the newly introduced projects to 0.5.1?

wpopielarski commented 9 years ago

no worries

2015-10-11 22:15 GMT+02:00 Simon Schäfer notifications@github.com:

Ok, LGTM now. I only introduced merge errors. Would you please fix them and update the versions for the newly introduced projects to 0.5.1?

— Reply to this email directly or view it on GitHub https://github.com/scala-ide/scala-ide-play2/pull/253#issuecomment-147241794 .

ghprb-bot commented 9 years ago

Refer to this link for build results (access rights to CI server needed):

https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-play-validator/99/ https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-play-for-ide-master/100/ Test PASSed.