public ResourceWorkingCopyFileInvocationHandler(Resource resource) throws IOException { file = ResourceUtil.getFile(resource); boolean isModified = resource.isModified(); ByteArrayOutputStream outputBuffer = new ByteArrayOutputStream(); OutputStream outputStream = new BufferedOutputStream(outputBuffer); try { resource.save(outputStream, null); } finally { outputStream.close(); resource.setModified(isModified); } buffer = outputBuffer.toByteArray(); // debug = new String(buffer); }
protected void setModificationFlag(boolean aBoolean) { if (getCMPResource() != null) getCMPResource().setModified(aBoolean); }
/** * Handle the failure of * * @aResource. */ protected void handleSaveFailed(Resource aResource, Exception e) { aResource.setModified(true); if (isFailedWriteFileFailure(e) && shouldSaveReadOnly(aResource)) saveResource(aResource); else primHandleSaveFailed(aResource, e); }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, text_.getText(), nillable_); if (artifactEdit != null) { artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyHandlerClassText command = new CommandModifyHandlerClassText(null, null, eObject_, text_.getText()); if (artifactEdit != null) { artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyServiceInterfaceText command = new CommandModifyServiceInterfaceText(null, null, eObject_, text_.getText()); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { //Handle PortComponentRef_ServiceEndpointInterface feature in a special way. String SEIFeatureName = Webservice_clientPackage.eINSTANCE.getPortComponentRef_ServiceEndpointInterface().getName(); if ((eObject_ instanceof PortComponentRef) && (feature_.getName().equals(SEIFeatureName))) { CommandModifySEI command = new CommandModifySEI(null, null, (PortComponentRef) eObject_, text_.getText(), nillable_); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } else { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, text_.getText(), nillable_); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { //Handle QName_NamespaceURI feature in a special way. String namespaceFeatureName = CommonPackage.eINSTANCE.getQName_NamespaceURI().getName(); if ((eObject_ instanceof QName) && (feature_.getName().equals(namespaceFeatureName))) { CommandModifyNSURI command = new CommandModifyNSURI(null, null, (QName) eObject_, text_.getText(), nillable_); if (artifactEdit != null) { artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } else { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, text_.getText(), nillable_); if (artifactEdit != null) { artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } } } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, expires(), nillable_); artifactEdit_.getContentModelRoot().eResource().setModified(true); artifactEdit_.getCommandStack().execute(command); } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, text_.getText(), nillable_); artifactEdit_.getContentModelRoot().eResource().setModified(true); artifactEdit_.getCommandStack().execute(command); } }
/** * @see RoleShapeStrategy#reconcileAttributes(CommonRelationshipRole, String, List, List) */ protected void reconcileAttributes(CommonRelationshipRole aRole, String attributeName, List aList, List computedNames) { Resource res = aRole.eResource(); boolean dirtyFlag = res != null ? res.isModified() : false; try { if (aRole.getOppositeAsCommonRole() != null) { ContainerManagedEntity entity = aRole.getOppositeAsCommonRole().getSourceEntity(); // ContainerManagedEntityExtension roleType = (ContainerManagedEntityExtension)getTypeExtension(aRole); if (entity != null) collectAttributes(entity, attributeName, aList, computedNames); } } finally { if (res != null) res.setModified(dirtyFlag); } }
/** * @see com.ibm.etools.archive.SaveStrategy */ public void saveMofResource(org.eclipse.emf.ecore.resource.Resource aResource) throws SaveFailureException { if (!shouldSave(aResource)) return; setEncoding(aResource); try { boolean wasModified = aResource.isModified(); OutputStream os = getOutputStreamForResource(aResource); saveMofResource(aResource, os); aResource.setModified(wasModified); } catch (Exception e) { throw new SaveFailureException(aResource.getURI().toString(), e); } }
parent_.eAdapters().remove(this); CommandRemoveElement command = new CommandRemoveElement(null, null, parent_, childFeature_); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); parent_.eAdapters().add(this); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); parent_.eAdapters().add(this);
/** * If the keyAttributes list is empty, try to reflect * the keyAttributes from the fields of the primaryKey class. */ public void initializeKeyAttributes() { if(cmp == null || initialized) return; //Disable notifications while we initialize cmp.eSetDeliver(false); try { Resource res = cmp.eResource(); if(res == null) return; boolean cachedIsModified = res.isModified(); try { // Handle primkeyfield scenario if (cmp.getPrimKeyField()!=null) initializeForPrimKey(); // Handle compound key scenario else initializeForCompoundKey(); } finally { res.setModified(cachedIsModified); } } finally { cmp.eSetDeliver(true); initialized = true; } }
parent_.eAdapters().remove(this); CommandRemoveElement command = new CommandRemoveElement(null, null, parent_, childFeature_); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); parent_.eAdapters().add(this); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); parent_.eAdapters().add(this);
public JavaHelpers getType() { if (getEType() != null) return (JavaHelpers) getEType(); // Be sensitive to CMP 2.0 beans, get type from field or get accessor type ContainerManagedEntity ejb = getCMPEntity(); Resource res = eResource(); boolean modFlag = res == null ? false : res.isModified(); boolean deliveryFlag = eDeliver(); try { eSetDeliver(false); if(ejb != null) { switch(ejb.getVersionID()) { case J2EEVersionConstants.EJB_1_0_ID: case J2EEVersionConstants.EJB_1_1_ID: setEType(getTypeFromBeanField()); break; case J2EEVersionConstants.EJB_2_0_ID: case J2EEVersionConstants.EJB_2_1_ID: default: setEType(get20Type()); break; } } } finally { eSetDeliver(deliveryFlag); if (res != null && res.isTrackingModification()) res.setModified(modFlag); } return (JavaHelpers) getEType(); } protected EClassifier getTypeFromBeanField() {