private void onInstanceFileRemoved(InstanceFileInterface fileInterface) { if (editInterface != null) { editInterface.removeSubInterface(fileInterface); } }
private void onInstanceFileAdded(InstanceFileInterface fileInterface) { if (editInterface != null) { editInterface.addSubInterface(fileInterface, fileInterface.getEditInterface()); } }
private void processInstanceSelection(EditInterface editInterface) { if (editInterface.hasEditableProperties()) { InstanceFileInterface instanceFile = editInterface.getEditableProperties().First() as InstanceFileInterface; if (instanceFile != null) { if (AddSelectable.HeldDown) { controller.SelectionController.addSelectedObject(instanceFile); } else if (RemoveSelectable.HeldDown) { controller.SelectionController.removeSelectedObject(instanceFile); } else { controller.SelectionController.setSelectedObject(instanceFile); } } else { controller.SelectionController.clearSelection(); } } else { controller.SelectionController.clearSelection(); } }
private void destroySimObjectCallback(EditUICallback callback) { EditInterface selected = callback.getSelectedEditInterface(); if (selected.hasEditableProperties()) { InstanceFileInterface instanceFile = this.editInterface.resolveSourceObject <InstanceFileInterface>(selected); removeInstanceFile(instanceFile.Name); } }
public void removeInstanceFile(String instanceName) { InstanceFileInterface fileInterface = instanceFiles[instanceName]; fileInterface.Deleted = true; fileInterface.Dispose(); instanceFiles.Remove(instanceName); deletedInstances.Add(fileInterface); onInstanceFileRemoved(fileInterface); }
public void addInstance(Instance instance) { InstanceFileInterface fileInterface = new InstanceFileInterface(instance.Name, AnomalyIcons.Instance, InstanceWriter.Instance.getInstanceFileName(this, instance.Name), this, instance); if (instancesDisplayed) { fileInterface.createInstance(simObjectController); } instanceFiles.Add(instance.Name, fileInterface); onInstanceFileAdded(fileInterface); }
private void renameSimObjectCallback(EditUICallback callback) { callback.getInputString("Enter a name.", delegate(String input, ref String errorPrompt) { if (input == null || input == "") { errorPrompt = "Please enter a non empty name."; return(false); } if (this.instanceFiles.ContainsKey(input)) { errorPrompt = "That name is already in use. Please provide another."; return(false); } InstanceFileInterface instanceFile = callback.getSelectedEditInterface().getEditableProperties().First() as InstanceFileInterface; SimObjectDefinition sourceObject = instanceFile.Instance.Definition; SimObjectDefinition simObject = copySaver.copyObject(sourceObject) as SimObjectDefinition; simObject.Name = input; createInstance(simObject); removeInstanceFile(instanceFile.Name); return(true); }); }