/** * Create marker of already exists top element map statement. * * @param resource Marker target resource. * @param model Map model. */ private void createExistsMapMarker(IResource resource, MapModel model) { try { IMarker marker = resource.createMarker(PROBLEM_MARKER_KEY); Map<String, Object> attribute = new HashMap<String, Object>(); attribute.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); attribute.put(IMarker.MESSAGE, "Already exists map statement."); attribute.put(IMarker.LINE_NUMBER, model.getLineNumber()); attribute.put(IMarker.CHAR_START, model.getOffset()); attribute.put(IMarker.CHAR_END, model.getOffset() + model.getStartBrace().length()); marker.setAttributes(attribute); } catch (CoreException e) { // log.error(e.getMessage(), e); } }
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); } } } }