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;
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;
+ }
+
}
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;
public void setDrawTextWithFocusStyle(boolean focus) {
drawWithFocus = focus;
}
+
+ protected static int getVscreenBounds() {
+ return vscreen_bounds;
+ }
+
+ protected static void setVscreenBounds(int vBounds) {
+ vscreen_bounds = vBounds;
+ }
+
}
}
// 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 {
protected int visibleAreaWidth;
protected int visibleAreaHeight;
- protected static ISDPreferences userPref = null;
+ static ISDPreferences userPref = null;
protected int forceEventOccurrenceSpacing = -1;
* @param categories the lifeline categories array
*/
public void setLifelineCategories(LifelineCategories[] categories) {
- lifelineCategories = categories;
+ lifelineCategories = Arrays.copyOf(categories, categories.length);
}
/**
* @return the lifeline categories array or null if not set
*/
public LifelineCategories[] getLifelineCategories() {
- return lifelineCategories;
+ return Arrays.copyOf(lifelineCategories, lifelineCategories.length);
}
/**
**********************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.impl;
+import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.jface.resource.ImageDescriptor;
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;
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
super.handleData(event);
if ((fMonitor!= null) && fMonitor.isCanceled()) {
- cancel();
+ super.cancel();
return;
}
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>();
**********************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences;
+import java.util.Arrays;
import java.util.Hashtable;
import org.eclipse.jface.preference.IPreferenceStore;
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;
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);
+ }
}
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);
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);
}
- 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();
}
}
- 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();
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();
}
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);
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();
}
}
int test = 3;
- public static int r = 0;
-
// bug 195026
protected WizardPage parentWizardPage = null;
protected SDPrintDialog parentDialog = null;
@Override
public void resizeContents(int _w, int _h) {
- // if (r<2)
super.resizeContents(_w, _h);
- r++;
}
}
stepY = ((float) ph / z1 / z2);
}
}
- } finally {
+ } catch (NumberFormatException e) {
stepX = stepY = nbPages = 0;
zoomFactor = 0;
}
}
public int[] getPageList() {
- return pagesList;
+ return Arrays.copyOf(pagesList, pagesList.length);
}
public void addToPagesList(int num) {
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;
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;