@Override public void resolveRenaming(String oldId, String newId) { super.resolveRenaming(oldId, newId); targetString.set(Function.repairTarget(oldId, newId, targetString.get())); if (targetString.get() != null) { resetTargets(); } }
@Override public void resolveCopying() { super.resolveCopying(); if (isCopied()) { String newTargetString = Global.idChangeDB().repairTargetString(targetString.get()); targetString.set(newTargetString); if (targetString.get() != null) { resetTargets(); } } }
private void resetTargets() { if (targetString.get().equals("null")) { target = null; targetPort = -1; return; } String[] parts = targetString.get().split(":"); KObject o = idDB().get(parts[0]); if (o instanceof Inputable) { target = (Inputable) o; targetPort = Integer.parseInt(parts[1]); } }
public void setTargetAndPort(int fromPort, Inputable t, int p) { String[] ts; if (targetString.get() != null) { ts = targetString.get().split(" "); } else { ts = new String[0]; } if (ts.length <= fromPort) { String[] ts2 = new String[fromPort + 1]; System.arraycopy(ts, 0, ts2, 0, ts.length); for (int i = ts.length; i < ts2.length; i++) { ts2[i] = "null"; } ts = ts2; } if (t != null) { ts[fromPort] = t.id() + ":" + p; } else { ts[fromPort] = "null"; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < ts.length; i++) { sb.append(ts[i]); if (i != ts.length - 1) { sb.append(" "); } } // Log.it("NOVĂ˝ targetString : >"+ sb +"<" ); targetString.set(sb.toString()); resetTargets(); }