private void replaceToReference(MapEntryModel entry) { for (DFPropModel child : entry.getChild()) { if (child instanceof MapModel) { boolean update = false; DFPropModel[] elements = child.getChild(); for (int i = 0; i < elements.length; i++) { DFPropModel element = elements[i]; if (element instanceof NamedModel) { try { IFile refFile = getReferencesFile((NamedModel) element); if (refFile.exists()) { String source = getReferencesSource(refFile); DFPropFileModel propModel = new DFPropModelParser().parse(source); propModel.setFileName(refFile.getName()); propModel.setFilePath(refFile.getProjectRelativePath().toString()); propModel.setReferences(true); elements[i] = new DFPropReferenceModel((NamedModel) element, propModel); update = true; } } catch (CoreException e) { } } } if (update) { ((MapModel) child).replaceChild(elements); } } } }
/** * Create DFMapModel for Document. * * @return Map Property Model Object. */ protected DFPropFileModel createDFModel() { IEditorInput input = getEditorInput(); IDocument document = getDocumentProvider().getDocument(input); String source = document.get(); DFPropFileModel propModel = new DFPropModelParser().parse(source); String name = input.getName(); propModel.setFileName(name); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); propModel.setFilePath(file.getProjectRelativePath().toString()); } if (canSplitMapFile()) { loadReferenceModel(propModel); } return propModel; }