📄 fingerprinttreelabelprovider.java
字号:
/**
* DuMP3 version morpheus_0.2.9 - a duplicate/similar file finder in Java<BR>
* Copyright 2005 Alexander Grässer<BR>
* All Rights Reserved, http://dump3.sourceforge.net/<BR>
* <BR>
* This file is part of DuMP3.<BR>
* <BR>
* DuMP3 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later version.<BR>
* <BR>
* DuMP3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.<BR>
* <BR>
* You should have received a copy of the GNU General Public License along with DuMP3; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
* Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.za.grasser.duplicate.gui;
import java.util.Iterator;
import java.util.List;
import net.za.grasser.duplicate.file.FingerprintFile;
import net.za.grasser.duplicate.fingerprint.AbstractFingerprint;
import net.za.grasser.duplicate.fingerprint.FingerprintFactory;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import com.cloudgarden.resource.SWTResourceManager;
/**
* This class ...
*
* @author <a href="http://sourceforge.net/sendmessage.php?touser=733840">pyropunk at sourceforge dot net</a>
* @version $Revision: 1.7 $
*/
public class FingerprintTreeLabelProvider extends LabelProvider {
/**
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
*/
@Override
public String getText(final Object element) {
final FingerprintFile f = (FingerprintFile)element;
return f.getPath();
}
/**
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
*/
@Override
public Image getImage(final Object element) {
final FingerprintFile f = (FingerprintFile)element;
if (f.getCompared() == null) {
final List<Class< ? extends AbstractFingerprint>> s = FingerprintFactory.getFingerprintTypes(((FingerprintFile)element).getExtension());
final Iterator<Class< ? extends AbstractFingerprint>> it = s.iterator();
while (it.hasNext()) {
final Class< ? > cls = it.next();
if (cls.getName().indexOf("ColorFingerprint") >= 0) {
return SWTResourceManager.getImage("icons/mona.gif");
}
if (cls.getName().indexOf("FdmfFingerprint") >= 0) {
return SWTResourceManager.getImage("icons/note.gif");
}
if (cls.getName().indexOf("SifFingerprint") >= 0 || cls.getName().indexOf("SubstringFingerprint") >= 0) {
return SWTResourceManager.getImage("icons/file.gif");
}
// return SWTResourceManager.getImage("icons/run.gif");
}
return SWTResourceManager.getImage("icons/binary.gif");
}
// FR 1548860 - Bigger text for percentage match
return SWTResourceManager.getImage(f.getSimilarity(),
SWTResourceManager.getColor(128, 0, 0),
SWTResourceManager.getColor(255, 255, 255),
SWTResourceManager.getFont("Arial", 8, SWT.NORMAL),
SWTResourceManager.getColor(255, 255, 255));
/**
* <pre>
* // old code
* return SWTResourceManager.getImage(f.getSimilarity(),
* SWTResourceManager.getColor(255, 128, 128),
* SWTResourceManager.getColor(255, 255, 255),
* SWTResourceManager.getFont("Arial", 8, SWT.NORMAL),
* SWTResourceManager.getColor(0, 0, 0));
* </pre>
*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -