of course thanks. i've got the last problem i think. you said "
Or you may choose to create an ISystemViewElementAdapter
for your object.". yes i need to do this but there are 63 methods to implement for
ISystemViewElementAdapter. is there any shortcut to create a connection like
---------------------------------
host = registry.createHost(
"SSH
Only",
//System
Type Name //$NON-NLS-1$
hostName, //Connection
name
hostName, //IP
Address
"Connection
to Eclipse build site"); //description
//$NON-NLS-1$---------------------------------------
but IHost is not what we want, is it?
i tried to let my tree node model class extend SystemViewConnectionAdapter. but it does not seem to work and i never run into this bracket:
--------------------------------------
{
result.setPropertySourceInput(object);
result.setViewer(_view);
return
result;
}
--------------------------------------
please let me know what you would do here! regard,wei.
----- Original Message ----
From: David McKnight <dmcknigh@xxxxxxxxxx>
To: Wei Zhang <zhangwei_2000_2000@xxxxxxxxx>
Cc: Target Management developer discussions <dsdp-tm-dev@xxxxxxxxxxx>; "Oberhuber, Martin" <Martin.Oberhuber@xxxxxxxxxxxxx>
Sent: Thursday, March 22, 2007 5:25:50 PM
Subject: Re: [dsdp-tm-dev] create rse connections programmatically.
With your own view, you probably already
have a content provider and a label provider. If you want to reuse
the existing RSE model objects (i.e. connections, subsystems, filters,
etc) there are adapters that can help out the provider. The interface
that these adapters implement is ISystemViewElementAdapter. The interface
has code to allow for getting the icon, label and children of a particular
node, as well as other things, such as action contributions and properties.
The reason I point to the ScratchpadViewProvider,
is that it's a good example of a content and label provider that makes
use of the ISystemViewelementAdapter. Here's code from the provider
that allows you to get at a ISystemViewElementAdapter from a model object:
protected
ISystemViewElementAdapter getAdapterFor(Object object)
{
if
(object instanceof
IContextObject)
{
object
= ((IContextObject)object).getModelObject();
}
if
(object instanceof
IAdaptable)
{
IAdaptable adapt = (IAdaptable)
object;
ISystemViewElementAdapter
result = (ISystemViewElementAdapter) adapt.getAdapter(ISystemViewElementAdapter.class);
if
(result != null)
{
result.setPropertySourceInput(object);
result.setViewer(_view);
return
result;
}
}
return
null;
}
Once you have a way to get at the adapter,
you can use it to implement the methods of the content provider and label
provider as follows:
public
boolean
hasChildren(Object object)
{
ISystemViewElementAdapter adapter = getAdapterFor(object);
if
(adapter != null)
{
if
(object instanceof
IContextObject)
{
return
adapter.hasChildren((IContextObject)object);
}
else
{
return
adapter.hasChildren((IAdaptable)object);
}
}
...
return
false;
}
public
Object[] getChildren(Object object)
{
return
getElements(object);
}
public
Object[] getElements(Object object)
{
Object[] results = null;
Object element = object;
if
(object instanceof
IContextObject)
{
element = ((IContextObject)object).getModelObject();
}
if
(element instanceof
IAdaptable)
{
ISystemViewElementAdapter
adapter = getAdapterFor(element);
if
(adapter != null
&& adapter.hasChildren((IAdaptable)element))
{
if
(object instanceof
IContextObject)
{
results = adapter.getChildren(new
NullProgressMonitor(), (IContextObject)object);
}
else
{
results = adapter.getChildren(new
NullProgressMonitor(), (IAdaptable)object);
}
}
...
}
if
(results == null)
{
return
new
Object[0];
}
return
results;
}
public
String getText(Object object)
{
ISystemViewElementAdapter adapter = getAdapterFor(object);
if
(adapter != null)
{
return
adapter.getText(object);
}
...
return
object.toString();
}
public
Image getImage(Object object)
{
Image image = null;
ISystemViewElementAdapter adapter = getAdapterFor(object);
if
(adapter != null)
{
ImageDescriptor
descriptor = adapter.getImageDescriptor(object);
if
(descriptor != null)
{
Object iobj = imageTable.get(descriptor);
if
(iobj == null)
{
image
= descriptor.createImage();
imageTable.put(descriptor,
image);
}
else
{
image
= (Image) iobj;
}
}
return
image;
}
...
return
null;
}
Once you have the content provider setup
properly, then you just need to make sure you populate the initial nodes
of the tree as you wish (wiht you connection folder objects). You
might either hardcode the provider to deal with your objects:
if (object instanceof MyConnectionFolder)
{
...
}
Or you may choose to create an ISystemViewElementAdapter
for your object.
Does this help?
____________________________________
David McKnight
Phone: 905-413-3902 , T/L: 969-3902
Internet: dmcknigh@xxxxxxxxxx
Mail: D1/YFY/8200/TOR
____________________________________
Wei Zhang <zhangwei_2000_2000@xxxxxxxxx>
22/03/2007 11:29 AM
|
To
| David McKnight/Toronto/IBM@IBMCA, "Oberhuber,
Martin" <Martin.Oberhuber@xxxxxxxxxxxxx>
|
cc
| Target Management developer discussions
<dsdp-tm-dev@xxxxxxxxxxx>
|
Subject
| Re: [dsdp-tm-dev] create rse connections
programmatically. |
|
hi, now i'll have to do this alone. could
you please explain your mail below a little bit more in detail? regard,wei.
----- Original Message ----
From: David McKnight <dmcknigh@xxxxxxxxxx>
To: "Oberhuber, Martin" <Martin.Oberhuber@xxxxxxxxxxxxx>
Cc: Target Management developer discussions <dsdp-tm-dev@xxxxxxxxxxx>;
Wei Zhang <zhangwei_2000_2000@xxxxxxxxx>
Sent: Wednesday, March 21, 2007 6:41:34 PM
Subject: RE: [dsdp-tm-dev] create rse connections programmatically.
Hi Wei,
For what you want to do, the current Remote Systems view will not work.
You could write your own view and reuse much of the RSE functionality.
In particular, you could have the label and content provider make
use of the SystemView adapters for the RSE model objects which you use.
For a simple example, you could take a look at: SystemScratchpadViewProvider.
This is what the scratchpad view does to display the same sorts
of things that the Remote Systems view displays. In this case, you'd
need to provide a new model object for these "connection folders"
as well as it's corresponding adapter.
____________________________________
David McKnight
Phone: 905-413-3902 , T/L: 969-3902
Internet: dmcknigh@xxxxxxxxxx
Mail: D1/YFY/8200/TOR
____________________________________
"Oberhuber, Martin"
<Martin.Oberhuber@xxxxxxxxxxxxx>
21/03/2007 01:21 PM
|
To
| "Wei Zhang" <zhangwei_2000_2000@xxxxxxxxx>,
David McKnight/Toronto/IBM@IBMCA
|
cc
| "Target Management developer discussions"
<dsdp-tm-dev@xxxxxxxxxxx>
|
Subject
| RE: [dsdp-tm-dev] create rse connections
programmatically. |
|
Hello Wei,
I'm afraid that what you want to do is not possible
with our official API. It may be possible by deriving
from RSE SystemView, and implementing a custom
SystemViewContentProvider.
I'm copying the dsdp-tm-dev list. Please CC the list
for all such kinds of requests, since there might be
others who know the answer better than any individual.
DaveM, can you help?
Thanks,
--
Martin Oberhuber
Wind River Systems, Inc.
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
> -----Original Message-----
> From: Wei Zhang [mailto:zhangwei_2000_2000@xxxxxxxxx]
> Sent: Wednesday, March 21, 2007 5:52 PM
> To: Oberhuber, Martin
> Subject: Re: [dsdp-tm-dev] create rse connections programmatically.
>
> thanks martin,
>
> my task is a little bit more than my last question. i should
> customize rse primary
>
Remote Systems view so that it
> contains nothing but a tree structure and have connections as
> end tree nodes:
>
> -folder
> -folder1
> -connection1
> -files
> -shells
> -connection2
> -files
>
> -shells
> -folder2
> -connection3
> -files
>
> -shells
>
> is it possible?
> regard,wei.
> ps: sorry, i'm quite new in plugin world.
>
>
>
> ----- Original Message ----
> From: "Oberhuber, Martin" <Martin.Oberhuber@xxxxxxxxxxxxx>
> To: Target Management developer discussions <dsdp-tm-dev@xxxxxxxxxxx>
> Sent: Wednesday, March 21, 2007 4:16:56 PM
> Subject: RE: [dsdp-tm-dev] create rse connections programmatically.
>
> Hello Wei,
>
> exactly this question was answered by the TM Tutorial
> at this year's EclipseCon. Tutorial materials as well
> as sample code are available. See
>
> http://wiki.eclipse.org/index.php/TM_and_RSE_FAQ#How_can_I_lea
> rn_program
> ming_with_RSE.3F
>
> Cheers,
> --
> Martin Oberhuber
> Wind River Systems, Inc.
> Target Management Project Lead, DSDP PMC Member
> http://www.eclipse.org/dsdp/tm
>
> > -----Original Message-----
> > From: dsdp-tm-dev-bounces@xxxxxxxxxxx
> > [mailto:dsdp-tm-dev-bounces@xxxxxxxxxxx] On Behalf Of Wei Zhang
> > Sent: Wednesday, March 21, 2007 4:09 PM
> > To: dsdp-tm-dev@xxxxxxxxxxx
> > Subject: [dsdp-tm-dev] create rse connections programmatically.
> >
> > hello there,
> >
> > i would like to extend rse and generate connections in rse
> > prospective programmatically. could anybody tell me how?
> >
> > regard,wei.
> >
> >
> >
> >
> > ______________________________________________________________
> > ______________________
> > Food fight? Enjoy some healthy debate
> > in the Yahoo! Answers Food & Drink Q&A.
> > http://answers.yahoo.com/dir/?link=list&sid=396545367
> > _______________________________________________
> > dsdp-tm-dev mailing list
> > dsdp-tm-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/dsdp-tm-dev
> >
> _______________________________________________
> dsdp-tm-dev mailing list
> dsdp-tm-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dsdp-tm-dev
>
>
>
>
>
>
> ______________________________________________________________
> ______________________
> It's here! Your new message!
> Get new email alerts with the free Yahoo! Toolbar.
> http://tools.search.yahoo.com/toolbar/features/mail/
>
Sucker-punch
spam with award-winning protection.
Try the free
Yahoo! Mail Beta.
Don't get soaked. Take a