Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344652 - [EditorMgmt] Editors should be able to treat large files specially (e.g. deny opening huge files)
Summary: [EditorMgmt] Editors should be able to treat large files specially (e.g. deny...
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.5.2+   Edit
Assignee: Prakash Rangaraj CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 117746 344031
Blocks: 344653 344654
  Show dependency tree
 
Reported: 2011-05-04 00:30 EDT by Prakash Rangaraj CLA
Modified: 2014-08-27 06:17 EDT (History)
12 users (show)

See Also:
prakash: review?


Attachments
Patch v01 (12.75 KB, patch)
2011-05-04 04:46 EDT, Prakash Rangaraj CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Prakash Rangaraj CLA 2011-05-04 00:30:23 EDT
+++ This bug was initially created as a clone of Bug #344031 +++

+++ This bug was initially created as a clone of Bug #117746 +++

Loading large files in an editor needs a lot of memory (up to 5 times the file size, see Bugzilla 75086), so the Workbench can run into an OutOfMemory error or freeze for some time while an editor is busy loading a file.

Since users do not see in the Resource navigator how large a file is, it can easily happen that one tries to open a very large file by accident. We have auto-generated log files which range from 1 to 400 MB in size. The smaller ones we want to open in Eclipse Workbench, the larger ones we open in an external editor. Trying to opening a 400MB file in the Workbench by accident leads to an OutOfMemoryError and destabilizes the workbench or even makes it unusable for some time.

It should be possible to define a maximum file size (in the Preferences, in plugin.xml or by computing available heap size) up to which an editor editor can open a file directly. If the user tries to open a file that exceeds the given size, the user should be shown a dialog which allows to
  * Open the file in spite of the warning
  * Open the file in an alternative (external) editor instead
  * Cancel the edit request

Perhaps the best solution would be to extend the Editor API such that an editor is given the file path to be opened BEFORE it is actually opened. Thereby, each editor implementor could have policies for allowing or denying the open request.
Policies for denying could be based on file size, virtual vs. real file system [See Bugzilla 106176], file content...) In case an edit request is denied, the Platform could show a dialog like

  "Editor FooBar has denied opening 'yourFile.xxx' with the following message:
   (Custom Message e.g. File is 50MB large)
   Do you want to
     * Open the file in (Dropdown of registered editors for xxx files) instead
     * Open the file in spite of the warning
     * Cancel
  "
Comment 1 Prakash Rangaraj CLA 2011-05-04 04:46:14 EDT
Created attachment 194676 [details]
Patch v01

Patch v01 for R3_5_maintenance branch
Comment 2 Dani Megert CLA 2011-06-06 09:22:29 EDT
Prakash, can you please finish this, so that we have the right fix in all streams? Thanks.
Comment 3 Martin Oberhuber CLA 2014-08-27 04:28:38 EDT
Ping, what is the status of this ?
Comment 4 Dani Megert CLA 2014-08-27 06:17:56 EDT
Nothing will be done for 3.5.2+ at this point. For 4.x see bug 117746.