Bug 483074 - [snipmatch][ui] Show "Create Snippet" context menu only for non-zero length selections
Summary: [snipmatch][ui] Show "Create Snippet" context menu only for non-zero length s...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Recommenders (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-26 04:23 EST by Andreas Sewe CLA
Modified: 2019-07-24 14:35 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sewe CLA 2015-11-26 04:23:05 EST
If no selection was made (i.e., the "selection" is just the cursor), "Create Snippet" doesn't do anything useful. It just produces the snippet

  ${cursor}

IMHO, we should not waste space in the already packed editor context menu.
Comment 1 Andreas Sewe CLA 2015-12-22 03:58:33 EST
The tricky think is to do this test without having to write your own PropertyTester. Using a PropertyTest seems like a straight-forward solution, but we would not want opening the context menu to always load the org.eclipse.recommenders.snipmatch.rcp bundle.

Maybe we can adapt the current selection to a String and then use not(equals("")) in our expression.
Comment 2 Andreas Sewe CLA 2015-12-22 05:17:04 EST
(In reply to Andreas Sewe from comment #1)
> Maybe we can adapt the current selection to a String and then use
> not(equals("")) in our expression.

AFAICT, ITextSelection can only be adapted to IIterable and ICountable, but in both cases it is always a one-element entity. So checking with <count> won't work.
Comment 3 Andreas Sewe CLA 2015-12-22 05:26:53 EST
Asked in the Eclipse Platform forum about this [1].

[1] <https://www.eclipse.org/forums/index.php/m/1718307/#msg_1718307>
Comment 4 Andreas Sewe CLA 2016-01-22 08:54:25 EST
Unless we find a solution for the problem mentioned in comment 1, we cannot address this issue.