org.infai.emo.matcher.editor
Class ModelMatcherEditor

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.EditorPart
              extended by org.eclipse.ui.part.MultiPageEditorPart
                  extended by org.infai.emo.matcher.editor.ModelMatcherEditor
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IEditorPart, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation

public class ModelMatcherEditor
extends org.eclipse.ui.part.MultiPageEditorPart

This class is the editorClass that provides the MultiPageEditor for the comparison, mapping, ...
The first Page visualizes the matching between both models and the second page shows the mapping and the differences of the models.

Version:
1.0.0
Author:
Stanley Hillner
See Also:
MultiPageEditorPart

Field Summary
private  ModelComparatorPage comparatorPage
          The page of this MultiPageEditor that visualizes the matching between both models.
private  DifferencePage differencePage
          The page of this MultiPageEditor that visualizes the mapping of the models and contains the difference-model.
private  ModelMatcherEditor editor
          The current instance of this class.
private  Input input
          The Editor Input used for a reload of a saved difference.
private  ModelComparator modelComparator
          The comparator that is responsible for the whole model-initializing and comparison.
private  org.eclipse.jface.action.Action reloadAction
          The action that is activated when the user clicks on the "reload" button on the menu-bar.
private  org.eclipse.jface.action.Action saveDiffAction
          The action that is activated when the user clicks on the "save diff" button on the menubar.
 
Fields inherited from class org.eclipse.ui.part.MultiPageEditorPart
PAGE_CONTAINER_SITE
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
ModelMatcherEditor()
           
 
Method Summary
private  void createActions()
          Method creates the actions for the editor which are intended to be available at the editor-startup.
(package private)  void createPage0(org.eclipse.swt.widgets.Composite parent)
          This method creates the first page of the editor.
(package private)  void createPage2(org.eclipse.swt.widgets.Composite parent)
          This method creates the third page of the editor.
protected  void createPages()
          Method creates the pages of this editor.
private  void createToolBar()
          Sets the created actions to the editors toolBar.
 void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
          
 void doSaveAs()
          
 ModelComparatorPage getComparatorPage()
           
private  org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String fileName)
          Returns an ImageDescriptor for an image file.
 ModelComparator getModelComparator()
           
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput editorInput)
          
 void initInput(java.lang.String leftModelPath, java.lang.String rightModelPath, java.lang.String metaModelPath, java.util.Hashtable<java.lang.String,java.lang.Double> weightings, boolean useCrossProduct)
          Initialize the Models and call the Methods of the ModelMatcherTreeViewers to initialize their input by giving them the resource of the model they are responsible for.
 boolean isSaveAsAllowed()
          
private  void loadDiffModel(Input input)
          This method loads the difference-model from the given input.
protected  void pageChange(int newPageIndex)
          
 void setComparatorPage(ModelComparatorPage comparatorPage)
           
 void setFocus()
          
 
Methods inherited from class org.eclipse.ui.part.MultiPageEditorPart
activateSite, addPage, addPage, addPage, addPage, createPageContainer, createPartControl, createSite, deactivateSite, dispose, findEditors, getActiveEditor, getActivePage, getAdapter, getContainer, getControl, getEditor, getPageCount, getPageImage, getPageSite, getPageText, handlePropertyChange, initializePageSwitching, isDirty, removePage, setActiveEditor, setActivePage, setControl, setPageImage, setPageText
 
Methods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, removePropertyListener
 

Field Detail

modelComparator

private ModelComparator modelComparator
The comparator that is responsible for the whole model-initializing and comparison.

See Also:
ModelComparator

saveDiffAction

private org.eclipse.jface.action.Action saveDiffAction
The action that is activated when the user clicks on the "save diff" button on the menubar.

See Also:
Action

reloadAction

private org.eclipse.jface.action.Action reloadAction
The action that is activated when the user clicks on the "reload" button on the menu-bar.

See Also:
Action

editor

private ModelMatcherEditor editor
The current instance of this class.


comparatorPage

