sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.wizards/src/com/nokia/carbide/cpp/internal/pi/wizards/ui/util/PkgListTreeContentProvider.java
changeset 5 844b047e260d
parent 2 b9ab3b238396
child 12 ae255c9aa552
equal deleted inserted replaced
4:615035072f7e 5:844b047e260d
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 package com.nokia.carbide.cpp.internal.pi.wizards.ui.util;
    18 package com.nokia.carbide.cpp.internal.pi.wizards.ui.util;
    19 
    19 
       
    20 import java.text.MessageFormat;
    20 import java.util.ArrayList;
    21 import java.util.ArrayList;
    21 import java.util.HashMap;
    22 import java.util.HashMap;
    22 import java.util.List;
    23 import java.util.List;
    23 import java.util.Map;
    24 import java.util.Map;
    24 
    25 
    32 import org.eclipse.ui.model.WorkbenchContentProvider;
    33 import org.eclipse.ui.model.WorkbenchContentProvider;
    33 
    34 
    34 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
    35 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
    35 import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
    36 import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
    36 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
    37 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
       
    38 import com.nokia.carbide.cpp.pi.util.GeneralMessages;
    37 
    39 
    38 public class PkgListTreeContentProvider implements ITreeContentProvider {
    40 public class PkgListTreeContentProvider implements ITreeContentProvider {
    39 	PkgListTree tree;
    41 	PkgListTree tree;
    40 	// need to work around CarbideBuildConfiguration equal() that claims
    42 	// need to work around CarbideBuildConfiguration equal() that claims
    41 	// configuration objects are equal even when their projects are different
    43 	// configuration objects are equal even when their projects are different
    48 	
    50 	
    49 	public Object[] getChildren(Object parentElement) {
    51 	public Object[] getChildren(Object parentElement) {
    50 		if (parentElement instanceof IPkgEntry) {
    52 		if (parentElement instanceof IPkgEntry) {
    51 			return null;
    53 			return null;
    52 		} else if (parentElement instanceof IViewSite) {
    54 		} else if (parentElement instanceof IViewSite) {
    53 			return getCarbideCppProjects();
    55 			return getCarbideCppProjects(false);
    54 		} else if (parentElement instanceof IWorkspaceRoot) {
    56 		} else if (parentElement instanceof IWorkspaceRoot) {
    55 			return getCarbideCppProjects();
    57 			return getCarbideCppProjects(false);
    56 		} else if (parentElement instanceof IProject) {
    58 		} else if (parentElement instanceof IProject) {
    57 			return getConfigs((IProject)parentElement).toArray();
    59 			return getConfigs((IProject)parentElement).toArray();
    58 		} else if (parentElement instanceof PkgListTree) {
    60 		} else if (parentElement instanceof PkgListTree) {
    59 			return getElements(parentElement);
    61 			return getElements(parentElement);
    60 		}
    62 		}
    93 	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    95 	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    94 		configMap.clear();
    96 		configMap.clear();
    95 		cp.inputChanged(viewer, oldInput, newInput);
    97 		cp.inputChanged(viewer, oldInput, newInput);
    96 	}
    98 	}
    97 
    99 
    98 	private Object[] getCarbideCppProjects() {
   100 	public Object[] getCarbideCppProjects(boolean logWarnings) {
    99 		// lifted from com.nokia.carbide.cpp.project.ui.views.SPNViewContentProvider
   101 		// lifted from com.nokia.carbide.cpp.project.ui.views.SPNViewContentProvider
   100 		IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
   102 		IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
   101 		List<IProject> list = new ArrayList<IProject>();
   103 		List<IProject> list = new ArrayList<IProject>();
   102 		for (int i = 0; i < projects.length; i++) {
   104 		for (int i = 0; i < projects.length; i++) {
   103 			try {
   105 			try {
   113 							if (config.getSISBuilderInfoList().size() > 0) {
   115 							if (config.getSISBuilderInfoList().size() > 0) {
   114 								haveConfigWithPKG = true;
   116 								haveConfigWithPKG = true;
   115 								break;
   117 								break;
   116 							}
   118 							}
   117 						}
   119 						}
   118 						if (haveConfigWithPKG == false)
   120 						if (haveConfigWithPKG == false){
       
   121 							if(logWarnings){						
       
   122 								GeneralMessages.PiLog(MessageFormat.format(Messages.getString("PkgListTreeContentProvider.warning.sisBuilderConfiguration.missing"),projects[i].getName()), GeneralMessages.WARNING); //$NON-NLS-1$
       
   123 							}
   119 							continue;	// must have buildconfig with good PKG to show up
   124 							continue;	// must have buildconfig with good PKG to show up
       
   125 						}							
   120 						list.add(projects[i]);
   126 						list.add(projects[i]);
   121 					}
   127 					}
   122 				}
   128 				}
   123 			} catch (CoreException e) {
   129 			} catch (CoreException e) {
   124 				e.printStackTrace();
   130 				e.printStackTrace();