Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
roikku committed May 29, 2014
1 parent b169548 commit 632bfea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Robot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -27,19 +26,21 @@ public enum ComputerSleepingManager {

private final static Logger logger = LoggerFactory.getLogger(ComputerSleepingManager.class);

private final int interval = 15 * 60 * 1000 ;
private final int interval = 15 * 60 * 1000 ; // 15 minutes
private SeeminglyStaticMouseShaker mouseShaker = null ;
private Thread thread = null ;
private int counter = 0 ;

public synchronized void keepAwake (boolean ka)
{
counter = Math.max(0, counter + ((ka) ? (1) : (-1))) ;
if (ka && (mouseShaker == null))
{
mouseShaker = new SeeminglyStaticMouseShaker (interval) ;
thread = new Thread (mouseShaker) ;
thread.start();
}
else if (!ka && (mouseShaker != null))
else if (!ka && (mouseShaker != null) && counter == 0)
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ public static Icon getFileTypeIcon (String contentType, String filename)
{
Icon ret = null ;

if (contentType != null && SwiftUtils.directoryContentType.equalsIgnoreCase(contentType))
return getIconFromIconFileName("folder.png");

String ext = FilenameUtils.getExtension(filename);
if (ext != null && !ext.isEmpty())
ret = getIconFromFileExt (ext) ;
Expand All @@ -247,9 +250,9 @@ public static Icon getFileTypeIcon (String contentType, String filename)

if (contentType != null && !contentType.isEmpty())
{
if (SwiftUtils.directoryContentType.equalsIgnoreCase(contentType))
/*if (SwiftUtils.directoryContentType.equalsIgnoreCase(contentType))
ret = getIconFromIconFileName("folder.png");
else if (mineToExtSetMap.containsKey(contentType))
else*/ if (mineToExtSetMap.containsKey(contentType))
{
Set<String> extsSet = mineToExtSetMap.get(contentType);
for (String ex : extsSet)
Expand Down

0 comments on commit 632bfea

Please sign in to comment.