import com.crystaldecisions.sdk.occa.report.application.AdvancedClientDocumentEvent; import com.crystaldecisions.sdk.occa.report.application.IAdvancedClientDocumentEventListener; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IPropertyListener;
public class MyReportPage extends EditorPart implements ICrystalReportsEditorPage, ICrystalDocumentChangedListener, IAdvancedClientDocumentEventListener { }
public void onAdded(AdvancedClientDocumentEvent event) { listViewer.refresh(); }
public void onChanged(AdvancedClientDocumentEvent event) { listViewer.refresh(); }
public void onRemoved(AdvancedClientDocumentEvent event) { listViewer.refresh(); }
public void attachToEditor(ICrystalReportsEditor editor) { myEditor = editor; setInput(myEditor.getEditorInput()); myEditor.addDocumentChangedListener(this); documentChangedHelper(null, myEditor.getReportClientDocument(), true); myEditor.addPropertyListener (new IPropertyListener () { public void propertyChanged(Object source, int propID) { if (propID == IEditorPart.PROP_INPUT) setInput (myEditor.getEditorInput()); } }); }
private void documentChangedHelper(IReportClientDocument oldReport, IReportClientDocument newReport, boolean mainChanged) { if (mainChanged) { if (oldReport != null) oldReport.getMainReport().removeAdvancedClientDocumentEventListener(this); if (newReport != null) newReport.getMainReport().addAdvancedClientDocumentEventListener(this); if (newReport == null) return; IDataDefinition definition = null; try { definition = newReport.getDataDefController().getDataDefinition(); } catch(ReportSDKException e) { e.printStackTrace(); } if (definition != null) { Fields parameters; parameters = definition.getParameterFields(); listViewer.setInput(parameters); } else { listViewer.setInput(null); } } }
SAP BusinessObjects http://www.sap.com/sapbusinessobjects/ Support services http://service.sap.com/bosap-support/ Product Documentation on the Web http://help.sap.com/ |