Search in sources :

Example 1 with ClientDialerDialog

use of de.janrufmonitor.ui.jface.application.dialer.ClientDialerDialog in project janrufmonitor by tbrandt77.

the class ClientClickDialAction 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 ICall) {
                o = ((ICall) o).getCaller();
            }
            if (o instanceof ICaller) {
                o = ((ICaller) o).getPhoneNumber();
            }
            if (o instanceof ITreeItemCallerData) {
                o = ((ITreeItemCallerData) o).getPhone();
            }
            if (o instanceof IPhonenumber) {
                if (((IPhonenumber) o).isClired())
                    return;
                String dial = ((IPhonenumber) o).getTelephoneNumber();
                if (PhonenumberAnalyzer.getInstance(getRuntime()).isInternal((IPhonenumber) o)) {
                    dial = ((IPhonenumber) o).getCallNumber();
                } else {
                    if (!((IPhonenumber) o).getIntAreaCode().equalsIgnoreCase(this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_INTAREA))) {
                        dial = "00" + ((IPhonenumber) o).getIntAreaCode() + dial;
                    }
                    if (!dial.startsWith("0"))
                        dial = "0" + dial;
                }
                ClientDialerDialog id = new ClientDialerDialog(new Shell(DisplayManager.getDefaultDisplay()), dial);
                id.open();
                this.m_app.updateViews(false);
            }
        }
    }
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) Shell(org.eclipse.swt.widgets.Shell) ICall(de.janrufmonitor.framework.ICall) ClientDialerDialog(de.janrufmonitor.ui.jface.application.dialer.ClientDialerDialog) Viewer(org.eclipse.jface.viewers.Viewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ITreeItemCallerData(de.janrufmonitor.ui.jface.application.ITreeItemCallerData) IPhonenumber(de.janrufmonitor.framework.IPhonenumber)

Aggregations

ICall (de.janrufmonitor.framework.ICall)1 ICaller (de.janrufmonitor.framework.ICaller)1 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)1 ITreeItemCallerData (de.janrufmonitor.ui.jface.application.ITreeItemCallerData)1 ClientDialerDialog (de.janrufmonitor.ui.jface.application.dialer.ClientDialerDialog)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Viewer (org.eclipse.jface.viewers.Viewer)1 Shell (org.eclipse.swt.widgets.Shell)1