Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to write an Eclipse plugin
How to write an Eclipse plugin [message #1729150] Mon, 11 April 2016 14:20 Go to next message
Kauan Klein is currently offline Kauan KleinFriend
Messages: 8
Registered: April 2016
Location: Brazil, RJ, Petrópolis
Junior Member
Hello, I'm new to the forum. I've been using eclipse for some time, though.

I have a plan to implement a few Java annotations that would check things like immutability and out parameters. My first intuition was to write a standalone application but I have no idea of how to check an entire project and it's dependencies

So my doubts are:

Which languages can I use to write a plugin?

Is the following list of actions possible to be achieved by a plugin:


  1. invoke the Build action to report build errors (without actually generating any output would be ideal, but not a requirement).

  2. if the Build action succeed, run my plugin as a "compiler" of sorts. It wont compile, only perform syntatic and semantic analysis and emit errors regarding my annotations.

  3. if my plugin analysis passes, invoke Build for real this time, otherwise just output to the user what is wrong.


Can it be done?
Re: How to write an Eclipse plugin [message #1729210 is a reply to message #1729150] Tue, 12 April 2016 08:33 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
On 11-Apr-16 16:51, Kauan Klein wrote:
> Hello, I'm new to the forum. I've been using eclipse for some time, though.
>
> I have a plan to implement a few Java annotations that would check
> things like immutability and out parameters. My first intuition was to
> write a standalone application but I have no idea of how to check an
> entire project and it's dependencies
>
> So my doubts are:
>
> Which languages can I use to write a plugin?

Java is the obvious choice..

> Is the following list of actions possible to be achieved by a plugin:
>
>
> invoke the Build action to report build errors (without actually
> generating any output would be ideal, but not a requirement).
>
> if the Build action succeed, run my plugin as a "compiler" of sorts. It
> wont compile, only perform syntatic and semantic analysis and emit
> errors regarding my annotations.
>
> if my plugin analysis passes, invoke Build for real this time, otherwise
> just output to the user what is wrong.
>
>
> Can it be done?
>
Yes. First look at eclipse plugin tutorials, I don't have a favourite.
Then maybe you could get along with
https://eclipse.org/articles/Article-Builders/builders.html
Re: How to write an Eclipse plugin [message #1729376 is a reply to message #1729210] Wed, 13 April 2016 13:24 Go to previous messageGo to next message
Kauan Klein is currently offline Kauan KleinFriend
Messages: 8
Registered: April 2016
Location: Brazil, RJ, Petrópolis
Junior Member
How do I log messagers for the user? How do I know my plugin is in use?

My plugin's console shows this when I start a Runtime eclipse on top of my normal workbench:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://540.fwk101601906:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://540.fwk101601906:2/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
!SESSION 2016-04-13 10:54:00.955 -----------------------------------------------
eclipse.buildId=4.5.2.M20160212-1500
java.version=1.8.0_77
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pt_BR
Framework arguments: -product org.eclipse.platform.ide
Command-line arguments: -product org.eclipse.platform.ide -data C:\Users\Starless\Documents\Nova pasta/../runtime-EclipseApplication -dev file:C:/Users/Starless/Documents/Nova pasta/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.egit.ui 2 0 2016-04-13 10:54:07.321
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Starless'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

This is my plugin code (mostly auto generated)

https://github.com/Starless2001/Plugin-for-Eclipse

[Updated on: Wed, 13 April 2016 16:12]

Report message to a moderator

Re: How to write an Eclipse plugin [message #1729439 is a reply to message #1729376] Thu, 14 April 2016 08:06 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
On 13-Apr-16 15:24, Kauan Klein wrote:
> How do I log messagers for the user?

Several possible ways:
- Builders usually use markers, see
https://www.eclipse.org/articles/Article-Mark%20My%20Words/mark-my-words.html
- Then there is the error log
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-error_log_view.htm
- There is also the console
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fviews%2Fconsole%2Fref-console_view.htm

> How do I know my plugin is in use?
Define 'in use'.
Re: How to write an Eclipse plugin [message #1729513 is a reply to message #1729439] Thu, 14 April 2016 23:20 Go to previous messageGo to next message
Kauan Klein is currently offline Kauan KleinFriend
Messages: 8
Registered: April 2016
Location: Brazil, RJ, Petrópolis
Junior Member
When I run the runtime eclipse application, how do I know it is being built using my plugin?
Re: How to write an Eclipse plugin [message #1729546 is a reply to message #1729513] Fri, 15 April 2016 09:55 Go to previous message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
Kauan Klein wrote on Fri, 15 April 2016 02:20
When I run the runtime eclipse application, how do I know it is being built using my plugin?


Are you intending to invoice based on your plugin use?
It is not in accordance of the Eclipse philosophy.

You can see if the plugin is in your Eclipse by Help -> Installation Details -> Plug-ins.

Please note that the plug-in is dynamically added in, the base Eclipse needs not be built with it. Please read the Eclipse platform documentation.


--

Tauno Voipio
Previous Topic:Eclipse starts in debug mode
Next Topic:Trouble getting Eclipse to run
Goto Forum:
  


Current Time: Tue Apr 16 20:49:39 GMT 2024

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

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

Back to the top