Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » GridTreeViewer
GridTreeViewer [message #36004] Mon, 04 June 2007 17:08 Go to next message
Michael Houston is currently offline Michael HoustonFriend
Messages: 2
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------010702030308040407080708
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I ran across the need to use the grid viewer as a tree, and discovered
that this wasn't possible with the provided GridViewer. I have
implemented a Tree Viewer based on the grid, which seems to work as
expected.

I've attached the source code so that anyone else who needs this can use
it (or not).

Mike.

--------------010702030308040407080708
Content-Type: text/plain;
name="GridTreeViewer.java"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="GridTreeViewer.java"

cGFja2FnZSBvcmcuZWNsaXBzZS5uZWJ1bGEuamZhY2UuZ3JpZHZpZXdlcjsN Cg0KaW1wb3J0
IGphdmEudXRpbC5MaXN0Ow0KDQppbXBvcnQgb3JnLmVjbGlwc2UuamZhY2Uu dmlld2Vycy5B
YnN0cmFjdFRyZWVWaWV3ZXI7DQppbXBvcnQgb3JnLmVjbGlwc2UuamZhY2Uu dmlld2Vycy5W
aWV3ZXJSb3c7DQppbXBvcnQgb3JnLmVjbGlwc2UubmVidWxhLmpmYWNlLmdy aWR2aWV3ZXIu
R3JpZFZpZXdlclJvdzsNCmltcG9ydCBvcmcuZWNsaXBzZS5uZWJ1bGEud2lk Z2V0cy5ncmlk
LkdyaWQ7DQppbXBvcnQgb3JnLmVjbGlwc2UubmVidWxhLndpZGdldHMuZ3Jp ZC5HcmlkSXRl
bTsNCmltcG9ydCBvcmcuZWNsaXBzZS5zd3QuU1dUOw0KaW1wb3J0IG9yZy5l Y2xpcHNlLnN3
dC5ldmVudHMuVHJlZUxpc3RlbmVyOw0KaW1wb3J0IG9yZy5lY2xpcHNlLnN3 dC53aWRnZXRz
LkNvbXBvc2l0ZTsNCmltcG9ydCBvcmcuZWNsaXBzZS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7DQoJ fQ0KDQoJQE92
ZXJyaWRlDQoJcHJvdGVjdGVkIFZpZXdlclJvdyBnZXRWaWV3ZXJSb3dGcm9t SXRlbShXaWRn
ZXQgaXRlbSkgew0KCQlpZiggY2FjaGVkUm93ID09IG51bGwgKSB7DQoJCQlj YWNoZWRSb3cg
PSBuZXcgR3JpZFZpZXdlclJvdygoR3JpZEl0ZW0pIGl0ZW0pOw0KCQl9IGVs c2Ugew0KCQkJ
Y2FjaGVkUm93LnNldEl0ZW0oKEdyaWRJdGVtKSBpdGVtKTsNCgkJfQ0KCQkN CgkJcmV0dXJu
IGNhY2hlZFJvdzsNCgl9DQoNCglAT3ZlcnJpZGUNCglwcm90ZWN0ZWQgV2lk Z2V0IGdldENv
bHVtblZpZXdlck93bmVyKGludCBjb2x1bW5JbmRleCkgew0KCQlpZiAoY29s dW1uSW5kZXgg
PCAwIHx8ICggY29sdW1uSW5kZXggPiAwICYmIGNvbHVtbkluZGV4ID49IGdl dEdyaWQoKS5n
ZXRDb2x1bW5Db3VudCgpICkgKSB7DQoJCQlyZXR1cm4gbnVsbDsNCgkJfQ0K DQoJCWlmIChn
ZXRHcmlkKCkuZ2V0Q29sdW1uQ291bnQoKSA9PSAwKS8vIEhhbmcgaXQgb2Zm IHRoZSB0YWJs
ZSBpZiBpdA0KCQkJcmV0dXJuIGdldEdyaWQoKTsNCg0KCQlyZXR1cm4gZ2V0 R3JpZCgpLmdl
dENvbHVtbihjb2x1bW5JbmRleCk7DQoJfQ0KDQoJQE92ZXJyaWRlDQoJcHJv dGVjdGVkIGlu
dCBkb0dldENvbHVtbkNvdW50KCkgew0KCQlyZXR1cm4gZ3JpZC5nZXRDb2x1 bW5Db3VudCgp
Ow0KCX0NCg0KfQ==
--------------010702030308040407080708--
Re: GridTreeViewer [message #36043 is a reply to message #36004] Tue, 05 June 2007 18:56 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6566
Registered: July 2009
Senior Member
Please file a bug and attach the code.
Re: GridTreeViewer [message #582887 is a reply to message #36004] Tue, 05 June 2007 18:56 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6566
Registered: July 2009
Senior Member
Please file a bug and attach the code.
Previous Topic:GridTreeViewer
Next Topic:Multicolumn sorting ...
Goto Forum:
  


Current Time: Thu Sep 24 05:09:15 GMT 2020

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

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

Back to the top