Properties p = tl.getTileInstancePropertiesAt(i, j); if (p != null) propertiesList.add(p);
propertiesCoordinates.add(new Point(i, j)); } } }  if (!propertiesCoordinates.isEmpty()) {  Point point = (Point) propertiesCoordinates.get(0); Properties p = tl.getTileInstancePropertiesAt(point.x, point.y);  if (p != null) { mergedProperties.putAll(p);  for (int i = 1; i < propertiesCoordinates.size(); i++) {  point = (Point) propertiesCoordinates.get(i); p = tl.getTileInstancePropertiesAt(point.x, point.y);  if (p != null) { for (Enumeration e = mergedProperties.keys(); e.hasMoreElements();) {  String key = (String) e.nextElement(); String val = mergedProperties.getProperty(key); String mval = p.getProperty(key);  if (mval == null) {  mergedProperties.remove(key); } else if (!mval.equals(val)) {  mergedProperties.setProperty(key, "?"); } } } else { mergedProperties.clear(); break; }
    public void setSelection(SelectionLayer selection) {        // Start off fresh...        properties.clear();        propertiesList.clear();        // Get all properties of all selected tiles...        MapLayer ml = editor.getCurrentLayer();        if (ml instanceof TileLayer) {            TileLayer tl = (TileLayer) ml;            Rectangle r = selection.getSelectedAreaBounds();            int maxJ = (int) (r.getY() + r.getHeight());            int maxI = (int) (r.getX() + r.getWidth());            for (int j = (int) r.getY(); j < maxJ; j++) {                for (int i = (int) r.getX(); i < maxI; i++) {                    Tile t = selection.getTileAt(i, j);                    if (t != null) {                        Properties p = tl.getTileInstancePropertiesAt(i, j);                        if (p != null) propertiesList.add(p);                    }                }            }        }        if (!propertiesList.isEmpty()) {            // Start with properties of first tile instance            Properties p = (Properties) propertiesList.get(0);            for (Enumeration e = p.keys(); e.hasMoreElements();) {                String key = (String) e.nextElement();                properties.put(key, p.getProperty(key));            }            for (int i = 1; i < propertiesList.size(); i++) {                // Merge the other properties...                p = (Properties) propertiesList.get(i);                for (Enumeration e = properties.keys(); e.hasMoreElements();) {                    // We only care for properties that are already "known"...                    String key = (String) e.nextElement();                    String val = properties.getProperty(key);                    String mval = p.getProperty(key);                    if (mval == null) {                        properties.remove(key); // Drop non-common properties                    } else if (!mval.equals(val)) {                        properties.setProperty(key, "?"); // Hide non-common values                    }                }            }        }        updateInfo(); // Refresh display    }