1 11 12 package org.eclipse.pde.internal.ui.editor.build; 13 14 import org.eclipse.core.resources.IFolder; 15 import org.eclipse.core.resources.IResource; 16 import org.eclipse.pde.core.IModelChangedListener; 17 import org.eclipse.pde.core.build.IBuild; 18 import org.eclipse.pde.core.build.IBuildEntry; 19 import org.eclipse.pde.internal.build.IBuildPropertiesConstants; 20 import org.eclipse.pde.internal.ui.PDEUIMessages; 21 import org.eclipse.swt.widgets.Composite; 22 23 public class SrcSection extends BuildContentsSection 24 implements 25 IModelChangedListener { 26 27 public SrcSection(BuildPage page, Composite parent) { 28 super(page, parent); 29 getSection().setText(PDEUIMessages.BuildEditor_SrcSection_title); 30 getSection().setDescription(PDEUIMessages.BuildEditor_SrcSection_desc); 31 32 } 33 34 protected void initializeCheckState() { 35 36 super.initializeCheckState(); 37 IBuild build = fBuildModel.getBuild(); 38 IBuildEntry srcIncl = build 39 .getEntry(IBuildPropertiesConstants.PROPERTY_SRC_INCLUDES); 40 IBuildEntry srcExcl = build 41 .getEntry(IBuildPropertiesConstants.PROPERTY_SRC_EXCLUDES); 42 43 if (srcIncl == null) 44 return; 45 46 super.initializeCheckState(srcIncl, srcExcl); 47 } 48 49 protected void deleteFolderChildrenFromEntries(IFolder folder) { 50 IBuild build = fBuildModel.getBuild(); 51 IBuildEntry srcIncl = build 52 .getEntry(IBuildPropertiesConstants.PROPERTY_SRC_INCLUDES); 53 IBuildEntry srcExcl = build 54 .getEntry(IBuildPropertiesConstants.PROPERTY_SRC_EXCLUDES); 55 String parentFolder = getResourceFolderName(folder 56 .getProjectRelativePath().toString()); 57 58 removeChildren(srcIncl, parentFolder); 59 removeChildren(srcExcl, parentFolder); 60 } 61 62 protected void handleBuildCheckStateChange(boolean wasTopParentChecked) { 63 IResource resource = fParentResource; 64 String resourceName = fParentResource.getFullPath() 65 .removeFirstSegments(1).toString(); 66 IBuild build = fBuildModel.getBuild(); 67 IBuildEntry includes = build 68 .getEntry(IBuildPropertiesConstants.PROPERTY_SRC_INCLUDES); 69 IBuildEntry excludes = build 70 .getEntry(IBuildPropertiesConstants.PROPERTY_SRC_EXCLUDES); 71 72 resourceName = handleResourceFolder(resource, resourceName); 73 74 if (isChecked) 75 handleCheck(includes, excludes, resourceName, resource, 76 wasTopParentChecked, 77 IBuildPropertiesConstants.PROPERTY_SRC_INCLUDES); 78 else 79 handleUncheck(includes, excludes, resourceName, resource, 80 IBuildPropertiesConstants.PROPERTY_SRC_EXCLUDES); 81 82 deleteEmptyEntries(); 83 } 84 } 85 | Popular Tags |