001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.uml.core.typemanagement;
043:
044: import org.dom4j.Node;
045:
046: import org.netbeans.modules.uml.core.metamodel.core.foundation.INamedElement;
047: import org.netbeans.modules.uml.core.metamodel.core.foundation.IElement;
048: import org.netbeans.modules.uml.core.metamodel.core.foundation.IVersionableElement;
049: import org.netbeans.modules.uml.core.metamodel.structure.IProject;
050: import org.netbeans.modules.uml.core.support.umlsupport.IStrings;
051: import org.netbeans.modules.uml.core.support.umlutils.ETList;
052:
053: public interface ITypeManager {
054: /**
055: * The IProject this TypeManager is monitoring.
056: */
057: public IProject getProject();
058:
059: /**
060: * The IProject this TypeManager is monitoring.
061: */
062: public void setProject(IProject value);
063:
064: /**
065: * Retrieves the element with the passed in name. If more than one element has the name, the first one found is returned.
066: */
067: public INamedElement getElementByName(String name);
068:
069: /**
070: * Retrieves the collection of elements with the passed in name.
071: */
072: public ETList<INamedElement> getElementsByName(String name);
073:
074: /**
075: * Retrieves the collection of elements with the passed in name.
076: */
077: public IVersionableElement getElementByID(String xmiID);
078:
079: /**
080: * method GetRawElementByID
081: */
082: public Node getRawElementByID(String elementID);
083:
084: /**
085: * Saves the contents of this manager.
086: */
087: public void save(String Location);
088:
089: /**
090: * Adds an entry to the Type file with information found in the passed in element.
091: */
092: public void addType(IVersionableElement element);
093:
094: /**
095: * Adds an entry to the Type file with information found in the passed in element. The element is assumed to be an import element from another Project.
096: */
097: public void addExternalType(IVersionableElement element);
098:
099: /**
100: * Removes the entry that matches the passed in element from the type file.
101: */
102: public void removeType(IVersionableElement element);
103:
104: /**
105: * Retrieves the absolute file locations of externally loaded elements.
106: */
107: public IStrings gatherExternalFileLocations();
108:
109: /**
110: * Loads the external elements found in fileLocation into the Project this TypeManager is a part of.
111: */
112: public void loadExternalFile(String fileLocation);
113:
114: public void loadExternalElements();
115:
116: /**
117: * Retrieves the owner of childElement that is under version control.
118: */
119: public IVersionableElement getVersionedOwner(
120: IVersionableElement childElement);
121:
122: /**
123: * Removes the passed in element from the type resolution portions of the .ettm file, cleaning any references to element throughout the IProject this TypeManager is associated with.
124: */
125: public void removeFromTypeLookup(IVersionableElement element);
126:
127: /**
128: * Retrieves all the elements in the Project this TypeManager is associated with that are directly under version control.
129: */
130: public ETList<IVersionableElement> getAllVersionedElements();
131:
132: /**
133: * Ensures that the element passed in is properly parented, with immediate parent loaded in memory.
134: */
135: public boolean verifyInMemoryStatus(IVersionableElement element);
136:
137: /**
138: * The PickListManager associated with this TypeManager.
139: */
140: public IPickListManager getPickListManager();
141:
142: /**
143: * The PickListManager associated with this TypeManager.
144: */
145: public void setPickListManager(IPickListManager value);
146:
147: /**
148: * Retrieves the element with the passed in name by searching the Project's list of referenced libraries. If more than one element has the name, the first one found is returned.
149: */
150: public INamedElement getElementFromLibrariesByName(String name);
151:
152: /**
153: * Retrieves the collection of elements with the passed in name by searching the Project's list of referenced libraries.
154: */
155: public ETList<INamedElement> getElementsFromLibrariesByName(
156: String name);
157:
158: /**
159: * Adds the passed in elements to the type file.
160: */
161: public void addTypes(ETList<IElement> Elements,
162: boolean addOnlyIfVersioned);
163:
164: /**
165: * Adds an entry to the Type file with information found in the passed in element.
166: */
167: public void addType(IVersionableElement element,
168: boolean addOnlyIfVersioned, boolean loadAllExternalElements);
169:
170: /**
171: * Retrieves the referenced library with the passed in name.
172: */
173: public IProject getReferencedLibraryProjectByLocation(
174: String refLibLoc);
175:
176: /**
177: * Retrieves all the referenced libraries associated with the Project this TypeManager manages.
178: */
179: public ETList<IProject> getReferencedLibraryProjects();
180:
181: /**
182: * Retrieves all the types that are generally managed by the PickListManager of a particular name.
183: */
184: public ETList<INamedElement> getCachedTypesByName(String nameOfType);
185:
186: /**
187: * Retrieves the first type that is generally managed by the PickListManager of a particular name.
188: */
189: public INamedElement getCachedTypeByName(String nameOfType);
190:
191: /**
192: * Retrieves the element with the passed in name by searching the Project's list of referenced libraries. If more than one element has the name, the first one found is returned. filter should be white-space delimited list of typenames, such as 'Class Interface St
193: */
194: public INamedElement getElementFromLibrariesByNameAndType(
195: String name, String filter);
196:
197: /**
198: * Adds the passed in ID to the cache of IDs that have been deleted. This prevents type resolution for IDs that have been deleted.
199: */
200: public void addToDeletedIds(String id);
201:
202: /**
203: * Clears the cache of deleted IDs.
204: */
205: public void clearDeletedIDs();
206:
207: /**
208: * Retrieves the collection of types that are resident in the Project this TypeManager is associated with. Searches will not be done across projects..
209: */
210: public ETList<INamedElement> getLocalCachedTypesByName(
211: String nameOfType);
212:
213: }
|