Search in sources :

Example 1 with TapiDialerDialog

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

the class TapiClickDialAction 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(this.getRuntime()).isInternal(dial)) {
                    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;
                // added 2010/03/06: check for dial prefix for outgoing calls
                // removed 2010/06/25: double addition of prefix. Is already added in Dialogue
                // if (this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_DIAL_PREFIX).length()>0) {
                // if (this.m_logger.isLoggable(Level.INFO))
                // this.m_logger.info("Using dial prefix: "+this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_DIAL_PREFIX));
                // dial = this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_DIAL_PREFIX).trim() + dial;
                // }
                }
                TapiDialerDialog id = new TapiDialerDialog(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) Viewer(org.eclipse.jface.viewers.Viewer) TapiDialerDialog(de.janrufmonitor.ui.jface.application.dialer.TapiDialerDialog) 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 TapiDialerDialog (de.janrufmonitor.ui.jface.application.dialer.TapiDialerDialog)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Viewer (org.eclipse.jface.viewers.Viewer)1 Shell (org.eclipse.swt.widgets.Shell)1