Writing build.gradle in Eclipse - eclipse

I want to write build.gradle in Eclipse and I need following support for that.
I need to write proper Groovy code to handle the complete build system and to deal with a certain file editing part. I want a support in eclipse which will show me all the methods available in dropdown for a particular class after typing classobject (methods dropdown). I want it to be the way it supports for Java programs.
I tried to add a couple of plugins in Eclipse, but they are not providing me this dropdown support. What plugin would work for this?

Related

Netbeans + Codename One - Avoid importing packages or classes not suitable for CN1

I'm using Netbeans IDE. It's quite annoying and it's a cause of errors the import of Java packages and/or classes that are not provided by Codename One. (Codename One use its own implementation of a subset of Java8 and it cannot support the full Java API).
For example, sometimes Netbeans imports automatically wrong packages (such as "java.awt.BorderLayout" instead of "com.codename1.ui.layouts.BorderLayout"), other times it shows me methods and Javadocs that are not available in Codename One.
Is it possible to force Netbeans to show me only packages, classes, methods and javadocs that are supported by Codename One? It could be useful to avoid errors.
We'd love to but unfortunately the only way NetBeans allows you to do that is if you build your own Java language package. That's what some other plugins like NBAndroid did AFAIK but when we implemented the plugin we didn't want to create something too complex.
If NetBeans supported a "bootclasspath" option for the JDK it would have solved everything. It does have support for plugging in an alternative JDK which can be a micro-profile but because we don't comply with the micro-profile spec I'm not sure if that will work.
At times, NetBeans suggests to import more than one package from the drop-down list. When you check carefully before pressing ENTER this might avoid importing the wrong package.
I use NetBeans for quite a while with CN1 and faced the same problem at the beginning.

Eclipse RCP Obfuscation

I have built a Eclipse RCP Application and packaged with Maven/Tycho and everything works fine. Now, I want to protect my code and want to obfuscate it.
Here are the list of questions :-
Which free tool to use for Obfuscating RCP application?? I tried
Proguard, but stuck with the configuration file and not able to run
Obfuscation. Unfortunately, I dont have sample Eclipse RCP Proguard
Config file.
When should the obfuscation be done?? After the
complete Maven Install of application or when the application is
packaging.
I have tried all possible Google solutions but in vein. Appreciate if any one could be of help.
Regards,
SDS.
Which free tool to use for Obfuscating RCP application
There are some existing plugins you can search in marketplace which help in Obfuscating for example:
https://marketplace.eclipse.org/content/stringer-java-obfuscator
https://marketplace.eclipse.org/content/java-antidecompiler
When should the obfuscation be done??
I have used Obfuscating my RCP application when I do not want to show my package name, method name while extracting code, the objective behind was that we have write down a very specific tool which had some genius and patent code and we do not want to make it free. Simply, in case when you do not want to show your logic.
Approach:
We did in a way that all package names and method names will appear like "OOOOOMMEEOOOOOOOOO" or "EEEEEXXXXXOOOOXX" while extracting or decompiling. you can also write your own logic to replicate specifically what you need and what you target.
It would be good which API or part of code or jar you want to Obfuscating, in my case, RCP application was combination of four applications and we did Obfuscating for our patent code jar only.
You can also refer this:
https://rcpquickstart.wordpress.com/2007/06/22/obfuscating-an-rcp-application/

Customizing UI elements in Eclipse default Java Editor via plugin

I'm trying to develop a plugin for Eclipse that will allow me to modify various elements within the default java text editor. I've found lots of tutorials for creating my own text editor for a different language, but nothing for editing the default java editor. Specifically, I want to be able to run a command and highlight certain areas of the code based on a different program. How do I develop this?
Thanks
You will need to implement your own type of markers and maybe associate annotations with them. Then you can associate the java editor with the annotations to show them. Your application will generate the markers.
Specifically you might want to start to read about org.eclipse.core.resources.marker extension point and IResource.createMarker() to create the markers.
Its doable. You need to find the right extension point that allows you to add functionality to the java editor.
See IBM tutorial. The example with the heading "How do you analyze Java code to apply modifications" seems to be what you want to do.

Two Eclispse projects -> One Eclipse Plug-in

