KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > model > elements > ExpressionLabelProvider


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.model.elements;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.debug.core.model.IErrorReportingExpression;
15 import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
16 import org.eclipse.jface.viewers.TreePath;
17 import org.eclipse.swt.graphics.RGB;
18
19 /**
20  * @since 3.3
21  */

22 public class ExpressionLabelProvider extends VariableLabelProvider {
23
24     /* (non-Javadoc)
25      * @see org.eclipse.debug.internal.ui.model.elements.VariableLabelProvider#getForeground(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String)
26      */

27     protected RGB getForeground(TreePath elementPath, IPresentationContext presentationContext, String JavaDoc columnId) throws CoreException {
28         Object JavaDoc element = elementPath.getLastSegment();
29         if (element instanceof IErrorReportingExpression) {
30             IErrorReportingExpression expression = (IErrorReportingExpression) element;
31             if (expression.hasErrors()) {
32                 return new RGB(255, 0, 0);
33             }
34         }
35         return super.getForeground(elementPath, presentationContext, columnId);
36     }
37     
38 }
39
Popular Tags