[jbosstools-issues] [JBoss JIRA] (JBIDE-12052) Selection of Source and Visual pane is not properly synchronized, StringIndexOutOfBoundsException

Denis Maliarevich (JIRA) jira-events at lists.jboss.org
Wed Jun 6 08:27:18 EDT 2012


    [ https://issues.jboss.org/browse/JBIDE-12052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12699334#comment-12699334 ] 

Denis Maliarevich commented on JBIDE-12052:
-------------------------------------------

Some details about selection functionality:

1. Text is the source part can contain some whitespaces (tabs, spaces, CR, etc.) Viusal part trims that and displays only visible text. So when you select any whitespaces in the source -- visual part won't show anything until you select the text after whitespaces.

2. Thus in visual part you can select only visible text.

3. While displaying selection for the text from message bundles (through EL like "#{Message.header}") -- there is a mismatch between text length in the source and visual representation. 
3A. For instance EL #{Message.header} in JSF kickstart project stands for "Hello Demo Application" text. The text is longer than EL. So the maximum selection lenght will equal the length of the shortest text among EL and its bundle's value.
3B. Thus because of length mismatch when bundle value is selected in the visual part -- the whole EL in the source will be selected.

4. Possible the current selection synchronization mechanism could be improved. But it's the metter of new ideas and issues.

To sum up, 
I think that the issue's clause about "Not proper synchronization of Source and Visual pane and StringIndexOutOfBoundsException" could be considered as resolved.


                
> Selection of Source and Visual pane is not properly synchronized, StringIndexOutOfBoundsException
> -------------------------------------------------------------------------------------------------
>
>                 Key: JBIDE-12052
>                 URL: https://issues.jboss.org/browse/JBIDE-12052
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: Visual Page Editor core
>    Affects Versions: 3.3.0.CR1
>         Environment: jbdevstudio-product-linux-gtk-5.0.0.v201205272317M-H143-CR1.
>            Reporter: Vlado Pakan
>            Assignee: Denis Maliarevich
>            Priority: Critical
>             Fix For: 3.3.0.CR1
>
>         Attachments: 12052a.patch, 12052vissel.png, selectionerror.ogg
>
>
> 1. Create JSF 1.2 Kickstart project
> 2. Open inputUserName.jsp.
> 3. Insert some plain text within <f:view> tag
> 4. Select part of this text in Source pane using mouse or Shift+Arrow
> ASSERT: Selection is reflected in Visual pane
> 5. Select part of this text in Visual pane using Shift+Arrow (both Lext and Right)
> ASSERT: Selection is reflected in Source pane
> 6. Select part of this text in Source pane using mouse or Shift+Arrow
> ERROR: Selection is not reflected in Visual pane
> 7. Select part of text "#{Message.header}" with mouse or Shift+Arrow
> ERROR: Lot of these error messages are displayed:
> java.lang.StringIndexOutOfBoundsException: String index out of range: -309
> 	at java.lang.String.substring(String.java:1937)
> 	at org.jboss.tools.vpe.editor.util.TextUtil.visualPosition(TextUtil.java:361)
> 	at org.jboss.tools.vpe.editor.template.SelectionManager.restoreVisualCursorPosition(SelectionManager.java:370)
> 	at org.jboss.tools.vpe.editor.template.SelectionManager.refreshVisualTextSelection(SelectionManager.java:251)
> 	at org.jboss.tools.vpe.editor.template.SelectionManager.refreshVisualSelection(SelectionManager.java:176)
> 	at org.jboss.tools.vpe.editor.VpeController.sourceSelectionChanged(VpeController.java:830)
> 	at org.jboss.tools.vpe.editor.VpeController$VPEUpdateJob.runInUIThread(VpeController.java:1271)
> 	at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
> 	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> 	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
> 	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
> 	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
> 	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
> 	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
> 	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
> 	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> 	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
> 	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> 	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
> 	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.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(EclipseStarter.java:344)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list