com.microsoft.tfs.core.externaltools
Class ExternalToolAssociation

java.lang.Object
  extended by com.microsoft.tfs.core.externaltools.ExternalToolAssociation

public final class ExternalToolAssociation
extends java.lang.Object

Associates one or more file extension strings with an ExternalTool. Extensions always have whitespace trimmed and are compared case-insensitive.

Since:
TEE-SDK-10.1
Thread-safety:
thread-safe

Constructor Summary
ExternalToolAssociation(java.lang.String[] extensions, ExternalTool tool)
          Creates a ExternalToolAssociation that associates the given extensions with the given tool.
 
Method Summary
 void clearExtensions()
          Clears the extensions in this association.
 boolean containsExtension(java.lang.String fileExtension)
          Tests whether this ExternalToolAssociation contains the given extension.
 java.lang.String[] getExtensions()
           
 ExternalTool getTool()
           
static ExternalToolAssociation loadFromMemento(Memento memento)
          Loads association state from the given Memento, which can have any name.
 boolean putExtension(java.lang.String extension)
          Adds an extension to the set of file extensions, if it did not already exist in the set.
 boolean putExtensions(java.lang.String[] extensions)
          Adds all the given file extensions, if they did not already exist in the set.
 void saveToMemento(Memento memento)
          Saves this association's state to the given Memento, which should have a name (of the caller's choice) but no other data.
 void setTool(ExternalTool tool)
          Sets the ExternalTool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalToolAssociation

public ExternalToolAssociation(java.lang.String[] extensions,
                               ExternalTool tool)
Creates a ExternalToolAssociation that associates the given extensions with the given tool.

Parameters:
extensions - the extension (may be null or empty; elements not null, or empty string, or all whitespace)
tool - the tool (may be null)
Method Detail

putExtension

public boolean putExtension(java.lang.String extension)
Adds an extension to the set of file extensions, if it did not already exist in the set. Extensions are stored case-insensitive.

Parameters:
extension - the extension to add (not null, not empty, not all whitespace)
Returns:
true if the extension set did not already contain the extension, false if it did already contain the extension

putExtensions

public boolean putExtensions(java.lang.String[] extensions)
Adds all the given file extensions, if they did not already exist in the set.

Parameters:
extensions - the extensions to add (may be null or empty; elements not null, or empty string, or all whitespace)
Returns:
true if any of the items were new to the set, false if they were all already in the set
See Also:
putExtension(String)

getExtensions

public java.lang.String[] getExtensions()
Returns:
the extensions in this association, never null but may be empty

clearExtensions

public void clearExtensions()
Clears the extensions in this association.


setTool

public void setTool(ExternalTool tool)
Sets the ExternalTool.

Parameters:
tool - the ExternalTool, may be null

getTool

public ExternalTool getTool()
Returns:
this association's ExternalTool, may be null

containsExtension

public boolean containsExtension(java.lang.String fileExtension)
Tests whether this ExternalToolAssociation contains the given extension.

Parameters:
fileExtension - the file extension (must not be null)
Returns:
true if this extension exists in this association, false if it does not

saveToMemento

public void saveToMemento(Memento memento)
Saves this association's state to the given Memento, which should have a name (of the caller's choice) but no other data.

Parameters:
memento - the Memento to save this association's state to (must not be null)

loadFromMemento

public static ExternalToolAssociation loadFromMemento(Memento memento)
Loads association state from the given Memento, which can have any name.

Parameters:
memento - the Memento to load state from (must not be null)


© 2015 Microsoft. All rights reserved.