001/*
002 * Copyright 2010-2015 Institut Pasteur.
003 * 
004 * This file is part of Icy.
005 * 
006 * Icy is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 * 
011 * Icy is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 * GNU General Public License for more details.
015 * 
016 * You should have received a copy of the GNU General Public License
017 * along with Icy. If not, see <http://www.gnu.org/licenses/>.
018 */
019// IJMethods.java
020//
021
022/*
023 * ImageJ software for multidimensional image processing and analysis.
024 * 
025 * Copyright (c) 2010, ImageJDev.org.
026 * All rights reserved.
027 * 
028 * Redistribution and use in source and binary forms, with or without
029 * modification, are permitted provided that the following conditions are met:
030 * Redistributions of source code must retain the above copyright
031 * notice, this list of conditions and the following disclaimer.
032 * Redistributions in binary form must reproduce the above copyright
033 * notice, this list of conditions and the following disclaimer in the
034 * documentation and/or other materials provided with the distribution.
035 * Neither the names of the ImageJDev.org developers nor the
036 * names of its contributors may be used to endorse or promote products
037 * derived from this software without specific prior written permission.
038 * 
039 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
040 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
041 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
042 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
043 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
044 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
045 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
046 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
047 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
048 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
049 * POSSIBILITY OF SUCH DAMAGE.
050 */
051
052package icy.imagej.patches;
053
054import icy.imagej.ImageJWrapper;
055import icy.main.Icy;
056
057import ij.IJ;
058
059/**
060 * Overrides {@link IJ} methods.
061 * 
062 * @author Curtis Rueden
063 */
064public class IJMethods
065{
066    /** Resolution to use when converting double progress to int ratio. */
067    private static final int PROGRESS_GRANULARITY = 1000;
068
069    private IJMethods()
070    {
071        // prevent instantiation of utility class
072    }
073
074    /** Appends {@link IJ#showProgress(double)}. */
075    public static void showProgress(final double progress)
076    {
077        // approximate progress as int ratio
078        final int currentIndex = (int) (PROGRESS_GRANULARITY * progress);
079        final int finalIndex = PROGRESS_GRANULARITY;
080        showProgress(currentIndex, finalIndex);
081    }
082
083    /** Appends {@link IJ#showProgress(int, int)}. */
084    public static void showProgress(final int currentIndex, final int finalIndex)
085    {
086        final ImageJWrapper ijw = Icy.getMainInterface().getImageJ();
087
088        if (ijw != null)
089            ijw.showSwingProgress(currentIndex, finalIndex);
090    }
091
092    /** Appends {@link IJ#showStatus(String)}. */
093    public static void showStatus(final String s)
094    {
095        
096    }
097}