public void run() { // Fetch viewer from editor part (might not work, if not, try some other way) EditPartViewer viewer = (EditPartViewer) part.getAdapter(EditPartViewer.class); // get Target EditPart that is under the mouse EditPart targetEditPart = viewer.findObjectAt(getLocation()); // If nothing under mouse, set root item as target (just playing safe) if(targetEditPart == null) targetEditPart = viewer.getContents(); // Make and initialize create request with proper information CreateRequest createReq = new CreateRequest(); createReq.setLocation(getLocation()); createReq.setFactory(new OwnFactoryImplementation()); // Ask from target editpart command for this request Command command = targetEditPart.getCommand(createReq); // If command is ok, and it can be executed, go and execute it on commandstack if(command != null && command.canExecute()) { viewer.getEditDomain().getCommandStack().execute(command); } }
CreateRequest request = new CreateRequest(contentFormat, target, (LwM2mObjectInstance) node); CreateResponse cResponse = server.send(registration, request, TIMEOUT); processDeviceResponse(req, resp, cResponse);
LwM2mInstanceEnabler instanceEnabler = instances.get(instanceNode.getId()); if (instanceEnabler == null) { doCreate(new CreateRequest(path.getObjectId(), instanceNode)); } else { doWrite(identity, new WriteRequest(Mode.REPLACE, path.getObjectId(), path.getObjectInstanceId(), LwM2mInstanceEnabler instanceEnabler = instances.get(path.getObjectInstanceId()); if (instanceEnabler == null) { doCreate(new CreateRequest(path.getObjectId(), instanceNode)); } else { doWrite(identity, new WriteRequest(Mode.REPLACE, request.getContentFormat(), path.getObjectId(), LwM2mInstanceEnabler instanceEnabler = instances.get(path.getObjectInstanceId()); if (instanceEnabler == null) { doCreate(new CreateRequest(path.getObjectId(), new LwM2mObjectInstance(path.getObjectInstanceId(), resource))); } else {
resources.add(resource); return new CreateRequest(ContentFormat.fromCode(format), path, new LwM2mObjectInstance(instanceId, resources));
resources.add(resource); return new CreateRequest(ContentFormat.fromCode(format), path, new LwM2mObjectInstance(instanceId, resources));
createRequest = new CreateRequest(contentFormat, path.getObjectId(), newInstance); } else { createRequest = new CreateRequest(contentFormat, path.getObjectId(), newInstance.getResources().values());