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

Insertion of JS/CSS from Mobile palette breaks editor content presentation

XMLWordPrintable

      1. Create an html file without <head> node but with <html> node

      <!DOCTYPE html>
      <html>
      
      </html>
      

      2. Call js/css item on jQuery Mobile palette.
      3. Click to different lines in the editor.
      FAILURE: Sometimes lines are presented broken.
      Exceptions may be thrown:

      !ENTRY org.eclipse.ui 4 0 2013-12-10 12:03:44.753
      !MESSAGE Unhandled event loop exception
      !STACK 0
      org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalStateException: startLine (9) does not match endLine (10))
      	at org.eclipse.swt.SWT.error(SWT.java:4397)
      	at org.eclipse.swt.SWT.error(SWT.java:4312)
      	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
      	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3717)
      	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3366)
      	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
      	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
      	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
      	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
      	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
      	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
      	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
      	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:354)
      	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
      	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:636)
      	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
      	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
      	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
      Caused by: java.lang.IllegalStateException: startLine (9) does not match endLine (10)
      	at org.eclipse.jface.text.projection.ProjectionMapping.toImageLine(ProjectionMapping.java:480)
      	at org.eclipse.jface.text.TextViewer.modelLine2WidgetLine(TextViewer.java:5306)
      	at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.modelLine2WidgetLine(StructuredTextViewer.java:807)
      	at org.eclipse.jface.text.JFaceTextUtil.modelLineToWidgetLine(JFaceTextUtil.java:224)
      	at org.eclipse.jface.internal.text.source.DiffPainter.paintLine(DiffPainter.java:220)
      	at org.eclipse.jface.internal.text.source.DiffPainter.paint(DiffPainter.java:158)
      	at org.eclipse.jface.text.source.LineNumberChangeRulerColumn.doPaint(LineNumberChangeRulerColumn.java:191)
      	at org.eclipse.jface.text.source.LineNumberRulerColumn.doubleBufferPaint(LineNumberRulerColumn.java:703)
      	at org.eclipse.jface.text.source.LineNumberRulerColumn.redraw(LineNumberRulerColumn.java:859)
      	at org.eclipse.jface.internal.text.source.DiffPainter.redraw(DiffPainter.java:382)
      	at org.eclipse.jface.internal.text.source.DiffPainter.access$2(DiffPainter.java:381)
      	at org.eclipse.jface.internal.text.source.DiffPainter$2.run(DiffPainter.java:371)
      	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
      	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
      	... 24 more
      

      4. Close/Reopen editor. Text looks ok.
      It seems that text is inserted correctly, but it broke the projection document.

      If <head> node is present, or if the file has no nodes, then the insertion is done smoothly.

      Tests pass, but they only check the content and cannot find a problem in the presentation model.

      It seemed to me that this feature worked ok previously, and file MobilePaletteInsertHelper had no major modifications. (Resolved issue JBIDE-15111 indirectly supports that it must have been ok.) Maybe this is only a local problem in my environment.

            dazarov_jira Daniel Azarov (Inactive)
            scabanovich Viacheslav Kabanovich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: