diff options
Diffstat (limited to 'common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ViewerCellLabelAdapter.java')
-rw-r--r-- | common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ViewerCellLabelAdapter.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ViewerCellLabelAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ViewerCellLabelAdapter.java new file mode 100644 index 0000000000..b39986d726 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ViewerCellLabelAdapter.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.common.ui.internal.jface; + +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jpt.common.ui.internal.swt.bind.WidgetLabelAdapter; +import org.eclipse.jpt.common.utility.internal.ObjectTools; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Control; + +/** + * Adapt a JFace viewer cell to the <em>label</em> interface. + * @see ViewerCell + */ +public final class ViewerCellLabelAdapter + implements WidgetLabelAdapter +{ + private final ViewerCell viewerCell; + + public ViewerCellLabelAdapter(ViewerCell viewerCell) { + super(); + if (viewerCell == null) { + throw new NullPointerException(); + } + this.viewerCell = viewerCell; + } + + public void setImage(Image image) { + this.viewerCell.setImage(image); + } + + public void setText(String text) { + this.viewerCell.setText(text); + } + + public Control getWidget() { + return this.viewerCell.getControl(); + } + + @Override + public String toString() { + return ObjectTools.toString(this, this.viewerCell); + } +} |