Author: adietish
Date: 2012-01-27 14:45:37 -0500 (Fri, 27 Jan 2012)
New Revision: 38250
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java
Log:
[JBIDE-10724] open external browser when link in property table is clicked
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java 2012-01-27
19:36:09 UTC (rev 38249)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java 2012-01-27
19:45:37 UTC (rev 38250)
@@ -12,8 +12,12 @@
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Tree;
+import org.jboss.tools.common.ui.BrowserUtil;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.TreeUtils;
/**
@@ -30,10 +34,23 @@
}
}
- private void createLink(IProperty property, final ViewerCell cell) {
+ protected void createLink(IProperty property, final ViewerCell cell) {
Link link = new Link((Tree) cell.getControl(), SWT.NONE);
- link.setText("<a>" + property.getValue() +"</a>");
+ link.setText("<a>" + property.getValue() + "</a>");
link.setBackground(cell.getBackground());
+ link.addMouseListener(onLinkClicked(property.getValue()));
+
TreeUtils.createTreeEditor(link, property.getValue(), cell);
}
+
+ protected MouseAdapter onLinkClicked(final String url) {
+ return new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ BrowserUtil.checkedCreateExternalBrowser(
+ url, OpenShiftUIActivator.PLUGIN_ID, OpenShiftUIActivator.getDefault().getLog());
+ }
+ };
+ }
}