Author: adietish
Date: 2012-01-27 18:58:59 -0500 (Fri, 27 Jan 2012)
New Revision: 38256
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyCellLabelProvider.java
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/utils/TreeUtils.java
Log:
[JBIDE-10724] show styled text before link widget (tree editor) becomes visible
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyCellLabelProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyCellLabelProvider.java 2012-01-27
21:25:20 UTC (rev 38255)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyCellLabelProvider.java 2012-01-27
23:58:59 UTC (rev 38256)
@@ -10,14 +10,14 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.propertytable;
-import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.StyledCellLabelProvider;
import org.eclipse.jface.viewers.ViewerCell;
/**
* @author Xavier Coulon
* @author Andre Dietisheim
*/
-public abstract class AbstractPropertyCellLabelProvider extends CellLabelProvider {
+public abstract class AbstractPropertyCellLabelProvider extends StyledCellLabelProvider
{
@Override
public void update(ViewerCell cell) {
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
21:25:20 UTC (rev 38255)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java 2012-01-27
23:58:59 UTC (rev 38256)
@@ -10,10 +10,12 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.propertytable;
+import org.eclipse.jface.viewers.StyledString;
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.graphics.TextStyle;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Tree;
import org.jboss.tools.common.ui.BrowserUtil;
@@ -28,6 +30,8 @@
protected void update(IProperty property, ViewerCell cell) {
if (property.isLink()) {
+ // tree editor takes some time to display, show text in the meantime
+ createStyledText(property, cell);
createLink(property, cell);
} else {
cell.setText(property.getValue());
@@ -39,10 +43,23 @@
link.setText("<a>" + property.getValue() + "</a>");
link.setBackground(cell.getBackground());
link.addMouseListener(onLinkClicked(property.getValue()));
-
+
TreeUtils.createTreeEditor(link, property.getValue(), cell);
}
+ private void createStyledText(IProperty property, final ViewerCell cell) {
+ StyledString.Styler style = new StyledString.Styler() {
+ @Override
+ public void applyStyles(TextStyle textStyle) {
+ textStyle.foreground =
cell.getControl().getDisplay().getSystemColor(SWT.COLOR_BLUE);
+ textStyle.underline = true;
+ }
+ };
+ StyledString styledString = new StyledString(property.getValue(), style);
+ cell.setStyleRanges(styledString.getStyleRanges());
+ cell.setText(styledString.getString());
+ }
+
protected MouseAdapter onLinkClicked(final String url) {
return new MouseAdapter() {
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java 2012-01-27
21:25:20 UTC (rev 38255)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java 2012-01-27
23:58:59 UTC (rev 38256)
@@ -66,12 +66,12 @@
{
treeEditor.grabHorizontal = true;
treeEditor.grabVertical = true;
- treeEditor.horizontalAlignment = SWT.CENTER;
- treeEditor.verticalAlignment = SWT.CENTER;
+ treeEditor.horizontalAlignment = SWT.FILL;
+ treeEditor.verticalAlignment = SWT.FILL;
TreeItem treeItem = ( TreeItem ) cell.getItem();
treeEditor.setEditor( control, treeItem, cell.getColumnIndex() );
// ensure cell is as large as space needed for link
- cell.setText( " " + cellText + " ");
+ //cell.setText( " " + cellText + " ");
}
/**
Show replies by date