| Summary: | API to know how much space editor needs to display whole file | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Szymon Brandys <Szymon.Brandys> | ||||
| Component: | Git | Assignee: | libing wang <libingw> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | libingw, Silenio_Quarti | ||||
| Version: | 0.2 | ||||||
| Target Milestone: | 0.5 M2 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Szymon Brandys
Created attachment 214532 [details]
Illustration
API already exists: textView.computeSize() Note that calling this API on a large file is very slow because it has to render HTML and measure all the lines. If you just care about the height of the widget, it might be ok to do something like this: textView.getLineHeight() * Math.min(some maximum number of lines, text.getModel().getLineCount()) I think it will be chicken-egg issue if you want to know it before you create the widget. Szymon, I think you can always create the compare widget by passing a DIV with minimal height. So in the callback when widget is loaded(currently the function where you create the next widget), I will pass the height(in pixel) required to the callback. You decide how tall the parent DIV should be and resize it before you create the next one. Make sense? Makes sense. So the callback will pass a result param or something like that, right? (In reply to comment #4) > Makes sense. So the callback will pass a result param or something like that, > right? Right. And I think all the embedded compare widget in a section need this to save space. There is already a callback in CompareContainer.startup(callback) used in gitCommitExplorer. I will pass an object back to the callback function. The object will only contain .widgetMaxHeight property for now but we can add more properties later. fixed with http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=a5d666db07c8142944becf9aae8506cb256721d8. Applied the parameter to both commit and status pages. |