Search in sources :

Example 1 with CommentDialog

use of de.janrufmonitor.ui.jface.dialogs.CommentDialog in project janrufmonitor by tbrandt77.

the class NewAction method run.

public void run() {
    Object callableObject = null;
    if (this.m_app instanceof Comment) {
        callableObject = ((Comment) this.m_app).getCallableObject();
    }
    CommentDialog cd = new CommentDialog(DisplayManager.getDefaultDisplay().getActiveShell(), null, callableObject);
    int result = cd.open();
    if (result == CommentDialog.OK) {
        IComment c = cd.getResult();
        this.m_app.getController().updateElement(c);
        this.m_app.updateViews(true);
    }
}
Also used : IComment(de.janrufmonitor.service.comment.api.IComment) Comment(de.janrufmonitor.ui.jface.application.comment.Comment) IComment(de.janrufmonitor.service.comment.api.IComment) CommentDialog(de.janrufmonitor.ui.jface.dialogs.CommentDialog)

Example 2 with CommentDialog

use of de.janrufmonitor.ui.jface.dialogs.CommentDialog in project janrufmonitor by tbrandt77.

the class ChangeAction method run.

public void run() {
    Viewer v = this.m_app.getApplication().getViewer();
    if (v != null) {
        IStructuredSelection selection = (IStructuredSelection) v.getSelection();
        if (!selection.isEmpty()) {
            Object o = selection.getFirstElement();
            if (o instanceof IComment) {
                Object callableObject = null;
                if (this.m_app instanceof Comment) {
                    callableObject = ((Comment) this.m_app).getCallableObject();
                }
                CommentDialog cd = new CommentDialog(DisplayManager.getDefaultDisplay().getActiveShell(), ((IComment) o), callableObject);
                int result = cd.open();
                if (result == CommentDialog.OK) {
                    IComment c = cd.getResult();
                    this.m_app.getController().updateElement(c);
                    this.m_app.updateViews(true);
                }
            }
        }
    }
}
Also used : IComment(de.janrufmonitor.service.comment.api.IComment) Comment(de.janrufmonitor.ui.jface.application.comment.Comment) IComment(de.janrufmonitor.service.comment.api.IComment) Viewer(org.eclipse.jface.viewers.Viewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) CommentDialog(de.janrufmonitor.ui.jface.dialogs.CommentDialog)

Aggregations

IComment (de.janrufmonitor.service.comment.api.IComment)2 Comment (de.janrufmonitor.ui.jface.application.comment.Comment)2 CommentDialog (de.janrufmonitor.ui.jface.dialogs.CommentDialog)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Viewer (org.eclipse.jface.viewers.Viewer)1