Search in sources :

Example 6 with GitChangeType

use of com.oxygenxml.git.service.entities.GitChangeType in project oxygen-git-client-addon by oxygenxml.

the class FileUtil method shouldEnableBlameAndHistory.

/**
 * Checks if we have just one resource and if it's a resource that is committed in the repository.
 *
 * @param allSelectedResources A set of resources.
 *
 * @return <code>true</code> if we have just one resource in the set and that resource is one with history.
 */
public static boolean shouldEnableBlameAndHistory(final List<FileStatus> allSelectedResources) {
    boolean hasHistory = false;
    if (allSelectedResources.size() == 1) {
        GitChangeType changeType = allSelectedResources.get(0).getChangeType();
        hasHistory = changeType == GitChangeType.CHANGED || changeType == GitChangeType.CONFLICT || changeType == GitChangeType.MODIFIED;
    }
    return hasHistory;
}
Also used : GitChangeType(com.oxygenxml.git.service.entities.GitChangeType)

Aggregations

GitChangeType (com.oxygenxml.git.service.entities.GitChangeType)6 FileStatus (com.oxygenxml.git.service.entities.FileStatus)3 RenderingInfo (com.oxygenxml.git.view.util.RenderingInfo)2 Icon (javax.swing.Icon)2 JLabel (javax.swing.JLabel)2 NoRepositorySelected (com.oxygenxml.git.service.NoRepositorySelected)1 CheckoutCommitAction (com.oxygenxml.git.view.history.actions.CheckoutCommitAction)1 CreateBranchFromCommitAction (com.oxygenxml.git.view.history.actions.CreateBranchFromCommitAction)1 CreateTagAction (com.oxygenxml.git.view.history.actions.CreateTagAction)1 ResetBranchToCommitAction (com.oxygenxml.git.view.history.actions.ResetBranchToCommitAction)1 RevertCommitAction (com.oxygenxml.git.view.history.actions.RevertCommitAction)1 Color (java.awt.Color)1 FontMetrics (java.awt.FontMetrics)1 ActionEvent (java.awt.event.ActionEvent)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 LinkedList (java.util.LinkedList)1 AbstractAction (javax.swing.AbstractAction)1 Action (javax.swing.Action)1 JMenu (javax.swing.JMenu)1