jface

Jface TreeViewer add right click menu, depending on clicked node

烂漫一生 提交于 2019-12-11 22:21:53
问题 There is a good thread on how to correctly hook up a right-click menu to a Jface TreeViewer depending on the selected item. I would like to show the right click menu depending on: if the right-click was on a node or into "empty space". The problem is that TreeViewer does not automatically clear the selection if you click into empty space. Is there any clean way how to achieve this? My current approach would be to simply hook up a MouseListener to the tree with the following mouseDown method:

How to select a treeview node like a click of mouse to update properties view

白昼怎懂夜的黑 提交于 2019-12-11 19:05:39
问题 I have a custom outline in my Eclipse plug-in, implemented using class TreeViewer and I created this outline using this code: public class MyOutlinePage extends ContentOutlinePage (...) Object[] data = (...) TreeViewer treeViewer = getTreeViewer(); treeViewer.setInput(data); After set input I need to select one specific element in outline. For example, I need to select the element data[2] in the outline. Im trying to use this code to select the emelent of outline: treeViewer.setSelection(new

JFace/SWT: What is the best way to add a toolbar with Commands to a Section?

我的未来我决定 提交于 2019-12-11 13:39:39
问题 I have a Section and want to add a toolbar to it. I'm able to do it programmatically using the Actions but the requirement is to do it as much declaratively (in plugin.xml) as I can. So I'd like to define a Command and a Handler for each toolbar button but I don't know how to add them to the section's toolbar. Is there any way to do it declaratively in plugin.xml? If not, how can I do it programmatically? Thanks! 回答1: I think you would have to write your own extension point to define what

How to enable autoscroll for a StyledText Component

こ雲淡風輕ζ 提交于 2019-12-11 13:16:49
问题 I'm using StyledText component which behaves somewhat similar to the popular eclipse IDE console view, (which appends the log), but here, in my StyledText component the scroll-lock is enabled. I mean for each line appended to the StyledText , the vertical scroll bar position remains constant. Below image reflects the behavior: As an attempt I tried like this: StyledText declaration StyledText styledText = new StyledText(parent, SWT.V_SCROLL); //other relevant code here styledText.addListener

How to get ToolTip in a ListViewer in JFace?

不羁的心 提交于 2019-12-11 12:45:16
问题 This is a gridLayout in which the Available side is a Tree Viewer and The Selected side is a ListViewer. Now I have to get a toolTip on the right hand side. Which I am unable to get. I am working on a existing code base , so I am unable to figure out on which line did they add a tooltip + I did not find any keywords like tooltip or mouse Hover. Still how is this implemented. I am mentioning some code. I believe the answer should be somewhere here only. availableViewer = new TreeViewer

How to lock swt Table or Jface tableviewer scrollbar

微笑、不失礼 提交于 2019-12-11 12:31:48
问题 I have a Tableviewer in which Objects are added really fast and I need the user to be able to select certain elements. The problem is that I can't find a way to make the scrollbar stop scrolling. I just want a button, which locks the Table at the current position. Maybe you have an answer. 回答1: [Edit] : You can use Toggle Button as Eclipse console have. You need to maintain below two states of button event. table#setSelection(item) will select the last item whichever is added.( Auto Scroll )

How to Disable Horizontal Scroll bar in ComboBox in SWT

感情迁移 提交于 2019-12-11 12:13:20
问题 I have created a combo Box but I am experiencing a strange behavior, If number of Elements in my Combobox is <= 2, I am unable to see a Horizontal scroll bar. But if they are more than 2 then I see a horizontal scroll bar automatically pop up. What I would like is, to disable the horizontal scroll bar. This is the code I am using. preferredResourceCombo = Components.createCombo(controlComposite, SWT.BORDER); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData.widthHint

TransferData is null during Drag on Linux

人走茶凉 提交于 2019-12-11 12:08:27
问题 When I drag a node from Project Explorer onto TreeViewer DnD works fine on Windows, but does not work on Linux. During debugging I see that TransferData has data on Windows But does not when debug on Linux Searching for possible cause didn't reveal anything. Any ideas what could be the problem here? 来源: https://stackoverflow.com/questions/28706697/transferdata-is-null-during-drag-on-linux

CheckboxTreeViewer: Can't expand nodes by default

风格不统一 提交于 2019-12-11 08:47:45
问题 I recently implemented a CheckboxTreeViewer in my own Dialog . This works fine so far except that the tree doesn't allow me to expand nodes by default. It only works when I check the checkbox, as you can see in the following images: This is by default. As you can see, it's not possible to expand the node, though it has children: After checking the check box, it works: I already tried to use setExpandPreCheckFilters , but with no success: Composite container = (Composite) super

Hiding menu items in Jface MenuManager and TreViewer

陌路散爱 提交于 2019-12-11 07:58:40
问题 I want to hide all popup menu items when I click on any node that is not "Item1", but the items are not being hidden, why? (The manager.getItems()[i].setVisible(false) inside loop is triggered) Action a1 = new Action("XXX") {}; Action a2 = new Action("YYY") {}; Action a3 = new Action("ZZZ") {}; final MenuManager mgr = new MenuManager(); mgr.add(a1); mgr.add(a2); mgr.add(a3); mgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { IStructuredSelection