Is it possible to make net beans scan for classes in namespaces which i haven't imported YET.
What I mean is, when I begin typing the name of a class, netbeans doesn't show it in its 'code prediction'. it only shows after I have imported the class's namespace.
I want it to show the class in the code prediction regardless of if I've imported the namespace or not
This isn't an issue with eclipse, can I make it work like eclipse?
Please go through this link.. I have followed this and I achieved what you are trying to get. https://netbeans.org/kb/docs/java/editor-codereference.html
Moreover, you can always customize your code completion settings to whatever behavior you need. It behaves almost similar to eclipse.
Related
I am currently using a library for "Notify My Android". The library is using an outdated URL so i tried to change it. I attached the source file and now I can edit the code. Before attaching the source file it just said "compiled code". But when i save it it does not seem to save the changes. It is still using the old URL. Also the change I made is underlined in blue. I hope somebody knows how to make the .jar to accept my changes.
Thanks in advance
it's highly discouraged to modify jars you depend on simply because if you ever want to upgrade versions you'd need to modify the new jar you are looking for.
In those situations you have these options:
if it is an open source project, contribute to the project and correct the URL
try and set the property from your code (this may not be possible in certain situations)
try and extend the class you're trying to use and set the URL on the property you need (like the previous one, it may not be possible to do this)
this should be your last resource: create your own project (from the original jar), make the changes you require, package it up and add it to you app.
This is in reference to the question posted at org.netbeans.validation.api.ui.ValidationGroup.add() - How to specify ValidationStrategy?
I am trying to do something similar. Please guide me on what needs to be changed and where. I went through the given links but couldn't find the relevant info.
P.S.: Asking in a separate question because I can't comment on the original one due to lack of reputation points.
Regards
Uday
I found out what was required.
Check out the code from their repository (https://svn.kenai.com/svn/simplevalidation~src) and open ValidationAPI as a project in Netbeans (or whatever IDE you're using).
To change the default validation strategy you'll need to make the changes in ValidationGroup and SwingValidationGroup classes under org.netbeans.validation.api.ui and org.netbeans.validation.api.ui.swing respectively.
In these classes find ValidationStrategy.DEFAULT and replace it with the strategy you want (INPUT_VERIFIER, ON_FOCUS_LOSS, ON_CHANGE_OR_ACTION).
Build the project to generate a new jar and incorporate that jar in your own project.
That's it.
I am aware of http://omnidroid.googlecode.com/svn/tools/Eclipse_Formatter-ITP_Conventions.xml that can be imported into my Android projects Formatter , but it doesn't enforce naming convention standards. I know there are many standards available per project but I'd rather if there were rules set to ensure it. Is there another XML file I can import into my formatter to ensure such? Something like the Resource Style Rules at the end of the page at https://github.com/iamshanedoyle/Android-CodingConvention would be great to have, but I don't really know how to code this into the XML file?
Formatter can only help you to maintain formatting.
Also check the Code Style part of the project configuration, like variable prefixes and suffixes; those help to use Content Assist for example with getters: if you have a member named m_x and prefix is set to m_ you get a suggestion for getX()/setX(T) upon pressing Ctrl+Space; without it, you'd get a funny getM_x() suggestion.
The best solution to your problem may be setting up PMD/Checkstyle for your project and failing build in CI if invalid code is submitted.
I sometimes set all these up together, so Formatter/Code Style helps to write code which adheres to PMD/Checkstyle rules. Also I set up Save Actions in Eclipse so that I don't have to press Ctrl+Shift+F and Ctrl+Shift+O, etc. repeatedly, just a simple Ctrl+S does the work.
I need to create an IMarker-object for input to MarkerAnnotation.
When doing it from within an Eclipse-plugin, itÅ› easy to get a IResource and do createMarker on that, but within my standalone SWT application I find it hard to get hold of a IResource.
Is there any way to get hold of a IResource within my SWT-application?, or is it possible to create the IMarker without using an IResource?
But how can you get a MarkerAnnotation in a standalone application? It's in org.eclipse.ui.texteditor package, which is provided by org.eclipse.ui.editors, which depends on org.eclipse.core.runtime, org.eclipse.ui, etc.
At any rate, look at methods returning IMarker. There doesn't seem to be anything suitable.
I'm adding an answer my own question.
It seems very hard to create IMarkers in standalone SWT, as Alexey pointed out.
However, the answer from Emil Crumhorn in this forum post effectively solved my AnnotationMarker-problem: http://www.eclipsezone.com/eclipse/forums/t30082.html
It shows how to create annotations (like the one used in a Eclipse-editor) in SWT code.
I'm trying to write an Eclipse plugin. It will have dependencies on the RCP for basic stuff and JDT for Java code generation. It consists of a Wizard / WizardPage which asks for a package and a few class names. When the user hits "Finish", I want the wizard to create classes corresponding to the entered values into the current Java project.
I have the basic UI working. What I cannot figure out is how to generate the corresponding class code. Eclipse documentation is a bit hard to follow. From what I can glean I need to first obtain an IJavaProject from the workspace, from that an IPackageFragment and from that I can call createCompilationUnit() to make a class.
What I can't do is find any working examples. I assume that somehow I can walk from the workspace root to where I need to be and create the unit.
Can anyone offer some pointers to simple working code?
You need to extend NewElementWizardPage and provide the functionality. See this documentation for more details
I assume that somehow I can walk from the workspace root to where I need to be and create the unit.
Yes. Take a look at IProject, IFolder, and IFile in the org.eclipse.core.resources package.
Can anyone offer some pointers to simple working code?
Eclipse itself creates a new Java class with a limited skeleton when you ask it to, using the New Java Class Wizard. That source code would be helpful to you for what you want to do. I couldn't find it with a cursory search of Eclipse and the Eclipse help. I'm guessing it's somewhere in an org.eclipse.pde package.
You might also look at Creation Wizards, which is the extension point org.eclipse.ui.newWizards.