List Info

Thread: ProjectItem vs. ProjectFolderItem




ProjectItem vs. ProjectFolderItem
user name
2007-09-30 04:51:02
Hi,

as Aleix pointed out its currently quite ugly to create
custom
ProjectItem's for your buildmanager. The reason is that
you'd have to
subclass KDevelop::ProjectItem+<custom folder item>
resulting in this:

class QMakeProjectItem : public ProjectItem,
QMakeFolderItem
{
};

The reason why this is ugly because the inheritance graph
for this is
now:

             ProjectFolderItem
	            |
          ----------+-------------
          |                      |
   QMakeFolderItem         ProjectItem
          |                      |
          ----------+-------------
                    |
             QMakeProjectItem

(not 100% correct, I left out the ProjectBuildFolderItem)

So we have that dreaded diamond-shape inheritance :(

Unfortunately I don't see a way of removing this inheritance
graph
without having to duplicate the code between
ProjectFolderItem and
ProjectItem (and thus all subclasses as well).

All those Item classes are ProjectBaseItem subclasses which
is a
QStandardItem subclass.

The only way I currently see is making the project item a
separate thing
from the source folder of the project. Of course you'd see
that in the
project manager, so we'd have
"Project->project-source-folder" instead of
only "Project" in the hierarchy.

My question is: Did I overlook a way to solve that
inheritance dilemma
without having to duplicate code? (I thought about changing
to
has-a-relationship between projectitem and
projectfolderitem, but then
you'd still get the new hierarchy in the project manager)

Andreas

-- 
Your step will soil many countries.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: ProjectItem vs. ProjectFolderItem
country flaguser name
United States
2007-09-30 09:03:28
On Sunday 30 September 2007 04:51:02 am Andreas Pakulat
wrote:
> Hi,
>
> as Aleix pointed out its currently quite ugly to create
custom
> ProjectItem's for your buildmanager. The reason is that
you'd have to
> subclass KDevelop::ProjectItem+<custom folder
item> resulting in this:
>
> class QMakeProjectItem : public ProjectItem,
QMakeFolderItem
> {
> };
>
> The reason why this is ugly because the inheritance
graph for this is
> now:
>
>              ProjectFolderItem
>
>           ----------+-------------
>
>    QMakeFolderItem         ProjectItem
>
>           ----------+-------------
>
>              QMakeProjectItem
>
> (not 100% correct, I left out the
ProjectBuildFolderItem)
>
> So we have that dreaded diamond-shape inheritance :(
>

Why do we have ProjectItem to begin with? Is there some
reason we can't just 
add an isProjectRoot() function to ProjectFolderItem?


> Unfortunately I don't see a way of removing this
inheritance graph
> without having to duplicate the code between
ProjectFolderItem and
> ProjectItem (and thus all subclasses as well).
>

Remove ProjectItem

> All those Item classes are ProjectBaseItem subclasses
which is a
> QStandardItem subclass.
>


> The only way I currently see is making the project item
a separate thing
> from the source folder of the project. Of course you'd
see that in the
> project manager, so we'd have
"Project->project-source-folder" instead of
> only "Project" in the hierarchy.
>
> My question is: Did I overlook a way to solve that
inheritance dilemma
> without having to duplicate code? (I thought about
changing to
> has-a-relationship between projectitem and
projectfolderitem, but then
> you'd still get the new hierarchy in the project
manager)
>
> Andreas

You did. Remove the inheritance. It's not needed. Add some
nice functions to 
ProjectFolderItem to find the root of the project. 
--
Matt

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: ProjectItem vs. ProjectFolderItem
user name
2007-09-30 09:13:41


On 9/30/07, Matt Rogers < mattrkde.org">mattrkde.org&gt; wrote:
On Sunday 30 September 2007 04:51:02 am Andreas Pakulat wrote:
>; Hi,
>
&gt; as Aleix pointed out its currently quite ugly to create custom
>; ProjectItem's for your buildmanager. The reason is that you'd have to
> subclass KDevelop::ProjectItem+<custom folder item> resulting in this:
>
> class QMakeProjectItem : public ProjectItem, QMakeFolderItem
> {
> };
>
&gt; The reason why this is ugly because the inheritance graph for this is
> now:
>
> &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; ProjectFolderItem
>
  ; &nbsp; &nbsp; &nbsp;  ----------+-------------
>
&gt; &nbsp; &nbsp;QMakeFolderItem&nbsp; &nbsp; &nbsp;   ; ProjectItem
>
>  ; &nbsp; &nbsp; &nbsp; &nbsp; ----------+-------------
>
> &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; QMakeProjectItem
>
> (not 100% correct, I left out the ProjectBuildFolderItem)
>
>; So we have that dreaded diamond-shape inheritance :(
>

Why do we have ProjectItem to begin with? Is there some reason we can't just
add an isProjectRoot() function to ProjectFolderItem?


> Unfortunately I don't see a way of removing this inheritance graph
> without having to duplicate the code between ProjectFolderItem and
> ProjectItem (and thus all subclasses as well).
>;

Remove ProjectItem

Well, I think that the problem was that the project item name was the project name, that's why we used the ProjectItem.

> All those Item classes are ProjectBaseItem subclasses which is a
> QStandardItem subclass.
>


&gt; The only way I currently see is making the project item a separate thing
> from the source folder of the project. Of course you'd see that in the
> project manager, so we'd have "Project->project-source-folder&quot; instead of
> only "Project" in the hierarchy.
>
> My question is: Did I overlook a way to solve that inheritance dilemma
&gt; without having to duplicate code? (I thought about changing to
> has-a-relationship between projectitem and projectfolderitem, but then
>; you'd still get the new hierarchy in the project manager)
&gt;
> Andreas

You did. Remove the inheritance. It's not needed. Add some nice functions to
ProjectFolderItem to find the root of the project.
--
Matt

Aleix

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org">KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel

Re: ProjectItem vs. ProjectFolderItem
user name
2007-09-30 09:33:33
On 30.09.07 09:03:28, Matt Rogers wrote:
> On Sunday 30 September 2007 04:51:02 am Andreas Pakulat
wrote:
> > Hi,
> >
> > as Aleix pointed out its currently quite ugly to
create custom
> > ProjectItem's for your buildmanager. The reason is
that you'd have to
> > subclass KDevelop::ProjectItem+<custom folder
item> resulting in this:
> >
> > class QMakeProjectItem : public ProjectItem,
QMakeFolderItem
> > {
> > };
> >
> > The reason why this is ugly because the
inheritance graph for this is
> > now:
> >
> >              ProjectFolderItem
> >
> >           ----------+-------------
> >
> >    QMakeFolderItem         ProjectItem
> >
> >           ----------+-------------
> >
> >              QMakeProjectItem
> >
> > (not 100% correct, I left out the
ProjectBuildFolderItem)
> >
> > So we have that dreaded diamond-shape inheritance
:(
> >
> 
> Why do we have ProjectItem to begin with? Is there some
reason we can't just 
> add an isProjectRoot() function to ProjectFolderItem?

See Aleix answer, the reason is currently that for a project
item the
text in the view is the projects name instead of the path of
the folder
like for normal folder items.

So we could do what you propose, but in that case
setProjectRoot( bool )
would do a setText( project()->name() ) behind the
scenes. If thats ok,
then yes thats a good solution of the problem.

Andreas

-- 
Another good night not to sleep in a eucalyptus tree.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: ProjectItem vs. ProjectFolderItem
user name
2007-09-30 09:47:55
Well, we could just use the setProjectProperty method to pass the project name as well.

Aleix

On 9/30/07, Andreas Pakulat < apakugmx.de"> apakugmx.de>; wrote:
On 30.09.07 09:03:28, Matt Rogers wrote:
>; On Sunday 30 September 2007 04:51:02 am Andreas Pakulat wrote:
&gt; > Hi,
> >
> > as Aleix pointed out its currently quite ugly to create custom
>; > ProjectItem's for your buildmanager. The reason is that you'd have to
> > subclass KDevelop::ProjectItem+<custom folder item> resulting in this:
&gt; >
> > class QMakeProjectItem : public ProjectItem, QMakeFolderItem
> > {
> > };
> >
> > The reason why this is ugly because the inheritance graph for this is
> > now:
>; >
> >   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;ProjectFolderItem
>; >
> >   ; &nbsp; &nbsp; &nbsp;  ----------+-------------
> >
> >   ; QMakeFolderItem  ; &nbsp; &nbsp; &nbsp; ProjectItem
> >
> >   ; &nbsp; &nbsp; &nbsp;  ----------+-------------
> >
> >   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;QMakeProjectItem
> >
> > (not 100% correct, I left out the ProjectBuildFolderItem)
> >
> > So we have that dreaded diamond-shape inheritance :(
> >
>
> Why do we have ProjectItem to begin with? Is there some reason we can't just
> add an isProjectRoot() function to ProjectFolderItem?

See Aleix answer, the reason is currently that for a project item the
text in the view is the projects name instead of the path of the folder
like for normal folder items.

So we could do what you propose, but in that case setProjectRoot( bool )
would do a setText( project()->name() ) behind the scenes. If thats ok,
then yes thats a good solution of the problem.

Andreas

--
Another good night not to sleep in a eucalyptus tree.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org">KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel

Re: ProjectItem vs. ProjectFolderItem
country flaguser name
United States
2007-09-30 10:09:39
On Sunday 30 September 2007 09:33:33 am Andreas Pakulat
wrote:
> On 30.09.07 09:03:28, Matt Rogers wrote:
> > On Sunday 30 September 2007 04:51:02 am Andreas
Pakulat wrote:
> > > Hi,
> > >
> > > as Aleix pointed out its currently quite ugly
to create custom
> > > ProjectItem's for your buildmanager. The
reason is that you'd have to
> > > subclass KDevelop::ProjectItem+<custom
folder item> resulting in this:
> > >
> > > class QMakeProjectItem : public ProjectItem,
QMakeFolderItem
> > > {
> > > };
> > >
> > > The reason why this is ugly because the
inheritance graph for this is
> > > now:
> > >
> > >              ProjectFolderItem
> > >
> > >           ----------+-------------
> > >
> > >    QMakeFolderItem         ProjectItem
> > >
> > >           ----------+-------------
> > >
> > >              QMakeProjectItem
> > >
> > > (not 100% correct, I left out the
ProjectBuildFolderItem)
> > >
> > > So we have that dreaded diamond-shape
inheritance :(
> >
> > Why do we have ProjectItem to begin with? Is there
some reason we can't
> > just add an isProjectRoot() function to
ProjectFolderItem?
>
> See Aleix answer, the reason is currently that for a
project item the
> text in the view is the projects name instead of the
path of the folder
> like for normal folder items.
>
> So we could do what you propose, but in that case
setProjectRoot( bool )
> would do a setText( project()->name() ) behind the
scenes. If thats ok,
> then yes thats a good solution of the problem.
>

I think that's fine.
--
Matt


_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )