Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Hyperlink as tableitem in jface/swt table
Hyperlink as tableitem in jface/swt table [message #330028] Sun, 13 July 2008 18:12 Go to next message
Eclipse UserFriend
Originally posted by: zee.ali.gmail.com

Hello,

I am trying to have one column of jface table as hyperlinks. I also
have 4 other columns of normal text strings using jface
columnlabelprovider to render the text on those columns.

One of the column which I want to display as hyperlink I dont use
ColumnLabelProvider for it, instead my columnlabelprovider just retruns
empty string for it. but I use the following way to insert hyperlinks
into it.

( in a for loop){

TableItem[] tableItems = table.getItems();//get tableItems

Hyperlink link = new Hyperlink(table, SWT.WRAP);

link.setText( some text);


TableEditor editor = new TableEditor(table);
editor.setEditor(link, tableItem[n], 0);//set hyperlinks in column 0

}

The issue with above approach is that if the width of hyperlink is
longer than the column it goes into next column. Where is the desired
behaviour is that it should show ellipsis(and tool tip of hidden text)
if it goes over the width of the column. Which is the normal behaviour
of other text string columns handled by jface columnlabelprovider.

The issue is that I couldnt find any jface interface for
columnlabelprovider which would return a widget instead of string for
its string getelement() method.

Any help would be greatly appreciated.


Thanks,

Zeeshan
Re: Hyperlink as tableitem in jface/swt table [message #330037 is a reply to message #330028] Sun, 13 July 2008 21:48 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You should use an owner draw label provider and draw the text to look
like a hyperlink [1] and act on the click event with a mouse-listener or
create an editor.

Tom

[1] http://wiki.eclipse.org/JFaceSnippets#Snippet049StyledCellLa belProvider

Zeeshan Ali schrieb:
>
> Hello,
>
> I am trying to have one column of jface table as hyperlinks. I also
> have 4 other columns of normal text strings using jface
> columnlabelprovider to render the text on those columns.
>
> One of the column which I want to display as hyperlink I dont use
> ColumnLabelProvider for it, instead my columnlabelprovider just retruns
> empty string for it. but I use the following way to insert hyperlinks
> into it.
>
> ( in a for loop){
>
> TableItem[] tableItems = table.getItems();//get tableItems
>
> Hyperlink link = new Hyperlink(table, SWT.WRAP);
>
> link.setText( some text);
>
>
> TableEditor editor = new TableEditor(table);
> editor.setEditor(link, tableItem[n], 0);//set hyperlinks in column 0
>
> }
>
> The issue with above approach is that if the width of hyperlink is
> longer than the column it goes into next column. Where is the desired
> behaviour is that it should show ellipsis(and tool tip of hidden text)
> if it goes over the width of the column. Which is the normal behaviour
> of other text string columns handled by jface columnlabelprovider.
>
> The issue is that I couldnt find any jface interface for
> columnlabelprovider which would return a widget instead of string for
> its string getelement() method.
>
> Any help would be greatly appreciated.
>
>
> Thanks,
>
> Zeeshan


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Hyperlink as tableitem in jface/swt table [message #330097 is a reply to message #330037] Mon, 14 July 2008 20:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zee.ali.gmail.com

Tom Schindl wrote:
> You should use an owner draw label provider and draw the text to look
> like a hyperlink [1] and act on the click event with a mouse-listener or
> create an editor.
>
> Tom
>
> [1] http://wiki.eclipse.org/JFaceSnippets#Snippet049StyledCellLa belProvider
>
> Zeeshan Ali schrieb:
>>
>> Hello,
>>
>> I am trying to have one column of jface table as hyperlinks. I also
>> have 4 other columns of normal text strings using jface
>> columnlabelprovider to render the text on those columns.
>>
>> One of the column which I want to display as hyperlink I dont use
>> ColumnLabelProvider for it, instead my columnlabelprovider just
>> retruns empty string for it. but I use the following way to insert
>> hyperlinks into it.
>>
>> ( in a for loop){
>>
>> TableItem[] tableItems = table.getItems();//get tableItems
>>
>> Hyperlink link = new Hyperlink(table, SWT.WRAP);
>>
>> link.setText( some text);
>>
>>
>> TableEditor editor = new TableEditor(table);
>> editor.setEditor(link, tableItem[n], 0);//set hyperlinks in column 0
>>
>> }
>>
>> The issue with above approach is that if the width of hyperlink is
>> longer than the column it goes into next column. Where is the desired
>> behaviour is that it should show ellipsis(and tool tip of hidden text)
>> if it goes over the width of the column. Which is the normal behaviour
>> of other text string columns handled by jface columnlabelprovider.
>>
>> The issue is that I couldnt find any jface interface for
>> columnlabelprovider which would return a widget instead of string for
>> its string getelement() method.
>>
>> Any help would be greatly appreciated.
>>
>>
>> Thanks,
>>
>> Zeeshan
>
>

Thanks for your reply/advice. I will try that and update this posting to
let everyone know how did that go.
Re: Hyperlink as tableitem in jface/swt table [message #330099 is a reply to message #330037] Mon, 14 July 2008 23:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zee.ali.gmail.com

Tom Schindl wrote:
> You should use an owner draw label provider and draw the text to look
> like a hyperlink [1] and act on the click event with a mouse-listener or
> create an editor.
>
> Tom
>
> [1] http://wiki.eclipse.org/JFaceSnippets#Snippet049StyledCellLa belProvider
>
> Zeeshan Ali schrieb:
>>
>> Hello,
>>
>> I am trying to have one column of jface table as hyperlinks. I also
>> have 4 other columns of normal text strings using jface
>> columnlabelprovider to render the text on those columns.
>>
>> One of the column which I want to display as hyperlink I dont use
>> ColumnLabelProvider for it, instead my columnlabelprovider just
>> retruns empty string for it. but I use the following way to insert
>> hyperlinks into it.
>>
>> ( in a for loop){
>>
>> TableItem[] tableItems = table.getItems();//get tableItems
>>
>> Hyperlink link = new Hyperlink(table, SWT.WRAP);
>>
>> link.setText( some text);
>>
>>
>> TableEditor editor = new TableEditor(table);
>> editor.setEditor(link, tableItem[n], 0);//set hyperlinks in column 0
>>
>> }
>>
>> The issue with above approach is that if the width of hyperlink is
>> longer than the column it goes into next column. Where is the desired
>> behaviour is that it should show ellipsis(and tool tip of hidden text)
>> if it goes over the width of the column. Which is the normal behaviour
>> of other text string columns handled by jface columnlabelprovider.
>>
>> The issue is that I couldnt find any jface interface for
>> columnlabelprovider which would return a widget instead of string for
>> its string getelement() method.
>>
>> Any help would be greatly appreciated.
>>
>>
>> Thanks,
>>
>> Zeeshan
>
>

Thanks for your reply/advice. I will try that and update this posting to
let everyone know how did that go.
Re: Hyperlink as tableitem in jface/swt table [message #330104 is a reply to message #330099] Tue, 15 July 2008 08:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
If you have a small snippet I'd add it to our collection. It was not the
first time this Hyperlink-Question was asked.

Tom

Zeeshan Ali schrieb:
> Tom Schindl wrote:
>> You should use an owner draw label provider and draw the text to look
>> like a hyperlink [1] and act on the click event with a mouse-listener
>> or create an editor.
>>
>> Tom
>>
>> [1] http://wiki.eclipse.org/JFaceSnippets#Snippet049StyledCellLa belProvider
>>
>>
>> Zeeshan Ali schrieb:
>>>
>>> Hello,
>>>
>>> I am trying to have one column of jface table as hyperlinks. I also
>>> have 4 other columns of normal text strings using jface
>>> columnlabelprovider to render the text on those columns.
>>>
>>> One of the column which I want to display as hyperlink I dont use
>>> ColumnLabelProvider for it, instead my columnlabelprovider just
>>> retruns empty string for it. but I use the following way to insert
>>> hyperlinks into it.
>>>
>>> ( in a for loop){
>>>
>>> TableItem[] tableItems = table.getItems();//get tableItems
>>>
>>> Hyperlink link = new Hyperlink(table, SWT.WRAP);
>>>
>>> link.setText( some text);
>>>
>>>
>>> TableEditor editor = new TableEditor(table);
>>> editor.setEditor(link, tableItem[n], 0);//set hyperlinks in column 0
>>>
>>> }
>>>
>>> The issue with above approach is that if the width of hyperlink is
>>> longer than the column it goes into next column. Where is the desired
>>> behaviour is that it should show ellipsis(and tool tip of hidden
>>> text) if it goes over the width of the column. Which is the normal
>>> behaviour of other text string columns handled by jface
>>> columnlabelprovider.
>>>
>>> The issue is that I couldnt find any jface interface for
>>> columnlabelprovider which would return a widget instead of string for
>>> its string getelement() method.
>>>
>>> Any help would be greatly appreciated.
>>>
>>>
>>> Thanks,
>>>
>>> Zeeshan
>>
>>
>
> Thanks for your reply/advice. I will try that and update this posting to
> let everyone know how did that go.


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Hyperlink as tableitem in jface/swt table [message #330141 is a reply to message #330037] Wed, 16 July 2008 18:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zee.ali.gmail.com

Thanks for your reply/suggestion. I will try this and post it here how
it goes.

Tom Schindl wrote:
> You should use an owner draw label provider and draw the text to look
> like a hyperlink [1] and act on the click event with a mouse-listener or
> create an editor.
>
> Tom
>
> [1] http://wiki.eclipse.org/JFaceSnippets#Snippet049StyledCellLa belProvider
>
> Zeeshan Ali schrieb:
>>
>> Hello,
>>
>> I am trying to have one column of jface table as hyperlinks. I also
>> have 4 other columns of normal text strings using jface
>> columnlabelprovider to render the text on those columns.
>>
>> One of the column which I want to display as hyperlink I dont use
>> ColumnLabelProvider for it, instead my columnlabelprovider just
>> retruns empty string for it. but I use the following way to insert
>> hyperlinks into it.
>>
>> ( in a for loop){
>>
>> TableItem[] tableItems = table.getItems();//get tableItems
>>
>> Hyperlink link = new Hyperlink(table, SWT.WRAP);
>>
>> link.setText( some text);
>>
>>
>> TableEditor editor = new TableEditor(table);
>> editor.setEditor(link, tableItem[n], 0);//set hyperlinks in column 0
>>
>> }
>>
>> The issue with above approach is that if the width of hyperlink is
>> longer than the column it goes into next column. Where is the desired
>> behaviour is that it should show ellipsis(and tool tip of hidden text)
>> if it goes over the width of the column. Which is the normal behaviour
>> of other text string columns handled by jface columnlabelprovider.
>>
>> The issue is that I couldnt find any jface interface for
>> columnlabelprovider which would return a widget instead of string for
>> its string getelement() method.
>>
>> Any help would be greatly appreciated.
>>
>>
>> Thanks,
>>
>> Zeeshan
>
>
Re: Hyperlink as tableitem in jface/swt table [message #330142 is a reply to message #330104] Wed, 16 July 2008 18:13 Go to previous message
Eclipse UserFriend
Originally posted by: zee.ali.gmail.com

It will be a while till I implement it, for now my manager is happy with
a workaround of resizing the table column, which I did, but once I have
time eventually I will have to try your suggestion. Could be few months
before I try your suggestion.

Tom Schindl wrote:
> If you have a small snippet I'd add it to our collection. It was not the
> first time this Hyperlink-Question was asked.
>
> Tom
>
> Zeeshan Ali schrieb:
>> Tom Schindl wrote:
>>> You should use an owner draw label provider and draw the text to look
>>> like a hyperlink [1] and act on the click event with a mouse-listener
>>> or create an editor.
>>>
>>> Tom
>>>
>>> [1] http://wiki.eclipse.org/JFaceSnippets#Snippet049StyledCellLa belProvider
>>>
>>>
>>> Zeeshan Ali schrieb:
>>>>
>>>> Hello,
>>>>
>>>> I am trying to have one column of jface table as hyperlinks. I also
>>>> have 4 other columns of normal text strings using jface
>>>> columnlabelprovider to render the text on those columns.
>>>>
>>>> One of the column which I want to display as hyperlink I dont use
>>>> ColumnLabelProvider for it, instead my columnlabelprovider just
>>>> retruns empty string for it. but I use the following way to insert
>>>> hyperlinks into it.
>>>>
>>>> ( in a for loop){
>>>>
>>>> TableItem[] tableItems = table.getItems();//get tableItems
>>>>
>>>> Hyperlink link = new Hyperlink(table, SWT.WRAP);
>>>>
>>>> link.setText( some text);
>>>>
>>>>
>>>> TableEditor editor = new TableEditor(table);
>>>> editor.setEditor(link, tableItem[n], 0);//set hyperlinks in column 0
>>>>
>>>> }
>>>>
>>>> The issue with above approach is that if the width of hyperlink is
>>>> longer than the column it goes into next column. Where is the
>>>> desired behaviour is that it should show ellipsis(and tool tip of
>>>> hidden text) if it goes over the width of the column. Which is the
>>>> normal behaviour of other text string columns handled by jface
>>>> columnlabelprovider.
>>>>
>>>> The issue is that I couldnt find any jface interface for
>>>> columnlabelprovider which would return a widget instead of string
>>>> for its string getelement() method.
>>>>
>>>> Any help would be greatly appreciated.
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Zeeshan
>>>
>>>
>>
>> Thanks for your reply/advice. I will try that and update this posting to
>> let everyone know how did that go.
>
>
Previous Topic:Handling passwords in CVS EFS
Next Topic:ID of default font for TableViewers
Goto Forum:
  


Current Time: Wed Jul 17 12:25:45 GMT 2024

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

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

Back to the top