sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/ui/ResourceVisitor.java
changeset 1 1050670c6980
child 6 f65f740e69f9
equal deleted inserted replaced
0:5ad7ad99af01 1:1050670c6980
       
     1 /*
       
     2  * Copyright (c) 2008-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:  Definitions for the class ResourceVisitor
       
    15  *
       
    16  */
       
    17 
       
    18 package com.nokia.s60tools.analyzetool.ui;
       
    19 
       
    20 import org.eclipse.core.resources.IResource;
       
    21 import org.eclipse.core.resources.IResourceVisitor;
       
    22 
       
    23 import com.nokia.s60tools.analyzetool.internal.ui.graph.AnalyzeToolGraph;
       
    24 import com.nokia.s60tools.analyzetool.ui.statistic.StatisticView;
       
    25 
       
    26 /**
       
    27  * Class to visit resources in the project.
       
    28  *
       
    29  * @author araj modified kihe
       
    30  *
       
    31  */
       
    32 public class ResourceVisitor implements IResourceVisitor {
       
    33 
       
    34 	/** Parent class reference. */
       
    35 	private final Object arg0;
       
    36 
       
    37 	/**
       
    38 	 * Constructor.
       
    39 	 *
       
    40 	 * @param parentClass Parent class reference
       
    41 	 */
       
    42 	public ResourceVisitor(final Object parentClass) {
       
    43 		this.arg0 = parentClass;
       
    44 	}
       
    45 
       
    46 	/**
       
    47 	 * Visit every resource of project.
       
    48 	 *
       
    49 	 * @see org.eclipse.core.resources.IResourceVisitor#visit(org.eclipse.core.resources.IResource)
       
    50 	 *
       
    51 	 * @param resource
       
    52 	 *            One resource of the project
       
    53 	 */
       
    54 	public boolean visit(IResource resource) {
       
    55 
       
    56 		// if visit request came from main view
       
    57 		if (arg0 instanceof MainView) {
       
    58 			MainView mainView = (MainView) arg0;
       
    59 			mainView.loadFileInfo(resource);
       
    60 		}
       
    61 		else if( arg0 instanceof StatisticView )
       
    62 		{
       
    63 			StatisticView stats = (StatisticView)arg0;
       
    64 			stats.loadFileInfo(resource);
       
    65 		}
       
    66 		else if(arg0 instanceof AnalyzeToolGraph) {
       
    67 			AnalyzeToolGraph chart = (AnalyzeToolGraph)arg0;
       
    68 			chart.loadFileInfo(resource);
       
    69 		}
       
    70 		return true;
       
    71 	}
       
    72 
       
    73 }