/*******************************************************************************
* Copyright (c) 2012 BREDEX GmbH.
* 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:
* BREDEX GmbH - initial API and implementation
*******************************************************************************/
package org.eclipse.jubula.rc.swt.tester.adapter;
import org.eclipse.jubula.rc.common.driver.IRunnable;
import org.eclipse.jubula.rc.common.tester.adapter.interfaces.ITextComponent;
import org.eclipse.jubula.rc.swt.tester.util.CAPUtil;
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
import org.eclipse.swt.widgets.Label;
/**
* @author BREDEX GmbH
*/
public class LabelAdapter extends ControlAdapter implements ITextComponent {
/**
* @param objectToAdapt the component to adapt
*/
public LabelAdapter(Object objectToAdapt) {
super(objectToAdapt);
}
/**
* {@inheritDoc}
*/
public String getText() {
final Label label = (Label) getRealComponent();
return getEventThreadQueuer().invokeAndWait(
"getText", new IRunnable<String>() { //$NON-NLS-1$
public String run() {
return CAPUtil.getWidgetText(label,
SwtUtils.removeMnemonics(label.getText()));
}
});
}
}