public void primSave(IProgressMonitor monitor) { List list = getChildren(); for (int i = 0; i < list.size(); i++) ((EditModel) list.get(i)).primSave(monitor); }
public EditModel getContainedEditModel(EditModel.Reference reference) { return (EditModel) getChildrenMap().get(reference); }
/** * Forward all events to the listeners for this model */ public void editModelChanged(EditModelEvent anEvent) { if (hasListeners()) notifyListeners(anEvent); }
public EditModel.Reference addChild(String editModelID, Map params, ComposedAccessorKey composedAccessorKey) { EditModel editModel = getEmfContext().getEditModelForWrite(editModelID, composedAccessorKey, params); editModel.addListener(this); getChildrenMap().put(editModel.getReference(), editModel); getChildren().add(editModel); return editModel.getReference(); }
public void removeChild(EditModel.Reference reference, Object accessorKey) { ComposedAccessorKey composedAccessorKey = ComposedAccessorKey.getComposedAccessorKey(accessorKey, this); EditModel editModel = (EditModel) getChildrenMap().remove(reference); if (editModel != null) { editModel.releaseAccess(composedAccessorKey); editModel.removeListener(this); getChildren().remove(editModel); } }
/** * This only increments the reference count of the children and should only be called if you * know what you are doing. */ public void access(Object accessorKey) { ComposedAccessorKey composedAccessorKey = ComposedAccessorKey.getComposedAccessorKey(accessorKey, this); if (getChildren().size() == 0) { createChildrenIfNecessary(composedAccessorKey); } else { List tempchildren = getChildren(); for (int i = 0; i < tempchildren.size(); i++) { EditModel model = (EditModel) tempchildren.get(i); model.access(composedAccessorKey); } } // removing for defect 1978, children should do all the accessing super.access(accessorKey); }
/** * This method should be called from each client when they are finished working with the * EditModel. */ public void releaseAccess(Object accessorKey) { List tempchildren = getChildren(); ComposedAccessorKey composedAccessorKey = ComposedAccessorKey.getComposedAccessorKey(accessorKey, this); for (int i = 0; i < tempchildren.size(); i++) { EditModel model = (EditModel) tempchildren.get(i); model.releaseAccess(composedAccessorKey); } removeKeyFromCache(composedAccessorKey); // Removing this call... Children should be able to handle all releasing defect 1978 super.releaseAccess(accessorKey); }
public static ComposedAccessorKey getComposedAccessorKey(Object accessorKey, ComposedEditModel editModel) { ComposedAccessorKey newKey = new ComposedAccessorKey(accessorKey, editModel); editModel.cacheAccessorKey(newKey); return newKey; }
public EditModel.Reference addChild(String editModelID, Map params, Object accessorKey) { return addChild(editModelID, params, ComposedAccessorKey.getComposedAccessorKey(accessorKey, this)); }
protected void executeInModel(AbstractEditModelCommand cmd) { getEditModel().getCommandStack().execute(cmd); }
/** * Return whether a save is needed on the CommandStack */ public boolean isInterrestedInResource(Resource aResource) { Iterator editModels = getChildren().iterator(); while (editModels.hasNext()) { EditModel editModel = (EditModel) editModels.next(); if (editModel.isInterrestedInResource(aResource)) return true; } return false; }
public Iterator getContainedReferences() { return getChildrenMap().keySet().iterator(); }
public Set getAffectedFiles() { Set aSet = new HashSet(); List models = getChildren(); for (int i = 0; i < models.size(); i++) { EditModel child = (EditModel) models.get(i); aSet.addAll(child.getAffectedFiles()); } return aSet; }
/** * Pass along to children. */ protected void handleSaveIfNecessaryDidNotSave(IProgressMonitor monitor) { List list = getChildren(); EditModel editModel; for (int i = 0; i < list.size(); i++) { editModel = (EditModel) list.get(i); editModel.handleSaveIfNecessaryDidNotSave(monitor); } }
/** * Return whether a save is needed on the CommandStack */ public boolean isDirty() { Iterator editModels = getChildren().iterator(); while (editModels.hasNext()) { EditModel editModel = (EditModel) editModels.next(); if (editModel.isDirty()) return true; } return false; }
/** * If one should save, they all should save. */ protected boolean shouldSave() { List list = getChildren(); EditModel editModel; for (int i = 0; i < list.size(); i++) { editModel = (EditModel) list.get(i); if (editModel.shouldSave()) return true; } return false; }
/** * If one should save, they all should save. */ protected boolean shouldSave(IOperationHandler operationHandler) { List list = getChildren(); EditModel editModel; for (int i = 0; i < list.size(); i++) { editModel = (EditModel) list.get(i); if (editModel.shouldSave(operationHandler)) return true; } return false; }
/** * @see com.ibm.etools.j2ee.workbench.EditModel#getNonResourceFiles() */ public List getNonResourceFiles() { List list = getChildren(); List result = new ArrayList(); EditModel editModel; for (int i = 0; i < list.size(); i++) { editModel = (EditModel) list.get(i); List files = editModel.getNonResourceFiles(); if (files != null && !files.isEmpty()) result.addAll(files); } return result; }
protected void computeAffectedModels() { ResourceSet set = null; List editModels = getEditModel().getChildren(); Iterator it = computeAffectedResourceSets().iterator(); while (it.hasNext()) { set = (ResourceSet) it.next(); for (int i = 0; i < editModels.size(); i++) { EditModel model = (EditModel) editModels.get(i); if (model.getResourceSet() == set) { getAffectedModels().add(new EditModelRetriever(model.getEmfContext(), model.getEditModelID(), model.getParams())); continue; } } } }