2015-10-22 00:05:29 +02:00
|
|
|
/*******************************************************************************
|
2015-10-22 00:25:12 +02:00
|
|
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
2015-10-22 00:05:29 +02:00
|
|
|
* 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:
|
|
|
|
* MINRES Technologies GmbH - initial API and implementation
|
|
|
|
*******************************************************************************/
|
|
|
|
package com.minres.scviewer.e4.application.provider;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
|
|
|
import org.eclipse.jface.viewers.ITableLabelProvider;
|
|
|
|
import org.eclipse.swt.graphics.Image;
|
|
|
|
|
|
|
|
import com.minres.scviewer.database.ITxAttribute;
|
|
|
|
import com.minres.scviewer.e4.application.parts.TransactionDetails;
|
|
|
|
|
2015-11-22 12:47:07 +01:00
|
|
|
/**
|
|
|
|
* The Class TxPropertiesLabelProvider providing the labels of a property to the respective viewer.
|
|
|
|
*/
|
2015-10-22 00:05:29 +02:00
|
|
|
public class TxPropertiesLabelProvider implements ITableLabelProvider {
|
|
|
|
|
2015-11-22 12:47:07 +01:00
|
|
|
/** The listeners. */
|
2015-10-22 00:05:29 +02:00
|
|
|
private List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>();
|
|
|
|
|
2015-11-22 12:47:07 +01:00
|
|
|
/**
|
|
|
|
* Instantiates a new tx properties label provider.
|
|
|
|
*/
|
2015-10-22 00:05:29 +02:00
|
|
|
public TxPropertiesLabelProvider() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
2015-11-22 12:47:07 +01:00
|
|
|
/* (non-Javadoc)
|
|
|
|
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
|
|
|
|
*/
|
2015-10-22 00:05:29 +02:00
|
|
|
@Override
|
|
|
|
public void dispose() {
|
|
|
|
}
|
|
|
|
|
2015-11-22 12:47:07 +01:00
|
|
|
/* (non-Javadoc)
|
|
|
|
* @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
|
|
|
|
*/
|
2015-10-22 00:05:29 +02:00
|
|
|
@Override
|
|
|
|
public void addListener(ILabelProviderListener listener) {
|
|
|
|
listeners.add(listener);
|
|
|
|
}
|
|
|
|
|
2015-11-22 12:47:07 +01:00
|
|
|
/* (non-Javadoc)
|
|
|
|
* @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
|
|
|
|
*/
|
2015-10-22 00:05:29 +02:00
|
|
|
@Override
|
|
|
|
public void removeListener(ILabelProviderListener listener) {
|
|
|
|
listeners.remove(listener);
|
|
|
|
}
|
|
|
|
|
2015-11-22 12:47:07 +01:00
|
|
|
/* (non-Javadoc)
|
|
|
|
* @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
|
|
|
|
*/
|
2015-10-22 00:05:29 +02:00
|
|
|
@Override
|
|
|
|
public boolean isLabelProperty(Object element, String property) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-11-22 12:47:07 +01:00
|
|
|
/* (non-Javadoc)
|
|
|
|
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
|
|
|
|
*/
|
2015-10-22 00:05:29 +02:00
|
|
|
@Override
|
|
|
|
public Image getColumnImage(Object element, int columnIndex) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-11-22 12:47:07 +01:00
|
|
|
/* (non-Javadoc)
|
|
|
|
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
|
|
|
|
*/
|
2015-10-22 00:05:29 +02:00
|
|
|
@Override
|
|
|
|
public String getColumnText(Object element, int columnIndex) {
|
|
|
|
ITxAttribute attribute = (ITxAttribute) element;
|
2017-01-23 22:53:14 +01:00
|
|
|
String text = ""; //$NON-NLS-1$
|
2015-10-22 00:05:29 +02:00
|
|
|
switch (columnIndex) {
|
|
|
|
case TransactionDetails.COLUMN_FIRST:
|
|
|
|
text = attribute.getName();
|
|
|
|
break;
|
|
|
|
case TransactionDetails.COLUMN_SECOND:
|
|
|
|
text = attribute.getValue().toString();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|