KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > builder > ClasspathMultiDirectory


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.core.builder;
12
13 import org.eclipse.core.resources.*;
14
15 import org.eclipse.jdt.core.compiler.CharOperation;
16 import org.eclipse.jdt.internal.core.util.Util;
17
18 class ClasspathMultiDirectory extends ClasspathDirectory {
19
20 IContainer sourceFolder;
21 char[][] inclusionPatterns; // used by builders when walking source folders
22
char[][] exclusionPatterns; // used by builders when walking source folders
23
boolean hasIndependentOutputFolder; // if output folder is not equal to any of the source folders
24

25 ClasspathMultiDirectory(IContainer sourceFolder, IContainer binaryFolder, char[][] inclusionPatterns, char[][] exclusionPatterns) {
26     super(binaryFolder, true, null);
27
28     this.sourceFolder = sourceFolder;
29     this.inclusionPatterns = inclusionPatterns;
30     this.exclusionPatterns = exclusionPatterns;
31     this.hasIndependentOutputFolder = false;
32
33     // handle the case when a state rebuilds a source folder
34
if (this.inclusionPatterns != null && this.inclusionPatterns.length == 0)
35         this.inclusionPatterns = null;
36     if (this.exclusionPatterns != null && this.exclusionPatterns.length == 0)
37         this.exclusionPatterns = null;
38 }
39
40 public boolean equals(Object JavaDoc o) {
41     if (this == o) return true;
42     if (!(o instanceof ClasspathMultiDirectory)) return false;
43
44     ClasspathMultiDirectory md = (ClasspathMultiDirectory) o;
45     return sourceFolder.equals(md.sourceFolder) && binaryFolder.equals(md.binaryFolder)
46         && CharOperation.equals(inclusionPatterns, md.inclusionPatterns)
47         && CharOperation.equals(exclusionPatterns, md.exclusionPatterns);
48 }
49
50 protected boolean isExcluded(IResource resource) {
51     if (this.exclusionPatterns != null || this.inclusionPatterns != null)
52         if (this.sourceFolder.equals(this.binaryFolder))
53             return Util.isExcluded(resource, this.inclusionPatterns, this.exclusionPatterns);
54     return false;
55 }
56
57 public String JavaDoc toString() {
58     return "Source classpath directory " + sourceFolder.getFullPath().toString() + //$NON-NLS-1$
59
" with " + super.toString(); //$NON-NLS-1$
60
}
61 }
62
Popular Tags