Fixed findbugs warnings in UML2SD of TMF UI
authorBernd Hufmann <bhufmann@gmail.com>
Thu, 21 Jul 2011 15:51:39 +0000 (11:51 -0400)
committerBernd Hufmann <bhufmann@gmail.com>
Thu, 21 Jul 2011 15:51:39 +0000 (11:51 -0400)
12 files changed:
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/DrawableToolTip.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/NGC.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/ScrollView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/BasicFrame.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/drawings/impl/ImageImpl.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/Zoom.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/impl/TmfUml2SDSyncLoader.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewPref.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/preferences/SDViewerPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/util/SDPrintDialogUI.java

index c972a2b3839623e0479bdea3c1048d8d2f6b8821..ae75d2d294086c6bce33dd54e3afcb2503296a2a 100755 (executable)
@@ -49,10 +49,11 @@ public class DrawableToolTip implements PaintListener {
     protected TmfTimeRange minMaxRange;
     protected TmfTimestamp currentValue;
 
-    protected static int H_MARGIN = 10;
-    protected static int V_MARGIN = 10;
-    protected static int TEXT_SCALE_MARGIN = 20;
-    protected static int SCALE_LENGTH = 100;
+    private static int H_MARGIN = 10;
+    private static int V_MARGIN = 10;
+
+    private static int TEXT_SCALE_MARGIN = 20;
+    private static int SCALE_LENGTH = 100;
 
     protected String msg;
 
@@ -177,4 +178,37 @@ public class DrawableToolTip implements PaintListener {
         for (int i = 0; i < col.length; i++)
             col[i].dispose();
     }
+    
+    protected static int getHorizontalMargin() {
+        return H_MARGIN;
+    }
+
+    protected static void setHorizontalMargin(int margin) {
+        H_MARGIN = margin;
+    }
+
+    protected static int getVerticalMargin() {
+        return V_MARGIN;
+    }
+
+    protected static void setVerticalMargin(int margin) {
+        V_MARGIN = margin;
+    }
+
+    protected static int getTestScaleMargin() {
+        return TEXT_SCALE_MARGIN;
+    }
+
+    protected static void setTestScaleMargin(int testScaleMargin) {
+        TEXT_SCALE_MARGIN = testScaleMargin;
+    }
+
+    protected static int getScaleLength() {
+        return SCALE_LENGTH;
+    }
+
+    protected static void setScaleLength(int scaleLength) {
+        SCALE_LENGTH = scaleLength;
+    }
+
 }
