import org.simantics.diagram.symbolcontribution.CompositeSymbolGroup;
import org.simantics.diagram.symbolcontribution.IIdentifiedObject;
import org.simantics.diagram.symbolcontribution.ISymbolProvider;
-import org.simantics.diagram.symbolcontribution.IdentifiedObject;
import org.simantics.diagram.symbolcontribution.SymbolProviderFactory;
import org.simantics.diagram.symbollibrary.IModifiableSymbolGroup;
import org.simantics.diagram.symbollibrary.ISymbolGroup;
json.append(" \"res\" : [");
int pos = 0;
for(int i=0;i<res.length;i++) {
- if(pos > 0) json.append(",");
- Object r = res[i];
- if(r instanceof IdentifiedObject) {
- Object id = ((IdentifiedObject) r).getId();
- if(id instanceof IAdaptable) {
- Object resource = ((IAdaptable) id).getAdapter(Resource.class);
- if(resource != null) {
- long rid = ((Resource)resource).getResourceId();
- json.append(Long.toString(rid));
- pos++;
- }
- }
- }
+ if(pos > 0) json.append(",");
+ Object r = res[i];
+ if(r instanceof IAdaptable) {
+ Resource resource = ((IAdaptable) r).getAdapter(Resource.class);
+ if(resource != null) {
+ long rid = resource.getResourceId();
+ json.append(Long.toString(rid));
+ pos++;
+ }
+ }
}
json.append("] }");
- StringSelection text = new StringSelection(json.toString());
- PlaintextTransfer plainText = new PlaintextTransfer(json.toString());
+ String jsonText = json.toString();
+ StringSelection text = new StringSelection(jsonText);
+ PlaintextTransfer plainText = new PlaintextTransfer(jsonText);
return new MultiTransferable(local, text, plainText);