📄 doubledisplayfactory.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.display;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import org.apache.log4j.Logger;
import org.eclipse.swt.widgets.Composite;
/**
* This class ...
*
* @author <a href="http://sourceforge.net/sendmessage.php?touser=733840">pyropunk at sourceforge dot net</a>
* @version $Revision: 1.3 $
*/
public class DoubleDisplayFactory {
/**
* <code>log</code> DoubleDisplayFactory -
*/
private static final Logger log = Logger.getLogger(DoubleDisplayFactory.class);
/**
* <code>internal</code> DoubleDisplayFactory -
*/
private static DoubleDisplayFactory internal = null;
/**
* Constructor
*/
private DoubleDisplayFactory() {
super();
}
/**
* This method ...
*
* @return DoubleDisplayFactory
*/
public static synchronized DoubleDisplayFactory getInstance() {
if (internal == null) {
internal = new DoubleDisplayFactory();
}
return internal;
}
/**
* This method generates the correct DoubleDisplay for the given type.
*
* @param pPackage
* @param pArg0
* @param pArg1
* @return DoubleDisplay
*/
@SuppressWarnings({
"unchecked", "boxing"
})
public final DoubleDisplay makeDoubleDisplay(final String pPackage, final Composite pArg0, final int pArg1) {
String cls = this.getClass().getName();
cls = cls.substring(0, cls.lastIndexOf('.') + 1) + pPackage;
cls += ".Double" + pPackage.substring(0, 1).toUpperCase() + pPackage.substring(1) + "Display";
try {
final Class<DoubleDisplay> c = (Class<DoubleDisplay>)Class.forName(cls);
final Constructor<DoubleDisplay> con = c.getConstructor(new Class[]{
Composite.class, int.class
});
return con.newInstance(new Object[]{
pArg0, pArg1
});
} catch (final ClassNotFoundException cnf) {
log.error("oops", cnf);
return null;
} catch (final InvocationTargetException ite) {
log.error("oops", ite);
return null;
} catch (final SecurityException e) {
log.error("oops", e);
return null;
} catch (final NoSuchMethodException e) {
log.error("oops", e);
return null;
} catch (final IllegalArgumentException e) {
log.error("oops", e);
return null;
} catch (final InstantiationException e) {
log.error("oops", e);
return null;
} catch (final IllegalAccessException e) {
log.error("oops", e);
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -