sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/internal/ui/graph/MemOpDescriptor.java
changeset 6 f65f740e69f9
parent 1 1050670c6980
child 15 0367d2db2c06
equal deleted inserted replaced
5:844b047e260d 6:f65f740e69f9
     1 /*
     1 /*
     2  * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 package com.nokia.s60tools.analyzetool.internal.ui.graph;
    18 package com.nokia.s60tools.analyzetool.internal.ui.graph;
    19 
    19 
       
    20 import java.io.IOException;
    20 import java.util.AbstractList;
    21 import java.util.AbstractList;
    21 import java.util.ArrayList;
    22 import java.util.ArrayList;
    22 import java.util.HashMap;
    23 import java.util.HashMap;
    23 import java.util.List;
    24 import java.util.List;
    24 import java.util.Locale;
    25 import java.util.Locale;
    27 import org.eclipse.core.resources.IMarker;
    28 import org.eclipse.core.resources.IMarker;
    28 import org.eclipse.core.resources.IProject;
    29 import org.eclipse.core.resources.IProject;
    29 import org.eclipse.core.resources.IWorkspaceRoot;
    30 import org.eclipse.core.resources.IWorkspaceRoot;
    30 import org.eclipse.core.resources.ResourcesPlugin;
    31 import org.eclipse.core.resources.ResourcesPlugin;
    31 import org.eclipse.core.runtime.CoreException;
    32 import org.eclipse.core.runtime.CoreException;
       
    33 import org.eclipse.core.runtime.IStatus;
    32 import org.eclipse.core.runtime.Path;
    34 import org.eclipse.core.runtime.Path;
    33 import org.eclipse.jface.viewers.CellEditor;
    35 import org.eclipse.jface.viewers.CellEditor;
    34 import org.eclipse.jface.viewers.TextCellEditor;
    36 import org.eclipse.jface.viewers.TextCellEditor;
    35 import org.eclipse.swt.SWT;
    37 import org.eclipse.swt.SWT;
    36 import org.eclipse.swt.events.KeyListener;
    38 import org.eclipse.swt.events.KeyListener;
    49 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
    51 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
    50 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
    52 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
    51 import com.nokia.cdt.debug.cw.symbian.symbolreader.IFunction;
    53 import com.nokia.cdt.debug.cw.symbian.symbolreader.IFunction;
    52 import com.nokia.cdt.debug.cw.symbian.symbolreader.ISourceLocation;
    54 import com.nokia.cdt.debug.cw.symbian.symbolreader.ISourceLocation;
    53 import com.nokia.cdt.debug.cw.symbian.symbolreader.ISymbolFile;
    55 import com.nokia.cdt.debug.cw.symbian.symbolreader.ISymbolFile;
       
    56 import com.nokia.s60tools.analyzetool.Activator;
       
    57 import com.nokia.s60tools.analyzetool.engine.ICallstackManager;
    54 import com.nokia.s60tools.analyzetool.engine.statistic.AllocCallstack;
    58 import com.nokia.s60tools.analyzetool.engine.statistic.AllocCallstack;
    55 import com.nokia.s60tools.analyzetool.engine.statistic.AllocInfo;
    59 import com.nokia.s60tools.analyzetool.engine.statistic.AllocInfo;
    56 import com.nokia.s60tools.analyzetool.engine.statistic.BaseInfo;
    60 import com.nokia.s60tools.analyzetool.engine.statistic.BaseInfo;
    57 import com.nokia.s60tools.analyzetool.engine.statistic.DllLoad;
    61 import com.nokia.s60tools.analyzetool.engine.statistic.DllLoad;
    58 import com.nokia.s60tools.analyzetool.engine.statistic.SourceFile;
    62 import com.nokia.s60tools.analyzetool.engine.statistic.SourceFile;
    69 @SuppressWarnings("restriction")
    73 @SuppressWarnings("restriction")
    70 class MemOpDescriptor implements IPropertySource {
    74 class MemOpDescriptor implements IPropertySource {
    71 	BaseInfo memInfo;
    75 	BaseInfo memInfo;
    72 	
    76 	
    73 	/** process Id descriptor */
    77 	/** process Id descriptor */
    74 	private static final String PID_ID = "pid";
    78 	private static final String PID_ID = "pid"; //$NON-NLS-1$
    75 	private final DotTextPropertyDescriptor PID_DESCRIPTOR = new DotTextPropertyDescriptor(PID_ID, "Process Id");
    79 	private final DotTextPropertyDescriptor PID_DESCRIPTOR = new DotTextPropertyDescriptor(PID_ID, Messages.MemOpDescriptor_1);
    76 
    80 
    77 	/** Memory operation type Allocation/Leak/Free descriptor */
    81 	/** Memory operation type Allocation/Leak/Free descriptor */
    78 	private static final String TYPE_ID = "type";
    82 	private static final String TYPE_ID = "type"; //$NON-NLS-1$
    79 	private final DotTextPropertyDescriptor TYPE_DESCRIPTOR = new DotTextPropertyDescriptor(TYPE_ID, "Operation Type");
    83 	private final DotTextPropertyDescriptor TYPE_DESCRIPTOR = new DotTextPropertyDescriptor(TYPE_ID, Messages.MemOpDescriptor_3);
    80 
    84 
    81 	/** Time descriptor */
    85 	/** Time descriptor */
    82 	private static final String TIME_ID = "time";
    86 	private static final String TIME_ID = "time"; //$NON-NLS-1$
    83 	private final DotTextPropertyDescriptor TIME_DESCRIPTOR = new DotTextPropertyDescriptor(TIME_ID, "Time");
    87 	private final DotTextPropertyDescriptor TIME_DESCRIPTOR = new DotTextPropertyDescriptor(TIME_ID, Messages.MemOpDescriptor_5);
    84 
    88 
    85 	/** size descriptor */
    89 	/** size descriptor */
    86 	private static final String SIZE_ID = "size";
    90 	private static final String SIZE_ID = "size"; //$NON-NLS-1$
    87 	private final DotTextPropertyDescriptor SIZE_DESCRIPTOR = new DotTextPropertyDescriptor(SIZE_ID, "Size");
    91 	private final DotTextPropertyDescriptor SIZE_DESCRIPTOR = new DotTextPropertyDescriptor(SIZE_ID, Messages.MemOpDescriptor_7);
    88 
    92 
    89 	/** memory address descriptor */
    93 	/** memory address descriptor */
    90 	private static final String ADDR_ID = "address";
    94 	private static final String ADDR_ID = "address"; //$NON-NLS-1$
    91 	private final DotTextPropertyDescriptor ADDR_DESCRIPTOR = new DotTextPropertyDescriptor(ADDR_ID, "Address");
    95 	private final DotTextPropertyDescriptor ADDR_DESCRIPTOR = new DotTextPropertyDescriptor(ADDR_ID, Messages.MemOpDescriptor_9);
    92 
    96 
    93 	/** total memory size consumed by the process descriptor */
    97 	/** total memory size consumed by the process descriptor */
    94 	private static final String TSIZE_ID = "total";
    98 	private static final String TSIZE_ID = "total"; //$NON-NLS-1$
    95 	private final DotTextPropertyDescriptor TSIZE_DESCRIPTOR = new DotTextPropertyDescriptor(TSIZE_ID, "Total Size");
    99 	private final DotTextPropertyDescriptor TSIZE_DESCRIPTOR = new DotTextPropertyDescriptor(TSIZE_ID, Messages.MemOpDescriptor_11);
    96 
   100 
    97 	/** life time of an allocation descriptor. This applies only to non Leaked allocations  */
   101 	/** life time of an allocation descriptor. This applies only to non Leaked allocations  */
    98 	private static final String LIFETIME_ID = "lifetime";
   102 	private static final String LIFETIME_ID = "lifetime"; //$NON-NLS-1$
    99 	private final DotTextPropertyDescriptor LIFETIME_DESCRIPTOR = new DotTextPropertyDescriptor(LIFETIME_ID, "Life Time");
   103 	private final DotTextPropertyDescriptor LIFETIME_DESCRIPTOR = new DotTextPropertyDescriptor(LIFETIME_ID, Messages.MemOpDescriptor_13);
   100 	private static final String ATTRIBUTES_GROUP = "Attributes";
   104 	private static final String ATTRIBUTES_GROUP = "Attributes"; //$NON-NLS-1$
   101 	/** used for making absolute time values relative */
   105 	/** used for making absolute time values relative */
   102 	private long baseTime;
   106 	private long baseTime;
   103 
   107 
   104 	/** callstack item descriptor id*/
   108 	/** callstack item descriptor id*/
   105 	private static final String CALL_STACK_ID = "callstack";
   109 	private static final String CALL_STACK_ID = "callstack"; //$NON-NLS-1$
   106 
   110 
   107 	/** current project */
   111 	/** current project */
   108 	IProject iCurrentProject = null;
   112 	IProject iCurrentProject = null;
   109 	/** Symbol Reader */
   113 	/** Symbol Reader */
   110 	SymReader iSymReader = null;
   114 	SymReader iSymReader = null;
   111 	/** c++ files from the current project */
   115 	/** c++ files from the current project */
   112 	AbstractList<String> cppFileNames;
   116 	AbstractList<String> cppFileNames;
   113 	static final String LINE_SEPARATOR = " :: ";
   117 	static final String LINE_SEPARATOR = " :: "; //$NON-NLS-1$
       
   118 	
       
   119 	private ICallstackManager callstackManager;
   114 	/**
   120 	/**
   115 	 * Constructor
   121 	 * Constructor
   116 	 * @param baseTime usually process start time, used for making absolute time values relative   
   122 	 * @param newBaseTime usually process start time, used for making absolute time values relative   
   117 	 * @param info the alloc or free info
   123 	 * @param info the alloc or free info
   118 	 * @param project IProject to use for locating source file 
   124 	 * @param project IProject to use for locating source file 
   119 	 * @param symReader the SymReader to use for pinpointing
   125 	 * @param symReader the SymReader to use for pinpointing
   120 	 * @param cppFiles 
   126 	 * @param cppFiles 
   121 	 */
   127 	 * @param callstackManager CallstackManager for reading callstacks from BaseInfo
   122 	public MemOpDescriptor(Long baseTime, BaseInfo info, IProject project, SymReader symReader, AbstractList<String> cppFiles) {
   128 	 */
       
   129 	public MemOpDescriptor(Long newBaseTime, BaseInfo info, IProject project, SymReader symReader, AbstractList<String> cppFiles, ICallstackManager callstackManager) {
   123 		memInfo = info;
   130 		memInfo = info;
   124 		iCurrentProject = project;
   131 		iCurrentProject = project;
   125 		iSymReader = symReader;
   132 		iSymReader = symReader;
   126 		cppFileNames = cppFiles;
   133 		cppFileNames = cppFiles;
   127 		this.baseTime = baseTime;	
   134 		this.baseTime = newBaseTime;	
       
   135 		this.callstackManager = callstackManager;
   128 	}
   136 	}
   129 
   137 
   130 	/* (non-Javadoc)
   138 	/* (non-Javadoc)
   131 	 * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
   139 	 * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
   132 	 */
   140 	 */
   157 		if (memInfo instanceof AllocInfo && ((AllocInfo)memInfo).isFreed()) {
   165 		if (memInfo instanceof AllocInfo && ((AllocInfo)memInfo).isFreed()) {
   158 			LIFETIME_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
   166 			LIFETIME_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
   159 			completeList.add(LIFETIME_DESCRIPTOR); //only non leaks
   167 			completeList.add(LIFETIME_DESCRIPTOR); //only non leaks
   160 		}
   168 		}
   161 		// add callstack descriptors
   169 		// add callstack descriptors
   162 		AbstractList<AllocCallstack> callstack = memInfo.getCallstack();
   170 		if (callstackManager != null && callstackManager.hasCallstack(memInfo)){
   163 		for (int i = 0; i < callstack.size(); i++) {
   171 			try {
   164 			
   172 				List<AllocCallstack> callstack = callstackManager.readCallstack(memInfo);
   165 			final DotTextPropertyDescriptor propDesc = new DotTextPropertyDescriptor(i, CALL_STACK_ID);
   173 				if (callstack != null){
   166 			propDesc.setCategory("CallStack");
   174 					for (int i = 0; i < callstack.size(); i++) {
   167 			completeList.add(propDesc);
   175 						
       
   176 						final DotTextPropertyDescriptor propDesc = new DotTextPropertyDescriptor(i, CALL_STACK_ID);
       
   177 						propDesc.setCategory("CallStack"); //$NON-NLS-1$
       
   178 						completeList.add(propDesc);
       
   179 					}					
       
   180 				}
       
   181 			} catch (IOException e) {
       
   182 				//since callstacks aren't fatal and we can't handle it usefully here, log this to the error log
       
   183 				Activator.getDefault().log(IStatus.ERROR, Messages.MemOpDescriptor_18, e);
       
   184 			}			
   168 		}
   185 		}
   169 		return completeList.toArray(new TextPropertyDescriptor[completeList.size()]);
   186 		return completeList.toArray(new TextPropertyDescriptor[completeList.size()]);
   170 	}
   187 	}
   171 
   188 
   172 	/* (non-Javadoc)
   189 	/* (non-Javadoc)
   176 		//Note, this method must return String values for the CellEditor to work
   193 		//Note, this method must return String values for the CellEditor to work
   177 		if (PID_ID.equals(id)) {
   194 		if (PID_ID.equals(id)) {
   178 			return String.valueOf(memInfo.getProcessID());//process ids are usually decimal values
   195 			return String.valueOf(memInfo.getProcessID());//process ids are usually decimal values
   179 		}
   196 		}
   180 		if (TYPE_ID.equals(id))
   197 		if (TYPE_ID.equals(id))
   181 			return memInfo instanceof AllocInfo ? ((AllocInfo)memInfo).isFreed() ? "Allocation" : "Leak" : "Free";
   198 			return memInfo instanceof AllocInfo ? ((AllocInfo)memInfo).isFreed() ? Messages.MemOpDescriptor_19 : Messages.MemOpDescriptor_20 : Messages.MemOpDescriptor_21;
   182 		if (TIME_ID.equals(id))
   199 		if (TIME_ID.equals(id))
   183 			return GraphUtils.renderTime(memInfo.getTime() - baseTime);
   200 			return GraphUtils.renderTime(memInfo.getTime() - baseTime);
   184 		if (SIZE_ID.equals(id))
   201 		if (SIZE_ID.equals(id))
   185 			return String.format("%,d B",memInfo.getSizeInt());
   202 			return String.format(Messages.MemOpDescriptor_22,memInfo.getSizeInt());
   186 		if (ADDR_ID.equals(id))
   203 		if (ADDR_ID.equals(id))
   187 			return Long.toString(memInfo.getMemoryAddress(),16);
   204 			return Long.toString(memInfo.getMemoryAddress(),16);
   188 		if (TSIZE_ID.equals(id))
   205 		if (TSIZE_ID.equals(id))
   189 			return String.format("%,d B",memInfo.getTotalMem());
   206 			return String.format(Messages.MemOpDescriptor_23,memInfo.getTotalMem());
   190 		if (LIFETIME_ID.equals(id)) {
   207 		if (LIFETIME_ID.equals(id)) {
   191 			if (memInfo instanceof AllocInfo && ((AllocInfo)memInfo).isFreed()) {
   208 			if (memInfo instanceof AllocInfo && ((AllocInfo)memInfo).isFreed()) {
   192 				AllocInfo info = (AllocInfo) memInfo;
   209 				AllocInfo info = (AllocInfo) memInfo;
   193 				return GraphUtils.renderTime(info.getFreedBy().getTime() - info.getTime()); 
   210 				return GraphUtils.renderTime(info.getFreedBy().getTime() - info.getTime()); 
   194 			}
   211 			}
   195 			throw new IllegalStateException("Should not happen because we did not provide a lifetime descriptor for leak and free");
   212 			throw new IllegalStateException("Should not happen because we did not provide a lifetime descriptor for leak and free"); //$NON-NLS-1$
   196 		}
   213 		}
   197 		if (id instanceof Integer && memInfo.getCallstack() != null){
   214 		if (id instanceof Integer && callstackManager.hasCallstack(memInfo)){
   198 			int callstackId = (Integer)id;
   215 			int callstackId = (Integer)id;
   199 			if (callstackId < memInfo.getCallstack().size()){
   216 			try {
   200 				AllocCallstack callstackItem = memInfo.getCallstack().get(callstackId);
   217 				List<AllocCallstack> callstackList = callstackManager.readCallstack(memInfo);
   201 				DllLoad tempLoad = callstackItem.getDllLoad();
   218 				if (callstackId < callstackList.size()){
   202 				long addr = callstackItem.getMemoryAddress();
   219 					AllocCallstack callstackItem = callstackList.get(callstackId);
   203 				
   220 					DllLoad tempLoad = callstackItem.getDllLoad();
   204 				String name = String.format("%1$08x",addr);
   221 					long addr = callstackItem.getMemoryAddress();
   205 				if (tempLoad != null && callstackItem.getMemoryAddress()!= tempLoad.getStartAddress()) {
   222 					
   206 					SourceFile aSourcefile = pinpoint(callstackItem.getMemoryAddress(),
   223 					String name = String.format(Messages.MemOpDescriptor_25,addr);
   207 							callstackItem.getDllLoad());
   224 					if (tempLoad != null && callstackItem.getMemoryAddress()!= tempLoad.getStartAddress()) {
   208 					if (aSourcefile != null) { //callstack resolved to a file-function-line
   225 						SourceFile aSourcefile = pinpoint(callstackItem.getMemoryAddress(),
   209 						return name + LINE_SEPARATOR + callstackItem.getDllLoad().getName() + LINE_SEPARATOR + aSourcefile.getFileName()+ LINE_SEPARATOR + aSourcefile.getFunctionName() + LINE_SEPARATOR + aSourcefile.getLineNumber();
   226 								callstackItem.getDllLoad());
       
   227 						if (aSourcefile != null) { //callstack resolved to a file-function-line
       
   228 							return name + LINE_SEPARATOR + callstackItem.getDllLoad().getName() + LINE_SEPARATOR + aSourcefile.getFileName()+ LINE_SEPARATOR + aSourcefile.getFunctionName() + LINE_SEPARATOR + aSourcefile.getLineNumber();
       
   229 						}
   210 					}
   230 					}
       
   231 					return name + (tempLoad != null ? LINE_SEPARATOR + tempLoad.getName() : ""); //$NON-NLS-1$
   211 				}
   232 				}
   212 				return name + (tempLoad != null ? LINE_SEPARATOR + tempLoad.getName() : "");
   233 			} catch (IOException e) {
   213 				}
   234 				//since callstacks aren't fatal and we can't handle it usefully here, log this to the error log
   214 			}
   235 				Activator.getDefault().log(IStatus.ERROR, Messages.MemOpDescriptor_27, e);
       
   236 			}
       
   237 		}
   215 		return null;
   238 		return null;
   216 	}
   239 	}
   217 
   240 
   218 	/* (non-Javadoc)
   241 	/* (non-Javadoc)
   219 	 * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
   242 	 * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
   310 	private class DotPropKeyMouseListener implements KeyListener, MouseListener {
   333 	private class DotPropKeyMouseListener implements KeyListener, MouseListener {
   311 
   334 
   312 		//key
   335 		//key
   313 
   336 
   314 		public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
   337 		public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
       
   338 			//do nothing by design
   315 		}
   339 		}
   316 
   340 
   317 		public void keyReleased(org.eclipse.swt.events.KeyEvent keyEvent) {
   341 		public void keyReleased(org.eclipse.swt.events.KeyEvent keyEvent) {
   318 			//System.out.println("key released.");
   342 			//System.out.println("key released.");
   319 			if (keyEvent.character == '\r') {
   343 			if (keyEvent.character == '\r') {
   339 				}
   363 				}
   340 			}
   364 			}
   341 		}
   365 		}
   342 
   366 
   343 		public void mouseDown(MouseEvent e) {
   367 		public void mouseDown(MouseEvent e) {
       
   368 			//do nothing by design
   344 		}
   369 		}
   345 
   370 
   346 		public void mouseUp(MouseEvent e) {
   371 		public void mouseUp(MouseEvent e) {
       
   372 			//do nothing by design
   347 		}
   373 		}
   348 	}
   374 	}
   349 	
   375 	
   350 	
   376 	
   351 	/**
   377 	/**
   407 			IFunction func = symbolFile.findFunctionByAddress(bigAddress);
   433 			IFunction func = symbolFile.findFunctionByAddress(bigAddress);
   408 			ISourceLocation loc = symbolFile.findSourceLocation(bigAddress);
   434 			ISourceLocation loc = symbolFile.findSourceLocation(bigAddress);
   409 			if (func != null && loc != null) {
   435 			if (func != null && loc != null) {
   410 				String sourceFile = loc.getSourceFile();
   436 				String sourceFile = loc.getSourceFile();
   411 				if (sourceFile == null
   437 				if (sourceFile == null
   412 						|| sourceFile.equalsIgnoreCase(""))
   438 						|| sourceFile.equalsIgnoreCase("")) //$NON-NLS-1$
   413 					return null;
   439 					return null;
   414 				int lineNumber = loc.getLineNumber();
   440 				int lineNumber = loc.getLineNumber();
   415 				if (lineNumber == 0)
   441 				if (lineNumber == 0)
   416 					return null;
   442 					return null;
   417 				String name = func.getName();
   443 				String name = func.getName();
   418 				if (name == null
   444 				if (name == null
   419 						|| name.equalsIgnoreCase(""))
   445 						|| name.equalsIgnoreCase("")) //$NON-NLS-1$
   420 					return null;
   446 					return null;
   421 				/*
   447 				/*
   422 				 * if( onlyForProjectFiles &&
   448 				 * if( onlyForProjectFiles &&
   423 				 * !isFilePartOfTheProject(loc.getSourceFile()) ) return null;
   449 				 * !isFilePartOfTheProject(loc.getSourceFile()) ) return null;
   424 				 */
   450 				 */
   453 	private void openEditor(String cppFileName, String lineNumber) {
   479 	private void openEditor(String cppFileName, String lineNumber) {
   454 
   480 
   455 		//check that used information is given
   481 		//check that used information is given
   456 		//we need to know file name and file line number
   482 		//we need to know file name and file line number
   457 		//that we could open the right line in editor
   483 		//that we could open the right line in editor
   458 		if (cppFileName == null || ("").equals(cppFileName)
   484 		if (cppFileName == null || ("").equals(cppFileName) //$NON-NLS-1$
   459 				|| lineNumber == null || ("").equals(lineNumber)) {
   485 				|| lineNumber == null || ("").equals(lineNumber)) { //$NON-NLS-1$
   460 			return;
   486 			return;
   461 		}
   487 		}
   462 		try {
   488 		try {
   463 
   489 
   464 			IFile file = null;
   490 			IFile file = null;
   475 				IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace()
   501 				IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace()
   476 						.getRoot();
   502 						.getRoot();
   477 				IProject[] projects = myWorkspaceRoot.getProjects();
   503 				IProject[] projects = myWorkspaceRoot.getProjects();
   478 				for (int i = 0; i < projects.length; i++) {
   504 				for (int i = 0; i < projects.length; i++) {
   479 					file = ResourcesPlugin.getWorkspace().getRoot().getFile(
   505 					file = ResourcesPlugin.getWorkspace().getRoot().getFile(
   480 							new Path(projects[i].getName() + "\\"
   506 							new Path(projects[i].getName() + "\\" //$NON-NLS-1$
   481 									+ usedFileName));
   507 									+ usedFileName));
   482 
   508 
   483 					// file found => skip the rest of the projects
   509 					// file found => skip the rest of the projects
   484 					if (file != null && file.exists()) {
   510 					if (file != null && file.exists()) {
   485 						break;
   511 						break;