CloneSet18


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
149230.991class_body_declarations[2]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
1149256
E:/TSE/Projects-CloneDR/emf-2.4.1/src/org/eclipse/emf/mapping/ecore2ecore/presentation/Ecore2EcoreModelWizard.java
2149235
E:/TSE/Projects-CloneDR/emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/presentation/Ecore2XMLModelWizard.java
Next
Last
Clone Instance
1
Line Count
149
Source Line
256
Source File
E:/TSE/Projects-CloneDR/emf-2.4.1/src/org/eclipse/emf/mapping/ecore2ecore/presentation/Ecore2EcoreModelWizard.java

/**
 * Do the work after everything is specified.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override public boolean performFinish() {
  try {
    // Remember the file.
    //
    final IFile modelFile = getModelFile();
    // Do the work within an operation.
    //
    WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
                                           @Override protected void execute(IProgressMonitor progressMonitor) {
                                             try {
                                               // Create a resource set
                                               //
                                               ResourceSet resourceSet = new ResourceSetImpl();
                                               // Get the URI of the model file.
                                               //
                                               URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
                                               // Create a resource for this file.
                                               //
                                               Resource resource = resourceSet.createResource(fileURI, Ecore2EcorePackage.eCONTENT_TYPE);
                                               // Add the initial model object to the contents.
                                               //
                                               EObject rootObject = createInitialModel();
                                               if (rootObject != null) {
                                                 resource.getContents().add(rootObject);
                                               }
                                               // Save the contents of the resource to the file system.
                                               //
                                               Map<Object, Object> options = new HashMap<Object, Object>();
                                               options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
                                               resource.save(options);
                                             }
                                             catch (Exception
                                                    exception) {
                                               Ecore2EcoreEditorPlugin.INSTANCE.log(exception);
                                             }
                                             finally {
                                               progressMonitor.done();
                                             }
                                           }
                                         };
    getContainer().run(false, false, operation);
    // Select the new file resource in the current view.
    //
    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = workbenchWindow.getActivePage();
    final IWorkbenchPart activePart = page.getActivePart();
    if (activePart instanceof ISetSelectionTarget) {
      final ISelection targetSelection = new StructuredSelection(modelFile);
      getShell().getDisplay().asyncExec(new Runnable() {
                                          public void run() {
                                            ((ISetSelectionTarget) activePart).selectReveal(targetSelection);
                                          }
                                        } );
    }
    // Open an editor on the new file.
    //
    try {
      page.openEditor(new FileEditorInput(modelFile), workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
    }
    catch (PartInitException
           exception) {
      MessageDialog.openError(workbenchWindow.getShell(), Ecore2EcoreEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
      return false;
    }
    return true;
  }
  catch (Exception
         exception) {
    Ecore2EcoreEditorPlugin.INSTANCE.log(exception);
    return false;
  }
}

/**
 * This is the one page of the wizard.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class Ecore2EcoreModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
  /**
   * Pass in the selection.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Ecore2EcoreModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {
    super(pageId, selection);
  }

  /**
   * The framework calls this to see if the file is correct.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override protected boolean validatePage() {
    if (super.validatePage()) {
      String extension = new Path(getFileName()).getFileExtension();
      if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
        String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions": "_WARN_FilenameExtension";
        setErrorMessage(Ecore2EcoreEditorPlugin.INSTANCE.getString(key, new Object[] {
                                                                                       FORMATTED_FILE_EXTENSIONS
                                                                                     } ));
        return false;
      }
      return true;
    }
    return false;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public IFile getModelFile() {
    return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
  }
}


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

/**
 * Do the work after everything is specified.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override public boolean performFinish() {
  try {
    // Remember the file.
    //
    final IFile modelFile = getModelFile();
    // Do the work within an operation.
    //
    WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
                                           @Override protected void execute(IProgressMonitor progressMonitor) {
                                             try {
                                               // Create a resource set
                                               //
                                               ResourceSet resourceSet = new ResourceSetImpl();
                                               // Get the URI of the model file.
                                               //
                                               URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
                                               // Create a resource for this file.
                                               //
                                               Resource resource = resourceSet.createResource(fileURI, Ecore2XMLPackage.eCONTENT_TYPE);
                                               // Add the initial model object to the contents.
                                               //
                                               EObject rootObject = createInitialModel();
                                               if (rootObject != null) {
                                                 resource.getContents().add(rootObject);
                                               }
                                               // Save the contents of the resource to the file system.
                                               //
                                               Map<Object, Object> options = new HashMap<Object, Object>();
                                               options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
                                               resource.save(options);
                                             }
                                             catch (Exception
                                                    exception) {
                                               Ecore2XMLUIPlugin.INSTANCE.log(exception);
                                             }
                                             finally {
                                               progressMonitor.done();
                                             }
                                           }
                                         };
    getContainer().run(false, false, operation);
    // Select the new file resource in the current view.
    //
    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = workbenchWindow.getActivePage();
    final IWorkbenchPart activePart = page.getActivePart();
    if (activePart instanceof ISetSelectionTarget) {
      final ISelection targetSelection = new StructuredSelection(modelFile);
      getShell().getDisplay().asyncExec(new Runnable() {
                                          public void run() {
                                            ((ISetSelectionTarget) activePart).selectReveal(targetSelection);
                                          }
                                        } );
    }
    // Open an editor on the new file.
    //
    try {
      page.openEditor(new FileEditorInput(modelFile), workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
    }
    catch (PartInitException
           exception) {
      MessageDialog.openError(workbenchWindow.getShell(), Ecore2XMLUIPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$
      return false;
    }
    return true;
  }
  catch (Exception
         exception) {
    Ecore2XMLUIPlugin.INSTANCE.log(exception);
    return false;
  }
}

/**
 * This is the one page of the wizard.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class Ecore2XMLModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
  /**
   * Pass in the selection.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Ecore2XMLModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {
    super(pageId, selection);
  }

  /**
   * The framework calls this to see if the file is correct.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override protected boolean validatePage() {
    if (super.validatePage()) {
      String extension = new Path(getFileName()).getFileExtension();
      if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
        String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions": "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$
        setErrorMessage(Ecore2XMLUIPlugin.INSTANCE.getString(key, new Object[] {
                                                                                 FORMATTED_FILE_EXTENSIONS
                                                                               } ));
        return false;
      }
      return true;
    }
    return false;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public IFile getModelFile() {
    return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
  }
}


Clone AbstractionParameter Count: 3Parameter Bindings

/**
   * Do the work after everything is specified.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
@Override public boolean performFinish() {
  try {
    // Remember the file.
    //
    final IFile modelFile = getModelFile();
    // Do the work within an operation.
    //
    WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
                                           @Override protected void execute(IProgressMonitor progressMonitor) {
                                             try {
                                               // Create a resource set
                                               //
                                               ResourceSet resourceSet = new ResourceSetImpl();
                                               // Get the URI of the model file.
                                               //
                                               URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
                                               // Create a resource for this file.
                                               //
                                               Resource resource = resourceSet.createResource(fileURI,  [[#variable146e41e0]].eCONTENT_TYPE);
                                               // Add the initial model object to the contents.
                                               //
                                               EObject rootObject = createInitialModel();
                                               if (rootObject != null) {
                                                 resource.getContents().add(rootObject);
                                               }
                                               // Save the contents of the resource to the file system.
                                               //
                                               Map<Object, Object> options = new HashMap<Object, Object>();
                                               options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
                                               resource.save(options);
                                             }
                                             catch (Exception
                                                    exception) {
                                                [[#variable146e40c0]].INSTANCE.log(exception);
                                             }
                                             finally {
                                               progressMonitor.done();
                                             }
                                           }
                                         };
    getContainer().run(false, false, operation);
    // Select the new file resource in the current view.
    //
    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = workbenchWindow.getActivePage();
    final IWorkbenchPart activePart = page.getActivePart();
    if (activePart instanceof ISetSelectionTarget) {
      final ISelection targetSelection = new StructuredSelection(modelFile);
      getShell().getDisplay().asyncExec(new Runnable() {
                                          public void run() {
                                            ((ISetSelectionTarget) activePart).selectReveal(targetSelection);
                                          }
                                        } );
    }
    // Open an editor on the new file.
    //
    try {
      page.openEditor(new FileEditorInput(modelFile), workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
    }
    catch (PartInitException
           exception) {
      MessageDialog.openError(workbenchWindow.getShell(),  [[#variable146e40c0]].INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$
      return false;
    }
    return true;
  }
  catch (Exception
         exception) {
     [[#variable146e40c0]].INSTANCE.log(exception);
    return false;
  }
}

/**
   * This is the one page of the wizard.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
public class [[#variable146e1f20]]extends WizardNewFileCreationPage {
  /**
       * Pass in the selection.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * @generated
       */
  public [[#variable146e1f20]](String pageId, IStructuredSelection selection) {
    super(pageId, selection);
  }

  /**
       * The framework calls this to see if the file is correct.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * @generated
       */
  @Override protected boolean validatePage() {
    if (super.validatePage()) {
      String extension = new Path(getFileName()).getFileExtension();
      if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
        String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions": "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$
        setErrorMessage( [[#variable146e40c0]].INSTANCE.getString(key, new Object[] {
                                                                                      FORMATTED_FILE_EXTENSIONS
                                                                                    } ));
        return false;
      }
      return true;
    }
    return false;
  }

  /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * @generated
       */
  public IFile getModelFile() {
    return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
  }
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#146e41e0]]
Ecore2EcorePackage 
12[[#146e41e0]]
Ecore2XMLPackage 
21[[#146e40c0]]
Ecore2EcoreEditorPlugin 
22[[#146e40c0]]
Ecore2XMLUIPlugin 
31[[#146e1f20]]
Ecore2EcoreModelWizardNewFileCreationPage 
32[[#146e1f20]]
Ecore2XMLModelWizardNewFileCreationPage