Revision 10666 branches/v10/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/ProjectDocumentFactory.java

View differences:

ProjectDocumentFactory.java
1 1
package com.iver.cit.gvsig.project.documents;
2 2

  
3 3
import java.security.KeyException;
4
import java.util.ArrayList;
4 5
import java.util.Hashtable;
5 6
import java.util.Map;
6 7

  
......
131 132
    public static void register(String registerName, Object obj, String alias) {
132 133
        ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
133 134
        extensionPoints.add("Documents", registerName, obj);
134

  
135
		ProjectDocument.NUMS.put(registerName,new Integer(0));
135 136
        ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints.get(
136 137
                "Documents"));
137 138

  
......
150 151
    public static void register(String registerName, Object obj) {
151 152
        ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
152 153
        extensionPoints.add("Documents", registerName, obj);
154
    	 ProjectDocument.NUMS.put(registerName,new Integer(0));
153 155
    }
154 156

  
155 157
    /**
......
181 183
     * @return true if all the conflicts are resolved , else false
182 184
     */
183 185
    public abstract boolean resolveImportXMLConflicts(XMLEntity root,Project project, Hashtable conflicts);
186
 	/**
187
    * Return true if the name exists to another document.
188
    *
189
    * @param project
190
    * @param documentName
191
    *
192
    * @return True if the name exists.
193
    */
194
   public boolean existName(Project project, String documentName) {
195
       ArrayList documentList = project.getDocumentsByType(getRegisterName());
196

  
197
       for (int i = 0; i < documentList.size(); i++) {
198
           ProjectDocument pd = (ProjectDocument) documentList.get(i);
199
           String title = pd.getName();
200

  
201
           if (title.compareTo(documentName) == 0) {
202
               return true;
203
           }
204
       }
205

  
206
       return false;
207
   }
184 208
}

Also available in: Unified diff