Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9633121dcddaadfd27f6125b19cf0beeef527502 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*******************************************************************************
 * Copyright (c) 2008-2010 Sonatype, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *      Sonatype, Inc. - initial API and implementation
 *******************************************************************************/

package org.eclipse.m2e.jdt;

import java.util.List;

import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IClasspathEntry;

import org.apache.maven.artifact.Artifact;

import org.eclipse.m2e.core.project.IMavenProjectFacade;


/**
 * Instances of this class can be used to incrementally define IClasspathEntry[] arrays used by JDT to describe Java
 * Project classpath and contents of Java classpath containers.
 * 
 * @author igor
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface IClasspathDescriptor {

  public static interface EntryFilter {
    public boolean accept(IClasspathEntryDescriptor descriptor);
  }

  /**
   * @return true if classpath contains entry with specified path, false otherwise.
   */
  public boolean containsPath(IPath path);

  /**
   * Convenience method, equivalent to
   * <code>addSourceEntry(sourcePath, outputLocation, new IPath[0], new IPath[0], generated)</code>
   */
  public IClasspathEntryDescriptor addSourceEntry(IPath sourcePath, IPath outputLocation, boolean generated);

  /**
   * Adds project source folder to the classpath. The source folder must exist in the workspace unless generated is
   * true. In the latter case, the source classpath entry will be marked as optional. 
   */
  public IClasspathEntryDescriptor addSourceEntry(IPath sourcePath, IPath outputLocation, IPath[] inclusion,
      IPath[] exclusion, boolean generated);

  /**
   * Adds fully populated IClasspathEntry instance to the classpath.
   */
  public IClasspathEntryDescriptor addEntry(IClasspathEntry entry);

  /**
   * Adds and returns new project classpath entry.
   */
  public IClasspathEntryDescriptor addProjectEntry(IPath entryPath);

  /**
   * Adds and returns new library entry to the classpath
   */
  public IClasspathEntryDescriptor addLibraryEntry(IPath entryPath);

  /**
   * Removes entry with specified path from the classpath. That this can remove multiple entries because classpath does
   * not enforce uniqueness of entry paths
   * 
   * @TODO should really be removeEntries (i.e. plural)
   */
  public List<IClasspathEntryDescriptor> removeEntry(IPath path);

  /**
   * Removed entries that match EntryFilter (i.e. EntryFilter#accept(entry) returns true) from the classpath
   * 
   * @TODO should really be removeEntries (i.e. plural)
   */
  public List<IClasspathEntryDescriptor> removeEntry(EntryFilter filter);

  /**
   * Renders classpath as IClasspathEntry[] array
   * 
   * @TODO should really be toEntriesArray
   */
  public IClasspathEntry[] getEntries();

  /**
   * Returns underlying "live" list of IClasspathEntryDescriptor instances. Changes to the list will be immediately
   * reflected in the classpath.
   */
  public List<IClasspathEntryDescriptor> getEntryDescriptors();

  // deprecated, to be removed before 1.0

  /**
   * Adds Maven artifact with corresponding sources and javadoc paths to the classpath.
   * 
   * @deprecated this method exposes Maven core classes, which are not part of m2eclipse-jdt API
   */
  public IClasspathEntryDescriptor addLibraryEntry(Artifact artifact, IPath srcPath, IPath srcRoot, String javaDocUrl);

  /**
   * Adds worksapce Maven project dependency to the classpath
   * 
   * @deprecated this method exposes Maven core classes, which are not part of m2eclipse-jdt API
   */
  public IClasspathEntryDescriptor addProjectEntry(Artifact artifact, IMavenProjectFacade projectFacade);
}

Back to the top