1

In Eclipse CDT at DefaultBinaryFileEditor class, in the method getStorage there is a comment that tells the line objdump.getOutput(limitBytes) is a UI blocking call...

How can I make it run in background without UI Blocking to process longer files than it is stated with parameter int limitBytes = 6*1024*1024;

I can access org.eclipse.cdt.utils.Objdump class' getOutput method via plugin.xml extension point "org.eclipse.cdt.core.BinaryParser"...

I tried to replace the class that is used in extension point "org.eclipse.ui.editors" in editor tag with id "org.eclipse.cdt.ui.binaryEditor" via my plugin.xml, but this did not worked.

  • I added org.eclipse.ui to dependencies of my plugin's manifest file and then added extension point org.eclipse.ui.editors as in org.eclipse.cdt.ui plugins plugin.xml file. I created an editor with same id as in Default Binary File Editor and I set the default to false like in Default Binary File Editor. I did not fill in the icon value. Finally I set my own class which is copy paste and some modification of DefaultBinaryFileEditor.java class. w – ilke Muhtaroglu Oct 03 '18 at 10:50
  • Now I need to figure out how to accomplish non ui blocking run with this custom class...(This is a generic way to override an extension of eclipse.) – ilke Muhtaroglu Oct 03 '18 at 10:58
  • In method getStorage of BinaryFileEditorInput inner class of DefaultBinaryFileEditor, I wrote a job. In this job, I get the content of elf file and call refresh method of outer class DefaultBinaryFileEditor. But this makes a infinite recursion of calling getStorage method. How can I break this recursion ? How should I put the content of FileStorage to Binary File Editor ? – ilke Muhtaroglu Oct 03 '18 at 13:36

1 Answers1

0

I put a boolean flag to outer class and in inner class BinaryFileEditorInput in method getStorage I put a Job and before this job works I created an empty fStorage = new FileStorage. I return this empty fstorage. So first the editor gets blank. Then when the objdump.getOutput(limitBytes) method returns in job, I set the fStorage to the returned output. I simply call the outer class'es refresh method. I put a reference of created outer class to inner static class in outerclasses constructor. This way I can access the refresh method. Also I moved fStorage varible to outerclass because refresh method triggers creating a new inner class so it overrides the valuable fStorage variable.

Finally If you want to update the opened elf file editor when you build the project again, assign the boolean variable and fStorage to first values in method resourceChanged before calling refresh method.