how to use Components?
Hey all,
I'm a complete newbie to the IDEA product, and I'm not having much luck
understanding the basic structure of Components and how they are used. If
anyone could give me a brief explanation or even better if there's any
documentation on it hidden away somewhere I'd appreciate the help greatly. I
haven't been had much luck in finding any documentation though...
I'm writing a VCS plug-in for IDEA and am not really sure what does what.
1. I have a class "MyVcs" that extends AbstractVcs and implements
ProjectComponent. So, this class maps directly to a specific Project right?
And once I've setup the VCS stuff for a project, I can use the VcsManager to
get the actual object for a given project right? Does initComponent only get
called once when IDEA loads my plugin, or is it called for each object (like
a ctor)?
2. I have a second class "MyProjectConfig" that implements the
ProjectComponent and JDOMExternalizable interface which is what I use to
save my VCS settings from the Project Properties dialog right?
3. What does the Project.getComponent() method do for me? I guess I would
want it to return the object instance for a given class that I associated
with the project. So, for example... I have one ctor in my "MyVcs" class
that takes a project. Once that's been created, can I call
project.getComponent(MyVcs.class) from anywhere and it will return me that
specific MyVcs object? Can I do the same with the MyProjectConfig class?
4. When does all this component stuff get created? Does IDEA handle creating
it when I open a project in the IDE?
Well, that's what's been bugging me so far.
Thanks for any help you can give,
-harpstein
Please sign in to leave a comment.
right?
Right. One instance of your MyVCS class will be created for each Project
instance.
to
Yes, but where do you need this?
(like
initComponent() is invoked for each instance of MyVCS created. That is, for
each Project.
>
Right.
>
Yes, exactly.
Yes, of course.
>
creating
The stuff is automatically created for each Project instance when it's
instantiated. Please note that it's not necessary that a Project instance
will be opened. For example, there is a special instance of Project which is
used to keep "Default Project Properties". When the Project for which a
project component was created is opened projectOpened() method is invoked
for the project component.
--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"
"Harpstein" <mharp@seapine.com> wrote in message
news:bmkcen$gvn$1@is.intellij.net...
>
I
>
>
right?
to
get
(like
>
>
>
creating
>
>
>
>
>