private ModelComparatorPage comparatorPage
The page of this MultiPageEditor that visualizes the matching between both models.

See Also:
ModelComparatorPage

differencePage

private DifferencePage differencePage
The page of this MultiPageEditor that visualizes the mapping of the models and contains the difference-model.

See Also:
DifferencePage

input

private Input input
The Editor Input used for a reload of a saved difference.

See Also:
Input
Constructor Detail

ModelMatcherEditor

public ModelMatcherEditor()
Method Detail

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput editorInput)
          throws org.eclipse.ui.PartInitException

Specified by:
init in interface org.eclipse.ui.IEditorPart
Overrides:
init in class org.eclipse.ui.part.MultiPageEditorPart
Throws:
org.eclipse.ui.PartInitException

createPages

protected void createPages()
Method creates the pages of this editor. The toolbar and the actions are also initialized by this method.
If there is a input for the Editor (when the user reloads a saved difference) the comparison will be reloaded.

Specified by:
createPages in class org.eclipse.ui.part.MultiPageEditorPart

loadDiffModel

private void loadDiffModel(Input input)
This method loads the difference-model from the given input. The loaded data will be used for a new comparison of both models using the saved settings.

Parameters:
input - the input for the editor.
See Also:
input

createPage0

void createPage0(org.eclipse.swt.widgets.Composite parent)
This method creates the first page of the editor.
Page 0 is the comparator-page for visualizing the matching.

Parameters:
parent - the composite on which the page shall be located.
See Also:
Composite

createPage2

void createPage2(org.eclipse.swt.widgets.Composite parent)
This method creates the third page of the editor.
Page 2 is the mapping-page for visualizing the mapping and the differences.

Parameters:
parent - the composite on which the page shall be located.
See Also:
Composite

createActions

private void createActions()
Method creates the actions for the editor which are intended to be available at the editor-startup.


createToolBar

private void createToolBar()
Sets the created actions to the editors toolBar.


getImageDescriptor

private org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String fileName)
Returns an ImageDescriptor for an image file.

Parameters:
fileName - the name of the file that contains the image.
Returns:
the ImageDescriptor from which an image can be built.
See Also:
ImageDescriptor

initInput

public void initInput(java.lang.String leftModelPath,
                      java.lang.String rightModelPath,
                      java.lang.String metaModelPath,
                      java.util.Hashtable<java.lang.String,java.lang.Double> weightings,
                      boolean useCrossProduct)
Initialize the Models and call the Methods of the ModelMatcherTreeViewers to initialize their input by giving them the resource of the model they are responsible for.

Parameters:
metaModelPath - the path of the metamodel.
leftModelPath - the path of the first model.
rightModelPath - the path of the second model.
weightings - the Hashtable that contains the weightings for the comparison criteria.
useCrossProduct - indicates if a full cross product shall be used to match the models.

setFocus

public void setFocus()

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart
Overrides:
setFocus in class org.eclipse.ui.part.MultiPageEditorPart

getModelComparator

public ModelComparator getModelComparator()
Returns:
the ModelComparator that controlled the comparison of both models.

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)

Specified by:
doSave in interface org.eclipse.ui.ISaveablePart
Specified by:
doSave in class org.eclipse.ui.part.EditorPart

doSaveAs

public void doSaveAs()

Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart
Specified by:
doSaveAs in class org.eclipse.ui.part.EditorPart

isSaveAsAllowed

public boolean isSaveAsAllowed()

Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
Specified by:
isSaveAsAllowed in class org.eclipse.ui.part.EditorPart

getComparatorPage

public ModelComparatorPage getComparatorPage()
Returns:
the page of this editor that contains the matching.
See Also:
comparatorPage

setComparatorPage

public void setComparatorPage(ModelComparatorPage comparatorPage)
Parameters:
comparatorPage - the ComparatorPage to be set.

pageChange

protected void pageChange(int newPageIndex)

Overrides:
pageChange in class org.eclipse.ui.part.MultiPageEditorPart