index c858bfd297b86c213fc0a31b482c25d4cce609c3..ee744a09104f17392800185d7ef3f76a7272a3b0 100755 (executable)
@@ -47,8 +47,8 @@ public class NGC implements IGC {
     protected int xx;
     protected boolean drawWithFocus = false;
 
-    protected static int vscreen_bounds = 0;
-
+    private static int vscreen_bounds = 0;
+    
     public NGC(SDWidget scrollView, GC gc) {
         context = gc;
         view = scrollView;
@@ -685,4 +685,13 @@ public class NGC implements IGC {
     public void setDrawTextWithFocusStyle(boolean focus) {
         drawWithFocus = focus;
     }
+    
+    protected static int getVscreenBounds() {
+        return vscreen_bounds;
+    }
+
+    protected static void setVscreenBounds(int vBounds) {
+        vscreen_bounds = vBounds;
+    }
+
 }
index 49c5be3d86c8606aa5d68638e829686b5bee77c5..39ae809cbe50134fbf8ad13f3351164638e6d8c2 100755 (executable)
@@ -1476,7 +1476,7 @@ public class ScrollView extends Composite {
     }
 
     // static must take place here... cursor is created once.
-    protected static Cursor overview_cursor_;
+    static Cursor overview_cursor_;
 
     /** Support for click-and-see overview shell on this ScrollView */
     protected class Overview {
index befab048d7ea652bceb7b7152b79a8816d41575c..4dc1b8aef11de13ab63fb23de665b2c4d08ebb49 100755 (executable)
@@ -76,7 +76,7 @@ public class BasicFrame extends GraphNode {
     protected int visibleAreaWidth;
     protected int visibleAreaHeight;
 
-    protected static ISDPreferences userPref = null;
+    static ISDPreferences userPref = null;
 
     protected int forceEventOccurrenceSpacing = -1;
 
index c15cc12b55b73f282ec16eeb64457438aba3e846..d3a17099d448cff6c03bdd9522019254364c7ed5 100755 (executable)
@@ -521,7 +521,7 @@ public class Frame extends BasicFrame {
      * @param categories the lifeline categories array
      */
     public void setLifelineCategories(LifelineCategories[] categories) {
-        lifelineCategories = categories;
+        lifelineCategories = Arrays.copyOf(categories, categories.length);
     }
 
     /**
@@ -530,7 +530,7 @@ public class Frame extends BasicFrame {
      * @return the lifeline categories array or null if not set
      */
     public LifelineCategories[] getLifelineCategories() {
-        return lifelineCategories;
+        return  Arrays.copyOf(lifelineCategories, lifelineCategories.length); 
     }
 
     /**
index 83e4f437072e72faff6c38250f54ad51e0628d22..1463eaa275fed88969a548d32a83702948e9703c 100755 (executable)
@@ -12,6 +12,7 @@
  **********************************************************************/
 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.impl;
 
+import java.net.MalformedURLException;
 import java.net.URL;
 
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -33,26 +34,14 @@ public class ImageImpl implements IImage {
     public ImageImpl(Image img_) {
         img = img_;
     }
-
-    protected static URL BASIC_URL = null;
-    static {
-        // URL to get images from plug-ins
-        // perhaps we can found better code to load images ...
-        // but at this time I know this:
-        try {
-            BASIC_URL = new URL("platform", "localhost", "plugin");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        } catch (Exception E) {
-            System.err.println(E);
-        }
-    }
-
+    
     public Image getResourceImage(String _name) {
         try {
-            // FIXME: bhufmann: don't use org.eclipse.linuxtools.tmf.ui
+            URL BASIC_URL = new URL("platform", "localhost", "plugin");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             URL url = new URL(BASIC_URL, "plugin/org.eclipse.linuxtools.tmf.ui/icons/" + _name);//$NON-NLS-1$
             ImageDescriptor img = ImageDescriptor.createFromURL(url);
             return img.createImage();
-        } catch (Exception E) {
+        } catch (MalformedURLException E) {
             System.err.println(E);
         }
         return null;
index 526b82919bf23dfc78c95fe93d0c1825b0aecb61..405915c74b916a45421ccd124a58a95805ab105c 100755 (executable)
@@ -46,8 +46,8 @@ public class Zoom extends Action {
     protected boolean fLastZoomOut = false;
     protected boolean fLastZoom = true;
 
-    protected static Cursor fZoomInCursor = null;
-    protected static Cursor fZoomOutCursor = null;
+    private static Cursor fZoomInCursor;
+    private static Cursor fZoomOutCursor;
 
     public static enum ZoomType {
         ZOOM_NONE, ZOOM_IN, ZOOM_OUT, ZOOM_RESET
index d383a5fcd4dc57a7854ea478c1553e30539b9f69..e6f169da9a8106e656c7ded25608cab04604ec29 100644 (file)
@@ -1239,7 +1239,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
             super.handleData(event);
 
             if ((fMonitor!= null) && fMonitor.isCanceled()) {
-                cancel();
+                super.cancel();
                 return;
             }
 
index 739359118f89426568e61e92f1575c06852df0b1..f71a44bbbaa8d2ba9ee484175b7098cb0efc5b46 100755 (executable)
@@ -42,7 +42,7 @@ public class LoadersManager {
     public static final String LOADER_PREFIX = LOADER_TAG + "."; //$NON-NLS-1$
 
     // The instance
-    protected static LoadersManager loadersManager;
+    private static LoadersManager loadersManager;
 
     // Maps for caching information
     protected HashMap<String, IUml2SDLoader> fViewLoaderMap = new HashMap<String, IUml2SDLoader>();
index 37f27e9dc2be4e19fea3f01ec4d0642a159318d3..eb1ca10eb6940ba2756ad66e3ce9affc5a2b33e3 100755 (executable)
@@ -12,6 +12,7 @@
  **********************************************************************/
 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences;
 
+import java.util.Arrays;
 import java.util.Hashtable;
 
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -43,22 +44,22 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
     public static final String FORE_COLOR_POSTFIX = "_FORE_COLOR";//$NON-NLS-1$
     public static final String TEXT_COLOR_POSTFIX = "_TEXT_COLOR";//$NON-NLS-1$
 
-    public static final String[] fontList = { PREF_LIFELINE, PREF_EXEC, PREF_SYNC_MESS, PREF_SYNC_MESS_RET, PREF_ASYNC_MESS, PREF_ASYNC_MESS_RET, PREF_FRAME, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
+    private static final String[] fontList = { PREF_LIFELINE, PREF_EXEC, PREF_SYNC_MESS, PREF_SYNC_MESS_RET, PREF_ASYNC_MESS, PREF_ASYNC_MESS_RET, PREF_FRAME, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
 
-    public static final String[] fontList2 = { SDMessages._88, SDMessages._89, SDMessages._90, SDMessages._91, SDMessages._92, SDMessages._93, SDMessages._94, SDMessages._95, SDMessages._96 };
+    private static final String[] fontList2 = { SDMessages._88, SDMessages._89, SDMessages._90, SDMessages._91, SDMessages._92, SDMessages._93, SDMessages._94, SDMessages._95, SDMessages._96 };
 
-    public static final String[] prefBackColorList = { PREF_LIFELINE, PREF_EXEC, PREF_FRAME, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
+    private static final String[] prefBackColorList = { PREF_LIFELINE, PREF_EXEC, PREF_FRAME, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
 
-    public static final String[] prefForeColorList = { PREF_LIFELINE, PREF_EXEC, PREF_SYNC_MESS, PREF_SYNC_MESS_RET, PREF_ASYNC_MESS, PREF_ASYNC_MESS_RET, PREF_FRAME, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
+    private static final String[] prefForeColorList = { PREF_LIFELINE, PREF_EXEC, PREF_SYNC_MESS, PREF_SYNC_MESS_RET, PREF_ASYNC_MESS, PREF_ASYNC_MESS_RET, PREF_FRAME, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
 
-    public static final String[] prefTextColorList = { PREF_LIFELINE, PREF_SYNC_MESS, PREF_SYNC_MESS_RET, PREF_ASYNC_MESS, PREF_ASYNC_MESS_RET, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
+    private static final String[] prefTextColorList = { PREF_LIFELINE, PREF_SYNC_MESS, PREF_SYNC_MESS_RET, PREF_ASYNC_MESS, PREF_ASYNC_MESS_RET, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
 
     protected Hashtable<String, IFont> fontPref;
     protected Hashtable<String, IColor> foreColorPref;
     protected Hashtable<String, IColor> backColorPref;
     protected Hashtable<String, IColor> textColorPref;
 
-    protected static SDViewPref handle = null;
+    private static SDViewPref handle = null;
     protected IPreferenceStore prefStore = null;
     protected IColor timeCompressionSelectionColor = null;
 
@@ -380,4 +381,39 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
     public void setNoFocusSelection(boolean v) {
         noFocusSelection = v;
     }
+
+    /**
+     * @return static font list
+     */
+    public static String[] getFontList() {
+        return Arrays.copyOf(fontList, fontList.length);
+    }
+    
+    /**
+     * @return 2nd static font list
+     */
+    public static String[] getFontList2() {
+        return Arrays.copyOf(fontList2, fontList2.length);
+    }
+    
+    /**
+     * @return preference background color list
+     */
+    public static String[] getPrefBackColorList() {
+        return Arrays.copyOf(prefBackColorList, prefBackColorList.length);
+    }
+    
+    /**
+     * @return preference foreground color list
+     */
+    public static String[] getPrefForeColorList() {
+        return Arrays.copyOf(prefForeColorList, prefForeColorList.length);
+    }
+    
+    /**
+     * @return preference text color list color list
+     */
+    public static String[] getPrefTextColorList() {
+        return Arrays.copyOf(prefTextColorList, prefTextColorList.length);
+    }
 }
index bf257d91c634cad38e4743fc6b6d6920788681b7..f41c191a9faafa3f55231a8838b3130c18457833 100755 (executable)
@@ -160,8 +160,9 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
         GridData tabItemLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
         classItemList.setLayoutData(tabItemLayoutdata);
 
-        for (int i = 0; i < SDViewPref.fontList2.length; i++) {
-            classItemList.add(SDViewPref.fontList2[i]);
+        String[] fontList2 = SDViewPref.getFontList2();
+        for (int i = 0; i < fontList2.length; i++) {
+            classItemList.add(fontList2[i]);
         }
         classItemList.setSelection(0);
         classItemList.addSelectionListener(this);
@@ -173,21 +174,22 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
         buttonArea.setLayout(buttonAreaLayout);
 
         // font selector initialise for the lifeline font pref
-        font = new FontFieldEditor(SDViewPref.fontList[0], "",//$NON-NLS-1$
+        String[] fontList = SDViewPref.getFontList();
+        font = new FontFieldEditor(fontList[0], "",//$NON-NLS-1$
                 SDMessages._81, buttonArea);
         font.getPreviewControl().setSize(500, 500);
         font.setPreferenceStore(pref.getPreferenceStore());
         font.load();
 
-        backGroundColor = new ColorFieldEditor(SDViewPref.fontList[0] + SDViewPref.BACK_COLOR_POSTFIX, SDMessages._85, buttonArea);
+        backGroundColor = new ColorFieldEditor(fontList[0] + SDViewPref.BACK_COLOR_POSTFIX, SDMessages._85, buttonArea);
         backGroundColor.setPreferenceStore(pref.getPreferenceStore());
         backGroundColor.load();
 
-        lineColor = new ColorFieldEditor(SDViewPref.fontList[0] + SDViewPref.FORE_COLOR_POSTFIX, SDMessages._86, buttonArea);
+        lineColor = new ColorFieldEditor(fontList[0] + SDViewPref.FORE_COLOR_POSTFIX, SDMessages._86, buttonArea);
         lineColor.setPreferenceStore(pref.getPreferenceStore());
         lineColor.load();
 
-        textColor = new ColorFieldEditor(SDViewPref.fontList[0] + SDViewPref.TEXT_COLOR_POSTFIX, SDMessages._87, buttonArea);
+        textColor = new ColorFieldEditor(fontList[0] + SDViewPref.TEXT_COLOR_POSTFIX, SDMessages._87, buttonArea);
         textColor.setPreferenceStore(pref.getPreferenceStore());
         textColor.load();
         swapPref(true);
@@ -276,7 +278,8 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
 
         }
 
-        backGroundColor.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + SDViewPref.BACK_COLOR_POSTFIX + TEMP_TAG);
+        String[] fontList = SDViewPref.getFontList();
+        backGroundColor.setPreferenceName(fontList[classItemList.getSelectionIndex()] + SDViewPref.BACK_COLOR_POSTFIX + TEMP_TAG);
         backGroundColor.load();
 
         keySet = SDViewPref.getInstance().foreColorPref.keySet();
@@ -291,7 +294,7 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
             }
         }
 
-        lineColor.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + SDViewPref.FORE_COLOR_POSTFIX + TEMP_TAG);
+        lineColor.setPreferenceName(fontList[classItemList.getSelectionIndex()] + SDViewPref.FORE_COLOR_POSTFIX + TEMP_TAG);
         lineColor.load();
 
         keySet = SDViewPref.getInstance().textColorPref.keySet();
@@ -305,7 +308,7 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
                 textColor.store();
             }
         }
-        textColor.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + SDViewPref.TEXT_COLOR_POSTFIX + TEMP_TAG);
+        textColor.setPreferenceName(fontList[classItemList.getSelectionIndex()] + SDViewPref.TEXT_COLOR_POSTFIX + TEMP_TAG);
         textColor.load();
     }
 
@@ -323,33 +326,35 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
         backGroundColor.store();
         textColor.store();
 
+        String[] fontList = SDViewPref.getFontList();
+        
         // set the FontFieldEditor for the new selected graphNode font
-        font.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + TEMP_TAG);
+        font.setPreferenceName(fontList[classItemList.getSelectionIndex()] + TEMP_TAG);
         font.load();
 
-        backGroundColor.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + SDViewPref.BACK_COLOR_POSTFIX + TEMP_TAG);
+        backGroundColor.setPreferenceName(fontList[classItemList.getSelectionIndex()] + SDViewPref.BACK_COLOR_POSTFIX + TEMP_TAG);
         backGroundColor.load();
 
-        lineColor.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + SDViewPref.FORE_COLOR_POSTFIX + TEMP_TAG);
+        lineColor.setPreferenceName(fontList[classItemList.getSelectionIndex()] + SDViewPref.FORE_COLOR_POSTFIX + TEMP_TAG);
         lineColor.load();
 
-        textColor.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + SDViewPref.TEXT_COLOR_POSTFIX + TEMP_TAG);
+        textColor.setPreferenceName(fontList[classItemList.getSelectionIndex()] + SDViewPref.TEXT_COLOR_POSTFIX + TEMP_TAG);
         textColor.load();
 
         // No Background for message graphNodes
-        if ((SDViewPref.fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_SYNC_MESS)) || (SDViewPref.fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_SYNC_MESS_RET))
-                || (SDViewPref.fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_ASYNC_MESS)) || (SDViewPref.fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_ASYNC_MESS_RET)))
+        if ((fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_SYNC_MESS)) || (fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_SYNC_MESS_RET))
+                || (fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_ASYNC_MESS)) || (fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_ASYNC_MESS_RET)))
             backGroundColor.setEnabled(false, buttonArea);
         else
             backGroundColor.setEnabled(true, buttonArea);
 
         // No font used for execution occurrence and global frame
