sysperfana/memspyext/com.nokia.s60tools.swmtanalyser/src/com/nokia/s60tools/swmtanalyser/ui/graphs/ZoomableGraph.java
changeset 7 8e12a575a9b5
equal deleted inserted replaced
6:f65f740e69f9 7:8e12a575a9b5
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.s60tools.swmtanalyser.ui.graphs;
       
    20 
       
    21 import org.eclipse.jface.action.IAction;
       
    22 
       
    23 /**
       
    24  * Common abstract base class for graphs that support zoom operations.
       
    25  */
       
    26 public abstract class ZoomableGraph {
       
    27 	
       
    28 	
       
    29 	/**
       
    30 	 * Context menu title for action: Zoom In
       
    31 	 */
       
    32 	protected static final String ZOOM_IN_CONTEXT_MENU_TITLE = "Zoom In";
       
    33 
       
    34 	/**
       
    35 	 * Context menu title for action: Zoom Out
       
    36 	 */
       
    37 	protected static final String ZOOM_OUT_CONTEXT_MENU_TITLE = "Zoom Out";
       
    38 
       
    39 	/**
       
    40 	 * Copy -action
       
    41 	 */
       
    42 	protected IAction copy;
       
    43 	
       
    44 	
       
    45 	/**
       
    46 	 * Zoom In -action
       
    47 	 */
       
    48 	protected IAction zoomIn;
       
    49 
       
    50 	/**
       
    51 	 * Zoom Out -action
       
    52 	 */
       
    53 	protected IAction zoomOut;
       
    54 	
       
    55 	/**
       
    56 	 * This method zooms in the graph area.
       
    57 	 */
       
    58 	protected abstract void zoomIn();
       
    59 	
       
    60 	/**
       
    61 	 * This method zooms out the graph area.
       
    62 	 */
       
    63 	protected abstract void zoomOut();
       
    64 
       
    65 	/**
       
    66 	 * Sets given enable state for an action if it is non <code>null</code>.
       
    67 	 * @param action Action to set enable status for.
       
    68 	 * @param enableStatus <code>true</code> if enabled, otherwise <code>false</code>.
       
    69 	 */
       
    70 	protected void setEnableState(IAction action, boolean enableStatus) {
       
    71 		if(action != null){
       
    72 			action.setEnabled(enableStatus);			
       
    73 		}
       
    74 	}
       
    75 }