How to change presentation of packages in Eclipse? - eclipse

I need to work with Eclipse source. And I have many packages imported:
org.eclipse.core
org.eclipse.jdt
org.eclipse.jdt.core
org.eclipse.core.resources
etc
So I have all this packages in my project. How can I divide them by their tree? So they look like this in my project:
org
+
|- eclipse +
|- core
| +
| |- runtime
| |- resources
|- jdt
+
|- core
+
|- dom

Srinivas Thatiparthy's comment was close. There is an option "Package presentation" under another button that is next to the button similar to "-><-".

Related

How do I include and access package resources?

I have this folder structure:
my-package -
|- src/mypackage
|- resources/some-resources
|- setup.py
|- setup.cfg
I want to load some-resources from within mypackage. How do I do this?
I have read online I should update my setup.py to include:
setup(
...
package_data={"": ["resources"]},
include_package_data=True,
...
)
And that I should then be able to use pkg_resources to access my resource folder. But the examples seem like they are incomplete, e.g. pkg_resources.resource_listdir("mypackage", "") (one suggestion) just lists the python files in mypackage. So to reiterate - how do I include resources in my package, and then access them from my code?

Can I specify the output folder for assets?

I have a project with this structure:
src
|- index.pug
| - layout
| |- index.less
| - scripts
| |- index.js
For now, when I run parcel build src/index.pug, all the files are bundled and I've got this on the distribution folder:
dist
|- index.html
|- index.12345.css
|- index.12345.js
When I was spected something like:
dist
|- index.html
|- layout
| |- index.12345.css
|- scripts
| |- index.12345.js
So, my question is: Can I specify the output path for my css, js and images using ParcelJS?
Parcel doesn't support this feature out of the box, but I've developed a plugin for it. Check it out https://www.npmjs.com/package/parcel-plugin-custom-dist-structure
It is suitable for all types of web/node development projects, it will generate the dist structure you specify while also handle your imports.
Let me know what you think!
With version 1 it's not supported. This is supposed to be available in version 2 through user plugins. See https://github.com/parcel-bundler/parcel/issues/233

Add Angular2 instructions to Netbeans IDE

I used to use Netbeans during my work. Now I want to start using Angular2.
I'm following tutorial from angular.io. I've created template HTML file with content (only relevant line):
<div *ngFor="let hero of heroes" (click)="gotoDetail(hero)">
And NB shows me errors about *ngFor and (click):
Attribute "*ngfor" is not realizable as XML 1.0. (Rule Category: Attributes)
Attribute "(click)" is not realizable as XML 1.0. (Rule Category: Attributes)
Attribute "*ngfor" not allowed on element "div" at this point. (Rule Category: Elements)
Attribute "(click)" not allowed on element "div" at this point. (Rule Category: Elements)
How can I teach NB that those are correct? I've already installed plugin to support TypeScript.
In my test project I downloaded node packages:
c:\proj> npm list --depth=0
angular2-quickstart#1.0.0 C:\a2
+-- angular2#2.0.0-beta.17
+-- concurrently#2.0.0
+-- es6-shim#0.35.0
+-- lite-server#2.2.0
+-- reflect-metadata#0.1.2
+-- rxjs#5.0.0-beta.6
+-- systemjs#0.19.26
+-- typescript#1.8.10
+-- typings#0.8.1
`-- zone.js#0.6.12
Unfortunately NetBeans does not support Angular 2 template syntax, so you will receive (wrong) warnings/errors and no codecompletion support.
You can use the TypeScript plugin and typings to get support for the TypeScript/JavaScript parts of the application. Feel free to open a NetBeans issue with the request, I will vote for it as well.
Edit:
There is already an issue filed to request that feature: https://netbeans.org/bugzilla/show_bug.cgi?id=257587 if you upvote it, it might get implemented.

Gradle sub-sub-projects with same name in does not work for eclipse

I have the following structure
root
|- foo
| |- implementation
| | \- build.gradle
| \- interface
| \- build.gradle
|
|- bar
| |- implementation
| | \- build.gradle
| \- interface
| \- build.gradle
|
|- build.gradle
\- settings.gradle
in settings.gradle I have the following:
include ':foo:implementation', ':foo:interface'
include ':bar:implementation', ':bar:interface'
in my build.gradle on the root folder I put all of them as a dependency
dependencies {
compile project(':foo:implementation')
compile project(':foo:interface')
compile project(':bar:implementation')
compile project(':bar:interface')
}
Eclipse needs each project to have distinct names. Gradle by default uses the project name to name these in eclipse. Thus eclipse is unable to distinguish between ':foo:implementation' and ':bar:implementation:' as they both will be named 'implementation' inside Eclipse. In my mind this should have been solvable by setting the eclipse project name to something more specific, e.g.:
allprojects {
eclipse.project {
if (project == rootProject) {
name = rootProject.name
} else {
name = rootProject.name + project.path.replace(":", "-")
}
}
}
With this I get unique project names, but when I look at the .classpath xml only one of the implementation projects and one of the interface projects are present.
Any idea?
So far, I've only been working with "single dir level" multiprojects; For that scenario, there are several ways to fix it:
If you want to fix it for eclipse only and if you're using the "import gradle project" wizard, you might want to set the "Use hierarchical project names" check box. Not sure how it behaves in your case (double dir level)
Next one can hopefully help you out: how to rename the project in gradle instead of using folder name?. Probably with some extra investigation for your double dir level. It will also change the gradle project names BTW
And indeed, The eclipse plugin also provides means to change project names, haven't used it myself though...
Sadly this is a bug with Gradle; see the open GitHub issue.
One (workaround) solution is to use different groups for the subprojects:
// root/foo/build.gradle
subprojects {
group = 'org.example.foo'
}
// root/bar/build.gradle
subprojects {
group = 'org.example.bar'
}

Java Servlet and JSP/JSF Help/Guidance

I've had very limited exposure to Java Web development side and suddenly been asked to work on a web application and learn to maintain it. I’m struggling to setup an environment to be able to test and debug existing code given to me.
I'm on windows XP. Using Eclipse and Tomcat 5.
The web app they've dumped at me has the following structure:
Parent_directory
|- src
|- mainapp
|- model
|- AssignT.java
|- LeavePerm.java
|- Invoice.java
|- ....
|- util
|- Dates.java
|- reports.java
|- .....
|- application.properties
|- DB.properties
|- log.properties
|- email.properties
|- ......
|- Webroot
|-images
|- 1.png
|- ......
|-jsp
|- index.jsp
|- email.jsp
|- assign.jsp
|- leave.jsp
|- .....
|-META-INF
|- context.xml
|- MAINFEST.MF
|-Scripts
|- display.js
|- info.js
|- dates.js
|-WEB-INF
|- classes
|- {EMPTY}
|- lib
|- {MANY .jar files}
|- faces.config.mex
|- faces.config.xml
|- web.xml
The web application is working but minor modifications need to be made hence why I need to be able to setup an environments with eclipse and tomcat 5 to be able to make those changes and test.
Having installed tomcat and tomcat eclipse plugin I've added the tomcat server in server tab so eclipse knows where tomcat is and able to start/stop it but cannot get it to load the above imported project and run it. Trying the "Add or Remove" option on the server tells me "there are no resources that can be added".
I would appreciate any help or guidance.
Thank you
Did you download package labelled "Eclipse for Java EE Developers"? If so, then it contains WTP and make sure the project as the facet "Dynamic Web Module" selected.
In eclipse Facets are used as markers for enabling user interface
elements.
How to activate a Facets:
Not a faceted project then go in Project > Properties > Project Facets Click on "Convert to faceted form...".
Already faceted project go in Project > Properties > Project Facets Select "Dynamic Web Module" with the proper version 2.3 or 2.5.
After you should be able to add the project to the tomcat server in the server tab.
More information on Dynamic Web projects and applications.