Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-11588

Open-on of EL from Visual Page Editor works incorrectly

    XMLWordPrintable

    Details

      Description

      Case 1.
      EXECUTE: Write <p>#

      {user.name} works at #{employee.name}</p> in a page, where 'user' is a bean with property 'name'.
      EXECUTE: Find this text in Visual editor and double click against 'name' in the second instance of EL.
      ASSERT: Source of bean 'employee' is open with method getName() selected.
      FAILURE: Source of bean 'user' is open, no method is selected.

      Case 2.
      EXECUTE: <h:outputLabel value="#{user.name}

      " /> in a page. (or h:outputText)
      EXECUTE: Find this text in Visual editor and double click against 'name'.
      ASSERT: Source of bean 'user' is open with method getName() selected.
      FAILURE: Source of bean 'user' is open, but no method is selected.

      Methods DocbookTextTemplate.getSourceRegionForOpenOn() and AbstractEditableJsfTemplate.getSourceRegionForOpenOn() find position for open-on as TextUtil.getStartELDocumentPosition(sourceNode), which finds first occurence of '#

      {' and first non-space symbol after it; the exact position of double click is neglected. The two cases above can be fixed by {code}

      Point selection = pageContext.getSourceBuilder().getSelectionRange();
      if(selection != null)

      { return new Region(selection.x, 0); } {code}

      inserted in the beginning of these methods, because double click in Visual part selects a word, so that selection in source is correct.

      Unfortunately, there are other cases, e.g. <h:inputText value="#

      {user.name}

      "/> (or h:commandButton, h:inputTextArea, etc.). In these cases, double click does not select a word, so that source selection will not be correct. Why? Attribute 'value' that is used for rendering these elements is often bound by EL to a bean property. I suggest that selecting/editing text in 'value' in h:inputText (as well as in all similar cases) be implemented as it is in h:outputText.

        Attachments

          Activity

            People

            Assignee:
            yradtsevich Yahor Radtsevich (Inactive)
            Reporter:
            scabanovich Viacheslav Kabanovich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: