This example assumes that you have created a class,
MyLocationInfo, which
stores information about the custom report location and the temporary file that
is used to store a copy of the report.
Create a custom class that provides input to the
Crystal Reports editor by
extending the
IEditorInput interface
and returning customized adapters with the
getAdapter method.
Click
File > New > Class.
The" New Java Class" dialog box
appears.
Type the name of the class in the
<Name> field.
For example, type
MyEditorInput.
Click
Add.
The
"Implemented
Interfaces Selection" dialog box appears.
Type org.eclipse.ui.IEditorInput,
and click
OK.
Click
Finish.
Create a member variable to store
information about the custom report format.
private MyLocationInfo locationInfo = new MyLocationInfo();
Modify the
exists method to
return
true to add the
report to the Most Recently Used (MRU) list.
public boolean exists()
{
return true;
}
Modify the
getToolTipText
method to return tooltip text.
public String getToolTipText()
{
return "tooltiptext";
}
Modify the
getName method to
return the name to be displayed in the editor.
public String getName()
{
return "myName";
}
Example: An editor input class
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
public class MyEditorInput implements IEditorInput
{
MyLocationInfo locationInfo = new MyLocationInfo();
public MyEditorInput ()
{
}
public Object getAdapter (Class adapter)
{
return null;
}
public boolean exists()
{
return true;
}
public ImageDescriptor getImageDescriptor()
{
return null;
}
public IPersistableElement getPersistable()
{
return null;
}
public String getToolTipText()
{
return "tooltiptext";
}
public String getName()
{
return "myName";
}
}