Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Trying to figure out how I was supposed to figure this out
Trying to figure out how I was supposed to figure this out [message #334941] Tue, 10 March 2009 23:13 Go to next message
Eclipse UserFriend
Originally posted by: marc.esher.comcast.net

Greetings all,
I'm really trying to understand "The Eclipse Way". At times, it's quite
easy. At other times, it's maddening. I believe this is because I'm still
learning how to get my head around such a massive API, and also because I
simply don't know yet the patterns/idioms that Eclipse expects me to know
to work easily with it.

Here's something I finally got working after I found a powerpoint
presentation that showed the 3 lines of code I needed. If I hadn't found it,
I'm not sure I would've ever got it working. The two books on Eclipse
programming that I own didn't cover this topic (at least, I couldn't find
it), so they weren't much help. My thing is: I want to know how to do this
stuff myself without relying on Google. I want to learn deep.

I wanted a simple Compare Dialog that showed a diff of two strings. I
created an Input class that extended CompareEditorInput. Within
prepareInput, I created a new DiffNode taking in a left and right instance
of a class that implemented ITypedElement (We'll call this class
"CompareItem"). I created an Action that calls CompareUI.openCompareDialog()
taking in my Input class. This successfully popped up the dialog, but there
was no content in either window.

I actually expected this b/c I couldn't figure out how the content I was
passing into my CompareItem ITypedElement objects was ever getting pulled
back out. So I searched all the javadocs of the seemingly relevant classes,
but I didn't see anything. I spent quite some time on this. Now, understand
that I've never done any Editor programming, just View programming. So
possibly the answer should've been obvious.

Eventually, as I said, I found the answer in a powerpoint given to a
Polish eclipse user group. I needed to have my CompareItem also implement
IStreamContentAccessor and then implement getContents(), returning a
ByteArrayInputStream of the string I was passing into the Item.

My question is this: How can I learn how to find this stuff on my own? I
really want to learn to think like an Eclipse programmer. I want to be able
to sit down and crank out stuff rather than spend hours on a few lines of
code.

thanks for any guidance!

Marc
Re: Trying to figure out how I was supposed to figure this out [message #334942 is a reply to message #334941] Wed, 11 March 2009 05:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: n.n.nnn

On Tue, 10 Mar 2009 19:13:31 -0400, Marc E wrote:

> My question is this: How can I learn how to find this stuff on my
> own? I
> really want to learn to think like an Eclipse programmer. I want to be
> able to sit down and crank out stuff rather than spend hours on a few
> lines of code.

One thing I do (besides a lot of Googling and books) is use Source |
Override/Implement Methods to see what's available. I also review
frequently my plugin.xml Extension Points.

I'd say by posting your article you may solve the problem for
someone else some day and maybe bring some attention to Eclipse
quality control.

It's not always going to be obvious. That happens in proprietary
environments too. Only then the answer is well, tough.

Anyone else?





--
// This is my opinion.
Re: Trying to figure out how I was supposed to figure this out [message #334956 is a reply to message #334941] Wed, 11 March 2009 19:14 Go to previous message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Marc E" <marc.esher@comcast.net> wrote in message
news:gp6s6p$s06$1@build.eclipse.org...
> Greetings all,
> I'm really trying to understand "The Eclipse Way". At times, it's quite
> easy. At other times, it's maddening.

Amen to that. I don't think you'll find much argument there.


>My thing is: I want to know how to do this stuff myself without relying on
>Google. I want to learn deep.

False dichotomy, I think. I'd suggest relying on Google to *find* answers,
and then on study of code to *understand* the answers. (And to verify the
frequently-incorrect advice from Google.)


> My question is this: How can I learn how to find this stuff on my own? I
> really want to learn to think like an Eclipse programmer. I want to be
> able to sit down and crank out stuff rather than spend hours on a few
> lines of code.

Personally I have found it most useful to think "where else in the product
does something like this happen", and then look at the source code for that
plug-in to see how they did it there. This is not always easy. Knowing the
basic extension points makes it somewhat easier to find the implementation
but it is still always a challenge.

I have rarely found that the javadoc alone is enough to tell me how to use
an API, or even which API method to use. I usually end up having to look at
the callers and at the implementation. Fortunately Eclipse makes this not
too hard (e.g., go to PDE perspective, Plug-ins tab, and import a plug-in
project as binary; voila, navigable source code).

It's still pretty hard, though. As you say, it's a huge and constantly
evolving API. Eclipse's principle of avoiding API breakage means that there
are often many ways to do something and some of them are obsolete or less
functional; finding the most-modern way is a challenge.

Feel free to use the newsgroups and IRC liberally, that's what they're there
for (providing that questions are asked in a useful way, as yours was).
Previous Topic:Existing problem markers are not displayed
Next Topic:How to handle changes to workspace outside Eclipse with a Job
Goto Forum:
  


Current Time: Tue Apr 23 08:55:14 GMT 2024

Powered by FUDForum. Page generated in 0.03259 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top