not getting option to create Scala Object in Eclipse - eclipse

I am not getting the option to create Scala Object in Eclipse project. I see the Scala nature is already added but still the issue is coming.
Note: This is an already existing project which I imported and I need to make some changes with it.
Kindly let me know if any additional information is required.

Related

Anatomy of Menu

I'm trying to understand how a basic Lift 2.5 project works. I'm working from the lift_basic application template, and going over the SimplyLift tutorial. When following the tutorial I find that most things seem to work fine, but I'm struggling to understand the why. In particular:
Menu.i("Home") / "index" >> User.AddUserMenusAfter
When I look at the Lift API for Menu, no function i is listed for Menu, nor any function that seems to define /. (This may refer to a function on String, but the API for that seems to only reference / as operating on a token that follows; I'm not sure if i produces a String.) My basic question is; how do I determine what i() is doing, both here in the specific (what is Menu doing at this point in the process) and in general (when I come across a clearly-working function that is not mentioned in the API)?
As an aside, I'm currently using Eclipse as my IDE, with an sbt build that is actually compiling and loading the webapp locally. Eclipse doesn't seem to do a good job of inferring what objects/functions mean, since the build path does not contain the Lift libraries - they're loaded by sbt. Is it possible to make Eclipse aware of these without polluting the repo and maintaining the library configuration in two places?
i is defined in the companion object, not in the actual class. You can see the definition in the source here Menu.i or in the scaladoc:
/**
* A convenient way to define a Menu item that has the same name as its localized LinkText.
* <pre>Menu.i("Home") / "index"</pre> is short-hand for <pre>Menu("Home", S.loc("Home", Text("Home")) / "index"</pre>
*/
def i(nameAndLink: String): PreMenu = Menu.apply(nameAndLink, S.loc(nameAndLink, scala.xml.Text(nameAndLink)))
/ is defined as part of PreMenu and it allows you to specify where the menu loc gets served from.
If you are using eclipse, you can try the sbteclipse plugin which should help make eclipse aware of your dependencies.
about the second issue. Did you generate the project structure with SBT? Here's the full info: https://github.com/typesafehub/sbteclipse/
In short, I'd remove anything already-created from the folder and launched eclipse with-source=true After that "imported the project" into eclipse and see it just working.)

Jar library is not recognized inside Intelij IDEA

Hi! I am new to intelij IDEA, and I cannot get google reflection library to work inside intelijIDEA.
I've tried adding it as recommender in many sites, by going to the module configuration, then dependency, clicking on the add library icon and giving the jar file.
It gets recognised in the editer (not underlined with red), but when I try running the problem it throws a java.lang.NoClassDefFoundError: com/google/common/base/Predicate
so I am guessing that the import did not work.
Thanks in advance for any help.
Sure, you need to add the guava library as well, and probably other libraries.
I would search for it using mvnrepository.com, and than download the appropriate binary and add it as library.
If you're not using maven already, try it, it would save you a lot of time. otherwise, look at the pom.xml of the Reflections library, and decide which other libraries you might need at runtime.

GWT compiler doesn't create symbolMaps in the right place

I recently integrated gwt-log into my GWT and Maven based project mostly because of it's ability to automatically deobfuscate client side stack traces on the server. To make this possible gwt-log needs a so called symbol-map which maps all of the obfuscated symbol names to the original Java symbol names. The GWT compiler is capable of generating these symbol maps but for some reason they are saved to a strange location, eg.:
target/project-name-1.0-SNAPSHOT/project-name/.junit_symbolMaps/0F9FD6EF6A1BC63EA834AC33C7ED13F3.symbolMap
According to the GWT Maven Plugin Documentation the GWT compiler has a "-deploy" parameter which determines where to create files like that and which per default points to "WEB-INF/deploy". But even if I manually set this parameter to the correct location the compiler still creates the symbol-maps in the wrong folder.
I even downloaded the GWT Maven Plugin sources and added some log output to find out whether or not the "-deploy" parameter is passed correctly to the compiler but all seems fine.
Has anybody experienced a similar behavior?
Thanks!
Michael
Disable JUnit GWT Module.
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/552a9578a76587ae#

How to link two or more projects in Eclipse?

I am trying to develop my application in different Eclipse Java projects where each will contain a certain feature. Then I want to combine them in one complete Java project.
However, I have a problem when linking the sources.
The sub-projects can correctly refer to parent-project classes but some of the source files that are accessed by the parent projects cannot be identified in the sub-projects.
I have a workspace/ParentProject/src/main/resources/file, where in the ParentProject I am accessing with "src\main\resources\" from within Java.
However, at runtime the ChildProject throws an exception that they cannot access the file : 'file:/E:/Eclipse%20workspace/ChildProject/src/main/resources/file'
So, when using a method of the ParentProject from the ChildProject, the classpath is somewhat transfered to the ChildProject. My question is how to resolve this.
I hope I made it clear what the problem is and will be really appreciative for any help.
Regards,
Petar
Btw: It is explained there How to link project in eclipse but I still have the error, that the child project cannot access resources accessed by the parent project.
Although I am not entirely sure what you need to do, it sounds to me that you are trying to create circular dependencies, which is an anti-pattern. You want to avoid creating dependencies where project a depends on project b, but project b also depends on project a. If you provide more details on your use case and what you are trying to create I will be happy to provide some guidance as to how you could structure your dependencies.
Hope this helps.
Right click the Parent project and click properties. Then click Java Build Path on the left hand side. Next click the projects tab. Make sure the Child project is selected as a required project, if it is not Add the Child project.
You should also do this for the Parent Project.

How to make a new Eclipse project template?

I am using a kind of framework where every time I make a new Java project. I have to arrange the files in the appropriate packages and reference the appropriate external JAR libraries. How do I make a new project template like in the New Project dialog under a new folder?
I've just done a bit of research on this for our own nefarious purposes, and found the answer.
You need to create an Eclipse plugin that uses the org.eclipse.ui.newWizards package. You can define your own category or use an existing one once you find the category ID. To create a new project wizard rather than a new resource wizard, you need to set the "project=true".
Also, your plugin must contain a class that implement org.eclipse.ui.INewWizard. Clicking on the class link from the plugin.xml editor will do the trick.
That class must do all the work in the performFinish override, and must return true to indicate that it actually did its thing and the wizard can close. This is where you create files, directories, set natures, and so forth.
You need to write an Eclipse plugin for that, and concentrate on New Project Wizard.
Writing Eclipse plugins is covered in Stack Overflow question How to write a plugin for Eclipse?.