01: package org.drools.eclipse.dsl.editor;
02:
03: import org.drools.eclipse.DroolsEclipsePlugin;
04: import org.drools.eclipse.editors.AbstractRuleEditor;
05: import org.eclipse.core.runtime.IStatus;
06: import org.eclipse.core.runtime.Status;
07: import org.eclipse.jface.dialogs.ErrorDialog;
08: import org.eclipse.ui.texteditor.IDocumentProvider;
09:
10: public class DSLtoDRLRuleViewer extends AbstractRuleEditor {
11:
12: private DSLRuleEditor dslRuleEditor;
13:
14: public DSLtoDRLRuleViewer(DSLRuleEditor dslRuleEditor) {
15: this .dslRuleEditor = dslRuleEditor;
16: }
17:
18: protected IDocumentProvider createDocumentProvider() {
19: return new DSLtoDRLDocumentProvider(this );
20: }
21:
22: public String getDSLRuleContent() {
23: return dslRuleEditor.getContent();
24: }
25:
26: public void handleError(Throwable t) {
27: DroolsEclipsePlugin.log(t);
28: Throwable cause = t.getCause();
29: if (cause == null) {
30: cause = t;
31: }
32: String message = cause.getClass().getName() + ": "
33: + cause.getMessage();
34: if (message == null || message.length() == 0) {
35: message = "Uncategorized Error!";
36: }
37: IStatus status = new Status(IStatus.ERROR, DroolsEclipsePlugin
38: .getUniqueIdentifier(), -1, message, null);
39: ErrorDialog.openError(getSite().getShell(),
40: "DSL Rule Translation Error!",
41: "DSL Rule Translation Error!", status);
42:
43: }
44: }
|