-        if ((SDViewPref.fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_EXEC)) || (SDViewPref.fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_FRAME)))
+        if ((fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_EXEC)) || (fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_FRAME)))
             textColor.setEnabled(false, buttonArea);
         else
             textColor.setEnabled(true, buttonArea);
 
-        if (SDViewPref.fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_FRAME))
+        if (fontList[classItemList.getSelectionIndex()].equals(SDViewPref.PREF_FRAME))
             font.setEnabled(false, buttonArea);
         else
             font.setEnabled(true, buttonArea);
@@ -410,18 +415,19 @@ public class SDViewerPage extends PreferencePage implements IWorkbenchPreference
                 textColor.store();
             }
         }
+        String[] fontList = SDViewPref.getFontList();
         if (toTemp) {
             // set the FontFieldEditor for the new selected graphNode font
-            font.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + TEMP_TAG);
+            font.setPreferenceName(fontList[classItemList.getSelectionIndex()] + TEMP_TAG);
             font.load();
 
-            backGroundColor.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + SDViewPref.BACK_COLOR_POSTFIX + TEMP_TAG);
+            backGroundColor.setPreferenceName(fontList[classItemList.getSelectionIndex()] + SDViewPref.BACK_COLOR_POSTFIX + TEMP_TAG);
             backGroundColor.load();
 
-            lineColor.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + SDViewPref.FORE_COLOR_POSTFIX + TEMP_TAG);
+            lineColor.setPreferenceName(fontList[classItemList.getSelectionIndex()] + SDViewPref.FORE_COLOR_POSTFIX + TEMP_TAG);
             lineColor.load();
 
-            textColor.setPreferenceName(SDViewPref.fontList[classItemList.getSelectionIndex()] + SDViewPref.TEXT_COLOR_POSTFIX + TEMP_TAG);
+            textColor.setPreferenceName(fontList[classItemList.getSelectionIndex()] + SDViewPref.TEXT_COLOR_POSTFIX + TEMP_TAG);
             textColor.load();
         }
     }
index 4c9cc6f2b9267ace791b05231cb9c7676c0266ca..7297c9f24d4d25aa86317e627a452f701eb0672d 100755 (executable)
@@ -128,8 +128,6 @@ public class SDPrintDialogUI {
 
     int test = 3;
 
-    public static int r = 0;
-
     // bug 195026
     protected WizardPage parentWizardPage = null;
     protected SDPrintDialog parentDialog = null;
@@ -450,9 +448,7 @@ public class SDPrintDialogUI {
 
         @Override
         public void resizeContents(int _w, int _h) {
-            // if (r<2)
             super.resizeContents(_w, _h);
-            r++;
         }
 
     }
@@ -894,7 +890,7 @@ public class SDPrintDialogUI {
                     stepY = ((float) ph / z1 / z2);
                 }
             }