Background
I'm a developer of the Vrapper project.
Vrapper contains of 2 major parts
Vim-emulation library (vrapper.core)
Eclipse part that makes a good use of it
We want vrapper.core to be Eclipse-unaware, so it's reusable
outside of the Eclipse. Currently, we can "vrap" all sorts of Eclipse
text editors and our little mock text editor that we use for unit testing.
vrapper.core implements all sorts of Vim commands, modes, etc.
Those all communicate with Platform - an interface that abstracts out
underlying stuff (text editor, clipboards, settings system, etc.).
When mode is created for an editor it asks platform if there are extra
commands that are approperiate for underlying editor, currently edited file type, etc.
EclipsePlatform provides those commands using Eclipse extension points mechanism.
So, let's consider the following projects (there are more):
vrapper.core - Eclipse-independent code for Vrapper
vrapper.eclipse - Eclipse plug-in that depends on vrapper.core
surround.core - Eclipse-independent code that emulates surround.vim (Vim plug-in)
surround.eclipse - Eclipse fragment for vrapper.eclipse
that makes it provide commands form surround.core.
There are two ways we can deal with those:
One plug-in to rule them all
This is how it should look like from Eclipse's perspective.
There is one plug-in that contains code from vrapper.eclipse and vrapper.core,
and one fragment that contains code from surround.core and surround.eclipse.
Many plug-ins
There are 3 plug-ins
two OSGified libraries vrapper.core, surround.core
vrapper.eclipse
surround.eclipse fragment depends on vrapper.core in this case
Problems
Many plug-ins solution have some issues with lazy class loading that I don't understand.
It's beacause when instances of modes from vrapper.core are created they need
classes from surround.core to be created (via vrapper.eclipse -> surround.eclipse).
This works if you run stuff from Eclipse and select all plug-ins from run configuration,
but if one deploys features & plugins and run eclipse normally an exception is thrown
because classes from surround.core cannot be found.
It's something in the spirit of surround.core asking for extra commands from
dependent plug-ins creates implicit circular dependencies.
What I mean by implicit dependencies is that no core class depends on eclipse-specific classes in compile time.
Modes (like vim normal mode) are core classes. They contain commands. There are some commands specific for particular Eclipse editors (like run this JDT-specific refactoring). Those commands implement core interfaces, but their code (obviously) lives in eclipse-specific projects. When mode is created it asks underlying platform for some extra commands - those extra commands are implemented in eclipse plug-ins. This is when lazy class loading in eclipse make everything blow up in runtime - classes for extra commands are referenced by extension points, but they are not yet loaded. Boom, exception.
I tried to work this around by using "one plug-in to rule them all" approach.
Having just one plug-in seems to be much better solution to me, but I couldn't make it work cleanly.
Only thing that succeeded for me was quite an ugly hack.
All .core projects had an Ant task that created .jar file with their classes
and dropped it into corresponding *.eclipse project
*.eclipse projects included that jars and had them enlisted in MANIFEST files.
The problem with this ugly hack approach (besides of it being ugly hack) is
that development becomes quite painful. Eclipse code navigation, code coverage
and few other things in Eclipse stops working.
Summary
We have eclipse independent library + eclipse specific stuff architecture,
but we really need all of this to live in one plug-in (because there are some dependencies in both directions).
How do I make code from few projects live into one plug-in/fragment?
It turned out that adding Eclipse-BuddyPolicy: dependent to MANIFEST.MF files, reexporting some dependencies and turning one fragment into plugin (so there is plug-in dependency for BuddyPolicy to track) was the right solution.
Problem solved :-)
From reading this it sounds as if the actual problem is the fact that there are dependencies in both directions. Can't you refactor your projects to make only the Eclipse-spcific proejcts depend on the core projects, and not the other way around?

How do I get support for GPB in Eclipse?

I'm trying to use Google Protocol Buffers in my project and I'd like to have some tooling support from Eclipse. In particular, I want Eclipse to call protoc every time I make changes to the .proto files and then rebuild all code that depends on the generated code.
I tried to set up a Custom Builder but it keeps bugging me with errors I don't understand, most often it complains that the .proto file is not on the path given by --proto-path, which it should be by all I can tell. Also, because I use ${build_files}, Eclipse passes all changed files to the compiler (instead of those that I have configured to trigger the build).
NetBeans seems to have a protobuf-Plugin, but I can't find one for Eclipse. Is there one?
Theres a protoclipse plugin on googlecode, which is in the initial stages:
http://code.google.com/p/protoclipse/
Not sure if there is a builder, but I did find a plugin for syntax highlighting for protocol buffers.
You can define an external builder on the plugin that invokes an ant task. It is an ugly kludge, but until there is a better solution this may serve your purposes.
In practice, syntax highlighting turned out to not be that important, I hardly edit these files, and they tend to be very small. Maven and the m2eclipse plugin handle the building side of things great.
I recommend using Google's "Protocol Buffers Development Tools". It is a plugin for Eclipse that features automagic regeneration and error checking, among other things. It's available here: http://code.google.com/p/protobuf-dt/ .
While this question is close to other Eclipse plugin for working with protobuf, answers here are different.
Well, yes, if you use maven/gradle to invoke protoc (Protobuf compiler), than you may need no Eclipse plugin at all.
Colorizing editor helps for long file or with many comments. Know there are 2 editor plugins for Eclipse.