• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Resource associated with Eclipse editor?

 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,
This is about my 250th post, but it's the first one where I'm asking rather than answering, so go easy on me
I'm feeling my way through learning Eclipse plug-in development; right now I'm working on a custom editor based on the TextEditor class. I've got most of the standard stuff working (syntax hilighting, content assist, etc, everything they show you how to do in the usual pile of books) but I'm stuck on what I'm sure is a lame thing to be stuck on: markers. I want to add problem markers to the document, and this seems to require that I get ahold of the IResource object corresponding to the document being edited. I'm stuck because I can't figure out how to get this reference -- can anybody tell me? Thanks for any info.
 
Dastardly Dan the Author
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Among my co-authors, Scott knows JFace Text the best and Pat knows the ins-and-outs of Markers. But I'll hazard a guess and suggest that EditorPart.getEditorInput() will get you there. You cast the result to IFileEditorInput and you've got an IFile. Of course, this assumes you have ready access to the editor itself.
-- Dan
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Dan, that sounds good to me. Eclipse is really a great framework, although it's taking me some time to get my bearings.
 
Dan Kehn
Dastardly Dan the Author
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good! BTW, you mentioned your "usual pile of books." Let me shamelessly assert that our book will help you get where you want to go a lot faster. Here's a reader's review from amazon.com:


I've been developing Eclipse plug-ins commercially for over a year. Previously, I had to teach myself by reading and/or searching:
1) Articles on Eclipse.org
2) The online help
3) The newsgroup
4) The source code to Eclipse itself
--not necessarily in that order.
Now I just turn to this book. It almost always answers my questions quickly and succinctly. Even with over a year of Eclipse background gained by teaching myself, I continually feel amazed at how quickly and how much this book has increased the depth of my understanding about how to write Eclipse plug-ins.
It is obvious when reading this book that (as professional teachers/trainers) the authors of this book have already taught this information many times and know what tends to trip people up. Their writing style flows with the ease of great familiarity with and confidence about their material. And their code examples work.


Scott, who authored the JFace Text chapter, plans to address the markers / editor relationship in the next edition. It currently does require the reader to "connect the dots" between the Editor, Markers, and JFace Text chapters. This is common enough a requirement to justify an explicit mention.
-- Dan
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wanted to chime in and say that Dan is right. Your specific question is covered in detail in the book that Dan co-wrote. Go pick it up and support the authors :-)
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
My "pile" consists of "Eclipse in Action" along with Dan's book. I read "Action" first, and I've been using "Java Developer's Guide" sort of as a reference book to fill in what "Action" leaves out.
Chapter 17 talks about markers, but always refers to a variable named "resource" pulled out of thin air, and my question concerned where this might come from. Chapter 15 is all about resources, and walking around the workspace, but then my problem would reduce to getting the filename or path in the workspace, so I could walk around and find the IFile, so that still doesn't help. Chapter 27 talks about the JFace text editor, but I don't see any mention of EditorInputs.... OK, now that I know what I'm looking for, I found it in chapter 13, "Editors." You're right, it is in there, page 353.
Apparently, I need to sit down and read the whole book straight through. Who'd have thunk?
 
Dan Kehn
Dastardly Dan the Author
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Michael Crutcher:
Just wanted to chime in and say that Dan is right. Your specific question is covered in detail in the book that Dan co-wrote.


*Blush* In all fairness, a bit of mental glue is required to get from where Ernest started to where he wants to end. Scott had already mentioned this as a follow-on edition topic (i.e., the relationship between annotations, markers, and JFace Text-based editors).
BTW, Ernest, congratulations on your book, Jess in Action! I read the introduction and it sounds very interesting. It's a topic that has made its way into a number of WebSphere presentations (e.g., custom portals) but always struck me as a bit too abstract to keep my attention. I like how your book uses an example-based approach -- and they look like good examples, not foo-ware. I'll give it a closer look next time I'm at the bookstore.

Go pick it up and support the authors :-)


Thanks Michael for your review on Amazon. One of the reasons that authors hang out on JavaRanch is to encourage their readers to do a little rah rah for their books. And of course to find out what needs to be in the next edition.
-- Dan
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Dan Kehn:

BTW, Ernest, congratulations on your book, Jess in Action!
-- Dan


Thanks! There really were no sizeable, realistic rule-based programming examples available from anywhere, and this was the motivation for this book.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!