CloneSet32


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
114210.998class_body_declarations[4]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
11141430
E:/TSE/Projects-CloneDR/emf-2.4.1/src/org/eclipse/emf/ecore/presentation/EcoreEditor.java
21141644
E:/TSE/Projects-CloneDR/emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/presentation/Ecore2XMLEditor.java
Next
Last
Clone Instance
1
Line Count
114
Source Line
1430
Source File
E:/TSE/Projects-CloneDR/emf-2.4.1/src/org/eclipse/emf/ecore/presentation/EcoreEditor.java

/**
 * This is for implementing {@link IEditorPart} and simply tests the command stack.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override public boolean isDirty() {
  return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded();
}

/**
 * This is for implementing {@link IEditorPart} and simply saves the model file.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override public void doSave(IProgressMonitor progressMonitor) {
  // Save only resources that have actually changed.
  //
  final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
  saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
  // Do the work within an operation because this is a long running activity that modifies the workbench.
  //
  WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
                                         // This is the method that gets invoked when the operation runs.
                                         //
                                         @Override public void execute(IProgressMonitor monitor) {
                                           // Save the resources to the file system.
                                           //
                                           boolean first = true;
                                           for (Resource resource: editingDomain.getResourceSet().getResources()) {
                                             if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
                                               try {
                                                 long timeStamp = resource.getTimeStamp();
                                                 resource.save(saveOptions);
                                                 if (resource.getTimeStamp() != timeStamp) {
                                                   savedResources.add(resource);
                                                 }
                                               }
                                               catch (Exception
                                                      exception) {
                                                 resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
                                               }
                                               first = false;
                                             }
                                           }
                                         }
                                       };
  updateProblemIndication = false;
  try {
    // This runs the options, and shows progress.
    //
    new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
    // Refresh the necessary state.
    //
    ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
    firePropertyChange(IEditorPart.PROP_DIRTY);
  }
  catch (Exception
         exception) {
    // Something went wrong that shouldn't.
    //
    EcoreEditorPlugin.INSTANCE.log(exception);
  }
  updateProblemIndication = true;
  updateProblemIndication();
}

/**
 * This returns whether something has been persisted to the URI of the specified resource.
 * The implementation uses the URI converter from the editor's resource set to try to open an input stream. 
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected boolean isPersisted(Resource resource) {
  boolean result = false;
  try {
    InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
    if (stream != null) {
      result = true;
      stream.close();
    }
  }
  catch (IOException
         e) {
  // Ignore
  }
  return result;
}

/**
 * This always returns true because it is not currently supported.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override public boolean isSaveAsAllowed() {
  return true;
}


First
Previous
Clone Instance
2
Line Count
114
Source Line
1644
Source File
E:/TSE/Projects-CloneDR/emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/presentation/Ecore2XMLEditor.java

/**
 * This is for implementing {@link IEditorPart} and simply tests the command stack.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override public boolean isDirty() {
  return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded();
}

/**
 * This is for implementing {@link IEditorPart} and simply saves the model file.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override public void doSave(IProgressMonitor progressMonitor) {
  // Save only resources that have actually changed.
  //
  final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
  saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
  // Do the work within an operation because this is a long running activity that modifies the workbench.
  //
  WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
                                         // This is the method that gets invoked when the operation runs.
                                         //
                                         @Override public void execute(IProgressMonitor monitor) {
                                           // Save the resources to the file system.
                                           //
                                           boolean first = true;
                                           for (Resource resource: editingDomain.getResourceSet().getResources()) {
                                             if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
                                               try {
                                                 long timeStamp = resource.getTimeStamp();
                                                 resource.save(saveOptions);
                                                 if (resource.getTimeStamp() != timeStamp) {
                                                   savedResources.add(resource);
                                                 }
                                               }
                                               catch (Exception
                                                      exception) {
                                                 resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
                                               }
                                               first = false;
                                             }
                                           }
                                         }
                                       };
  updateProblemIndication = false;
  try {
    // This runs the options, and shows progress.
    //
    new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
    // Refresh the necessary state.
    //
    ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
    firePropertyChange(IEditorPart.PROP_DIRTY);
  }
  catch (Exception
         exception) {
    // Something went wrong that shouldn't.
    //
    Ecore2XMLUIPlugin.INSTANCE.log(exception);
  }
  updateProblemIndication = true;
  updateProblemIndication();
}

/**
 * This returns whether something has been persisted to the URI of the specified resource.
 * The implementation uses the URI converter from the editor's resource set to try to open an input stream. 
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected boolean isPersisted(Resource resource) {
  boolean result = false;
  try {
    InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
    if (stream != null) {
      result = true;
      stream.close();
    }
  }
  catch (IOException
         e) {
  // Ignore
  }
  return result;
}

/**
 * This always returns true because it is not currently supported.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override public boolean isSaveAsAllowed() {
  return true;
}


Clone AbstractionParameter Count: 1Parameter Bindings

/**
   * This is for implementing {@link IEditorPart} and simply tests the command stack.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
@Override public boolean isDirty() {
  return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded();
}

/**
   * This is for implementing {@link IEditorPart} and simply saves the model file.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
@Override public void doSave(IProgressMonitor progressMonitor) {
  // Save only resources that have actually changed.
  //
  final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
  saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
  // Do the work within an operation because this is a long running activity that modifies the workbench.
  //
  WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
                                         // This is the method that gets invoked when the operation runs.
                                         //
                                         @Override public void execute(IProgressMonitor monitor) {
                                           // Save the resources to the file system.
                                           //
                                           boolean first = true;
                                           for (Resource resource: editingDomain.getResourceSet().getResources()) {
                                             if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
                                               try {
                                                 long timeStamp = resource.getTimeStamp();
                                                 resource.save(saveOptions);
                                                 if (resource.getTimeStamp() != timeStamp) {
                                                   savedResources.add(resource);
                                                 }
                                               }
                                               catch (Exception
                                                      exception) {
                                                 resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
                                               }
                                               first = false;
                                             }
                                           }
                                         }
                                       };
  updateProblemIndication = false;
  try {
    // This runs the options, and shows progress.
    //
    new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
    // Refresh the necessary state.
    //
    ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
    firePropertyChange(IEditorPart.PROP_DIRTY);
  }
  catch (Exception
         exception) {
     [[#variable146a3c00]].INSTANCE.log(exception);
  }
  updateProblemIndication = true;
  updateProblemIndication();
}

/**
   * This returns whether something has been persisted to the URI of the specified resource.
   * The implementation uses the URI converter from the editor's resource set to try to open an input stream. 
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
protected boolean isPersisted(Resource resource) {
  boolean result = false;
  try {
    InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
    if (stream != null) {
      result = true;
      stream.close();
    }
  }
  catch (IOException
         e) {
  // Ignore
  }
  return result;
}

/**
   * This always returns true because it is not currently supported.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
@Override public boolean isSaveAsAllowed() {
  return true;
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#146a3c00]]
// Something went wrong that shouldn't.
//
EcoreEditorPlugin 
12[[#146a3c00]]
// Something went wrong that shouldn't.
//
Ecore2XMLUIPlugin