use of de.janrufmonitor.ui.jface.application.controls.HyperLink in project janrufmonitor by tbrandt77.
the class BalloonDialog method createDialog.
public void createDialog() {
final Color color = new Color(getShell().getDisplay(), 255, 255, 225);
boolean hasCallerImage = this.hasCallerImage();
Composite c = this.getContents();
c.setLayout(new GridLayout((hasCallerImage ? 2 : 1), false));
if (hasCallerImage) {
Label image = new Label(c, SWT.BORDER | SWT.RIGHT);
GridData gd = new GridData();
gd.verticalSpan = 5;
image.setVisible(false);
gd.widthHint = 92;
gd.heightHint = 110;
gd.horizontalIndent = 10;
image.setVisible(true);
image.setImage(this.getCallerImage());
image.setLayoutData(gd);
}
// date
Label l = new Label(c, SWT.NONE);
l.setText(this.getI18nManager().getString(this.getNamespace(), "date_label", "label", this.getLanguage()) + this.getParsedDate());
Font initialFont = l.getFont();
FontData[] fontData = initialFont.getFontData();
for (int i = 0; i < fontData.length; i++) {
fontData[i].setHeight(this.getFontSize() - 3);
}
Font newFont = new Font(DisplayManager.getDefaultDisplay(), fontData[0]);
l.setFont(newFont);
l.setBackground(color);
// MSN
l = new Label(c, SWT.NONE);
l.setText(this.getI18nManager().getString(this.getNamespace(), "msn_label", "label", this.getLanguage()) + this.getParsedMsn());
initialFont = l.getFont();
fontData = initialFont.getFontData();
for (int i = 0; i < fontData.length; i++) {
fontData[i].setHeight(this.getFontSize() - 3);
fontData[i].setStyle(SWT.BOLD);
}
newFont = new Font(DisplayManager.getDefaultDisplay(), fontData[0]);
l.setFont(newFont);
l.setBackground(color);
// caller name + additional
l = new Label(c, SWT.LEFT);
l.setText(this.getParsedCaller());
l.setBackground(color);
l.setForeground(new Color(DisplayManager.getDefaultDisplay(), this.getColor()));
initialFont = l.getFont();
fontData = initialFont.getFontData();
for (int i = 0; i < fontData.length; i++) {
fontData[i].setHeight(this.getFontSize());
fontData[i].setStyle(SWT.BOLD);
}
newFont = new Font(DisplayManager.getDefaultDisplay(), fontData[0]);
l.setFont(newFont);
l.pack();
this.checkCallerLength(l);
l.pack();
// number
// added 2008/04/08: add provider image if present
Composite numberbar = new Composite(c, SWT.NONE);
numberbar.setBackground(color);
ITableCellRenderer tr = RendererRegistry.getInstance().getRenderer("ProviderLogo".toLowerCase());
Image img = null;
if (tr != null && this.m_call != null && !isCliredCaller()) {
tr.updateData(this.m_call);
img = tr.renderAsImage();
}
numberbar.setLayout(new GridLayout((img != null ? 2 : 1), false));
if (img != null) {
l = new Label(numberbar, SWT.LEFT);
l.setBackground(color);
l.setImage(new Image(DisplayManager.getDefaultDisplay(), img.getImageData().scaledTo(32, 32)));
}
l = new Label(numberbar, SWT.LEFT);
l.setText(this.getParsedNumber());
l.setBackground(color);
l.setForeground(new Color(DisplayManager.getDefaultDisplay(), this.getColor()));
initialFont = l.getFont();
fontData = initialFont.getFontData();
for (int i = 0; i < fontData.length; i++) {
fontData[i].setHeight(this.getFontSize() - 3);
}
newFont = new Font(DisplayManager.getDefaultDisplay(), fontData[0]);
l.setFont(newFont);
l.pack();
// CIP
l = new Label(c, SWT.LEFT);
l.setText(this.getParsedCip());
l.setBackground(color);
l.pack();
// Buttons
Composite buttonBar = new Composite(c, SWT.NONE);
GridData gd = new GridData();
gd.horizontalSpan = 2;
// check for plugins
List plugins = this.getPlugins(this.getConfiguration().getProperty("pluginlist", ""));
GridLayout gl = new GridLayout(Math.max(5, (plugins.size() + 2)), false);
gl.marginRight = 20;
buttonBar.setLayout(gl);
buttonBar.setLayoutData(gd);
buttonBar.setBackground(color);
// Label la = new Label(buttonBar, SWT.LEFT);
// la.setText(" ");
// la.setBackground(color);
// check for active reject service
IService rejectService = this.getRuntime().getServiceFactory().getService("Reject");
if (rejectService != null && rejectService.isEnabled()) {
final HyperLink reject = new HyperLink(buttonBar, SWT.LEFT);
reject.setBackground(color);
reject.setText(this.getI18nManager().getString(this.getNamespace(), "reject", "label", this.getLanguage()));
reject.pack();
reject.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1) {
reject.setEnabled(false);
reject.setText(getI18nManager().getString(getNamespace(), "rejected", "label", getLanguage()));
reject.setUnderline(color);
reject.setActiveUnderline(color);
reject.setHoverUnderline(color);
reject.pack(true);
IEventBroker eventBroker = getRuntime().getEventBroker();
if (m_call != null)
m_call.setAttribute(getRuntime().getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS, IJAMConst.ATTRIBUTE_VALUE_REJECTED));
eventBroker.send(BalloonDialog.this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLREJECTED, m_call));
}
}
});
}
if (this.isAssignement() && !this.isCliredCaller()) {
final IDialogPlugin assignPlugin = new AssignPlugin();
assignPlugin.setDialog(this);
HyperLink hl = new HyperLink(buttonBar, SWT.LEFT);
hl.setText(assignPlugin.getLabel());
hl.setBackground(color);
hl.pack();
hl.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1) {
assignPlugin.run();
}
}
});
}
// add plugins
String classString = null;
for (int i = 0, j = plugins.size(); i < j; i++) {
classString = this.getConfiguration().getProperty((String) plugins.get(i));
if (classString != null && classString.trim().length() > 0) {
try {
Class classObject = Thread.currentThread().getContextClassLoader().loadClass(classString);
final IDialogPlugin plugin = (IDialogPlugin) classObject.newInstance();
plugin.setDialog(this);
plugin.setID((String) plugins.get(i));
if (plugin.isEnabled()) {
HyperLink hl = new HyperLink(buttonBar, SWT.LEFT);
hl.setText(plugin.getLabel());
hl.setBackground(color);
hl.pack();
hl.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1) {
plugin.run();
}
}
});
}
} catch (ClassNotFoundException e) {
this.m_logger.warning("Class not found: " + classString);
} catch (InstantiationException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
} catch (IllegalAccessException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
}
}
}
color.dispose();
c.pack();
}
use of de.janrufmonitor.ui.jface.application.controls.HyperLink in project janrufmonitor by tbrandt77.
the class InfoDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(3, false));
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalIndent = 15;
gd.verticalIndent = 15;
composite.setLayoutData(gd);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
FontData fd = parent.getFont().getFontData()[0];
fd.setStyle(SWT.BOLD);
fd.setHeight(11);
Font font = new Font(parent.getDisplay(), fd);
Label l = new Label(composite, SWT.NONE);
l.setText("jAnrufmonitor");
l.setFont(font);
l.setLayoutData(gd);
gd = new GridData(GridData.FILL_BOTH);
gd.verticalSpan = 8;
// check for edition
String edition = getI18nManager().getString(NAMESPACE, "edition", "label", getLanguage());
if (edition != null && edition.trim().length() > 0 && !edition.equalsIgnoreCase("edition"))
l.setText(l.getText() + " " + edition);
l = new Label(composite, SWT.NONE);
l.setImage(SWTImageManager.getInstance(this.getRuntime()).get(IJAMConst.IMAGE_KEY_TELEFON_JPG));
l.setLayoutData(gd);
fd = parent.getFont().getFontData()[0];
fd.setStyle(SWT.BOLD);
font = new Font(parent.getDisplay(), fd);
l = new Label(composite, SWT.NONE);
l.setText(getI18nManager().getString(NAMESPACE, "license", "label", getLanguage()));
l.setFont(font);
new Label(composite, SWT.NONE).setText(getI18nManager().getString(NAMESPACE, "freeware", "label", getLanguage()));
l = new Label(composite, SWT.NONE);
l.setText(getI18nManager().getString(NAMESPACE, "version", "label", getLanguage()));
l.setFont(font);
new Label(composite, SWT.NONE).setText(IJAMConst.VERSION_DISPLAY);
l = new Label(composite, SWT.NONE);
l.setText(getI18nManager().getString(NAMESPACE, "build", "label", getLanguage()));
l.setFont(font);
new Label(composite, SWT.NONE).setText(IJAMConst.VERSION_BUILD);
l = new Label(composite, SWT.NONE);
l.setText(getI18nManager().getString(NAMESPACE, "rkey", "label", getLanguage()));
l.setFont(font);
String key = getRuntime().getConfigManagerFactory().getConfigManager().getProperty("service.update.UpdateManager", "regkey");
if (key == null || key.length() == 0) {
key = new UUID().toString();
getRuntime().getConfigManagerFactory().getConfigManager().setProperty("service.update.UpdateManager", "regkey", key);
getRuntime().getConfigManagerFactory().getConfigManager().saveConfiguration();
}
HyperLink hl = new HyperLink(composite, SWT.NONE);
hl.setText(key);
final String rkey = key;
hl.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1)
Program.launch("https://www.janrufmonitor.de/registry.php?k=" + rkey);
}
});
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
l = new Label(composite, SWT.NONE);
l.setText(getI18nManager().getString(NAMESPACE, "homepage", "label", getLanguage()));
l.setFont(font);
hl = new HyperLink(composite, SWT.NONE);
hl.setText("https://www.janrufmonitor.de/");
hl.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1)
Program.launch("https://www.janrufmonitor.de/");
}
});
l = new Label(composite, SWT.NONE);
l.setText(getI18nManager().getString(NAMESPACE, "mail", "label", getLanguage()));
l.setFont(font);
hl = new HyperLink(composite, SWT.NONE);
hl.setText("support@janrufmonitor.de");
hl.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1)
Program.launch("https://www.janrufmonitor.de/support/");
}
});
l = new Label(composite, SWT.NONE);
l.setText(getI18nManager().getString(NAMESPACE, "donation", "label", getLanguage()));
l.setFont(font);
hl = new HyperLink(composite, SWT.NONE);
hl.setText("https://www.janrufmonitor.de/donation/");
hl.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1)
Program.launch("https://www.janrufmonitor.de/ihre-unterstuetzung/");
}
});
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 3;
gd.widthHint = 300;
l = new Label(composite, SWT.RIGHT);
l.setText("(c) 2008 - 2018 by Thilo Brandt ");
l.setLayoutData(gd);
return super.createDialogArea(parent);
}
use of de.janrufmonitor.ui.jface.application.controls.HyperLink in project janrufmonitor by tbrandt77.
the class InitFritzBoxVariantPage method createControl.
public void createControl(Composite parent) {
setTitle(this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "title", "label", this.m_language));
setDescription(this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "description", "label", this.m_language));
final Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(1, false));
c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
BooleanFieldEditor bfe = new BooleanFieldEditor("activemonitor", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "activemonitor2", "label", this.m_language), c);
bfe.setPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
if (e != null && e.getNewValue() != null && e.getNewValue() instanceof Boolean)
m_active = ((Boolean) e.getNewValue()).booleanValue();
setPageComplete(isComplete());
}
});
new Label(c, SWT.LEFT);
StringFieldEditor sfe = new StringFieldEditor("boxip", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "boxip", "label", this.m_language), c);
sfe.setStringValue("fritz.box");
this.m_boxip = "fritz.box";
sfe.setPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String)
m_boxip = (String) e.getNewValue();
setPageComplete(isComplete());
}
});
ComboFieldEditor mode = new ComboFieldEditor("boxloginmode", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "boxloginmode", "label", this.m_language), new String[][] { { this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "userpassword", "label", this.m_language), "0" }, { this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "password_only", "label", this.m_language), "1" } }, c);
final StringFieldEditor sfe1 = new StringFieldEditor("boxuser", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "boxuser", "label", this.m_language), c);
sfe1.setStringValue("");
this.m_boxuser = "";
mode.setPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String) {
String state = (String) e.getNewValue();
if (state.equalsIgnoreCase("1")) {
sfe1.setEnabled(false, c);
sfe1.setStringValue("");
sfe1.getTextControl(c).setBackground(new Color(DisplayManager.getDefaultDisplay(), 190, 190, 190));
m_boxuser = "";
} else {
sfe1.setEnabled(true, c);
sfe1.getTextControl(c).setBackground(new Color(DisplayManager.getDefaultDisplay(), 255, 255, 255));
}
}
}
});
sfe1.setPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String)
m_boxuser = (String) e.getNewValue();
setPageComplete(isComplete());
}
});
sfe = new StringFieldEditor("boxpassword", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "boxpassword", "label", this.m_language), c);
sfe.getTextControl(c).setEchoChar('*');
sfe.setStringValue("");
this.m_boxpassword = "";
sfe.setPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String)
m_boxpassword = (String) e.getNewValue();
setPageComplete(isComplete());
}
});
new Label(c, SWT.LEFT);
bfe = new BooleanFieldEditor("usemsns", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "usemsns", "label", this.m_language), c);
bfe.setPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
if (e != null && e.getNewValue() != null && e.getNewValue() instanceof Boolean)
m_usemsns = ((Boolean) e.getNewValue()).booleanValue();
setPageComplete(isComplete());
}
});
new Label(c, SWT.LEFT);
Text l = new Text(c, SWT.LEFT | SWT.WRAP);
l.setText(this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "openfb", "label", this.m_language));
l.setEditable(false);
l.setBackground(parent.getBackground());
new Label(c, SWT.LEFT);
HyperLink hl = new HyperLink(c, SWT.LEFT | SWT.WRAP);
hl.setText(this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "openfb2", "label", this.m_language));
hl.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1)
Program.launch("http://www.janrufmonitor.de/fritzbox-freischalten");
}
});
setPageComplete(isComplete());
setControl(c);
}
use of de.janrufmonitor.ui.jface.application.controls.HyperLink in project janrufmonitor by tbrandt77.
the class ExtendedBalloonDialog method createDialog.
public synchronized void createDialog() {
Composite c = this.getContents();
prepareDialog(c, getShell());
final Color color = new Color(getShell().getDisplay(), 255, 255, 225);
// Buttons
Composite buttonBar = new Composite(c, SWT.NONE);
GridData gd = new GridData();
gd.horizontalSpan = this.m_columnCount;
// check for plugins
List plugins = this.getPlugins(this.getConfiguration().getProperty("pluginlist", ""));
GridLayout gl = new GridLayout(Math.max(5, (plugins.size() + 2)), false);
gl.marginRight = 20;
buttonBar.setLayout(gl);
buttonBar.setLayoutData(gd);
buttonBar.setBackground(color);
// check for active reject service
IService rejectService = this.getRuntime().getServiceFactory().getService("Reject");
if (rejectService != null && rejectService.isEnabled()) {
final HyperLink reject = new HyperLink(buttonBar, SWT.LEFT);
reject.setBackground(color);
reject.setText(this.getI18nManager().getString(this.getNamespace(), "reject", "label", this.getLanguage()));
reject.pack();
reject.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1) {
reject.setEnabled(false);
reject.setText(getI18nManager().getString(getNamespace(), "rejected", "label", getLanguage()));
reject.setUnderline(color);
reject.setActiveUnderline(color);
reject.setHoverUnderline(color);
reject.pack(true);
IEventBroker eventBroker = getRuntime().getEventBroker();
if (m_call != null)
m_call.setAttribute(getRuntime().getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS, IJAMConst.ATTRIBUTE_VALUE_REJECTED));
eventBroker.send(ExtendedBalloonDialog.this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLREJECTED, m_call));
}
}
});
}
if (this.isAssignement() && !this.isCliredCaller()) {
final IDialogPlugin assignPlugin = new AssignPlugin();
assignPlugin.setDialog(this);
HyperLink hl = new HyperLink(buttonBar, SWT.LEFT);
hl.setText(assignPlugin.getLabel());
hl.setBackground(color);
hl.pack();
hl.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1) {
assignPlugin.run();
}
}
});
}
// add plugins
String classString = null;
for (int i = 0, j = plugins.size(); i < j; i++) {
classString = this.getConfiguration().getProperty((String) plugins.get(i));
if (classString != null && classString.trim().length() > 0) {
try {
Class classObject = Thread.currentThread().getContextClassLoader().loadClass(classString);
final IDialogPlugin plugin = (IDialogPlugin) classObject.newInstance();
plugin.setDialog(this);
plugin.setID((String) plugins.get(i));
if (plugin.isEnabled()) {
HyperLink hl = new HyperLink(buttonBar, SWT.LEFT);
hl.setText(plugin.getLabel());
hl.setBackground(color);
hl.pack();
hl.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1) {
plugin.run();
}
}
});
}
} catch (ClassNotFoundException e) {
this.m_logger.warning("Class not found: " + classString);
} catch (InstantiationException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
} catch (IllegalAccessException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
}
}
}
color.dispose();
c.pack();
}
use of de.janrufmonitor.ui.jface.application.controls.HyperLink in project janrufmonitor by tbrandt77.
the class ModuleManager method createContents.
protected Control createContents(Composite parent) {
this.setTitle(this.m_i18n.getString(this.getNamespace(), "title", "label", this.m_language));
this.noDefaultAndApplyButton();
Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(2, false));
int operations = DND.DROP_MOVE;
Transfer[] types = new Transfer[] { FileTransfer.getInstance() };
DropTarget target = new DropTarget(c, operations);
target.setTransfer(types);
target.addDropListener(new DropTargetAdapter() {
public void drop(DropTargetEvent event) {
// A drop has occurred, copy over the data
if (event.data == null) {
event.detail = DND.DROP_NONE;
return;
}
getDropTargetHandler().execute((String[]) event.data);
}
});
GridData gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 1;
gd.widthHint = 200;
Label l = new Label(c, SWT.LEFT);
l.setText(this.m_i18n.getString(this.getNamespace(), "file", "label", this.m_language));
l.pack();
l = new Label(c, SWT.LEFT);
final org.eclipse.swt.widgets.List m_fileList = new org.eclipse.swt.widgets.List(c, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
m_fileList.setLayoutData(gd);
Button b = new Button(c, SWT.PUSH);
b.setText(JFaceResources.getString("openBrowse"));
final Button install = new Button(c, SWT.PUSH);
install.setText(this.m_i18n.getString(this.getNamespace(), "install", "label", this.m_language));
install.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ModuleContainer mc = (ModuleContainer) m_fileList.getData("modules");
if (mc != null) {
String[] sources = new String[mc.getFilenames().length];
for (int i = 0, j = mc.getFilenames().length; i < j; i++) {
sources[i] = mc.getDirectory() + File.separator + mc.getFilenames()[i];
}
getDropTargetHandler().execute(sources);
}
install.setEnabled(false);
m_fileList.removeAll();
m_fileList.setData("modules", null);
}
});
install.setEnabled(false);
b.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
ModuleContainer mc = changePressed(m_fileList.getParent());
if (mc != null) {
m_fileList.removeAll();
m_fileList.setData("modules", null);
m_fileList.setData("modules", mc);
String[] mods = mc.getFilenames();
for (int i = 0; i < mods.length; i++) m_fileList.add(mods[i]);
if (mods.length > 0) {
install.setEnabled(true);
}
}
}
});
l = new Label(c, SWT.LEFT);
l = new Label(c, SWT.LEFT);
l = new Label(c, SWT.LEFT);
l = new Label(c, SWT.LEFT);
l.setText(this.m_i18n.getString(this.getNamespace(), "remove", "label", this.m_language));
l = new Label(c, SWT.LEFT);
final Combo module = new Combo(c, SWT.READ_ONLY);
gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 1;
gd.widthHint = 200;
module.setLayoutData(gd);
this.buildCombobox(module);
l = new Label(c, SWT.LEFT);
if (module.getItemCount() > 0 && !OSUtils.isMultiuserEnabled()) {
final Group info = new Group(c, SWT.SHADOW_ETCHED_IN);
info.setLayout(new GridLayout(2, false));
gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 2;
info.setLayoutData(gd);
info.setText(this.m_i18n.getString(this.getNamespace(), "infotitle", "label", this.m_language));
info.setVisible(false);
l = new Label(info, SWT.LEFT);
l.setText(this.m_i18n.getString(this.getNamespace(), "modname", "label", this.m_language));
final Label name = new Label(info, SWT.LEFT);
l = new Label(info, SWT.LEFT);
l.setText(this.m_i18n.getString(this.getNamespace(), "modversion", "label", this.m_language));
final Label version = new Label(info, SWT.LEFT);
l = new Label(info, SWT.LEFT);
l.setText(this.m_i18n.getString(this.getNamespace(), "modtype", "label", this.m_language));
final Label type = new Label(info, SWT.LEFT);
l = new Label(info, SWT.LEFT);
l.setText(this.m_i18n.getString(this.getNamespace(), "modauthor", "label", this.m_language));
final Label author = new Label(info, SWT.LEFT);
l = new Label(info, SWT.LEFT);
l.setText(this.m_i18n.getString(this.getNamespace(), "modwebsite", "label", this.m_language));
final HyperLink website = new HyperLink(info, SWT.NONE);
website.setEnabled(false);
website.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (e.button == 1)
Program.launch(website.getText());
}
});
String ns = (String) module.getData(module.getText());
if (ns != null && ns.length() > 0) {
info.setVisible(true);
Properties currentDescriptor = InstallerEngine.getInstance().getDescriptor(ns);
if (currentDescriptor != null) {
name.setText(this.getNamespaceLabel(ns));
version.setText(currentDescriptor.getProperty(InstallerConst.DESCRIPTOR_VERSION, "-"));
author.setText(currentDescriptor.getProperty(InstallerConst.DESCRIPTOR_AUTHOR, "-"));
type.setText(m_i18n.getString(getNamespace(), currentDescriptor.getProperty(InstallerConst.DESCRIPTOR_TYPE, "-"), "label", m_language));
website.setText(currentDescriptor.getProperty(InstallerConst.DESCRIPTOR_WEBSITE, "-"));
if (website.getText().length() > 6 && website.getText().toLowerCase().startsWith("http")) {
website.setEnabled(true);
}
}
}
module.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String ns = (String) module.getData(module.getText());
if (ns != null && ns.length() > 0) {
info.setVisible(true);
Properties currentDescriptor = InstallerEngine.getInstance().getDescriptor(ns);
if (currentDescriptor != null) {
name.setText(getNamespaceLabel(ns));
name.pack();
version.setText(currentDescriptor.getProperty(InstallerConst.DESCRIPTOR_VERSION, "-"));
version.pack();
author.setText(currentDescriptor.getProperty(InstallerConst.DESCRIPTOR_AUTHOR, "-"));
author.pack();
type.setText(m_i18n.getString(getNamespace(), currentDescriptor.getProperty(InstallerConst.DESCRIPTOR_TYPE, "-"), "label", m_language));
type.pack();
website.setText(currentDescriptor.getProperty(InstallerConst.DESCRIPTOR_WEBSITE, "-"));
if (website.getText().length() > 6 && website.getText().toLowerCase().startsWith("http")) {
website.setEnabled(true);
}
website.pack();
}
}
}
});
}
final Button uninstall = new Button(c, SWT.PUSH | SWT.LEFT);
uninstall.setText(this.m_i18n.getString(this.getNamespace(), "uninstall", "label", this.m_language));
if (module.getItemCount() == 0 || OSUtils.isMultiuserEnabled()) {
uninstall.setEnabled(false);
}
uninstall.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String ns = (String) module.getData(module.getText());
MessageBox messageBox = new MessageBox(uninstall.getShell(), SWT.APPLICATION_MODAL | SWT.YES | SWT.NO);
messageBox.setMessage(m_i18n.getString(getNamespace(), "confirmdelete", "label", m_language));
if (messageBox.open() == SWT.YES) {
if (InstallerEngine.getInstance().uninstall(ns)) {
m_logger.info("Removed <" + ns + "> module successfully.");
if (module.getItemCount() == 0) {
uninstall.setEnabled(false);
}
MessageDialog.openInformation(install.getShell(), m_i18n.getString(getNamespace(), "okrtitle", "label", m_language), m_i18n.getString(getNamespace(), "okrmessage", "label", m_language));
} else {
MessageDialog.openError(install.getShell(), m_i18n.getString(getNamespace(), "failrtitle", "label", m_language), m_i18n.getString(getNamespace(), "failrmessage", "label", m_language));
}
buildCombobox(module);
}
}
});
l = new Label(c, SWT.LEFT);
return c;
}
Aggregations