srcanaapps/depexplorer/com.nokia.s60tools.appdep/src/com/nokia/s60tools/appdep/ui/views/main/MainViewSelectionChangedListener.java
author noe\swadi
Sat, 09 Jan 2010 10:04:11 +0530
changeset 0 a02c979e8dfd
permissions -rw-r--r--
1. Copyrights changed to EPL 2. Feature updates mentioned in release notes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     1
/*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     3
* All rights reserved.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     4
* This component and the accompanying materials are made available
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     6
* which accompanies this distribution, and is available
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     8
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     9
* Initial Contributors:
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    11
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    12
* Contributors:
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    13
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    14
* Description:
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    15
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    16
*/
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    17
 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    18
 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    19
package com.nokia.s60tools.appdep.ui.views.main;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    20
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    21
import java.io.FileNotFoundException;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    22
import java.io.IOException;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    23
import java.util.ArrayList;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    24
import java.util.NoSuchElementException;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    25
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    26
import org.eclipse.jface.viewers.ISelectionChangedListener;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    27
import org.eclipse.jface.viewers.SelectionChangedEvent;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    28
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    29
import com.nokia.s60tools.appdep.core.AppDepSettings;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    30
import com.nokia.s60tools.appdep.core.ITargetPlatform;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    31
import com.nokia.s60tools.appdep.core.data.CacheDataConstants;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    32
import com.nokia.s60tools.appdep.core.data.ComponentLinkLeafNode;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    33
import com.nokia.s60tools.appdep.core.data.ComponentNode;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    34
import com.nokia.s60tools.appdep.core.data.ComponentParentNode;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    35
import com.nokia.s60tools.appdep.core.model.ComponentPropertiesData;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    36
import com.nokia.s60tools.appdep.core.model.ExportFunctionData;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    37
import com.nokia.s60tools.appdep.core.model.ImportFunctionData;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    38
import com.nokia.s60tools.appdep.exceptions.CacheFileDoesNotExistException;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    39
import com.nokia.s60tools.appdep.exceptions.CacheIndexNotReadyException;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    40
import com.nokia.s60tools.appdep.resources.Messages;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    41
import com.nokia.s60tools.sdk.SdkInformation;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    42
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    43
/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    44
 * Selection change listener for main view.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    45
 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    46
