[MGNLUI-3433] Resolve AceEditor mode automatically for syntax highlighting. Created: 20/May/15  Updated: 02/Jun/15  Resolved: 20/May/15

Status: Closed
Project: Magnolia UI
Component/s: forms
Affects Version/s: None
Fix Version/s: 5.4

Type: Improvement Priority: Neutral
Reporter: Ilgun Ilgun Assignee: Ilgun Ilgun
Resolution: Fixed Votes: 0
Labels: ace, resources-app
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Currently we have to define mappings (e.g. in the old resources app) for identifying AceEditor mode.
This ticket aims to detect it automatically in BasicTextCodeFieldFactory, based on the file extension.

For this feature to be usable in various apps, we assume the Vaadin Item has to provide the file name as one of its properties—which name may vary, e.g.:

  • JcrNodeAdapter provides it as "jcrName"
  • new resources app is currently using BeanItem<ResourcePath>, hence providing file name as its "name" property.


 Comments   
Comment by Ilgun Ilgun [ 20/May/15 ]

Changes can be found in branch

MGNLUI-3433-automated-AceMode-Detection

Comment by Mikaël Geljić [ 21/May/15 ]
  1. Noise with <p/> tags introduced in various comments—that bug in intellij Greg told you about this morning
    • FYI this would break the build because checkstyle checks for these license headers
  2. Let's get rid of those string isBlank checks in the definition, keep it simple/stupid
  3. Static imports
    • we definitely do not want that on MgnlContext; context is used in static ways all around the place (should be injected), so whenever it's used, we want to see it straight
    • for the others, I don't mind so much
    • if you want them on existing code in the future, it's a good practice to do that in a separate first commit.
  4. fileNameProperty, let's have proper camel case (mind the capital 'N')
  5. in test, use ModelConstants.JCR_NAME, no need to redefine constant here
  6. Meanwhile I'll add javadoc for the definition's new method, and take a closer look at the test

Big list, but it's ok, only minor things

Comment by Ilgun Ilgun [ 21/May/15 ]

Made necessary changes and pushed to same branch.

Generated at Mon Feb 12 09:06:34 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.