Difference between revisions of "Eclipse Plug-In: DEPRECATED"
imported>Aeric |
Wikidevuser (talk | contribs) (Redirected page to Eclipse Plug-in) Tag: New redirect |
||
Line 1: | Line 1: | ||
#REDIRECT [[Eclipse Plug-in]] | |||
{{Warn|1= | {{Warn|1= | ||
<br> | <br> |
Latest revision as of 05:43, 5 June 2024
Redirect to:
This topic explains how to set up and use the Eclipse plug-in.
About the Eclipse Plug-In
The Eclipse Plug-In creates a bridge between the Eclipse development environment and the platform. It gives you:
- A good, syntax-highlighting editor with "go to definition" capabilities and other features.
- The ability to compile your classes, to make sure they're syntactically correct before putting them on the platform.
- The ability to keep your workspace synchronized with the platform.
- The ability to swap in a "hot fix" without restarting the platform.
Using the plug-in, you can create and edit these elements:
Platform Requirements
The Eclipse plug-in has been tested with:
- Windows XP and Mac OS X operating systems
- Java version 1.6.0_02 and above
- Java SE Runtime Environment (build 1.6.0_02-b06)
- Java HotSpot Client VM (build 1.6.0_02-b06, mixed mode, sharing)
- Eclipse Helios for Java Developers, version 3.6.x
Set Up the Plug-In
- Download the appropriate version of the plugin jar files:
- For Eclipse Kepler (10.0) and later, download eclipse_plugin_kepler.zip
- For Eclipse Helios (3.6) and later, download eclipse_plugin_helios.zip
- View the JAR files in the ZIP archive.
- Remove any earlier versions of those JAR files from the Eclipse plugins/ directory: {eclipse_IDE_installation}/plugins
- Extract the three JAR files into {eclipse_IDE_installation}/plugins
- (Re)start Eclipse.
Setting Up the Eclipse Plugin behind a Proxy Server
Some organizations have a proxy server that stands between you and the internet. (If in doubt, ask your network admin.) If so, you need to to take a few additional steps to connect to the platform through the proxy server.
To configure the proxy server settings:
- Open the Eclipse IDE
- Click Windows > Preferences > Network Connections > Manual Configurations
- Add proxy server hostname
- Optionally, add username and password
- Save
- Considerations
-
- If the proxy setting is enabled then Eclipse Plug-in expects the proxy settings as configured in Network Connections of Eclipse
- Eclipse Plug-in currently supports HTTP , HTTPS proxy types
- If both [HTTP, HTTPS] are specified then HTTPS proxy is given first preference
To enable the proxy settings:
- From a project in the Eclipse IDE, right-click on any LongJump project
- Click Properties > LongJump Authentication
- Click the checkbox next to Enable proxy settings
After the proxy settings are enabled, the Eclipse Plug-in will pick up the proxy values from Network Connections and make the connection to the platform.
A Success message is displayed in the console window on successful connection.
Set up a Project
With the Eclipse plugin jars installed, the next step is to establish a project.
Create a New Project
To create a new project in Eclipse:
- If you don't want to use the default folder for projects, start by selecting the parent folder for the project.
(You can't select the parent folder when creating a project.)- File > Switch Workspace > Other
- Select the folder that will contain the new project directory.
- Right click in Package Explorer
- Click New > Project > LongJump > LongJump Project
- Click [Next]
- Enter project settings:
- Project Name
- Platform URL
- http://localhost - For a development environment on the local workstation
- https://{yourDomain} - For a development environment in the cloud
- User Name: {platform login username}
- Password: {platform login password}
- Click [Finish]
- The project is created, with folders for platform elements (classes and pages).
- Any elements that are defined in the platform are automatically downloaded. (In essence, the platform acts as a shared repository.)
- JARs containing global classes and API stubs for the platform are downloaded to the lib/ folder, and automatically added to the Eclipse environment.
- Open the LongJump perspective:
- Window > Open Perspective > Other > LongJump
Manage Projects
To change the server URL, the login user name, or password:
- Click Project > Properties
- Click LongJump Authentication
To change the location where new projects are created by default:
- Use File > Switch Workspace > Other
- Select a new workspace folder.
Migrating Classes for Use in the Plugin
There are three changes you need to make existing platform classes compile in Eclipse:
- Add package statements
- Add import statements
- Qualify function references
Add Package Declarations
Package declarations are automatically supplied in platform classes. For your class to work in Eclipse, you need to add the package declaration:
- <syntaxhighlight lang="java" enclose="div">
package com.platform.{yourNamespace}.{yourPackageName}; </syntaxhighlight>
Add Import Statements
In the platform, import statements are automatically added to your code. To get the same results in Eclipse, add these import statements:
- <syntaxhighlight lang="java" enclose="div">
import com.platform.api.*; // For all classes import com.platform.beans.*; // For classes that use Java Beans </syntaxhighlight>
Qualify Function References
All platform methods are defined in the Functions class (more than 80 methods, in all). In the platform, a class could invoke those methods directly. But in Eclipse, those references need to be explicitly qualified. There are two ways to do it:
- The right way (Use this for new code. Use it for old code if you have time.)
- The fast way (Use this for old code, when you're in a hurry.)
Here's the right way:
- Add the Functions. qualifier to access methods defined in the Functions class.
- For example:
- Functions.getParametersInstance()
(The IDE will show you where changes are needed.)
- Functions.getParametersInstance()
Here's the fast way:
- Add a global import to make existing code work, without change:
- <syntaxhighlight lang="java" enclose="div">
import static com.platform.api.Functions.*; </syntaxhighlight>
It's preferable to use the Functions. qualifier, so anyone reading the code can see where the method is defined. But you can use the static import for a fast conversion.
Synchronize Files with the Platform
When you first create a project, the files for the classes, components, pages, and functions are copied from the platform to the project folder in your Eclipse workspace directory. You can then edit the files and save them locally.
To commit changes in a file, folder, or project to the platform:
- Right click to display synchronization options.
- Click [Save on server]
(An error occurs if someone changed the file in the platform after you downloaded it.)
To restore an edited file, folder, or project:
- Right click to display synchronization options.
- Click [Refresh from server] to update the file from the platform
You are prompted to make a backup copy of the local file in your project workspace.
Refactoring Operations
Refactoring operations need to be considered carefully. Methods defined in a class can be by external REST requests, and in other ways. As much as possible, then, try to get things right at the outside, so that you don't have to change the names and locations of packages and classes later on.
Renaming Classes and JSP Pages
The Eclipse platform provides sophisticated refactoring operations. But when those operations are used to rename classes or JSP page, the Eclipse Plugin isn't aware of it. Platform-sync operations fail, as a result.
To rename classes and JSP most easily, use the platform GUI. There, a variety of checks occur to make sure that references to the class continue to work.
Moving a Class to Another Package
The plugin is unaware of local refactoring, so you can't do the move in Eclipse.
You can do the move in the platform by editing the package statement in the class, but in this version, the plugin doesn't know about that change, either. (It copies the class to the old location, but with the new package statement. The package statement then no longer matches the folder, so Eclipse reports an error.)
The solution then, is to:
- Copy the class to the new package folder
- Fix the package statement
- Save the class to the server
- Remove the old class
Renaming a Package
The plugin is similarly unaware of package renames. Since the platform doesn't have package-rename capability, the best course of action is to:
- Make a new package folder in the file system and copy the class files to it.
- Fix the package statements in the new files.
- Save the new package to the server.
- Remove the old package
It is then best to delete the old package on the platform. (An error occurs when attempting to deleted classes with referenced methods, which helps to ensure that all references remain valid.)
Create an Element
To create a new class or page:
- Right click in Package Explorer and select New
- Select the type of element. (You may need to use the long path the first time. After that, your choice will be readily available on the initial list.)
- Other > Class
- Other > Web > JSP File (Page)
- Enter information about the element:
- For a class, enter the Name.
- For a page, select the parent folder (pages) and specify the File name.
- Click [Finish]
Use the LongJump Perspective
The LongJump Perspective adds menu items to Package Explorer and adds a Console view that displays status messages.
To open the LongJump perspective:
- Click Window > Open Perspective > Other > LongJump
Package Explorer Context Menu
The context menu in Package Explorer has a LongJump Server menu item with these subitems:
- Save on Server
- Saves locally modified elements to the server.
- Refresh from Server
- Gets new and modified elements from the server. When you replace a single file, you are prompted to make a backup if you made changes to the local file.
- Delete from Server
- After a confirmation dialog, removes the selected item from the server and deletes the local copy.
- Refresh Library
- Gets the latest version of LongJump libraries from the server. (Use this operation after upgrading the platform.)
LongJump Toolbar
The LongJump toolbar has icons for these operations (hover the cursor over the icons to see the names):
- Save on Server
- Refresh from Server
Troubleshooting
Sync and Refresh Operations return "Bad Request"
Early versions of the plug-in lack refined error messaging. To see the cause of the error, inspect the Eclipse error log:
- Window > Show View > Error Log
After identifying the cause of the problem, take the appropriate action. (One common cause is an invalid username or password.
Sync and Refresh Operations fail due to Invalid Password
The situation tends to arise when a developer has changed their password on the platform--for example, when the "password protection" security policies defined for the tenancy require it.
To reset username or password:
- Right click in the project pane
- Properties > LongJump Authentication