public class MainViewSelectionChangedListener implements
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    47
		ISelectionChangedListener {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    48
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    49
	//
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    50
	// Members
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    51
	//
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    52
	private final MainView view;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    53
	private final ArrayList<ImportFunctionData> importFunctionsArrayList;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    54
	private final ArrayList<ExportFunctionData> exportFunctionsArrayList;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    55
	private boolean propertiesFoundSuccessfully;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    56
	
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    57
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    58
	 * Default constructor.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    59
	 * @param view Reference to main view
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    60
	 * @param importFunctionsArrayList Import function list to be updated on selection.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    61
	 * @param exportFunctionsArrayList Export function list to be updated on selection.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    62
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    63
	public MainViewSelectionChangedListener(MainView view, 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    64
										    ArrayList<ImportFunctionData> importFunctionsArrayList,
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    65
										    ArrayList<ExportFunctionData> exportFunctionsArrayList){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    66
		this.view = view;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    67
		this.importFunctionsArrayList = importFunctionsArrayList;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    68
		this.exportFunctionsArrayList = exportFunctionsArrayList;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    69
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    70
	
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    71
	/* (non-Javadoc)
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    72
	 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    73
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    74
	public void selectionChanged(SelectionChangedEvent event) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    75
		try {			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    76
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    77
			Object obj = view.getComponentTreeSelectedElement();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    78
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    79
			// By default component properties data reference
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    80
			// is set to null
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    81
			view.setSelectedComponentPropertiesData(null);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    82
						
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    83
			if(obj == null){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    84
				// We might get null-selections when
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    85
				// tree is expanded/collapsed.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    86
				return;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    87
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    88
			else{
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    89
				// Storing the selection for further reference in case 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    90
				// selection is lost because of the user decides
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    91
				// to use 'Go Into' functionality which loses the selection.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    92
				view.setMostRecentlySelectedComponentNode(obj);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    93
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    94
						
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    95
			// The object is for sure an instance of ComponentNode
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    96
			ComponentNode node = (ComponentNode) obj;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    97
			// Storing name of the selected component (that might be name of the concrete component replacing generic one).
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    98
			String selectedComponentName = node.getName();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    99
			// Component node instance which is selected or selected leaf node refers to
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   100
			ComponentParentNode componentNodeInstance;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   101
			// Storing original component name in here, if we are replacing a generic component
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   102
			String selectedComponentOriginalName;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   103
			if(node instanceof ComponentParentNode){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   104
				componentNodeInstance = (ComponentParentNode)node;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   105
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   106
			else{
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   107
				// We have leaf node 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   108
				ComponentLinkLeafNode leafNode = (ComponentLinkLeafNode)node;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   109
				// Getting referred component
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   110
				componentNodeInstance = leafNode.getReferredComponent();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   111
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   112
			// Storing name of the original component if needed
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   113
			if(componentNodeInstance.wasGenericComponent()){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   114
				selectedComponentOriginalName = componentNodeInstance.getOriginalName();	
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   115
			}else{
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   116
				// No concrete component replacement done and therefore selected component is the original one.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   117
				selectedComponentOriginalName = selectedComponentName;		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   118
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   119
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   120
			String parentComponentName = node.getParent().getName();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   121
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   122
			AppDepSettings st = AppDepSettings.getActiveSettings();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   123
			SdkInformation sdkInfo = st.getCurrentlyUsedSdk();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   124
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   125
			//Updating tool bar text if the view is fully populated
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   126
			// i.e. dependency search is finished.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   127
			if(!MainView.isDependencySearchOngoing()){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   128
				String descr = null;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   129
				if(sdkInfo != null){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   130
					descr = 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   131
							Messages.getString("MainViewSelectionChangedListener.SDK_Prefix") //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   132
							+ sdkInfo.getSdkId()
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   133
							+ " - " //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   134
							+  st.getCurrentlyUsedTargetPlatformsAsString()
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   135
							+ " " //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   136
							+  st.getBuildType().getBuildTypeDescription()
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   137
							+ Messages.getString("MainViewSelectionChangedListener.Component_Prefix") //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   138
							+ node.getFullName();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   139
							
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   140
					view.updateDescription(descr);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   141
				}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   142
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   143
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   144
			// Fetching property information for the selected component
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   145
			//For properties, cannot use selectedComponentName, because it may point to generic component
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   146
			propertiesFoundSuccessfully = updateComponentPropertyInformation(selectedComponentName, st.getCurrentlyAnalyzedComponentTargetPlatform());
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   147
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   148
			// Clearing old information for imported functions
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   149
			importFunctionsArrayList.clear();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   150
			// and also for exported ones
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   151
			exportFunctionsArrayList.clear();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   152
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   153
			// Is currently used SDK configured?
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   154
			if(sdkInfo != null){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   155
				// Export functions array list can be populated
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   156
				// if component is not an EXE file, because there
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   157
				// might exist EXE and DLL files with the same name,
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   158
				// and the export function information is only available
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   159
				// for DLLs. If EXE files were passed further, it would
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   160
				// give the information for the DLL with the same name.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   161
				if(! isExeFile(selectedComponentName)){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   162
					// For exported functions using always concrete component if available
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   163
					updateExportFunctionsArray(selectedComponentName);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   164
				}				
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   165
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   166
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   167
			// Checking if root component has been selected
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   168
			ComponentParentNode pNode = null;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   169
			if(obj instanceof ComponentParentNode){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   170
				pNode = (ComponentParentNode) obj;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   171
				if(pNode.isRootComponent()){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   172
					// Disabling action that are not valid for root component
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   173
					view.disableSetAsNewRootAction();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   174
					// The showing of parent import functions
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   175
					// is not applicable for the root component
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   176
					// Just refreshing view when old imported
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   177
					// functions information has been cleared.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   178
					refreshMainView();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   179
					return;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   180
				}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   181
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   182
			else if(obj instanceof ComponentLinkLeafNode){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   183
				ComponentLinkLeafNode linkNode = (ComponentLinkLeafNode) obj;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   184
				pNode = linkNode.getReferredComponent();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   185
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   186
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   187
			// Also link node can refer to root component
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   188
			if(pNode.isMissing() || pNode.isRootComponent()){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   189
				view.disableSetAsNewRootAction();							
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   190
				view.enableLocateComponentAction();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   191
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   192
			else{
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   193
				view.enableSetAsNewRootAction();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   194
				view.disableLocateComponentAction();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   195
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   196
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   197
			// Import functions can be fetched selected node is not root component
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   198
			updateImportFunctionsArray(selectedComponentOriginalName, parentComponentName);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   199
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   200
			// Checks if there are unresolved import function names and if those can be fetched from export function data
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   201
			checkForUnresolvedImportFunctionNames();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   202
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   203
			// Finally asking from main view that content providers gets updated data for showing.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   204
			refreshMainView();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   205
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   206
		catch (CacheIndexNotReadyException e) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   207
			//
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   208
			// This may happen when no SDK selection has been made and therefore
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   209
			// no cache indexes has been created.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   210
			// There is only single node in tree view with help text available
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   211
			// for selection that for sure raises this exception.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   212
			//
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   213
			// => can be ignored safely
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   214
			//
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   215
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   216
		catch (Exception e) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   217
			e.printStackTrace();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   218
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   219
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   220
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   221
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   222
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   223
	 * Checks if there are unresolved import function names and if those can be fetched from export function data.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   224
	 * This method does not have any effects if there are no unresolved imported functions, and if there are no
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   225
	 * exported function data available.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   226
	 * @precondition if there are unresolved imported function names, there has to be valid exported functions data 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   227
	 *               available for successful operation.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   228
	 * @postcondition names of unresolved imported function names in <code>importFunctionsArrayList</code> are replaced 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   229
	 *                by function names got from <code>exportFunctionsArrayList</code>.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   230
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   231
	private void checkForUnresolvedImportFunctionNames() {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   232
		// In case there is no exported data available, there is no use to continue the checking
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   233
		if(exportFunctionsArrayList.size() == 0) return;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   234
		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   235
		// Otherwise checking imported functions array for unresolved function names
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   236
		for (int i = 0; i < importFunctionsArrayList.size(); i++) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   237
			ImportFunctionData importFunc = importFunctionsArrayList.get(i);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   238
			if(importFunc.getFunctionName().endsWith(CacheDataConstants.FUNC_NAME_NOT_RESOLVED)){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   239
				String funcName = getFuncNameFromExportedFunctions(importFunc.getFunctionOrdinalAsInt()); 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   240
				if(funcName !=  null){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   241
					importFunc.setFunctionName(funcName);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   242
				}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   243
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   244
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   245
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   246
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   247
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   248
	 * Gets function name from exported function array list with given ordinal. 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   249
	 * @param ordinal function ordinal to get name for.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   250
	 * @return Function name or <code>null</code> if cannot be resolved.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   251
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   252
	private String getFuncNameFromExportedFunctions(int ordinal) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   253
		// If we have valid ordinal that exists also in exported functions data...
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   254
		if(ordinal > 0 && ordinal <= exportFunctionsArrayList.size()){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   255
			//...returning the function name for it
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   256
			return exportFunctionsArrayList.get(ordinal-1).getFunctionName();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   257
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   258
		//  Could not found match from exported function data 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   259
		return null;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   260
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   261
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   262
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   263
	 * Checks is given file name has EXE extension, or not.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   264
	 * @param fileNameStr File name to be checked for.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   265
	 * @return Returns <code>true</code> if file has EXE extension, 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   266
	 *         otherwise <code>false</code>.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   267
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   268
	private boolean isExeFile(String fileNameStr) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   269
		int extIndex = fileNameStr.lastIndexOf("."); //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   270
		if(extIndex != -1){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   271
			String extStr = fileNameStr.substring(extIndex+1, fileNameStr.length());
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   272
			if(extStr.equalsIgnoreCase("EXE")){ //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   273
				return true;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   274
			}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   275
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   276
		return false;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   277
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   278
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   279
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   280
	 * Performs refresh and other operation needed to
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   281
	 * run after refresh. 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   282
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   283
	private void refreshMainView() {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   284
		view.refresh();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   285
		if(propertiesFoundSuccessfully){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   286
			// This resizes value column which enables the seeing
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   287
			// of all the capabilities defined for the component.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   288
			view.performValueColumnPackToPropertiesTab();			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   289
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   290
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   291
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   292
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   293
	 * Updates importFunctionsArrayList with information that was found
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   294
	 * for the selected component.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   295
	 * @param selectedComponentName Name of the component that has been selected.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   296
	 * @param parentComponentName Parent component of the selected component.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   297
	 * @throws FileNotFoundException
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   298
	 * @throws IOException
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   299
	 * @throws CacheIndexNotReadyException
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   300
	 * @throws CacheFileDoesNotExistException 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   301
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   302
	private void updateImportFunctionsArray(String selectedComponentName, String parentComponentName) throws FileNotFoundException, IOException, CacheIndexNotReadyException, CacheFileDoesNotExistException {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   303
		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   304
		importFunctionsArrayList.clear(); // Making sure that array is cleared
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   305
		try {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   306
			// Non-root component => seeking for the parent imported functions
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   307
			importFunctionsArrayList.addAll(
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   308
											MainViewDataPopulator.getParentImportedFunctionsForComponent(
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   309
																	parentComponentName,
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   310
																	selectedComponentName)
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   311
											);												             												
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   312
		} catch (Exception e) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   313
			// Catching exceptions here, because throwing them upper level would prevent fetching of component properties.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   314
			e.printStackTrace();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   315
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   316
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   317
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   318
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   319
	 * Updates property information for the currently
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   320
	 * selected component.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   321
	 * @param selectedComponentName Name of the component that has been selected.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   322
	 * @param targetPlatform Target platform restriction, or <code>null</code> if target platform does not matter.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   323
	 * @return Returns <code>true</code> of component properties was found successfully, 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   324
	 *         otherwise returns <code>false</code>.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   325
	 * @throws IOException
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   326
	 * @throws CacheIndexNotReadyException
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   327
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   328
	private boolean updateComponentPropertyInformation(String selectedComponentName, ITargetPlatform targetPlatform) throws IOException, CacheIndexNotReadyException {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   329
		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   330
		boolean propertiesFound = false;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   331
		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   332
		try {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   333
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   334
			ComponentPropertiesData comPropData = MainViewDataPopulator
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   335
														.getComponentPropertyArrayForComponent(selectedComponentName, targetPlatform);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   336
			propertiesFound = true;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   337
			view.setSelectedComponentPropertiesData(comPropData);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   338
		} catch (NoSuchElementException e1) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   339
			// This can be ignored because there may be components 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   340
			// that does not exist in cache at all
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   341
		} catch (java.lang.NullPointerException e1) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   342
			// This can be ignored because we'll get this if
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   343
			// currently used SDK is not yet configured and we
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   344
			// select the root node that just advices the user
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   345
			// to double-click the root node.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   346
		} catch (CacheFileDoesNotExistException e2) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   347
			// This might happen during dialog to view transitions
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   348
			// When cache file does not exist yet.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   349
		} catch (Exception e3) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   350
			e3.printStackTrace();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   351
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   352
		return propertiesFound;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   353
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   354
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   355
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   356
	 * Updates exportFunctionsArrayList with information that was found
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   357
	 * for the selected component.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   358
	 * @param selectedComponentName Name of the component that has been selected.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   359
	 * @throws FileNotFoundException
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   360
	 * @throws IOException
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   361
	 * @throws CacheIndexNotReadyException
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   362
	 * @throws CacheFileDoesNotExistException 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   363
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   364
	private void updateExportFunctionsArray(String selectedComponentName) throws FileNotFoundException, IOException, CacheIndexNotReadyException, CacheFileDoesNotExistException {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   365
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   366
		try {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   367
			exportFunctionsArrayList.clear(); // Making sure that earlier results are destroyed
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   368
			// Populating with new data
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   369
			exportFunctionsArrayList.addAll(MainViewDataPopulator.getExportedFunctionsForComponent(selectedComponentName));
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   370
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   371
		} catch (NoSuchElementException e) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   372
			// The selected component does necessary
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   373
			// have any data about exported functions.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   374
			// Therefore we can ignore this exception
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   375
		} catch (Exception e) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   376
			e.printStackTrace();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   377
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   378
	}	
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   379
	
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   380
}