I am new to plugin development using eclipse with RCP and Java. I am developing a plugin for a email Client software.
I am trying to find users clicks on target platform, whether it is clicked on texts or hyperlinks using my plugin code.
As of now, I am getting the clicked object as follows,
IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().getActivePart()
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
System.out.println(selection .toString());
But this shows only same thing for all the clicks even though it is text or links.
Can anyone assist here on how to differentiate these.
Thanks in advance.
The selection returned by the part selection provider gives you the selected object in whatever model the current part is using. So if the part is showing a list of files the selection might be the file.
The selection does not tell you anything about the UI the part is using or what caused the selection to happen.
Eclipse does not provide a general API to determine what happened to cause the selection. Some individual parts may provide a specialized API but this is not common.
Related
I am currently using a bunch of eclipse, jface libraries to build a small editor. I am using eclipse's SourceViewer for it. I am trying to highlight/change the color of parts of my code in eclipse however I don't think I can use the concept of damager, repairer and PresentationReconciler because I want to highlight lines of code based on user selection. So if a user selects some code I can get the selected code by using
SourceViewer.getSelectionProvider().getSelection();
Which would return an ISelection and thats what I want to "Highlight". I am currently able to create Annotations which essentially creates squigglies under the text the user selects I would rather change the color of the selected text. Would much appreciate any help.
edit:
I am not developing as an eclipse plugin but as a standalone application using the plugin api's.
If I use eclipse and right click on a part of Java source code, the context menu depends on the syntactic element the user clicks on (like: a method, a variable,...).
How can I implement this kind of behaviour in my own eclipse plugin, e.g. add an item to the context menu only if the user clicks on a method in Java source code. Furthermore, the plugin needs to know which method the user clicks on.
I guess I have to relate the clicking position to the abstract syntax tree that eclipse builds but I have no idea how to do that.
You do this with Eclipse Commands and you can enable them and change their visibility in many ways, depending on selection, global state, etc.
I guess I have to relate the clicking position to the abstract syntax
tree that eclipse builds but I have no idea how to do that.
The good news is you (generally) don't have to do that, Eclipse has done all that heavy lifting for you.
It is quite a broad subject, so I suggest working through some tutorials on Commands first:
Adding menus, toolbar and popup menus to the Eclipse IDE - Tutorial
Eclipse Commands Advanced - Tutorial
I've been trying develop my custom plugin for Eclipse, and basically I want to make is a "richer" version on the current TextHover. I don't know what widget(?) Eclipse uses to display the hovering text, but I want to use something different, like SWT Image or SWT Browser.
Most of the tutorials that I've read suggest that I have to implement my own Java Editor to do this, but I don't want the user to switch to my custom editor just for a simple feature (and I don't want to implement a whole editor).
Some Tests:
I've already created two Eclipse Plugin Projects. The first one is a extension for the JavaEditorTextHovers, and with this project I managed to show some custom Strings when hovering some random texts, but wasn't able to change the hover appearance. The second project was a editor plugin. With this last one I managed to get a Browser to appear when hovering a random text(this tutorial helped me), but again, this editor had nothing, no syntax coloring, no rules, etc., and for the previous reasons, I couldn't accept this has a solution.
Maybe if there was way to change the (or set a new) SourceViewerConfiguration of the current editor I could pass my custom SourceViewerConfiguration, but I'm not sure if this is possible.
I am a newbie to eclipse plugin development. I want to implement a plugin that when selected opens a sidebar in the workbench. The sidebar should contain a search text box whose input is captured by the plugin and the output based on that is displayed below the text box.
I shall be grateful to anyone who can provide me with directions on how to get started and set up to implement such a plugin in the eclipse workbench, like what are the extensions I'll need to implement etc.
Thanks!
This book is the standard reference: http://www.amazon.com/Eclipse-Plug-ins-3rd-Eric-Clayberg/dp/0321553462
you probably want to implement a (sticky) view. And this should help get started http://www.eclipse.org/articles/viewArticle/ViewArticle2.html
Once you are sure about it let you more specific questions come.
A coworker has been struggling with this problem.
The desired result is an installable plugin for Notes that will add a button emails with attachments that will let users save the attachment to a document management system.
Finding documentation on doing this for Notes has been an uphill battle to say the least.
Writing the actual java to do the work isn't a problem, but figuring out how to extend Notes is.
So, is there a way to add a button/icon to the toolbar, or is it just a matter of adding a new toolbar? If we add a new toolbar then can we make it only visible (or just grey it out otherwise) when no email is open?
Both Lotus Notes 8+ and Lotus Symphony use the IBM Lotus Expeditor Toolkit.
If you get the Lotus Symphony SDK here.
Their are one or two examples dealing with adding button's to the symphony toolbar.
They should translate almost identically to Notes.
Good Luck,
Brian Gianforcaro
I had to do this once in Notes for a plugin I was developing. What I ended up doing was editing the Notes template in the designer, and then writing some LotusScript behind it that called a .NET class via a DLL. So when you clicked the button, it triggered the event in the LotusScript, and then called the DLL, and passed the item information to it.
I should also note that it was a freakin' bear to figure out because Notes documentation is terrible.
Depending on what access you have to the system the task can be fairly easy. Typically you customize your mail template to include a button in the inbox folder and the all documents view (for safety precautions see this entry). You customize ($Inbox) ($All) if you want to have the buttons only on the view level or additionaly the forms (there is a shared header subform you can use.
Give the button a meaningful label and add this code:
#Command([ToolsRunMacro];"(ExportDocumentsTo[yourSystemNameHere])")
The round brackets are actually important. Your code (Java I presume) the goes into an agent. You select "Create Agent" and Java as language. You specify "selected documents" to run against and agent list selection as trigger (this puts the () around your name). You can can get them from the Session class.
If your users are ok using a menu instead of a button you can simply select Action list as trigger and the agent will be listed in the action menu.
From your question I gather you want this for the Eclipse client. Please peruse Mikkel Heisterberg's site LekkimWorld.com
It contains tons of material. Start by reading his presentations and search the site. It has a lot of useful material.