Home » Eclipse Projects » GEF » CellEditor tutorial
CellEditor tutorial [message #147121] |
Tue, 10 August 2004 17:53 |
Eclipse User |
|
|
|
Originally posted by: svenkat.asu.edu
I want to be able to click on nodes and add text entries, much like that of
a UML Class node. I understand from reading the archives that I would be
using DirectEdit and CellEditor. I was wondering if there was any article
or tutorial on how I can get a start on making a node editable.
Thanks.
|
|
|
Re: CellEditor tutorial [message #147143 is a reply to message #147121] |
Tue, 10 August 2004 18:56 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Basically, you just receive the DirectEditRequest, startup a
DirectEditManager, and provide the command which performs the edit in the
end. You may also provide optional feedback. See LabelDirectEditPolicy in
logic example.
"Swami Venkataramani" <svenkat@asu.edu> wrote in message
news:cfb2kv$tmc$1@eclipse.org...
> I want to be able to click on nodes and add text entries, much like that
of
> a UML Class node. I understand from reading the archives that I would be
> using DirectEdit and CellEditor. I was wondering if there was any article
> or tutorial on how I can get a start on making a node editable.
>
> Thanks.
>
>
|
|
|
Re: CellEditor tutorial [message #147660 is a reply to message #147143] |
Fri, 13 August 2004 23:55 |
Eclipse User |
|
|
|
Originally posted by: svenkat.asu.edu
For some reason, I am not able to get the cell editor to show up:
I copied stuff from the Logic example:
1. I added the following methods in my edit part:
protected void createEditPolicies()
{
installEditPolicy(EditPolicy.COMPONENT_ROLE, new
FilterEditPolicy());
installEditPolicy(EditPolicy.NODE_ROLE, new
SFTEditGraphicalNodeEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
LabelDirectEditPolicy());
//installEditPolicy(EditPolicy.COMPONENT_ROLE,new
LogicLabelEditPolicy());
}
private void performDirectEdit(){
if(manager == null)
manager = new LogicLabelEditManager(this,
TextCellEditor.class, new
LabelCellEditorLocator((StickyNoteFigure)getFigure()));
manager.show();
}
public void performRequest(Request request){
if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
performDirectEdit();
}
Then, I added the following classes:
1. LabelDirectEditPolicy
2. LogicLabelCommand
3. LabelCellEditorLocator
4. LogicLabelEditManager
(All exactly as it is in the Logic Example)
My createFigure in the editPart looks like this (StickyNoteFigure in my
program simply extends ImageFigure and has the same methods as the one on
the logic example):
protected IFigure createFigure()
{
Image andGate = new Image (null,
"C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
StickyNoteFigure gate = new StickyNoteFigure();
gate.setImage(andGate);
Label label = new Label(label_);
label.setLocation(new Point(0,0));
gate.add(label);
Point location = new Point(60,50);
gate.setLocation(location);
gate.setSize(new Dimension(70,70));
return gate;
}
protected void refreshVisuals()
{
NodeModel node = (NodeModel)getModel();
StickyNoteFigure gate = (StickyNoteFigure)getFigure();
Point p = node.getLocation();
Dimension s = node.getSize();
Rectangle r = new Rectangle(p, s);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, gate,
r);
super.refreshVisuals();
}
What am I missing?
Thanks for any help...
Swami.
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cfb5jk$28t$1@eclipse.org...
> Basically, you just receive the DirectEditRequest, startup a
> DirectEditManager, and provide the command which performs the edit in the
> end. You may also provide optional feedback. See LabelDirectEditPolicy
> in
> logic example.
>
> "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> news:cfb2kv$tmc$1@eclipse.org...
>> I want to be able to click on nodes and add text entries, much like that
> of
>> a UML Class node. I understand from reading the archives that I would be
>> using DirectEdit and CellEditor. I was wondering if there was any
>> article
>> or tutorial on how I can get a start on making a node editable.
>>
>> Thanks.
>>
>>
>
>
|
|
|
Re: CellEditor tutorial [message #147715 is a reply to message #147660] |
Mon, 16 August 2004 14:32 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Did you create the action and place it in a Menu or somewhere where you
could invoke it?
"Swami Venkataramani" <svenkat@asu.edu> wrote in message
news:cfjkvk$vok$1@eclipse.org...
> For some reason, I am not able to get the cell editor to show up:
>
> I copied stuff from the Logic example:
>
> 1. I added the following methods in my edit part:
>
> protected void createEditPolicies()
> {
> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
> FilterEditPolicy());
> installEditPolicy(EditPolicy.NODE_ROLE, new
> SFTEditGraphicalNodeEditPolicy());
>
> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
> LabelDirectEditPolicy());
> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
> LogicLabelEditPolicy());
> }
>
> private void performDirectEdit(){
> if(manager == null)
> manager = new LogicLabelEditManager(this,
> TextCellEditor.class, new
> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
> manager.show();
> }
>
> public void performRequest(Request request){
> if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
> performDirectEdit();
> }
>
> Then, I added the following classes:
>
> 1. LabelDirectEditPolicy
> 2. LogicLabelCommand
> 3. LabelCellEditorLocator
> 4. LogicLabelEditManager
>
> (All exactly as it is in the Logic Example)
>
>
> My createFigure in the editPart looks like this (StickyNoteFigure in my
> program simply extends ImageFigure and has the same methods as the one on
> the logic example):
>
> protected IFigure createFigure()
> {
>
> Image andGate = new Image (null,
> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
> StickyNoteFigure gate = new StickyNoteFigure();
> gate.setImage(andGate);
>
> Label label = new Label(label_);
> label.setLocation(new Point(0,0));
> gate.add(label);
>
> Point location = new Point(60,50);
> gate.setLocation(location);
> gate.setSize(new Dimension(70,70));
>
> return gate;
> }
>
> protected void refreshVisuals()
> {
> NodeModel node = (NodeModel)getModel();
> StickyNoteFigure gate = (StickyNoteFigure)getFigure();
> Point p = node.getLocation();
> Dimension s = node.getSize();
> Rectangle r = new Rectangle(p, s);
> ((GraphicalEditPart) getParent()).setLayoutConstraint(this, gate,
> r);
> super.refreshVisuals();
>
> }
>
>
>
> What am I missing?
>
> Thanks for any help...
>
> Swami.
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:cfb5jk$28t$1@eclipse.org...
> > Basically, you just receive the DirectEditRequest, startup a
> > DirectEditManager, and provide the command which performs the edit in
the
> > end. You may also provide optional feedback. See LabelDirectEditPolicy
> > in
> > logic example.
> >
> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> > news:cfb2kv$tmc$1@eclipse.org...
> >> I want to be able to click on nodes and add text entries, much like
that
> > of
> >> a UML Class node. I understand from reading the archives that I would
be
> >> using DirectEdit and CellEditor. I was wondering if there was any
> >> article
> >> or tutorial on how I can get a start on making a node editable.
> >>
> >> Thanks.
> >>
> >>
> >
> >
>
>
|
|
|
Re: CellEditor tutorial [message #147769 is a reply to message #147715] |
Mon, 16 August 2004 17:33 |
Eclipse User |
|
|
|
Originally posted by: svenkat.asu.edu
Basically, I wanted my user to click once on my edit part, which will then
open up a text editor (just like the Label in the Logic example). Do I need
to create an Action and place it in a Menu for this? I thought the action
would be to simply click on the edit part. Sorry, I'm still a newbie :-)
Thanks,
Swami.
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cfqgce$pe$1@eclipse.org...
> Did you create the action and place it in a Menu or somewhere where you
> could invoke it?
>
> "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> news:cfjkvk$vok$1@eclipse.org...
>> For some reason, I am not able to get the cell editor to show up:
>>
>> I copied stuff from the Logic example:
>>
>> 1. I added the following methods in my edit part:
>>
>> protected void createEditPolicies()
>> {
>> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
>> FilterEditPolicy());
>> installEditPolicy(EditPolicy.NODE_ROLE, new
>> SFTEditGraphicalNodeEditPolicy());
>>
>> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
>> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
>> LabelDirectEditPolicy());
>> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
>> LogicLabelEditPolicy());
>> }
>>
>> private void performDirectEdit(){
>> if(manager == null)
>> manager = new LogicLabelEditManager(this,
>> TextCellEditor.class, new
>> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
>> manager.show();
>> }
>>
>> public void performRequest(Request request){
>> if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
>> performDirectEdit();
>> }
>>
>> Then, I added the following classes:
>>
>> 1. LabelDirectEditPolicy
>> 2. LogicLabelCommand
>> 3. LabelCellEditorLocator
>> 4. LogicLabelEditManager
>>
>> (All exactly as it is in the Logic Example)
>>
>>
>> My createFigure in the editPart looks like this (StickyNoteFigure in my
>> program simply extends ImageFigure and has the same methods as the one on
>> the logic example):
>>
>> protected IFigure createFigure()
>> {
>>
>> Image andGate = new Image (null,
>> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
>> StickyNoteFigure gate = new StickyNoteFigure();
>> gate.setImage(andGate);
>>
>> Label label = new Label(label_);
>> label.setLocation(new Point(0,0));
>> gate.add(label);
>>
>> Point location = new Point(60,50);
>> gate.setLocation(location);
>> gate.setSize(new Dimension(70,70));
>>
>> return gate;
>> }
>>
>> protected void refreshVisuals()
>> {
>> NodeModel node = (NodeModel)getModel();
>> StickyNoteFigure gate = (StickyNoteFigure)getFigure();
>> Point p = node.getLocation();
>> Dimension s = node.getSize();
>> Rectangle r = new Rectangle(p, s);
>> ((GraphicalEditPart) getParent()).setLayoutConstraint(this, gate,
>> r);
>> super.refreshVisuals();
>>
>> }
>>
>>
>>
>> What am I missing?
>>
>> Thanks for any help...
>>
>> Swami.
>>
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:cfb5jk$28t$1@eclipse.org...
>> > Basically, you just receive the DirectEditRequest, startup a
>> > DirectEditManager, and provide the command which performs the edit in
> the
>> > end. You may also provide optional feedback. See
>> > LabelDirectEditPolicy
>> > in
>> > logic example.
>> >
>> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> > news:cfb2kv$tmc$1@eclipse.org...
>> >> I want to be able to click on nodes and add text entries, much like
> that
>> > of
>> >> a UML Class node. I understand from reading the archives that I would
> be
>> >> using DirectEdit and CellEditor. I was wondering if there was any
>> >> article
>> >> or tutorial on how I can get a start on making a node editable.
>> >>
>> >> Thanks.
>> >>
>> >>
>> >
>> >
>>
>>
>
>
|
|
|
Re: CellEditor tutorial [message #147776 is a reply to message #147769] |
Mon, 16 August 2004 17:35 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Nope, your right. You need to click on the part to select it, then click a
second time to direct-edit the same part. This is how the "platform" (read
windows file explorer) works.
"Swami Venkataramani" <svenkat@asu.edu> wrote in message
news:cfqqvq$jro$1@eclipse.org...
> Basically, I wanted my user to click once on my edit part, which will then
> open up a text editor (just like the Label in the Logic example). Do I
need
> to create an Action and place it in a Menu for this? I thought the action
> would be to simply click on the edit part. Sorry, I'm still a newbie :-)
>
> Thanks,
> Swami.
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:cfqgce$pe$1@eclipse.org...
> > Did you create the action and place it in a Menu or somewhere where you
> > could invoke it?
> >
> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> > news:cfjkvk$vok$1@eclipse.org...
> >> For some reason, I am not able to get the cell editor to show up:
> >>
> >> I copied stuff from the Logic example:
> >>
> >> 1. I added the following methods in my edit part:
> >>
> >> protected void createEditPolicies()
> >> {
> >> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
> >> FilterEditPolicy());
> >> installEditPolicy(EditPolicy.NODE_ROLE, new
> >> SFTEditGraphicalNodeEditPolicy());
> >>
> >> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
> >> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
> >> LabelDirectEditPolicy());
> >> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
> >> LogicLabelEditPolicy());
> >> }
> >>
> >> private void performDirectEdit(){
> >> if(manager == null)
> >> manager = new LogicLabelEditManager(this,
> >> TextCellEditor.class, new
> >> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
> >> manager.show();
> >> }
> >>
> >> public void performRequest(Request request){
> >> if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
> >> performDirectEdit();
> >> }
> >>
> >> Then, I added the following classes:
> >>
> >> 1. LabelDirectEditPolicy
> >> 2. LogicLabelCommand
> >> 3. LabelCellEditorLocator
> >> 4. LogicLabelEditManager
> >>
> >> (All exactly as it is in the Logic Example)
> >>
> >>
> >> My createFigure in the editPart looks like this (StickyNoteFigure in my
> >> program simply extends ImageFigure and has the same methods as the one
on
> >> the logic example):
> >>
> >> protected IFigure createFigure()
> >> {
> >>
> >> Image andGate = new Image (null,
> >> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
> >> StickyNoteFigure gate = new StickyNoteFigure();
> >> gate.setImage(andGate);
> >>
> >> Label label = new Label(label_);
> >> label.setLocation(new Point(0,0));
> >> gate.add(label);
> >>
> >> Point location = new Point(60,50);
> >> gate.setLocation(location);
> >> gate.setSize(new Dimension(70,70));
> >>
> >> return gate;
> >> }
> >>
> >> protected void refreshVisuals()
> >> {
> >> NodeModel node = (NodeModel)getModel();
> >> StickyNoteFigure gate = (StickyNoteFigure)getFigure();
> >> Point p = node.getLocation();
> >> Dimension s = node.getSize();
> >> Rectangle r = new Rectangle(p, s);
> >> ((GraphicalEditPart) getParent()).setLayoutConstraint(this,
gate,
> >> r);
> >> super.refreshVisuals();
> >>
> >> }
> >>
> >>
> >>
> >> What am I missing?
> >>
> >> Thanks for any help...
> >>
> >> Swami.
> >>
> >>
> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> news:cfb5jk$28t$1@eclipse.org...
> >> > Basically, you just receive the DirectEditRequest, startup a
> >> > DirectEditManager, and provide the command which performs the edit in
> > the
> >> > end. You may also provide optional feedback. See
> >> > LabelDirectEditPolicy
> >> > in
> >> > logic example.
> >> >
> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> > news:cfb2kv$tmc$1@eclipse.org...
> >> >> I want to be able to click on nodes and add text entries, much like
> > that
> >> > of
> >> >> a UML Class node. I understand from reading the archives that I
would
> > be
> >> >> using DirectEdit and CellEditor. I was wondering if there was any
> >> >> article
> >> >> or tutorial on how I can get a start on making a node editable.
> >> >>
> >> >> Thanks.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>
|
|
|
Re: CellEditor tutorial [message #147784 is a reply to message #147776] |
Mon, 16 August 2004 18:14 |
Eclipse User |
|
|
|
Originally posted by: svenkat.asu.edu
That doesn't work however--when I select the edit part and then click it
once more, I thought the editor should pop up--but it doesn't...so I was
wondering what I was missing, because like I was describing in my earlier
mails, most of my components are ditto to the Logic example...
Any suggestions?
Thanks,
Swami.
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cfqr4n$k40$1@eclipse.org...
> Nope, your right. You need to click on the part to select it, then click
> a
> second time to direct-edit the same part. This is how the "platform"
> (read
> windows file explorer) works.
>
> "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> news:cfqqvq$jro$1@eclipse.org...
>> Basically, I wanted my user to click once on my edit part, which will
>> then
>> open up a text editor (just like the Label in the Logic example). Do I
> need
>> to create an Action and place it in a Menu for this? I thought the
>> action
>> would be to simply click on the edit part. Sorry, I'm still a newbie :-)
>>
>> Thanks,
>> Swami.
>>
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:cfqgce$pe$1@eclipse.org...
>> > Did you create the action and place it in a Menu or somewhere where you
>> > could invoke it?
>> >
>> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> > news:cfjkvk$vok$1@eclipse.org...
>> >> For some reason, I am not able to get the cell editor to show up:
>> >>
>> >> I copied stuff from the Logic example:
>> >>
>> >> 1. I added the following methods in my edit part:
>> >>
>> >> protected void createEditPolicies()
>> >> {
>> >> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
>> >> FilterEditPolicy());
>> >> installEditPolicy(EditPolicy.NODE_ROLE, new
>> >> SFTEditGraphicalNodeEditPolicy());
>> >>
>> >> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
>> >> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
>> >> LabelDirectEditPolicy());
>> >> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
>> >> LogicLabelEditPolicy());
>> >> }
>> >>
>> >> private void performDirectEdit(){
>> >> if(manager == null)
>> >> manager = new LogicLabelEditManager(this,
>> >> TextCellEditor.class, new
>> >> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
>> >> manager.show();
>> >> }
>> >>
>> >> public void performRequest(Request request){
>> >> if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
>> >> performDirectEdit();
>> >> }
>> >>
>> >> Then, I added the following classes:
>> >>
>> >> 1. LabelDirectEditPolicy
>> >> 2. LogicLabelCommand
>> >> 3. LabelCellEditorLocator
>> >> 4. LogicLabelEditManager
>> >>
>> >> (All exactly as it is in the Logic Example)
>> >>
>> >>
>> >> My createFigure in the editPart looks like this (StickyNoteFigure in
>> >> my
>> >> program simply extends ImageFigure and has the same methods as the one
> on
>> >> the logic example):
>> >>
>> >> protected IFigure createFigure()
>> >> {
>> >>
>> >> Image andGate = new Image (null,
>> >> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
>> >> StickyNoteFigure gate = new StickyNoteFigure();
>> >> gate.setImage(andGate);
>> >>
>> >> Label label = new Label(label_);
>> >> label.setLocation(new Point(0,0));
>> >> gate.add(label);
>> >>
>> >> Point location = new Point(60,50);
>> >> gate.setLocation(location);
>> >> gate.setSize(new Dimension(70,70));
>> >>
>> >> return gate;
>> >> }
>> >>
>> >> protected void refreshVisuals()
>> >> {
>> >> NodeModel node = (NodeModel)getModel();
>> >> StickyNoteFigure gate = (StickyNoteFigure)getFigure();
>> >> Point p = node.getLocation();
>> >> Dimension s = node.getSize();
>> >> Rectangle r = new Rectangle(p, s);
>> >> ((GraphicalEditPart) getParent()).setLayoutConstraint(this,
> gate,
>> >> r);
>> >> super.refreshVisuals();
>> >>
>> >> }
>> >>
>> >>
>> >>
>> >> What am I missing?
>> >>
>> >> Thanks for any help...
>> >>
>> >> Swami.
>> >>
>> >>
>> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> news:cfb5jk$28t$1@eclipse.org...
>> >> > Basically, you just receive the DirectEditRequest, startup a
>> >> > DirectEditManager, and provide the command which performs the edit
>> >> > in
>> > the
>> >> > end. You may also provide optional feedback. See
>> >> > LabelDirectEditPolicy
>> >> > in
>> >> > logic example.
>> >> >
>> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> > news:cfb2kv$tmc$1@eclipse.org...
>> >> >> I want to be able to click on nodes and add text entries, much like
>> > that
>> >> > of
>> >> >> a UML Class node. I understand from reading the archives that I
> would
>> > be
>> >> >> using DirectEdit and CellEditor. I was wondering if there was any
>> >> >> article
>> >> >> or tutorial on how I can get a start on making a node editable.
>> >> >>
>> >> >> Thanks.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
|
|
|
Re: CellEditor tutorial [message #147802 is a reply to message #147784] |
Mon, 16 August 2004 19:58 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
put a breakpoint in SelectEditPartTracker.handleButtonUp(). The
performDirectEdit() method should get called, step into it and find out
where it stops.
"Swami Venkataramani" <svenkat@asu.edu> wrote in message
news:cfqtdb$nm7$1@eclipse.org...
> That doesn't work however--when I select the edit part and then click it
> once more, I thought the editor should pop up--but it doesn't...so I was
> wondering what I was missing, because like I was describing in my earlier
> mails, most of my components are ditto to the Logic example...
>
> Any suggestions?
>
> Thanks,
>
> Swami.
>
>
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:cfqr4n$k40$1@eclipse.org...
> > Nope, your right. You need to click on the part to select it, then
click
> > a
> > second time to direct-edit the same part. This is how the "platform"
> > (read
> > windows file explorer) works.
> >
> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> > news:cfqqvq$jro$1@eclipse.org...
> >> Basically, I wanted my user to click once on my edit part, which will
> >> then
> >> open up a text editor (just like the Label in the Logic example). Do I
> > need
> >> to create an Action and place it in a Menu for this? I thought the
> >> action
> >> would be to simply click on the edit part. Sorry, I'm still a newbie
:-)
> >>
> >> Thanks,
> >> Swami.
> >>
> >>
> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> news:cfqgce$pe$1@eclipse.org...
> >> > Did you create the action and place it in a Menu or somewhere where
you
> >> > could invoke it?
> >> >
> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> > news:cfjkvk$vok$1@eclipse.org...
> >> >> For some reason, I am not able to get the cell editor to show up:
> >> >>
> >> >> I copied stuff from the Logic example:
> >> >>
> >> >> 1. I added the following methods in my edit part:
> >> >>
> >> >> protected void createEditPolicies()
> >> >> {
> >> >> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
> >> >> FilterEditPolicy());
> >> >> installEditPolicy(EditPolicy.NODE_ROLE, new
> >> >> SFTEditGraphicalNodeEditPolicy());
> >> >>
> >> >> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
> >> >> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
> >> >> LabelDirectEditPolicy());
> >> >> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
> >> >> LogicLabelEditPolicy());
> >> >> }
> >> >>
> >> >> private void performDirectEdit(){
> >> >> if(manager == null)
> >> >> manager = new LogicLabelEditManager(this,
> >> >> TextCellEditor.class, new
> >> >> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
> >> >> manager.show();
> >> >> }
> >> >>
> >> >> public void performRequest(Request request){
> >> >> if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
> >> >> performDirectEdit();
> >> >> }
> >> >>
> >> >> Then, I added the following classes:
> >> >>
> >> >> 1. LabelDirectEditPolicy
> >> >> 2. LogicLabelCommand
> >> >> 3. LabelCellEditorLocator
> >> >> 4. LogicLabelEditManager
> >> >>
> >> >> (All exactly as it is in the Logic Example)
> >> >>
> >> >>
> >> >> My createFigure in the editPart looks like this (StickyNoteFigure in
> >> >> my
> >> >> program simply extends ImageFigure and has the same methods as the
one
> > on
> >> >> the logic example):
> >> >>
> >> >> protected IFigure createFigure()
> >> >> {
> >> >>
> >> >> Image andGate = new Image (null,
> >> >> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
> >> >> StickyNoteFigure gate = new StickyNoteFigure();
> >> >> gate.setImage(andGate);
> >> >>
> >> >> Label label = new Label(label_);
> >> >> label.setLocation(new Point(0,0));
> >> >> gate.add(label);
> >> >>
> >> >> Point location = new Point(60,50);
> >> >> gate.setLocation(location);
> >> >> gate.setSize(new Dimension(70,70));
> >> >>
> >> >> return gate;
> >> >> }
> >> >>
> >> >> protected void refreshVisuals()
> >> >> {
> >> >> NodeModel node = (NodeModel)getModel();
> >> >> StickyNoteFigure gate = (StickyNoteFigure)getFigure();
> >> >> Point p = node.getLocation();
> >> >> Dimension s = node.getSize();
> >> >> Rectangle r = new Rectangle(p, s);
> >> >> ((GraphicalEditPart) getParent()).setLayoutConstraint(this,
> > gate,
> >> >> r);
> >> >> super.refreshVisuals();
> >> >>
> >> >> }
> >> >>
> >> >>
> >> >>
> >> >> What am I missing?
> >> >>
> >> >> Thanks for any help...
> >> >>
> >> >> Swami.
> >> >>
> >> >>
> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> >> news:cfb5jk$28t$1@eclipse.org...
> >> >> > Basically, you just receive the DirectEditRequest, startup a
> >> >> > DirectEditManager, and provide the command which performs the edit
> >> >> > in
> >> > the
> >> >> > end. You may also provide optional feedback. See
> >> >> > LabelDirectEditPolicy
> >> >> > in
> >> >> > logic example.
> >> >> >
> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> >> > news:cfb2kv$tmc$1@eclipse.org...
> >> >> >> I want to be able to click on nodes and add text entries, much
like
> >> > that
> >> >> > of
> >> >> >> a UML Class node. I understand from reading the archives that I
> > would
> >> > be
> >> >> >> using DirectEdit and CellEditor. I was wondering if there was
any
> >> >> >> article
> >> >> >> or tutorial on how I can get a start on making a node editable.
> >> >> >>
> >> >> >> Thanks.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>
|
|
|
Re: CellEditor tutorial [message #147833 is a reply to message #147802] |
Tue, 17 August 2004 02:37 |
Eclipse User |
|
|
|
Originally posted by: svenkat.asu.edu
Ok, here is the code where I observed as you had asked me to:
protected boolean handleButtonUp(int button) {
if (isInState(STATE_DRAG)) {
performSelection();
if (getFlag(FLAG_ENABLE_DIRECT_EDIT))
performDirectEdit();
if (button == 1 && getSourceEditPart().getSelected() !=
EditPart.SELECTED_NONE)
getCurrentViewer().reveal(getSourceEditPart());
setState(STATE_TERMINAL);
return true;
}
return false;
}
I steped over each line when the control came into this method...it returned
from performDirectEdit and then later stops debugging when it reaches the
folowing method in Workbench:
private void runEventLoop(Window.IExceptionHandler handler, Display display)
{
runEventLoop = true;
while (runEventLoop) {
try {
if (!display.readAndDispatch()) {
getAdvisor().eventLoopIdle(display);
}
} catch (Throwable t) {
handler.handleException(t);
}
}
}
The program doesn't halt or anything--I can continue to drag further objects
from my pallete, but the direct edit editor does not show up when the edit
part is clicked.
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cfr3g2$2et$1@eclipse.org...
> put a breakpoint in SelectEditPartTracker.handleButtonUp(). The
> performDirectEdit() method should get called, step into it and find out
> where it stops.
>
> "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> news:cfqtdb$nm7$1@eclipse.org...
>> That doesn't work however--when I select the edit part and then click it
>> once more, I thought the editor should pop up--but it doesn't...so I was
>> wondering what I was missing, because like I was describing in my earlier
>> mails, most of my components are ditto to the Logic example...
>>
>> Any suggestions?
>>
>> Thanks,
>>
>> Swami.
>>
>>
>>
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:cfqr4n$k40$1@eclipse.org...
>> > Nope, your right. You need to click on the part to select it, then
> click
>> > a
>> > second time to direct-edit the same part. This is how the "platform"
>> > (read
>> > windows file explorer) works.
>> >
>> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> > news:cfqqvq$jro$1@eclipse.org...
>> >> Basically, I wanted my user to click once on my edit part, which will
>> >> then
>> >> open up a text editor (just like the Label in the Logic example). Do
>> >> I
>> > need
>> >> to create an Action and place it in a Menu for this? I thought the
>> >> action
>> >> would be to simply click on the edit part. Sorry, I'm still a newbie
> :-)
>> >>
>> >> Thanks,
>> >> Swami.
>> >>
>> >>
>> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> news:cfqgce$pe$1@eclipse.org...
>> >> > Did you create the action and place it in a Menu or somewhere where
> you
>> >> > could invoke it?
>> >> >
>> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> > news:cfjkvk$vok$1@eclipse.org...
>> >> >> For some reason, I am not able to get the cell editor to show up:
>> >> >>
>> >> >> I copied stuff from the Logic example:
>> >> >>
>> >> >> 1. I added the following methods in my edit part:
>> >> >>
>> >> >> protected void createEditPolicies()
>> >> >> {
>> >> >> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
>> >> >> FilterEditPolicy());
>> >> >> installEditPolicy(EditPolicy.NODE_ROLE, new
>> >> >> SFTEditGraphicalNodeEditPolicy());
>> >> >>
>> >> >> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
>> >> >> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
>> >> >> LabelDirectEditPolicy());
>> >> >> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
>> >> >> LogicLabelEditPolicy());
>> >> >> }
>> >> >>
>> >> >> private void performDirectEdit(){
>> >> >> if(manager == null)
>> >> >> manager = new LogicLabelEditManager(this,
>> >> >> TextCellEditor.class, new
>> >> >> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
>> >> >> manager.show();
>> >> >> }
>> >> >>
>> >> >> public void performRequest(Request request){
>> >> >> if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
>> >> >> performDirectEdit();
>> >> >> }
>> >> >>
>> >> >> Then, I added the following classes:
>> >> >>
>> >> >> 1. LabelDirectEditPolicy
>> >> >> 2. LogicLabelCommand
>> >> >> 3. LabelCellEditorLocator
>> >> >> 4. LogicLabelEditManager
>> >> >>
>> >> >> (All exactly as it is in the Logic Example)
>> >> >>
>> >> >>
>> >> >> My createFigure in the editPart looks like this (StickyNoteFigure
>> >> >> in
>> >> >> my
>> >> >> program simply extends ImageFigure and has the same methods as the
> one
>> > on
>> >> >> the logic example):
>> >> >>
>> >> >> protected IFigure createFigure()
>> >> >> {
>> >> >>
>> >> >> Image andGate = new Image (null,
>> >> >> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
>> >> >> StickyNoteFigure gate = new StickyNoteFigure();
>> >> >> gate.setImage(andGate);
>> >> >>
>> >> >> Label label = new Label(label_);
>> >> >> label.setLocation(new Point(0,0));
>> >> >> gate.add(label);
>> >> >>
>> >> >> Point location = new Point(60,50);
>> >> >> gate.setLocation(location);
>> >> >> gate.setSize(new Dimension(70,70));
>> >> >>
>> >> >> return gate;
>> >> >> }
>> >> >>
>> >> >> protected void refreshVisuals()
>> >> >> {
>> >> >> NodeModel node = (NodeModel)getModel();
>> >> >> StickyNoteFigure gate = (StickyNoteFigure)getFigure();
>> >> >> Point p = node.getLocation();
>> >> >> Dimension s = node.getSize();
>> >> >> Rectangle r = new Rectangle(p, s);
>> >> >> ((GraphicalEditPart) getParent()).setLayoutConstraint(this,
>> > gate,
>> >> >> r);
>> >> >> super.refreshVisuals();
>> >> >>
>> >> >> }
>> >> >>
>> >> >>
>> >> >>
>> >> >> What am I missing?
>> >> >>
>> >> >> Thanks for any help...
>> >> >>
>> >> >> Swami.
>> >> >>
>> >> >>
>> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> >> news:cfb5jk$28t$1@eclipse.org...
>> >> >> > Basically, you just receive the DirectEditRequest, startup a
>> >> >> > DirectEditManager, and provide the command which performs the
>> >> >> > edit
>> >> >> > in
>> >> > the
>> >> >> > end. You may also provide optional feedback. See
>> >> >> > LabelDirectEditPolicy
>> >> >> > in
>> >> >> > logic example.
>> >> >> >
>> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> >> > news:cfb2kv$tmc$1@eclipse.org...
>> >> >> >> I want to be able to click on nodes and add text entries, much
> like
>> >> > that
>> >> >> > of
>> >> >> >> a UML Class node. I understand from reading the archives that I
>> > would
>> >> > be
>> >> >> >> using DirectEdit and CellEditor. I was wondering if there was
> any
>> >> >> >> article
>> >> >> >> or tutorial on how I can get a start on making a node editable.
>> >> >> >>
>> >> >> >> Thanks.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
|
|
|
Re: CellEditor tutorial [message #147896 is a reply to message #147833] |
Tue, 17 August 2004 14:30 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
You've stepped through to the event loop of the application where it waits
for Windows to send more message. You need to step Into (F5)
performDirectEdit(), and step into editpart.performRequest(), etc., and find
out if your editpart is receiving the request, if it constructs a
celleditor, if it is actived, etc.
"Swami Venkataramani" <svenkat@asu.edu> wrote in message
news:cfrqs0$vh6$1@eclipse.org...
> Ok, here is the code where I observed as you had asked me to:
>
> protected boolean handleButtonUp(int button) {
> if (isInState(STATE_DRAG)) {
> performSelection();
> if (getFlag(FLAG_ENABLE_DIRECT_EDIT))
> performDirectEdit();
> if (button == 1 && getSourceEditPart().getSelected() !=
> EditPart.SELECTED_NONE)
> getCurrentViewer().reveal(getSourceEditPart());
> setState(STATE_TERMINAL);
> return true;
> }
> return false;
> }
>
>
> I steped over each line when the control came into this method...it
returned
> from performDirectEdit and then later stops debugging when it reaches the
> folowing method in Workbench:
>
> private void runEventLoop(Window.IExceptionHandler handler, Display
display)
> {
> runEventLoop = true;
> while (runEventLoop) {
> try {
> if (!display.readAndDispatch()) {
> getAdvisor().eventLoopIdle(display);
> }
> } catch (Throwable t) {
> handler.handleException(t);
> }
> }
> }
>
> The program doesn't halt or anything--I can continue to drag further
objects
> from my pallete, but the direct edit editor does not show up when the edit
> part is clicked.
>
>
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:cfr3g2$2et$1@eclipse.org...
> > put a breakpoint in SelectEditPartTracker.handleButtonUp(). The
> > performDirectEdit() method should get called, step into it and find out
> > where it stops.
> >
> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> > news:cfqtdb$nm7$1@eclipse.org...
> >> That doesn't work however--when I select the edit part and then click
it
> >> once more, I thought the editor should pop up--but it doesn't...so I
was
> >> wondering what I was missing, because like I was describing in my
earlier
> >> mails, most of my components are ditto to the Logic example...
> >>
> >> Any suggestions?
> >>
> >> Thanks,
> >>
> >> Swami.
> >>
> >>
> >>
> >>
> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> news:cfqr4n$k40$1@eclipse.org...
> >> > Nope, your right. You need to click on the part to select it, then
> > click
> >> > a
> >> > second time to direct-edit the same part. This is how the "platform"
> >> > (read
> >> > windows file explorer) works.
> >> >
> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> > news:cfqqvq$jro$1@eclipse.org...
> >> >> Basically, I wanted my user to click once on my edit part, which
will
> >> >> then
> >> >> open up a text editor (just like the Label in the Logic example).
Do
> >> >> I
> >> > need
> >> >> to create an Action and place it in a Menu for this? I thought the
> >> >> action
> >> >> would be to simply click on the edit part. Sorry, I'm still a newbie
> > :-)
> >> >>
> >> >> Thanks,
> >> >> Swami.
> >> >>
> >> >>
> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> >> news:cfqgce$pe$1@eclipse.org...
> >> >> > Did you create the action and place it in a Menu or somewhere
where
> > you
> >> >> > could invoke it?
> >> >> >
> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> >> > news:cfjkvk$vok$1@eclipse.org...
> >> >> >> For some reason, I am not able to get the cell editor to show
up:
> >> >> >>
> >> >> >> I copied stuff from the Logic example:
> >> >> >>
> >> >> >> 1. I added the following methods in my edit part:
> >> >> >>
> >> >> >> protected void createEditPolicies()
> >> >> >> {
> >> >> >> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
> >> >> >> FilterEditPolicy());
> >> >> >> installEditPolicy(EditPolicy.NODE_ROLE, new
> >> >> >> SFTEditGraphicalNodeEditPolicy());
> >> >> >>
> >> >> >> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
> >> >> >> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
> >> >> >> LabelDirectEditPolicy());
> >> >> >> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
> >> >> >> LogicLabelEditPolicy());
> >> >> >> }
> >> >> >>
> >> >> >> private void performDirectEdit(){
> >> >> >> if(manager == null)
> >> >> >> manager = new LogicLabelEditManager(this,
> >> >> >> TextCellEditor.class, new
> >> >> >> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
> >> >> >> manager.show();
> >> >> >> }
> >> >> >>
> >> >> >> public void performRequest(Request request){
> >> >> >> if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
> >> >> >> performDirectEdit();
> >> >> >> }
> >> >> >>
> >> >> >> Then, I added the following classes:
> >> >> >>
> >> >> >> 1. LabelDirectEditPolicy
> >> >> >> 2. LogicLabelCommand
> >> >> >> 3. LabelCellEditorLocator
> >> >> >> 4. LogicLabelEditManager
> >> >> >>
> >> >> >> (All exactly as it is in the Logic Example)
> >> >> >>
> >> >> >>
> >> >> >> My createFigure in the editPart looks like this (StickyNoteFigure
> >> >> >> in
> >> >> >> my
> >> >> >> program simply extends ImageFigure and has the same methods as
the
> > one
> >> > on
> >> >> >> the logic example):
> >> >> >>
> >> >> >> protected IFigure createFigure()
> >> >> >> {
> >> >> >>
> >> >> >> Image andGate = new Image (null,
> >> >> >> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
> >> >> >> StickyNoteFigure gate = new StickyNoteFigure();
> >> >> >> gate.setImage(andGate);
> >> >> >>
> >> >> >> Label label = new Label(label_);
> >> >> >> label.setLocation(new Point(0,0));
> >> >> >> gate.add(label);
> >> >> >>
> >> >> >> Point location = new Point(60,50);
> >> >> >> gate.setLocation(location);
> >> >> >> gate.setSize(new Dimension(70,70));
> >> >> >>
> >> >> >> return gate;
> >> >> >> }
> >> >> >>
> >> >> >> protected void refreshVisuals()
> >> >> >> {
> >> >> >> NodeModel node = (NodeModel)getModel();
> >> >> >> StickyNoteFigure gate = (StickyNoteFigure)getFigure();
> >> >> >> Point p = node.getLocation();
> >> >> >> Dimension s = node.getSize();
> >> >> >> Rectangle r = new Rectangle(p, s);
> >> >> >> ((GraphicalEditPart)
getParent()).setLayoutConstraint(this,
> >> > gate,
> >> >> >> r);
> >> >> >> super.refreshVisuals();
> >> >> >>
> >> >> >> }
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> What am I missing?
> >> >> >>
> >> >> >> Thanks for any help...
> >> >> >>
> >> >> >> Swami.
> >> >> >>
> >> >> >>
> >> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> >> >> news:cfb5jk$28t$1@eclipse.org...
> >> >> >> > Basically, you just receive the DirectEditRequest, startup a
> >> >> >> > DirectEditManager, and provide the command which performs the
> >> >> >> > edit
> >> >> >> > in
> >> >> > the
> >> >> >> > end. You may also provide optional feedback. See
> >> >> >> > LabelDirectEditPolicy
> >> >> >> > in
> >> >> >> > logic example.
> >> >> >> >
> >> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> >> >> > news:cfb2kv$tmc$1@eclipse.org...
> >> >> >> >> I want to be able to click on nodes and add text entries, much
> > like
> >> >> > that
> >> >> >> > of
> >> >> >> >> a UML Class node. I understand from reading the archives that
I
> >> > would
> >> >> > be
> >> >> >> >> using DirectEdit and CellEditor. I was wondering if there was
> > any
> >> >> >> >> article
> >> >> >> >> or tutorial on how I can get a start on making a node
editable.
> >> >> >> >>
> >> >> >> >> Thanks.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>
|
|
|
Re: CellEditor tutorial [message #147920 is a reply to message #147896] |
Tue, 17 August 2004 17:17 |
Eclipse User |
|
|
|
Originally posted by: svenkat.asu.edu
Ok, I stepped into performDirectEdit() and at this point--
EclipseClassLoader(ClassLoader).loadClassInternal(String) line: not
available
--I get this error page:
----------------------
Class File Editor
Source not found
The jar file rt.jar has no source attachment.
You can attach the source by clicking Attach below
[Attach Source] (button)
---------------------
abstract public class java.lang.ClassLoader extends java.lang.Object {
......
}
---------------------
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cft4l7$vrm$1@eclipse.org...
> You've stepped through to the event loop of the application where it waits
> for Windows to send more message. You need to step Into (F5)
> performDirectEdit(), and step into editpart.performRequest(), etc., and
> find
> out if your editpart is receiving the request, if it constructs a
> celleditor, if it is actived, etc.
>
> "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> news:cfrqs0$vh6$1@eclipse.org...
>> Ok, here is the code where I observed as you had asked me to:
>>
>> protected boolean handleButtonUp(int button) {
>> if (isInState(STATE_DRAG)) {
>> performSelection();
>> if (getFlag(FLAG_ENABLE_DIRECT_EDIT))
>> performDirectEdit();
>> if (button == 1 && getSourceEditPart().getSelected() !=
>> EditPart.SELECTED_NONE)
>> getCurrentViewer().reveal(getSourceEditPart());
>> setState(STATE_TERMINAL);
>> return true;
>> }
>> return false;
>> }
>>
>>
>> I steped over each line when the control came into this method...it
> returned
>> from performDirectEdit and then later stops debugging when it reaches the
>> folowing method in Workbench:
>>
>> private void runEventLoop(Window.IExceptionHandler handler, Display
> display)
>> {
>> runEventLoop = true;
>> while (runEventLoop) {
>> try {
>> if (!display.readAndDispatch()) {
>> getAdvisor().eventLoopIdle(display);
>> }
>> } catch (Throwable t) {
>> handler.handleException(t);
>> }
>> }
>> }
>>
>> The program doesn't halt or anything--I can continue to drag further
> objects
>> from my pallete, but the direct edit editor does not show up when the
>> edit
>> part is clicked.
>>
>>
>>
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:cfr3g2$2et$1@eclipse.org...
>> > put a breakpoint in SelectEditPartTracker.handleButtonUp(). The
>> > performDirectEdit() method should get called, step into it and find out
>> > where it stops.
>> >
>> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> > news:cfqtdb$nm7$1@eclipse.org...
>> >> That doesn't work however--when I select the edit part and then click
> it
>> >> once more, I thought the editor should pop up--but it doesn't...so I
> was
>> >> wondering what I was missing, because like I was describing in my
> earlier
>> >> mails, most of my components are ditto to the Logic example...
>> >>
>> >> Any suggestions?
>> >>
>> >> Thanks,
>> >>
>> >> Swami.
>> >>
>> >>
>> >>
>> >>
>> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> news:cfqr4n$k40$1@eclipse.org...
>> >> > Nope, your right. You need to click on the part to select it, then
>> > click
>> >> > a
>> >> > second time to direct-edit the same part. This is how the
>> >> > "platform"
>> >> > (read
>> >> > windows file explorer) works.
>> >> >
>> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> > news:cfqqvq$jro$1@eclipse.org...
>> >> >> Basically, I wanted my user to click once on my edit part, which
> will
>> >> >> then
>> >> >> open up a text editor (just like the Label in the Logic example).
> Do
>> >> >> I
>> >> > need
>> >> >> to create an Action and place it in a Menu for this? I thought the
>> >> >> action
>> >> >> would be to simply click on the edit part. Sorry, I'm still a
>> >> >> newbie
>> > :-)
>> >> >>
>> >> >> Thanks,
>> >> >> Swami.
>> >> >>
>> >> >>
>> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> >> news:cfqgce$pe$1@eclipse.org...
>> >> >> > Did you create the action and place it in a Menu or somewhere
> where
>> > you
>> >> >> > could invoke it?
>> >> >> >
>> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> >> > news:cfjkvk$vok$1@eclipse.org...
>> >> >> >> For some reason, I am not able to get the cell editor to show
> up:
>> >> >> >>
>> >> >> >> I copied stuff from the Logic example:
>> >> >> >>
>> >> >> >> 1. I added the following methods in my edit part:
>> >> >> >>
>> >> >> >> protected void createEditPolicies()
>> >> >> >> {
>> >> >> >> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
>> >> >> >> FilterEditPolicy());
>> >> >> >> installEditPolicy(EditPolicy.NODE_ROLE, new
>> >> >> >> SFTEditGraphicalNodeEditPolicy());
>> >> >> >>
>> >> >> >> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
>> >> >> >> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
>> >> >> >> LabelDirectEditPolicy());
>> >> >> >> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
>> >> >> >> LogicLabelEditPolicy());
>> >> >> >> }
>> >> >> >>
>> >> >> >> private void performDirectEdit(){
>> >> >> >> if(manager == null)
>> >> >> >> manager = new LogicLabelEditManager(this,
>> >> >> >> TextCellEditor.class, new
>> >> >> >> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
>> >> >> >> manager.show();
>> >> >> >> }
>> >> >> >>
>> >> >> >> public void performRequest(Request request){
>> >> >> >> if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
>> >> >> >> performDirectEdit();
>> >> >> >> }
>> >> >> >>
>> >> >> >> Then, I added the following classes:
>> >> >> >>
>> >> >> >> 1. LabelDirectEditPolicy
>> >> >> >> 2. LogicLabelCommand
>> >> >> >> 3. LabelCellEditorLocator
>> >> >> >> 4. LogicLabelEditManager
>> >> >> >>
>> >> >> >> (All exactly as it is in the Logic Example)
>> >> >> >>
>> >> >> >>
>> >> >> >> My createFigure in the editPart looks like this
>> >> >> >> (StickyNoteFigure
>> >> >> >> in
>> >> >> >> my
>> >> >> >> program simply extends ImageFigure and has the same methods as
> the
>> > one
>> >> > on
>> >> >> >> the logic example):
>> >> >> >>
>> >> >> >> protected IFigure createFigure()
>> >> >> >> {
>> >> >> >>
>> >> >> >> Image andGate = new Image (null,
>> >> >> >> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
>> >> >> >> StickyNoteFigure gate = new StickyNoteFigure();
>> >> >> >> gate.setImage(andGate);
>> >> >> >>
>> >> >> >> Label label = new Label(label_);
>> >> >> >> label.setLocation(new Point(0,0));
>> >> >> >> gate.add(label);
>> >> >> >>
>> >> >> >> Point location = new Point(60,50);
>> >> >> >> gate.setLocation(location);
>> >> >> >> gate.setSize(new Dimension(70,70));
>> >> >> >>
>> >> >> >> return gate;
>> >> >> >> }
>> >> >> >>
>> >> >> >> protected void refreshVisuals()
>> >> >> >> {
>> >> >> >> NodeModel node = (NodeModel)getModel();
>> >> >> >> StickyNoteFigure gate = (StickyNoteFigure)getFigure();
>> >> >> >> Point p = node.getLocation();
>> >> >> >> Dimension s = node.getSize();
>> >> >> >> Rectangle r = new Rectangle(p, s);
>> >> >> >> ((GraphicalEditPart)
> getParent()).setLayoutConstraint(this,
>> >> > gate,
>> >> >> >> r);
>> >> >> >> super.refreshVisuals();
>> >> >> >>
>> >> >> >> }
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> What am I missing?
>> >> >> >>
>> >> >> >> Thanks for any help...
>> >> >> >>
>> >> >> >> Swami.
>> >> >> >>
>> >> >> >>
>> >> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> >> >> news:cfb5jk$28t$1@eclipse.org...
>> >> >> >> > Basically, you just receive the DirectEditRequest, startup a
>> >> >> >> > DirectEditManager, and provide the command which performs the
>> >> >> >> > edit
>> >> >> >> > in
>> >> >> > the
>> >> >> >> > end. You may also provide optional feedback. See
>> >> >> >> > LabelDirectEditPolicy
>> >> >> >> > in
>> >> >> >> > logic example.
>> >> >> >> >
>> >> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> >> >> > news:cfb2kv$tmc$1@eclipse.org...
>> >> >> >> >> I want to be able to click on nodes and add text entries,
>> >> >> >> >> much
>> > like
>> >> >> > that
>> >> >> >> > of
>> >> >> >> >> a UML Class node. I understand from reading the archives
>> >> >> >> >> that
> I
>> >> > would
>> >> >> > be
>> >> >> >> >> using DirectEdit and CellEditor. I was wondering if there
>> >> >> >> >> was
>> > any
>> >> >> >> >> article
>> >> >> >> >> or tutorial on how I can get a start on making a node
> editable.
>> >> >> >> >>
>> >> >> >> >> Thanks.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
|
|
|
Re: CellEditor tutorial [message #147957 is a reply to message #147920] |
Tue, 17 August 2004 18:21 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
So you need a JDK with src.zip
"Swami Venkataramani" <svenkat@asu.edu> wrote in message
news:cfteeq$k1p$1@eclipse.org...
>
> Ok, I stepped into performDirectEdit() and at this point--
>
> EclipseClassLoader(ClassLoader).loadClassInternal(String) line: not
> available
>
> --I get this error page:
>
> ----------------------
> Class File Editor
>
> Source not found
> The jar file rt.jar has no source attachment.
> You can attach the source by clicking Attach below
>
> [Attach Source] (button)
> ---------------------
> abstract public class java.lang.ClassLoader extends java.lang.Object {
> .....
>
> }
>
> ---------------------
>
>
>
>
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:cft4l7$vrm$1@eclipse.org...
> > You've stepped through to the event loop of the application where it
waits
> > for Windows to send more message. You need to step Into (F5)
> > performDirectEdit(), and step into editpart.performRequest(), etc., and
> > find
> > out if your editpart is receiving the request, if it constructs a
> > celleditor, if it is actived, etc.
> >
> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> > news:cfrqs0$vh6$1@eclipse.org...
> >> Ok, here is the code where I observed as you had asked me to:
> >>
> >> protected boolean handleButtonUp(int button) {
> >> if (isInState(STATE_DRAG)) {
> >> performSelection();
> >> if (getFlag(FLAG_ENABLE_DIRECT_EDIT))
> >> performDirectEdit();
> >> if (button == 1 && getSourceEditPart().getSelected() !=
> >> EditPart.SELECTED_NONE)
> >> getCurrentViewer().reveal(getSourceEditPart());
> >> setState(STATE_TERMINAL);
> >> return true;
> >> }
> >> return false;
> >> }
> >>
> >>
> >> I steped over each line when the control came into this method...it
> > returned
> >> from performDirectEdit and then later stops debugging when it reaches
the
> >> folowing method in Workbench:
> >>
> >> private void runEventLoop(Window.IExceptionHandler handler, Display
> > display)
> >> {
> >> runEventLoop = true;
> >> while (runEventLoop) {
> >> try {
> >> if (!display.readAndDispatch()) {
> >> getAdvisor().eventLoopIdle(display);
> >> }
> >> } catch (Throwable t) {
> >> handler.handleException(t);
> >> }
> >> }
> >> }
> >>
> >> The program doesn't halt or anything--I can continue to drag further
> > objects
> >> from my pallete, but the direct edit editor does not show up when the
> >> edit
> >> part is clicked.
> >>
> >>
> >>
> >>
> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> news:cfr3g2$2et$1@eclipse.org...
> >> > put a breakpoint in SelectEditPartTracker.handleButtonUp(). The
> >> > performDirectEdit() method should get called, step into it and find
out
> >> > where it stops.
> >> >
> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> > news:cfqtdb$nm7$1@eclipse.org...
> >> >> That doesn't work however--when I select the edit part and then
click
> > it
> >> >> once more, I thought the editor should pop up--but it doesn't...so I
> > was
> >> >> wondering what I was missing, because like I was describing in my
> > earlier
> >> >> mails, most of my components are ditto to the Logic example...
> >> >>
> >> >> Any suggestions?
> >> >>
> >> >> Thanks,
> >> >>
> >> >> Swami.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> >> news:cfqr4n$k40$1@eclipse.org...
> >> >> > Nope, your right. You need to click on the part to select it,
then
> >> > click
> >> >> > a
> >> >> > second time to direct-edit the same part. This is how the
> >> >> > "platform"
> >> >> > (read
> >> >> > windows file explorer) works.
> >> >> >
> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> >> > news:cfqqvq$jro$1@eclipse.org...
> >> >> >> Basically, I wanted my user to click once on my edit part, which
> > will
> >> >> >> then
> >> >> >> open up a text editor (just like the Label in the Logic example).
> > Do
> >> >> >> I
> >> >> > need
> >> >> >> to create an Action and place it in a Menu for this? I thought
the
> >> >> >> action
> >> >> >> would be to simply click on the edit part. Sorry, I'm still a
> >> >> >> newbie
> >> > :-)
> >> >> >>
> >> >> >> Thanks,
> >> >> >> Swami.
> >> >> >>
> >> >> >>
> >> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> >> >> news:cfqgce$pe$1@eclipse.org...
> >> >> >> > Did you create the action and place it in a Menu or somewhere
> > where
> >> > you
> >> >> >> > could invoke it?
> >> >> >> >
> >> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> >> >> > news:cfjkvk$vok$1@eclipse.org...
> >> >> >> >> For some reason, I am not able to get the cell editor to show
> > up:
> >> >> >> >>
> >> >> >> >> I copied stuff from the Logic example:
> >> >> >> >>
> >> >> >> >> 1. I added the following methods in my edit part:
> >> >> >> >>
> >> >> >> >> protected void createEditPolicies()
> >> >> >> >> {
> >> >> >> >> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
> >> >> >> >> FilterEditPolicy());
> >> >> >> >> installEditPolicy(EditPolicy.NODE_ROLE, new
> >> >> >> >> SFTEditGraphicalNodeEditPolicy());
> >> >> >> >>
> >> >> >> >> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
> >> >> >> >> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
> >> >> >> >> LabelDirectEditPolicy());
> >> >> >> >> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
> >> >> >> >> LogicLabelEditPolicy());
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >> private void performDirectEdit(){
> >> >> >> >> if(manager == null)
> >> >> >> >> manager = new LogicLabelEditManager(this,
> >> >> >> >> TextCellEditor.class, new
> >> >> >> >> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
> >> >> >> >> manager.show();
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >> public void performRequest(Request request){
> >> >> >> >> if (request.getType() ==
RequestConstants.REQ_DIRECT_EDIT)
> >> >> >> >> performDirectEdit();
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >> Then, I added the following classes:
> >> >> >> >>
> >> >> >> >> 1. LabelDirectEditPolicy
> >> >> >> >> 2. LogicLabelCommand
> >> >> >> >> 3. LabelCellEditorLocator
> >> >> >> >> 4. LogicLabelEditManager
> >> >> >> >>
> >> >> >> >> (All exactly as it is in the Logic Example)
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> My createFigure in the editPart looks like this
> >> >> >> >> (StickyNoteFigure
> >> >> >> >> in
> >> >> >> >> my
> >> >> >> >> program simply extends ImageFigure and has the same methods as
> > the
> >> > one
> >> >> > on
> >> >> >> >> the logic example):
> >> >> >> >>
> >> >> >> >> protected IFigure createFigure()
> >> >> >> >> {
> >> >> >> >>
> >> >> >> >> Image andGate = new Image (null,
> >> >> >> >> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
> >> >> >> >> StickyNoteFigure gate = new StickyNoteFigure();
> >> >> >> >> gate.setImage(andGate);
> >> >> >> >>
> >> >> >> >> Label label = new Label(label_);
> >> >> >> >> label.setLocation(new Point(0,0));
> >> >> >> >> gate.add(label);
> >> >> >> >>
> >> >> >> >> Point location = new Point(60,50);
> >> >> >> >> gate.setLocation(location);
> >> >> >> >> gate.setSize(new Dimension(70,70));
> >> >> >> >>
> >> >> >> >> return gate;
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >> protected void refreshVisuals()
> >> >> >> >> {
> >> >> >> >> NodeModel node = (NodeModel)getModel();
> >> >> >> >> StickyNoteFigure gate = (StickyNoteFigure)getFigure();
> >> >> >> >> Point p = node.getLocation();
> >> >> >> >> Dimension s = node.getSize();
> >> >> >> >> Rectangle r = new Rectangle(p, s);
> >> >> >> >> ((GraphicalEditPart)
> > getParent()).setLayoutConstraint(this,
> >> >> > gate,
> >> >> >> >> r);
> >> >> >> >> super.refreshVisuals();
> >> >> >> >>
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> What am I missing?
> >> >> >> >>
> >> >> >> >> Thanks for any help...
> >> >> >> >>
> >> >> >> >> Swami.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
> >> >> >> >> news:cfb5jk$28t$1@eclipse.org...
> >> >> >> >> > Basically, you just receive the DirectEditRequest, startup a
> >> >> >> >> > DirectEditManager, and provide the command which performs
the
> >> >> >> >> > edit
> >> >> >> >> > in
> >> >> >> > the
> >> >> >> >> > end. You may also provide optional feedback. See
> >> >> >> >> > LabelDirectEditPolicy
> >> >> >> >> > in
> >> >> >> >> > logic example.
> >> >> >> >> >
> >> >> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> >> >> >> >> > news:cfb2kv$tmc$1@eclipse.org...
> >> >> >> >> >> I want to be able to click on nodes and add text entries,
> >> >> >> >> >> much
> >> > like
> >> >> >> > that
> >> >> >> >> > of
> >> >> >> >> >> a UML Class node. I understand from reading the archives
> >> >> >> >> >> that
> > I
> >> >> > would
> >> >> >> > be
> >> >> >> >> >> using DirectEdit and CellEditor. I was wondering if there
> >> >> >> >> >> was
> >> > any
> >> >> >> >> >> article
> >> >> >> >> >> or tutorial on how I can get a start on making a node
> > editable.
> >> >> >> >> >>
> >> >> >> >> >> Thanks.
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>
|
|
|
Re: CellEditor tutorial [message #147963 is a reply to message #147957] |
Tue, 17 August 2004 19:23 |
Eclipse User |
|
|
|
Originally posted by: svenkat.asu.edu
Hmm...I changed the JRE that Eclispe uses to one that has src.zip
Now, when I click on the edit part I get the following error:
Unhandled event loop exception
Reason:
java.lang.NullPointerException
But what I'm confused about is that how come the Logic example works with
the other JRE?
Thanks,
Swami.
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cfti5i$qbm$1@eclipse.org...
> So you need a JDK with src.zip
>
> "Swami Venkataramani" <svenkat@asu.edu> wrote in message
> news:cfteeq$k1p$1@eclipse.org...
>>
>> Ok, I stepped into performDirectEdit() and at this point--
>>
>> EclipseClassLoader(ClassLoader).loadClassInternal(String) line: not
>> available
>>
>> --I get this error page:
>>
>> ----------------------
>> Class File Editor
>>
>> Source not found
>> The jar file rt.jar has no source attachment.
>> You can attach the source by clicking Attach below
>>
>> [Attach Source] (button)
>> ---------------------
>> abstract public class java.lang.ClassLoader extends java.lang.Object {
>> .....
>>
>> }
>>
>> ---------------------
>>
>>
>>
>>
>>
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:cft4l7$vrm$1@eclipse.org...
>> > You've stepped through to the event loop of the application where it
> waits
>> > for Windows to send more message. You need to step Into (F5)
>> > performDirectEdit(), and step into editpart.performRequest(), etc., and
>> > find
>> > out if your editpart is receiving the request, if it constructs a
>> > celleditor, if it is actived, etc.
>> >
>> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> > news:cfrqs0$vh6$1@eclipse.org...
>> >> Ok, here is the code where I observed as you had asked me to:
>> >>
>> >> protected boolean handleButtonUp(int button) {
>> >> if (isInState(STATE_DRAG)) {
>> >> performSelection();
>> >> if (getFlag(FLAG_ENABLE_DIRECT_EDIT))
>> >> performDirectEdit();
>> >> if (button == 1 && getSourceEditPart().getSelected() !=
>> >> EditPart.SELECTED_NONE)
>> >> getCurrentViewer().reveal(getSourceEditPart());
>> >> setState(STATE_TERMINAL);
>> >> return true;
>> >> }
>> >> return false;
>> >> }
>> >>
>> >>
>> >> I steped over each line when the control came into this method...it
>> > returned
>> >> from performDirectEdit and then later stops debugging when it reaches
> the
>> >> folowing method in Workbench:
>> >>
>> >> private void runEventLoop(Window.IExceptionHandler handler, Display
>> > display)
>> >> {
>> >> runEventLoop = true;
>> >> while (runEventLoop) {
>> >> try {
>> >> if (!display.readAndDispatch()) {
>> >> getAdvisor().eventLoopIdle(display);
>> >> }
>> >> } catch (Throwable t) {
>> >> handler.handleException(t);
>> >> }
>> >> }
>> >> }
>> >>
>> >> The program doesn't halt or anything--I can continue to drag further
>> > objects
>> >> from my pallete, but the direct edit editor does not show up when the
>> >> edit
>> >> part is clicked.
>> >>
>> >>
>> >>
>> >>
>> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> news:cfr3g2$2et$1@eclipse.org...
>> >> > put a breakpoint in SelectEditPartTracker.handleButtonUp(). The
>> >> > performDirectEdit() method should get called, step into it and find
> out
>> >> > where it stops.
>> >> >
>> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> > news:cfqtdb$nm7$1@eclipse.org...
>> >> >> That doesn't work however--when I select the edit part and then
> click
>> > it
>> >> >> once more, I thought the editor should pop up--but it doesn't...so
>> >> >> I
>> > was
>> >> >> wondering what I was missing, because like I was describing in my
>> > earlier
>> >> >> mails, most of my components are ditto to the Logic example...
>> >> >>
>> >> >> Any suggestions?
>> >> >>
>> >> >> Thanks,
>> >> >>
>> >> >> Swami.
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> >> news:cfqr4n$k40$1@eclipse.org...
>> >> >> > Nope, your right. You need to click on the part to select it,
> then
>> >> > click
>> >> >> > a
>> >> >> > second time to direct-edit the same part. This is how the
>> >> >> > "platform"
>> >> >> > (read
>> >> >> > windows file explorer) works.
>> >> >> >
>> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> >> > news:cfqqvq$jro$1@eclipse.org...
>> >> >> >> Basically, I wanted my user to click once on my edit part, which
>> > will
>> >> >> >> then
>> >> >> >> open up a text editor (just like the Label in the Logic
>> >> >> >> example).
>> > Do
>> >> >> >> I
>> >> >> > need
>> >> >> >> to create an Action and place it in a Menu for this? I thought
> the
>> >> >> >> action
>> >> >> >> would be to simply click on the edit part. Sorry, I'm still a
>> >> >> >> newbie
>> >> > :-)
>> >> >> >>
>> >> >> >> Thanks,
>> >> >> >> Swami.
>> >> >> >>
>> >> >> >>
>> >> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> >> >> news:cfqgce$pe$1@eclipse.org...
>> >> >> >> > Did you create the action and place it in a Menu or somewhere
>> > where
>> >> > you
>> >> >> >> > could invoke it?
>> >> >> >> >
>> >> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> >> >> > news:cfjkvk$vok$1@eclipse.org...
>> >> >> >> >> For some reason, I am not able to get the cell editor to
>> >> >> >> >> show
>> > up:
>> >> >> >> >>
>> >> >> >> >> I copied stuff from the Logic example:
>> >> >> >> >>
>> >> >> >> >> 1. I added the following methods in my edit part:
>> >> >> >> >>
>> >> >> >> >> protected void createEditPolicies()
>> >> >> >> >> {
>> >> >> >> >> installEditPolicy(EditPolicy.COMPONENT_ROLE, new
>> >> >> >> >> FilterEditPolicy());
>> >> >> >> >> installEditPolicy(EditPolicy.NODE_ROLE, new
>> >> >> >> >> SFTEditGraphicalNodeEditPolicy());
>> >> >> >> >>
>> >> >> >> >> installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
>> >> >> >> >> installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new
>> >> >> >> >> LabelDirectEditPolicy());
>> >> >> >> >> //installEditPolicy(EditPolicy.COMPONENT_ROLE,new
>> >> >> >> >> LogicLabelEditPolicy());
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >> private void performDirectEdit(){
>> >> >> >> >> if(manager == null)
>> >> >> >> >> manager = new LogicLabelEditManager(this,
>> >> >> >> >> TextCellEditor.class, new
>> >> >> >> >> LabelCellEditorLocator((StickyNoteFigure)getFigure()));
>> >> >> >> >> manager.show();
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >> public void performRequest(Request request){
>> >> >> >> >> if (request.getType() ==
> RequestConstants.REQ_DIRECT_EDIT)
>> >> >> >> >> performDirectEdit();
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >> Then, I added the following classes:
>> >> >> >> >>
>> >> >> >> >> 1. LabelDirectEditPolicy
>> >> >> >> >> 2. LogicLabelCommand
>> >> >> >> >> 3. LabelCellEditorLocator
>> >> >> >> >> 4. LogicLabelEditManager
>> >> >> >> >>
>> >> >> >> >> (All exactly as it is in the Logic Example)
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> My createFigure in the editPart looks like this
>> >> >> >> >> (StickyNoteFigure
>> >> >> >> >> in
>> >> >> >> >> my
>> >> >> >> >> program simply extends ImageFigure and has the same methods
>> >> >> >> >> as
>> > the
>> >> > one
>> >> >> > on
>> >> >> >> >> the logic example):
>> >> >> >> >>
>> >> >> >> >> protected IFigure createFigure()
>> >> >> >> >> {
>> >> >> >> >>
>> >> >> >> >> Image andGate = new Image (null,
>> >> >> >> >> "C:/eclipse/workspace/sft/src/sft/editor/images/andGate.bmp");
>> >> >> >> >> StickyNoteFigure gate = new StickyNoteFigure();
>> >> >> >> >> gate.setImage(andGate);
>> >> >> >> >>
>> >> >> >> >> Label label = new Label(label_);
>> >> >> >> >> label.setLocation(new Point(0,0));
>> >> >> >> >> gate.add(label);
>> >> >> >> >>
>> >> >> >> >> Point location = new Point(60,50);
>> >> >> >> >> gate.setLocation(location);
>> >> >> >> >> gate.setSize(new Dimension(70,70));
>> >> >> >> >>
>> >> >> >> >> return gate;
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >> protected void refreshVisuals()
>> >> >> >> >> {
>> >> >> >> >> NodeModel node = (NodeModel)getModel();
>> >> >> >> >> StickyNoteFigure gate =
>> >> >> >> >> (StickyNoteFigure)getFigure();
>> >> >> >> >> Point p = node.getLocation();
>> >> >> >> >> Dimension s = node.getSize();
>> >> >> >> >> Rectangle r = new Rectangle(p, s);
>> >> >> >> >> ((GraphicalEditPart)
>> > getParent()).setLayoutConstraint(this,
>> >> >> > gate,
>> >> >> >> >> r);
>> >> >> >> >> super.refreshVisuals();
>> >> >> >> >>
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> What am I missing?
>> >> >> >> >>
>> >> >> >> >> Thanks for any help...
>> >> >> >> >>
>> >> >> >> >> Swami.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> "Randy Hudson" <none@us.ibm.com> wrote in message
>> >> >> >> >> news:cfb5jk$28t$1@eclipse.org...
>> >> >> >> >> > Basically, you just receive the DirectEditRequest, startup
>> >> >> >> >> > a
>> >> >> >> >> > DirectEditManager, and provide the command which performs
> the
>> >> >> >> >> > edit
>> >> >> >> >> > in
>> >> >> >> > the
>> >> >> >> >> > end. You may also provide optional feedback. See
>> >> >> >> >> > LabelDirectEditPolicy
>> >> >> >> >> > in
>> >> >> >> >> > logic example.
>> >> >> >> >> >
>> >> >> >> >> > "Swami Venkataramani" <svenkat@asu.edu> wrote in message
>> >> >> >> >> > news:cfb2kv$tmc$1@eclipse.org...
>> >> >> >> >> >> I want to be able to click on nodes and add text entries,
>> >> >> >> >> >> much
>> >> > like
>> >> >> >> > that
>> >> >> >> >> > of
>> >> >> >> >> >> a UML Class node. I understand from reading the archives
>> >> >> >> >> >> that
>> > I
>> >> >> > would
>> >> >> >> > be
>> >> >> >> >> >> using DirectEdit and CellEditor. I was wondering if there
>> >> >> >> >> >> was
>> >> > any
>> >> >> >> >> >> article
>> >> >> >> >> >> or tutorial on how I can get a start on making a node
>> > editable.
>> >> >> >> >> >>
>> >> >> >> >> >> Thanks.
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
|
|
|
Goto Forum:
Current Time: Fri Jan 24 04:51:11 GMT 2025
Powered by FUDForum. Page generated in 0.04956 seconds
|