One of the first steps in many portal customizations is to create a custom project.
Note: Before creating any projects, set up your IDE for portal development as explained in Setting Up the Java Development Portal and install the sample projects as described in Installing UI Customization Sample Projects (Java).
The instructions below are for the Eclipse IDE and use Ant scripts to build your custom code. For details on requirements for using Ant scripts, see Setting Up the Java Development Portal. The example below consists of creating a custom View. For more detail on portal Views, see View Replacement.
Navigate to SOURCE_HOME\portalui\6.0\ptwebui-samples\sampleproject and examine the directory structure. You should notice the following components:
\java: This folder contains the .classpath and .project files, as well as the source directory tree.
build.xml: This file is the default build file used by Ant if you do not specify a file, and simply wraps the contents of build_core.xml.
build_core.xml: This file is the main build file for the custom project and contains the core list of library files for the custom project.
Copy the \sampleproject
directory to SOURCE_HOME\ptshared\6.0\ptwebui and rename the directory
to the name of your desired custom project.
This example will create a custom view that prints a "Hello World"
string on the login page, so the custom project will be named "helloworldview".
Browse to the new \helloworldview folder, and open the build.xml and build_core.xml files.
Replace the entire <CHANGENAME>
string with the name of the new view ("helloworldview").
For example,
name="<CHANGENAME>"
becomes name="helloworldview".
In the \helloworldview\java
folder, open the .project file in a text editor, and
change the value of the <name>
tag to the name of the
view ("helloworldview"). For example,
<name>sampleproject</name> becomes <name>helloworldview</name>.
Open Eclipse.
Confirm that you are in the same workspace as the projects you imported from the UI Customization Installer (see the Configure Eclipse section for details). Also ensure that you are in the Eclipse Package Explorer view (Window | Open Perspective | Other | Java).
Select File | Import.
Select Existing Project Into Workspace, and click Next.
Browse to SOURCE_HOME\portalui\6.0\ptwebui\helloworldview\java
and click OK, then click Finish.
The helloworldview should now appear in your Package Explorer.
Expand helloworldview and open the \prod\src folder.
Right-click the placeholder.txt file and select Delete.
Click OK to confirm that you want to delete the file.
Right-click the \prod\src folder, and select New | Package.
Name the new package com.plumtree.sampleui.view.
Right-click the innermost folder of the newly created package and select New | Class.
Name the new class HelloWorldView.
To select an Interface,
click Add and choose IView.
Note: If you wanted to extend an existing class, click Browse
to choose a Superclass.
Click Finish.
The steps above create the framework for your custom project. The remaining steps fill out the framework based on existing source code.
These steps explain how to update code in your custom project.
Select File | Import.
Select Existing Project Into Workspace, and click Next.
Browse to SOURCE_HOME\portalui\6.0\ptwebui-samples\sampleview\java
and click OK, then click Finish.
The sampleview project should now appear in your Package Explorer.
Expand sampleview and open the \prod\src\com\plumtree\sampleui\view folder.
Open the HelloWorldView.java file and copy all of the text in the file.
Paste the text into the
HelloWorldView.java file that you created in the previous
section and overwrite everything that is there.
Note: You are copying the code from the sampleview project as
an example only. For more details on the sample code, see View
Replacement. This code adds the text "HELLO WORLD" to the
login page.
Now that the custom project is complete, you must add the new class to the debugging configuration file and deploy the new code.