-        } finally {
+        } catch (NumberFormatException e) {
             stepX = stepY = nbPages = 0;
             zoomFactor = 0;
         }
@@ -907,7 +903,7 @@ public class SDPrintDialogUI {
     }
 
     public int[] getPageList() {
-        return pagesList;
+        return Arrays.copyOf(pagesList, pagesList.length);
     }
 
     public void addToPagesList(int num) {
@@ -935,14 +931,14 @@ public class SDPrintDialogUI {
     public int getNbRow() {
         if (!setHPagesNumber.isDisposed()) {
             int cw = (int) (overviewCanvas.getContentsWidth() / overviewCanvas.zoomValue);
-            if (stepX == 0)
-                return 1;
-            int row = (int) (cw / stepX);
-            if (setHPagesNumber.getSelection())
-                row = Math.round((float) cw / stepX);
-            else if ((cw % stepX != 0))
-                row++;
-
+            int row = 1;
+            if (stepX != 0) {
+                row = (int) (cw / stepX);
+                if (setHPagesNumber.getSelection())
+                    row = Math.round((float) cw / stepX);
+                else if ((cw % stepX != 0))
+                    row++;
+            }
             nbRows = row;
         }
         return nbRows;
@@ -951,13 +947,14 @@ public class SDPrintDialogUI {
     public int getNbLines() {
         if (!setVPagesNumber.isDisposed()) {
             int ch = (int) (overviewCanvas.getContentsHeight() / overviewCanvas.zoomValue);
-            if (stepY == 0)
-                return 1;
-            int line = (int) (ch / stepY);
-            if (setVPagesNumber.getSelection())
-                line = Math.round((float) ch / stepY);
-            else if (ch % stepY != 0)
-                line++;
+            int line = 1;
+            if (stepY != 0) {
+                line = (int) (ch / stepY);
+                if (setVPagesNumber.getSelection())
+                    line = Math.round((float) ch / stepY);
+                else if (ch % stepY != 0)
+                    line++;
+            }
             nbLines = line;
         }
         return nbLines;
This page took 0.052798 seconds and 5 git commands to generate.