Verified Owner
Top Description Fields Constructors Methods
org.jabref.gui.externalfiletype

public Class CustomExternalFileType

extends Object
implements ExternalFileType
Class Inheritance
All Implemented Interfaces
org.jabref.gui.externalfiletype.ExternalFileType
Imports
java.util.Objects, org.jabref.gui.icon.IconTheme, .JabRefIcon, org.jspecify.annotations.NonNull

This class defines a type of external files that can be linked to from JabRef. The class contains enough information to provide an icon, a standard extension and a link to which application handles files of this type.

Todo

Move to model (and then adapt org.jabref.gui.fieldeditors.LinkedFilesEditorViewModel#fromFile(java.nio.file.Path, java.util.List, org.jabref.logic.FilePreferences)).

Field Summary

Modifier and TypeField and Description
private String
private JabRefIcon
private String
private String
private String
private String

Constructor Summary

AccessConstructor and Description
public
CustomExternalFileType(String name, String extension, String mimeType, String openWith, String iconName, JabRefIcon icon)

public

Method Summary

Modifier and TypeMethod and Description
public static ExternalFileType
buildFromArgs(String[]
arguments.
val
)

Construct an ExternalFileType from a String array.

public ExternalFileType
copy()

public boolean

Returns:

true if the file types are equal.
equals
(Object
The file type to compare with.
object
)

Overrides java.lang.Object.equals.

We define two file type objects as equal if their name, extension, openWith and iconName are equal.

public String
public JabRefIcon
public String

Returns:

The icon name.
getIconName
()

Get the string associated with this file type's icon.

public String
public String
public String
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public void
setExtension(String extension)

public void
public void
setIconName(String
The icon name to use.
name
)

Set the string associated with this file type's icon.

public void
setMimeType(String mimeType)

public void
public void
setOpenWith(String openWith)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

extensionback to summary
private String extension
iconback to summary
private JabRefIcon icon
iconNameback to summary
private String iconName
mimeTypeback to summary
private String mimeType
nameback to summary
private String name
openWithback to summary
private String openWith

Constructor Detail

CustomExternalFileTypeback to summary
public CustomExternalFileType(String name, String extension, String mimeType, String openWith, String iconName, JabRefIcon icon)
CustomExternalFileTypeback to summary
public CustomExternalFileType(ExternalFileType type)

Method Detail

buildFromArgsback to summary
public static ExternalFileType buildFromArgs(String[] val)

Construct an ExternalFileType from a String array. This is used when reading file type definitions from Preferences, where the available data types are limited. We assume that the array contains the same values as the main constructor, in the same order.

Parameters
val:String[]

arguments.

copyback to summary
public ExternalFileType copy()
equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

We define two file type objects as equal if their name, extension, openWith and iconName are equal.

Parameters
object:Object

The file type to compare with.

Returns:boolean

true if the file types are equal.

Annotations
@Override
getExtensionback to summary
public String getExtension()

Implements org.jabref.gui.externalfiletype.ExternalFileType.getExtension.

Annotations
@Override
getIconback to summary
public JabRefIcon getIcon()

Implements org.jabref.gui.externalfiletype.ExternalFileType.getIcon.

Annotations
@Override
getIconNameback to summary
public String getIconName()

Get the string associated with this file type's icon.

Returns:String

The icon name.

getMimeTypeback to summary
public String getMimeType()

Implements org.jabref.gui.externalfiletype.ExternalFileType.getMimeType.

Annotations
@Override
getNameback to summary
public String getName()

Implements org.jabref.gui.externalfiletype.ExternalFileType.getName.

Annotations
@Override
getOpenWithApplicationback to summary
public String getOpenWithApplication()

Implements org.jabref.gui.externalfiletype.ExternalFileType.getOpenWithApplication.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
setExtensionback to summary
public void setExtension(String extension)
setIconback to summary
public void setIcon(@NonNull JabRefIcon icon)
setIconNameback to summary
public void setIconName(String name)

Set the string associated with this file type's icon.

Parameters
name:String

The icon name to use.

setMimeTypeback to summary
public void setMimeType(String mimeType)
setNameback to summary
public void setName(String name)
setOpenWithback to summary
public void setOpenWith(String openWith)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override