Eclipse - rsanchez-wsu/jfiles GitHub Wiki

For the purposes of this class, Eclipse will be used as the IDE program for development. All plug-ins and tools will be in reference to Eclipse IDE.

Eclipse is available on all CECS lab computers, but plugins and features will be missing. Lab computers will wipe themselves after a set time or at restart, so it is recommended that each student install Eclipse IDE on their own computers.

You may download Eclipse from this link: https://eclipse.org/downloads/

Eclipse allows for extensions. It has a curated list of repositories built-in through a feature called Eclipse Marketplace. Once Eclipse is downloaded, you can access the Eclipse Marketplace through the Help Menu.

Contents

  1. Requirements
  2. Plug-ins
  3. Tips & Tricks

Requirements

  1. For our use, Eclipse requires a Java Development Kit pre-installed. You may download the latest JDK from this link: http://www.oracle.com/technetwork/java/javase/downloads

  2. Plugins (see below)


Eclipse Plug-ins

The following plug-ins for Eclipse are required to tackle issues left by previous teams.

NOTE: Installing command-line tools of the same name (such as Ivy) is not the equivalent of installing the plug-in for Eclipse. Therefore, you must install Eclipse-specific plugins, and follow the tutorial for command-line tools separately.

NOTE: Apache Ant must be installed in command-line, but it is already included as part of the Eclipse install. Eclipse does not provide a GUI output for Ant, but it is not necessary to search for a plug-in installation for Ant in Eclipse.

This video runs through installing the plugins: https://www.youtube.com/watch?v=M-NJJt2TiL4


Tips and Tricks

Encoding Setup for Eclipse Workspace

In Eclipse, you will need to switch your encoding from the default Windows encoding to a more common UTF-8 encoding scheme. With Eclipse open, head to the Window menu, select Preferences, choose the General menu item in the left-hand menu tree, then select Workspace. At the bottom of the window, the Text file encoding section should be switched to UTF-8.

See image.

Warning Icons

The following warning icons may be encountered with your new plug-ins:

  • Red X in the icon over the tree/explorer view: Checkstyle or Eclipse may have an automatic suggestion on how to fix an error. Choose the source file, scroll on the main source code window to find the red squiggly line, place your cursor on/over the offending text, and push Ctrl + Space on your keyboard. This should pop up a hint on how to fix the error and may also offer you the option to hit Enter to automatically insert a solution.

  • Yellow triangle warning icon: Checkstyle and FindBugs may be reporting suggestions to improve your code that may lead to a run-time error.

  • Green bug icon: This is an error notification generated by FindBugs. Right-click on the icon to get more information.

  • Red squiggle with a "cannot be resolved to a type" error message: Ivy is not installed in Eclipse. Follow the Ivy installation guide for the Eclipse plug-in.

  • Unresolved calls to imported libraries (red squiggles): At the top of the document, list third party imports before Java library imports.

Access and Visibility

  • Public: Shown as a green circle in Eclipse, filled in if the whole method is public.
    • If you don't define a constructor for a class, the Java compiler will automatically create a public constructor.
  • Private: Shown as a red square in in Eclipse, filled in if the whole method is private.
    • The top-level or main class cannot be private since it prevents instantiation.
  • Protected: Shown as a yellow diamond.
    • Sub-classes (those that extend the original class with a protected item) can access the protected item.
  • Package: Shown as a blue triangle in Eclipse.
    • This is the default access if nothing is specified.

Saving Git workspace locally without committing: Stash

If you would like to save your work with a proper diff saved by Git without committing online, you can create a "Stash". This will allow you to make your own snapshots of work without having to commit back to a repository. In Eclipse, open the Package Explorer view, right-click on your branch, choose the Team menu option in the pop-up menu, then choose Stash. You will need Git properly installed before using Stashes.

See image.

Converting the project from GIT to Java

In order to run the project on your machine, you might have to convert jfiles into a java project. Here is the simple way of doing it:
1. Open jfiles under the git view.
2. Right-click on "import projects".
3. The screen should default to "import existing projects." Do not change this. click on next, and then finish. 4. If everything worked, then you should see Jfiles under the JavaScript file viewer.
5. If you wish to import a newer jfiles folder from GitHub, then right-click on your existing folder in JavaScript, and click delete. You will see a little checkbox asking to remove jfiles from the disk. LEAVE IT UNCHECKED. Otherwise, you will remove the whole project from your disk.