use of de.janrufmonitor.util.formatter.Formatter in project janrufmonitor by tbrandt77.
the class GenericWebAction 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 instanceof ICaller) {
Properties configuration = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(this.getNamespace());
if (configuration != null) {
String url = configuration.getProperty("url");
if (url != null && url.trim().length() > 0) {
this.m_logger.info("Found valid web url to execute: " + url);
Formatter f = Formatter.getInstance(this.getRuntime());
url = f.parse(url, o);
this.m_logger.info("Parsed web url to execute: " + url);
Program.launch(url);
}
} else {
this.m_logger.warning("Found invalid configuration for namespace: " + this.getNamespace());
}
}
}
}
}
use of de.janrufmonitor.util.formatter.Formatter in project janrufmonitor by tbrandt77.
the class GenericWebDialogPlugin method run.
public void run() {
Properties configuration = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(this.getNamespace());
if (configuration != null) {
String url = configuration.getProperty("url");
if (url != null && url.trim().length() > 0) {
this.m_logger.info("Found valid web url to execute: " + url);
Formatter f = Formatter.getInstance(this.getRuntime());
url = f.parse(url, this.m_dialog.getCall());
this.m_logger.info("Parsed web url to execute: " + url);
Program.launch(url);
}
} else {
this.m_logger.warning("Found invalid configuration for namespace: " + this.getNamespace());
}
}
use of de.janrufmonitor.util.formatter.Formatter in project janrufmonitor by tbrandt77.
the class BalloonDialog method getParsedCaller.
private String getParsedCaller() {
Formatter formatter = Formatter.getInstance(this.getRuntime());
String name = "";
if (this.m_call.getCaller() != null && this.m_call.getCaller().getPhoneNumber().isClired()) {
name = this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_CLIR);
} else {
name = formatter.parse(IJAMConst.GLOBAL_VARIABLE_CALLERNAME, this.m_call);
// hack for 4.2.1 & sign is not shown
name = StringUtils.replaceString(name, "&", "%amp%");
name = StringUtils.replaceString(name, "%amp%", "&&");
}
return name;
}
use of de.janrufmonitor.util.formatter.Formatter in project janrufmonitor by tbrandt77.
the class BalloonDialog method getParsedNumber.
private String getParsedNumber() {
Formatter formatter = Formatter.getInstance(this.getRuntime());
String number = "";
if (this.m_call.getCaller() != null && !this.m_call.getCaller().getPhoneNumber().isClired()) {
number = formatter.parse(IJAMConst.GLOBAL_VARIABLE_CALLERNUMBER, this.m_call);
}
return number;
}
use of de.janrufmonitor.util.formatter.Formatter in project janrufmonitor by tbrandt77.
the class TrayIcon method getToolTipText.
private String getToolTipText(ICall aCall) {
// menu fails to open.
if (aCall != null && aCall.getCaller().getPhoneNumber().isClired()) {
return this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_CLIR);
}
Formatter formatter = Formatter.getInstance(this.getRuntime());
String p = "\r\n" + formatter.parse(IJAMConst.GLOBAL_VARIABLE_CALLERNUMBER, aCall);
// cut tooltips > 128
if (p.length() > 128)
return p.substring(2, Math.max(132, p.length())).trim();
String name = formatter.parse(IJAMConst.GLOBAL_VARIABLE_CALLERNAME, aCall);
if ((name.length() + p.length()) > 128) {
name = name.substring(0, (127 - 3 - p.length())) + "...";
}
return name + p;
}
Aggregations