Example usage for org.eclipse.jface.viewers TreeViewer getTree

List of usage examples for org.eclipse.jface.viewers TreeViewer getTree

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers TreeViewer getTree.

Prototype

public Tree getTree() 

Source Link

Document

Returns this tree viewer's tree control.

Usage

From source file:oic.simulator.clientcontroller.view.dialogs.ModelArrayAddItemDialog.java

License:Open Source License

public void createAttributeColumns(TreeViewer viewer) {
    Tree tree = viewer.getTree();

    attributeEditor = new AttributeEditingSupport();

    TreeColumn attName = new TreeColumn(tree, SWT.NONE);
    attName.setWidth(attTblColWidth[0]);
    attName.setText(attTblHeaders[0]);/*from w  w w. j av a  2s  .c o m*/

    TreeColumn attValue = new TreeColumn(tree, SWT.NONE);
    attValue.setWidth(attTblColWidth[1]);
    attValue.setText(attTblHeaders[1]);

    TreeViewerColumn attValueVwrCol = new TreeViewerColumn(attViewer, attValue);
    attValueVwrCol.setEditingSupport(attributeEditor.createAttributeValueEditor(attViewer, dialog));

    addColumnListeners();
}

From source file:oic.simulator.clientcontroller.view.dialogs.PostRequestDialog.java

License:Open Source License

public void createAttributeColumns(TreeViewer viewer) {
    Tree tree = viewer.getTree();

    attributeEditor = new AttributeEditingSupport();

    TreeColumn attName = new TreeColumn(tree, SWT.NONE);
    attName.setWidth(attTblColWidth[0]);
    attName.setText(attTblHeaders[0]);/*from  w w  w.  j a  v a 2s  .  co m*/

    TreeColumn attValue = new TreeColumn(tree, SWT.NONE);
    attValue.setWidth(attTblColWidth[1]);
    attValue.setText(attTblHeaders[1]);
    TreeViewerColumn attValueVwrCol = new TreeViewerColumn(attViewer, attValue);
    attValueVwrCol.setEditingSupport(attributeEditor.createAttributeValueEditor(attViewer, this));

    TreeColumn updateColumn = new TreeColumn(tree, SWT.NONE);
    updateColumn.setWidth(attTblColWidth[2]);
    updateColumn.setText(attTblHeaders[2]);
    TreeViewerColumn updateVwrCol = new TreeViewerColumn(attViewer, updateColumn);
    updateVwrCol.setEditingSupport(attributeEditor.createPostSelectionEditor(attViewer));

    addMenuItems();
}

From source file:oic.simulator.clientcontroller.view.dialogs.PutRequestDialog.java

License:Open Source License

public void createAttributeColumns(TreeViewer viewer) {
    Tree tree = viewer.getTree();

    attributeEditor = new AttributeEditingSupport();

    TreeColumn attName = new TreeColumn(tree, SWT.NONE);
    attName.setWidth(attTblColWidth[0]);
    attName.setText(attTblHeaders[0]);/*from  w  w w . ja  va  2 s.com*/

    TreeColumn attValue = new TreeColumn(tree, SWT.NONE);
    attValue.setWidth(attTblColWidth[1]);
    attValue.setText(attTblHeaders[1]);
    TreeViewerColumn attValueVwrCol = new TreeViewerColumn(attViewer, attValue);
    attValueVwrCol.setEditingSupport(attributeEditor.createAttributeValueEditor(attViewer, this));

    addMenuItems();
}

From source file:oic.simulator.serviceprovider.view.AttributeView.java

License:Open Source License

public void createAttributeColumns(TreeViewer viewer) {
    Tree tree = viewer.getTree();

    attributeEditor = new AttributeEditingSupport();

    TreeColumn attName = new TreeColumn(tree, SWT.NONE);
    attName.setWidth(attTblColWidth[0]);
    attName.setText(attTblHeaders[0]);//from  w  ww. j a  v  a  2  s .  com

    TreeColumn attValue = new TreeColumn(tree, SWT.NONE);
    attValue.setWidth(attTblColWidth[1]);
    attValue.setText(attTblHeaders[1]);

    TreeViewerColumn attValueVwrCol = new TreeViewerColumn(attViewer, attValue);
    attValueVwrCol.setEditingSupport(attributeEditor.createAttributeValueEditor(attViewer, true));

    TreeColumn automation = new TreeColumn(tree, SWT.NONE);
    automation.setWidth(attTblColWidth[2]);
    automation.setText(attTblHeaders[2]);
    TreeViewerColumn automationVwrCol = new TreeViewerColumn(attViewer, automation);
    automationVwrCol.setEditingSupport(attributeEditor.createAutomationEditor(attViewer));

    addColumnListeners();

    addMenuItems();
}

From source file:oic.simulator.serviceprovider.view.dialogs.ModelArrayAddItemDialog.java

License:Open Source License

public void createAttributeColumns(TreeViewer viewer) {
    Tree tree = viewer.getTree();

    attributeEditor = new AttributeEditingSupport();

    TreeColumn attName = new TreeColumn(tree, SWT.NONE);
    attName.setWidth(attTblColWidth[0]);
    attName.setText(attTblHeaders[0]);/*  www. j a v a 2s . co  m*/

    TreeColumn attValue = new TreeColumn(tree, SWT.NONE);
    attValue.setWidth(attTblColWidth[1]);
    attValue.setText(attTblHeaders[1]);

    TreeViewerColumn attValueVwrCol = new TreeViewerColumn(attViewer, attValue);
    attValueVwrCol.setEditingSupport(attributeEditor.createAttributeValueEditor(attViewer, false));

    addColumnListeners();
}

From source file:oida.model.integration.ui.dialogs.MigrateDialog.java

License:Open Source License

/**
 * Create contents of the dialog.//w w w. j a v a2s .  c  o m
 */
private void createContents() {
    shlMigratedialog = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE);
    shlMigratedialog.setSize(802, 400);
    shlMigratedialog.setText("Import");
    shlMigratedialog.setLayout(new FillLayout(SWT.HORIZONTAL));

    SashForm sashForm = new SashForm(shlMigratedialog, SWT.NONE);

    Composite compositeTargetModel = new Composite(sashForm, SWT.NONE);
    compositeTargetModel.setLayout(new FillLayout(SWT.HORIZONTAL));

    final TreeViewer treeViewerTargetModel = new TreeViewer(compositeTargetModel, SWT.BORDER);
    Tree treeTargetModel = treeViewerTargetModel.getTree();
    treeTargetModel.addSelectionListener(new SelectionAdapter() {

        @SuppressWarnings("unchecked")
        @Override
        public void widgetSelected(SelectionEvent e) {
            EObject containerEObject = (EObject) ((StructuredSelection) treeViewerTargetModel.getSelection())
                    .getFirstElement();
            if ((mergeModel.getCurrentReferenceMatching() != null) && (mergeModel.getDiffModel()
                    .getTheirMatchings().contains(mergeModel.getCurrentReferenceMatching()))) {
                EObject currentEObject = mergeModel.getCurrentReferenceMatching().getTargetReferenceMapping()
                        .getSourceEObject();

                MergeModel mergeModel1 = mergeModel;

                for (EReference containmentEReference : containerEObject.eClass().getEAllContainments()) {
                    EClassifier referenceEClassifier = containmentEReference.getEType();

                    if (referenceEClassifier.isInstance(currentEObject)) {
                        if (containmentEReference.isMany()) {
                            ((EList<EObject>) containerEObject.eGet(containmentEReference))
                                    .add(mergeModel.getCurrentReferenceMatching().getTargetReferenceMapping()
                                            .getSourceEObject());

                        } else {
                            containerEObject.eSet(containmentEReference,
                                    mergeModel.getCurrentReferenceMatching().getTargetReferenceMapping()
                                            .getSourceEObject());
                        }
                        tableViewerNewElements.refresh();
                        break;
                    }

                }

            }
        }
    });

    SashForm sashForm_1 = new SashForm(sashForm, SWT.VERTICAL);

    Composite compositeNewElements = new Composite(sashForm_1, SWT.NONE);
    compositeNewElements.setLayout(new GridLayout(1, false));

    tableViewerNewElements = new TableViewer(compositeNewElements, SWT.BORDER | SWT.FULL_SELECTION);
    tableNewElements = tableViewerNewElements.getTable();
    tableNewElements.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            ReferenceMatching referenceMatching = (ReferenceMatching) ((StructuredSelection) tableViewerNewElements
                    .getSelection()).getFirstElement();
            mergeModel.selectConflictingObject(referenceMatching);
            if (mergeModel.getCurrentReferenceMatching() != null) {
                EObject currentContainer = referenceMatching.getTargetReferenceMapping().getSourceEObject()
                        .eContainer();
                if (currentContainer != null) {
                    List<EObject> selectionList = new ArrayList<EObject>();
                    selectionList.add(currentContainer);
                    treeViewerTargetModel
                            .setSelection(new StructuredSelection(selectionList, new EObjectsComparer()), true);
                }
            }

        }
    });
    tableNewElements.setLinesVisible(true);
    tableNewElements.setHeaderVisible(true);
    tableNewElements.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TableViewerColumn tableViewerElement = new TableViewerColumn(tableViewerNewElements, SWT.NONE);
    TableColumn tblclmnElement = tableViewerElement.getColumn();
    tblclmnElement.setWidth(100);
    tblclmnElement.setText("Element");
    tableViewerElement.setEditingSupport(new ElementNameEditingSupport(tableViewerNewElements));

    TableViewerColumn tableViewerMeaning = new TableViewerColumn(tableViewerNewElements, SWT.NONE);
    TableColumn tblclmnMeaning = tableViewerMeaning.getColumn();
    tblclmnMeaning.setWidth(113);
    tblclmnMeaning.setText("Meaning");

    TableViewerColumn tableViewerContainer = new TableViewerColumn(tableViewerNewElements, SWT.NONE);
    TableColumn tblclmnContainer = tableViewerContainer.getColumn();
    tblclmnContainer.setWidth(104);
    tblclmnContainer.setText("Container");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewerNewElements, SWT.NONE);
    TableColumn tblclmnStatus = tableViewerColumn_1.getColumn();
    tblclmnStatus.setWidth(71);
    tblclmnStatus.setText("Status");

    TableViewerColumn tableViewerComment = new TableViewerColumn(tableViewerNewElements, SWT.NONE);
    TableColumn tblclmnComment = tableViewerComment.getColumn();
    tblclmnComment.setWidth(160);
    tblclmnComment.setText("Comment");
    tableViewerComment.setEditingSupport(new CommentEditingSupport(tableViewerNewElements));

    Composite compositeAttribute = new Composite(sashForm_1, SWT.NONE);
    compositeAttribute.setLayout(new GridLayout(2, false));

    tableViewerAttributes = new TableViewer(compositeAttribute, SWT.BORDER | SWT.FULL_SELECTION);

    tableViewerAttributes.setContentProvider(new ArrayContentProvider());

    tableAttributes = tableViewerAttributes.getTable();
    GridData gd_tableAttributes = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_tableAttributes.widthHint = 208;
    tableAttributes.setLayoutData(gd_tableAttributes);
    tableAttributes.setLinesVisible(true);
    tableAttributes.setHeaderVisible(true);

    TableViewerColumn tableViewerColumnAttribute = new TableViewerColumn(tableViewerAttributes, SWT.NONE);
    TableColumn tblclmnAttribute = tableViewerColumnAttribute.getColumn();
    tblclmnAttribute.setWidth(85);
    tblclmnAttribute.setText("Attribute");
    tableViewerColumnAttribute.setLabelProvider(new ColumnLabelProvider() {
        @Override
        public String getText(Object element) {
            IntegratedAttribute integratedAttribute = (IntegratedAttribute) element;
            return integratedAttribute.getAttributeName();
        }
    });

    TableViewerColumn tableViewerColumnValue = new TableViewerColumn(tableViewerAttributes, SWT.NONE);
    TableColumn tblclmnValue = tableViewerColumnValue.getColumn();
    tblclmnValue.setWidth(102);
    tblclmnValue.setText("Value");

    Composite composite = new Composite(compositeAttribute, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
    composite.setLayout(new GridLayout(3, false));

    lblCommitedImports = new Label(composite, SWT.NONE);
    lblCommitedImports.setText("commited imports");

    Button btnCommit = new Button(composite, SWT.NONE);
    btnCommit.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            EObject container = mergeModel.getCurrentReferenceMatching().getTargetReferenceMapping()
                    .getSourceEObject().eContainer();
            String name = ModelProviderHelper.getModelElementName(
                    mergeModel.getCurrentReferenceMatching().getTargetReferenceMapping().getSourceEObject());
            if ((container != null) && (name != "")) {
                mergeModel.confirmCurrentReferenceMatching();
                tableViewerNewElements.refresh();
            } else {
                System.out.println("Cannot confirm underdefined model element");
            }

        }
    });
    btnCommit.setText("Confirm");
    new Label(composite, SWT.NONE);

    lblReportedImports = new Label(composite, SWT.NONE);
    lblReportedImports.setText("Reported imports");

    Button btnReport = new Button(composite, SWT.NONE);
    btnReport.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    btnReport.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TransformatorHelper.removeContainment(
                    mergeModel.getCurrentReferenceMatching().getTargetReferenceMapping().getSourceEObject());
            mergeModel.reportCurrentReferenceMatching();
            tableViewerNewElements.refresh();
        }

    });
    btnReport.setText("Report");
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);

    Button btnFinish = new Button(composite, SWT.NONE);
    btnFinish.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            shlMigratedialog.close();
        }
    });
    btnFinish.setText("Finish");
    sashForm_1.setWeights(new int[] { 183, 93 });
    sashForm.setWeights(new int[] { 125, 316 });

    ObservableListContentProvider listContentProviderNewElements = new ObservableListContentProvider();
    tableViewerNewElements.setContentProvider(listContentProviderNewElements);

    IObservableMap[] observeMapsNewElements = PojoObservables.observeMaps(
            listContentProviderNewElements.getKnownElements(), ReferenceMatching.class,
            new String[] { "confirmed", "reported" });
    tableViewerNewElements.setLabelProvider(new NewElementsTableLabelProvider(observeMapsNewElements));

    treeViewerTargetModel.setLabelProvider(new AdapterFactoryLabelProvider(
            new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)));

    treeViewerTargetModel.setContentProvider(new AdapterFactoryContentProvider(
            new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)) {
        @Override
        public Object[] getElements(Object object) {
            if (object instanceof Object[]) {
                return (Object[]) object;
            }
            return super.getElements(object);
        }
    });
    treeViewerTargetModel.addFilter(new ContainerFilter());

    treeViewerTargetModel.setInput(new Object[] { mergeModel.getTargetRootObject() });

    m_bindingContext = initDataBindings();

}

From source file:oida.model.integration.ui.editors.ExtendingMatchEditor.java

License:Open Source License

/**
 * Create contents of the editor part./*from   w w  w .  jav a  2s  .com*/
 * 
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));

    SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
    GridData gd_sashForm = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_sashForm.widthHint = 585;
    sashForm.setLayoutData(gd_sashForm);

    SashForm sashFormMetaModel = new SashForm(sashForm, SWT.NONE);

    Composite compositeMetaModel = new Composite(sashFormMetaModel, SWT.NONE);
    compositeMetaModel.setLayout(new GridLayout(1, false));

    Label labelMetamodelItems = new Label(compositeMetaModel, SWT.NONE);
    labelMetamodelItems.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    labelMetamodelItems.setText("Metamodel Items");

    final TreeViewer treeViewerMetamodel = new TreeViewer(compositeMetaModel, SWT.BORDER);
    treeViewerMetamodel.setContentProvider(new OntClassContentProvider());
    treeViewerMetamodel.setLabelProvider(new OntClassLabelProvider());
    OntResource topOntResource = ontologyModel.getOntologyModel()
            .getOntResource(("http://www.w3.org/2000/01/rdf-schema#Resource"));
    OntClassContentProvider ontClassContentProvider = (OntClassContentProvider) treeViewerMetamodel
            .getContentProvider();
    ontClassContentProvider.setOntology(OntologyModel.getInstance().getBaseOntology());
    treeViewerMetamodel.setInput(topOntResource);

    final Tree treeMetamodel = treeViewerMetamodel.getTree();
    treeMetamodel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite compositeMetaModelRecommendations = new Composite(sashFormMetaModel, SWT.NONE);
    compositeMetaModelRecommendations.setLayout(new GridLayout(1, false));

    Label lblMetamodelRecommendations = new Label(compositeMetaModelRecommendations, SWT.NONE);
    lblMetamodelRecommendations.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lblMetamodelRecommendations.setText("Metamodel recommendations");

    listViewerMetamodelReference = new ListViewer(compositeMetaModelRecommendations, SWT.BORDER | SWT.V_SCROLL);
    listViewerMetamodelReference.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {

        }
    });

    final List listMetamodelReference = listViewerMetamodelReference.getList();
    listMetamodelReference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    listMetamodelReference.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            listViewerModelReference.getList().deselectAll();
            OntResource currentReferenceOntResource = (OntResource) ((StructuredSelection) listViewerMetamodelReference
                    .getSelection()).getFirstElement();

            matchingModel.selectOntResource(currentReferenceOntResource);
            if (currentReferenceOntResource.isClass()) {
                matchingModel.setCurrentReferenceClass(currentReferenceOntResource.asClass());
            }

        }
    });
    listViewerMetamodelReference.setSorter(new OntResourceSorter());

    sashFormMetaModel.setWeights(new int[] { 1, 1 });

    Composite MatchingOperations = new Composite(sashForm, SWT.NONE);
    MatchingOperations.setLayout(new GridLayout(4, false));

    Button btnAddToReference = new Button(MatchingOperations, SWT.NONE);
    GridData gd_btnAddToReference = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnAddToReference.widthHint = 112;
    btnAddToReference.setLayoutData(gd_btnAddToReference);
    btnAddToReference.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            OntResource ontResource = matchingModel.getManualMatch().getSource();
            if (ontResource.isIndividual()) {
                Individual sourceIndividual = ontResource.asIndividual();
                CreateNewReferenceIndividualDialog createNewReferenceIndividual = new CreateNewReferenceIndividualDialog(

                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                        SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL, matchingModel.getCurrentReferenceClass());
                createNewReferenceIndividual.setSourceIndividual(sourceIndividual);
                createNewReferenceIndividual.open();
                listViewerModelReference.refresh();

            } else if (ontResource.isClass()) {
                OntClass sourceOntClass = ontResource.asClass();
                CreateNewReferenceOntClassDialog createNewReferenceOntClass = new CreateNewReferenceOntClassDialog(

                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                        SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL, matchingModel.getCurrentReferenceClass());
                createNewReferenceOntClass.setSourceOntClass(sourceOntClass);
                createNewReferenceOntClass.open();
                listViewerMetamodelReference.refresh();
            }
        }
    });
    btnAddToReference.setText("Add to reference");

    txtSourceResource = new Text(MatchingOperations, SWT.BORDER);
    txtSourceResource.setEditable(false);
    txtSourceResource.setText("Unmapped resources");
    GridData gd_txtSourceResource = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
    gd_txtSourceResource.widthHint = 137;
    txtSourceResource.setLayoutData(gd_txtSourceResource);

    btnConfirm = new Button(MatchingOperations, SWT.NONE);
    GridData gd_btnConfirm = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_btnConfirm.widthHint = 124;
    btnConfirm.setLayoutData(gd_btnConfirm);

    btnConfirm.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            matchingModel.toggleManualMatch();
        }
    });
    btnConfirm.setText("Confirm");

    txtReferenceresource = new Text(MatchingOperations, SWT.BORDER);
    txtReferenceresource.setEditable(false);
    txtReferenceresource.setText("Reasoner Status");
    GridData gd_txtReferenceresource = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_txtReferenceresource.widthHint = 257;
    txtReferenceresource.setLayoutData(gd_txtReferenceresource);

    SashForm sashFormModel = new SashForm(sashForm, SWT.NONE);

    Composite compositeModel = new Composite(sashFormModel, SWT.NONE);
    compositeModel.setLayout(new GridLayout(1, false));

    Label labelModelItems = new Label(compositeModel, SWT.NONE);
    labelModelItems.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    labelModelItems.setText("Model Items");

    final TreeViewer treeViewerModel = new TreeViewer(compositeModel, SWT.BORDER);

    treeViewerModel.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {

        }
    });
    treeViewerModel.setLabelProvider(new AdapterFactoryLabelProvider(
            new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)));

    treeViewerModel.setContentProvider(new AdapterFactoryContentProvider(
            new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)) {
        @Override
        public Object[] getElements(Object object) {
            if (object instanceof Object[]) {
                return (Object[]) object;
            }
            return super.getElements(object);
        }
    });
    treeViewerModel.setInput(new Object[] { rootEObject });

    Tree treeModel = treeViewerModel.getTree();
    treeModel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite compositeModelRecommendations = new Composite(sashFormModel, SWT.NONE);
    compositeModelRecommendations.setLayout(new GridLayout(1, false));

    Label labelModelRecommendations = new Label(compositeModelRecommendations, SWT.NONE);
    labelModelRecommendations.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    labelModelRecommendations.setText("Model Recommendations");

    listViewerModelReference = new ListViewer(compositeModelRecommendations, SWT.BORDER | SWT.V_SCROLL);
    List listModelReference = listViewerModelReference.getList();
    listModelReference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    listModelReference.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            Individual referenceIndividual = (Individual) ((StructuredSelection) listViewerModelReference
                    .getSelection()).getFirstElement();

            matchingModel.selectOntResource(referenceIndividual);

        }
    });
    listViewerModelReference.setSorter(new OntResourceSorter());

    treeModel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // Get Individual
            EObject eObject = (EObject) ((StructuredSelection) treeViewerModel.getSelection())
                    .getFirstElement();

            String baseIndividualName = matchingModel.getEObjectName(eObject);
            String baseOntologyURIString = ontologyModel.getBaseOntologyURI().toString();

            Individual sourceIndividual = ontologyModel
                    .getIndividual(URI.createURI(baseOntologyURIString + "#" + baseIndividualName));

            matchingModel.selectOntResource(sourceIndividual);
            // Get Type and select in treeviewerMetamodel
            listViewerMetamodelReference.refresh();

            OntResource metaSourceOntResource = matchingModel.getSourceMetaOntResource();
            treeViewerMetamodel.setSelection(new StructuredSelection(metaSourceOntResource), true);

            // Get ReferenceOntClass of the individual and select it if
            // possible

            if (matchingModel.getReferenceIndividual() != null) {
                // manualMatch.setTarget(referenceIndividual);
                listViewerModelReference
                        .setSelection(new StructuredSelection(matchingModel.getReferenceIndividual()), true);
            }

            //

        }
    });

    treeMetamodel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            treeViewerModel.getTree().deselectAll();

            // Set internal Resource of manual Mapping
            OntResource sourceOntResource = (OntResource) ((StructuredSelection) treeViewerMetamodel
                    .getSelection()).getFirstElement();

            matchingModel.selectOntResource(sourceOntResource);

            matchingModel.setSourceMetaOntResource(sourceOntResource);
            OntResource referenceMetaOntResource = ontologyModel.getReferenceOntResource(sourceOntResource);

            listViewerMetamodelReference.refresh();

            // if equivalent reference class exists select the
            // external class and switch to revoke

            if (referenceMetaOntResource != null) {
                listViewerMetamodelReference.setSelection(new StructuredSelection(referenceMetaOntResource),
                        true);
            }

        }

    });

    sashFormModel.setWeights(new int[] { 1, 1 });

    Composite compositeFileOperations = new Composite(sashForm, SWT.NONE);
    compositeFileOperations.setLayout(new GridLayout(2, true));

    Label lblFileName = new Label(compositeFileOperations, SWT.NONE);
    lblFileName.setText("Mapping ontology file name");
    new Label(compositeFileOperations, SWT.NONE);

    textFileName = new Text(compositeFileOperations, SWT.BORDER);
    textFileName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnSave = new Button(compositeFileOperations, SWT.NONE);

    btnSave.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            Owl.saveToOwl(OntologyHelper.getOntologyURL(matchingModel.getSourceOntologyFileName()),
                    ontologyModel.getBaseOntology());

        }
    });
    btnSave.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    btnSave.setText("Save mapping");
    new Label(compositeFileOperations, SWT.NONE);

    Button btnSaveReferenceOntology = new Button(compositeFileOperations, SWT.NONE);
    btnSaveReferenceOntology.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            OntModel referenceOntModel = ontologyModel.getOntologyModel()
                    .getImportedModel(ontologyModel.getReferenceOntologyURI().toString());
            Owl.saveModelToOwl(OntologyHelper.getOntologyURL(matchingModel.getReferenceOntologyFileName()),
                    referenceOntModel);

        }
    });
    btnSaveReferenceOntology.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    btnSaveReferenceOntology.setText("Save reference");
    sashForm.setWeights(new int[] { 173, 36, 161, 85 });
    m_bindingContext = initDataBindings();

}

From source file:oida.model.integration.ui.editors.LayoutTester.java

License:Open Source License

/**
 * Create contents of the editor part.//from  w w w.  j a va  2s  . co m
 * 
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, true));

    SashForm sashForm = new SashForm(parent, SWT.NONE);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Composite composite = new Composite(sashForm, SWT.NONE);
    composite.setLayout(new FillLayout(SWT.HORIZONTAL));

    TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
    table = tableViewer.getTable();

    Composite composite_1 = new Composite(sashForm, SWT.NONE);
    composite_1.setLayout(new FillLayout(SWT.HORIZONTAL));

    TreeViewer treeViewer = new TreeViewer(composite_1, SWT.BORDER);
    Tree tree = treeViewer.getTree();
    sashForm.setWeights(new int[] { 1, 1 });

}

From source file:oida.model.integration.ui.editors.MatchingEditor.java

License:Open Source License

/**
 * Create contents of the editor part.//from  www .  java 2 s.co m
 * 
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));

    SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
    GridData gd_sashForm = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_sashForm.widthHint = 585;
    sashForm.setLayoutData(gd_sashForm);

    SashForm sashFormMetaModel = new SashForm(sashForm, SWT.NONE);

    Composite compositeMetaModel = new Composite(sashFormMetaModel, SWT.NONE);
    compositeMetaModel.setLayout(new GridLayout(1, false));

    Label labelMetamodelItems = new Label(compositeMetaModel, SWT.NONE);
    labelMetamodelItems.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    labelMetamodelItems.setText("Metamodel Items");

    final TreeViewer treeViewerMetamodel = new TreeViewer(compositeMetaModel, SWT.BORDER);
    treeViewerMetamodel.setContentProvider(new OntClassContentProvider());
    treeViewerMetamodel.setLabelProvider(new OntClassLabelProvider());
    OntResource topOntResource = ontologyModel.getOntologyModel()
            .getOntResource(("http://www.w3.org/2000/01/rdf-schema#Resource"));
    OntClassContentProvider ontClassContentProvider = (OntClassContentProvider) treeViewerMetamodel
            .getContentProvider();
    ontClassContentProvider.setOntology(OntologyModel.getInstance().getBaseOntology());
    treeViewerMetamodel.setInput(topOntResource);

    final Tree treeMetamodel = treeViewerMetamodel.getTree();
    treeMetamodel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite compositeMetaModelRecommendations = new Composite(sashFormMetaModel, SWT.NONE);
    compositeMetaModelRecommendations.setLayout(new GridLayout(1, false));

    Label lblMetamodelRecommendations = new Label(compositeMetaModelRecommendations, SWT.NONE);
    lblMetamodelRecommendations.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lblMetamodelRecommendations.setText("Metamodel recommendations");

    listViewerMetamodelReference = new ListViewer(compositeMetaModelRecommendations, SWT.BORDER | SWT.V_SCROLL);
    listViewerMetamodelReference.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {

        }
    });

    final List listMetamodelReference = listViewerMetamodelReference.getList();
    listMetamodelReference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    listMetamodelReference.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            listViewerModelReference.getList().deselectAll();
            OntResource currentReferenceOntResource = (OntResource) ((StructuredSelection) listViewerMetamodelReference
                    .getSelection()).getFirstElement();

            recommendationProvider.selectOntResource(currentReferenceOntResource);
            if (currentReferenceOntResource.isClass()) {
                recommendationProvider.setCurrentReferenceClass(currentReferenceOntResource.asClass());
            }

        }
    });
    listViewerMetamodelReference.setSorter(new OntResourceSorter());

    sashFormMetaModel.setWeights(new int[] { 1, 1 });

    Composite MatchingOperations = new Composite(sashForm, SWT.NONE);
    MatchingOperations.setLayout(new GridLayout(3, false));

    txtSourceResource = new Text(MatchingOperations, SWT.BORDER);
    txtSourceResource.setEditable(false);
    txtSourceResource.setText("Number of unmapped resources");
    txtSourceResource.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    btnConfirm = new Button(MatchingOperations, SWT.NONE);
    btnConfirm.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    btnConfirm.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
        }
    });
    btnConfirm.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            recommendationProvider.toggleManualMatch();
        }
    });
    btnConfirm.setText("Confirm");

    txtReferenceresource = new Text(MatchingOperations, SWT.BORDER);
    txtReferenceresource.setEditable(false);
    txtReferenceresource.setText("Reasoner Status");
    txtReferenceresource.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    SashForm sashFormModel = new SashForm(sashForm, SWT.NONE);

    Composite compositeModel = new Composite(sashFormModel, SWT.NONE);
    compositeModel.setLayout(new GridLayout(1, false));

    Label labelModelItems = new Label(compositeModel, SWT.NONE);
    labelModelItems.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    labelModelItems.setText("Model Items");

    final TreeViewer treeViewerModel = new TreeViewer(compositeModel, SWT.BORDER);

    treeViewerModel.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {

        }
    });
    treeViewerModel.setLabelProvider(new AdapterFactoryLabelProvider(
            new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)));

    treeViewerModel.setContentProvider(new AdapterFactoryContentProvider(
            new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)) {
        @Override
        public Object[] getElements(Object object) {
            if (object instanceof Object[]) {
                return (Object[]) object;
            }
            return super.getElements(object);
        }
    });
    treeViewerModel.setInput(new Object[] { rootEObject });

    Tree treeModel = treeViewerModel.getTree();
    treeModel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite compositeModelRecommendations = new Composite(sashFormModel, SWT.NONE);
    compositeModelRecommendations.setLayout(new GridLayout(1, false));

    Label labelModelRecommendations = new Label(compositeModelRecommendations, SWT.NONE);
    labelModelRecommendations.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    labelModelRecommendations.setText("Model Recommendations");

    listViewerModelReference = new ListViewer(compositeModelRecommendations, SWT.BORDER | SWT.V_SCROLL);
    List listModelReference = listViewerModelReference.getList();
    listModelReference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    listModelReference.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            Individual referenceIndividual = (Individual) ((StructuredSelection) listViewerModelReference
                    .getSelection()).getFirstElement();

            recommendationProvider.selectOntResource(referenceIndividual);

        }
    });
    listViewerModelReference.setSorter(new OntResourceSorter());

    treeModel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // Get Individual
            EObject eObject = (EObject) ((StructuredSelection) treeViewerModel.getSelection())
                    .getFirstElement();

            String baseIndividualName = recommendationProvider.getEObjectName(eObject);
            String baseOntologyURIString = ontologyModel.getBaseOntologyURI().toString();

            Individual sourceIndividual = ontologyModel
                    .getIndividual(URI.createURI(baseOntologyURIString + "#" + baseIndividualName));

            recommendationProvider.selectOntResource(sourceIndividual);
            // Get Type and select in treeviewerMetamodel
            listViewerMetamodelReference.refresh();

            OntResource metaSourceOntResource = recommendationProvider.getSourceMetaOntResource();
            treeViewerMetamodel.setSelection(new StructuredSelection(metaSourceOntResource), true);

            // Get ReferenceOntClass of the individual and select it if
            // possible

            if (recommendationProvider.getReferenceIndividual() != null) {
                // manualMatch.setTarget(referenceIndividual);
                listViewerModelReference.setSelection(
                        new StructuredSelection(recommendationProvider.getReferenceIndividual()), true);
            }

            //

        }
    });

    treeMetamodel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            treeViewerModel.getTree().deselectAll();

            // Set internal Resource of manual Mapping
            OntResource sourceOntResource = (OntResource) ((StructuredSelection) treeViewerMetamodel
                    .getSelection()).getFirstElement();

            recommendationProvider.selectOntResource(sourceOntResource);

            recommendationProvider.setSourceMetaOntResource(sourceOntResource);
            OntResource referenceMetaOntResource = ontologyModel.getReferenceOntResource(sourceOntResource);

            listViewerMetamodelReference.refresh();

            // TODO if equivalent reference class exists select the
            // external class and switch to revoke

            if (referenceMetaOntResource != null) {
                listViewerMetamodelReference.setSelection(new StructuredSelection(referenceMetaOntResource),
                        true);
            }

        }

    });

    sashFormModel.setWeights(new int[] { 1, 1 });

    Composite compositeFileOperations = new Composite(sashForm, SWT.NONE);
    compositeFileOperations.setLayout(new GridLayout(2, true));

    Label lblFileName = new Label(compositeFileOperations, SWT.NONE);
    lblFileName.setText("Matching ontology file name");
    new Label(compositeFileOperations, SWT.NONE);

    textFileName = new Text(compositeFileOperations, SWT.BORDER);
    textFileName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnSave = new Button(compositeFileOperations, SWT.NONE);
    btnSave.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            Owl.saveToOwl(OntologyHelper.getOntologyURL(recommendationProvider.getSourceOntologyFileName()),
                    ontologyModel.getBaseOntology());

        }
    });
    btnSave.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    btnSave.setText("Save");
    sashForm.setWeights(new int[] { 173, 36, 193, 53 });
    m_bindingContext = initDataBindings();

}

From source file:oida.model.integration.ui.editors.MatchingTreeEditor.java

License:Open Source License

/**
 * Create contents of the editor part.//from  ww  w. j av a  2s. c o m
 * 
 * @param parent
 */

public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));

    SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
    GridData gd_sashForm = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_sashForm.widthHint = 585;
    sashForm.setLayoutData(gd_sashForm);

    SashForm sashFormMetaModel = new SashForm(sashForm, SWT.NONE);

    Composite compositeMetaModel = new Composite(sashFormMetaModel, SWT.NONE);
    compositeMetaModel.setLayout(new GridLayout(1, false));

    Label labelMetamodelItems = new Label(compositeMetaModel, SWT.NONE);
    labelMetamodelItems.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    labelMetamodelItems.setText("Metamodel Items");

    final TreeViewer treeViewerMetamodel = new TreeViewer(compositeMetaModel, SWT.BORDER);
    treeViewerMetamodel.setContentProvider(new OntClassContentProvider());
    treeViewerMetamodel.setLabelProvider(new OntClassLabelProvider());
    OntResource topOntResource = ontologyModel.getOntologyModel()
            .getOntResource(("http://www.w3.org/2000/01/rdf-schema#Resource"));
    OntClassContentProvider ontClassContentProvider = (OntClassContentProvider) treeViewerMetamodel
            .getContentProvider();
    ontClassContentProvider.setOntology(OntologyModel.getInstance().getBaseOntology());
    treeViewerMetamodel.setInput(topOntResource);

    final Tree treeMetamodel = treeViewerMetamodel.getTree();
    treeMetamodel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite compositeMetaModelRecommendations = new Composite(sashFormMetaModel, SWT.NONE);
    compositeMetaModelRecommendations.setLayout(new GridLayout(1, false));

    Label lblMetamodelRecommendations = new Label(compositeMetaModelRecommendations, SWT.NONE);
    lblMetamodelRecommendations.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lblMetamodelRecommendations.setText("Metamodel recommendations");

    treeViewerMetamodelReference = new TreeViewer(compositeMetaModelRecommendations, SWT.BORDER | SWT.V_SCROLL);
    treeViewerMetamodelReference.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {

        }
    });
    treeViewerMetamodelReference.setContentProvider(new OntClassContentProvider());
    treeViewerMetamodelReference.setLabelProvider(new OntClassLabelProvider());
    OntClassContentProvider referenceOntologyContentProvider = (OntClassContentProvider) treeViewerMetamodelReference
            .getContentProvider();
    referenceOntologyContentProvider.setOntology(OntologyModel.getInstance().getReferenceOntology());

    treeViewerMetamodelReference.setInput(topOntResource);

    final Tree treeMetamodelReference = treeViewerMetamodelReference.getTree();
    treeMetamodelReference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    treeMetamodelReference.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            listViewerModelReference.getList().deselectAll();
            OntResource currentReferenceOntResource = (OntResource) ((StructuredSelection) treeViewerMetamodelReference
                    .getSelection()).getFirstElement();

            recommendationProvider.selectOntResource(currentReferenceOntResource);
            if (currentReferenceOntResource.isClass()) {
                recommendationProvider.setCurrentReferenceClass(currentReferenceOntResource.asClass());
            }

        }
    });

    treeViewerMetamodelReference.setSorter(new OntResourceSorter());

    sashFormMetaModel.setWeights(new int[] { 1, 1 });

    Composite MatchingOperations = new Composite(sashForm, SWT.NONE);
    MatchingOperations.setLayout(new GridLayout(3, false));

    txtSourceResource = new Text(MatchingOperations, SWT.BORDER);
    txtSourceResource.setEditable(false);
    txtSourceResource.setText("Number of unmapped resources");
    txtSourceResource.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    btnConfirm = new Button(MatchingOperations, SWT.NONE);
    btnConfirm.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    btnConfirm.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
        }
    });
    btnConfirm.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            recommendationProvider.toggleManualMatch();
        }
    });
    btnConfirm.setText("Confirm");

    txtReferenceresource = new Text(MatchingOperations, SWT.BORDER);
    txtReferenceresource.setEditable(false);
    txtReferenceresource.setText("Reasoner Status");
    txtReferenceresource.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    SashForm sashFormModel = new SashForm(sashForm, SWT.NONE);

    Composite compositeModel = new Composite(sashFormModel, SWT.NONE);
    compositeModel.setLayout(new GridLayout(1, false));

    Label labelModelItems = new Label(compositeModel, SWT.NONE);
    labelModelItems.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    labelModelItems.setText("Model Items");

    final TreeViewer treeViewerModel = new TreeViewer(compositeModel, SWT.BORDER);

    treeViewerModel.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {

        }
    });
    treeViewerModel.setLabelProvider(new AdapterFactoryLabelProvider(
            new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)));

    treeViewerModel.setContentProvider(new AdapterFactoryContentProvider(
            new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)) {
        @Override
        public Object[] getElements(Object object) {
            if (object instanceof Object[]) {
                return (Object[]) object;
            }
            return super.getElements(object);
        }
    });
    treeViewerModel.setInput(new Object[] { rootEObject });

    Tree treeModel = treeViewerModel.getTree();
    treeModel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite compositeModelRecommendations = new Composite(sashFormModel, SWT.NONE);
    compositeModelRecommendations.setLayout(new GridLayout(1, false));

    Label labelModelRecommendations = new Label(compositeModelRecommendations, SWT.NONE);
    labelModelRecommendations.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    labelModelRecommendations.setText("Model Recommendations");

    listViewerModelReference = new ListViewer(compositeModelRecommendations, SWT.BORDER | SWT.V_SCROLL);
    List listModelReference = listViewerModelReference.getList();
    listModelReference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    listModelReference.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            Individual referenceIndividual = (Individual) ((StructuredSelection) listViewerModelReference
                    .getSelection()).getFirstElement();

            recommendationProvider.selectOntResource(referenceIndividual);

        }
    });
    listViewerModelReference.setSorter(new OntResourceSorter());

    treeModel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // Get Individual
            EObject eObject = (EObject) ((StructuredSelection) treeViewerModel.getSelection())
                    .getFirstElement();

            String baseIndividualName = recommendationProvider.getEObjectName(eObject);
            String baseOntologyURIString = ontologyModel.getBaseOntologyURI().toString();

            Individual sourceIndividual = ontologyModel
                    .getIndividual(URI.createURI(baseOntologyURIString + "#" + baseIndividualName));

            recommendationProvider.selectOntResource(sourceIndividual);
            // Get Type and select in treeviewerMetamodel

            treeViewerMetamodel.setSelection(
                    new StructuredSelection(recommendationProvider.getSourceMetaOntResource()), true);

            // Get ReferenceOntClass of the individual and select it if
            // possible

            if (recommendationProvider.getReferenceIndividual() != null) {
                // manualMatch.setTarget(referenceIndividual);
                listViewerModelReference.setSelection(
                        new StructuredSelection(recommendationProvider.getReferenceIndividual()), true);
            }

            //

        }
    });

    treeMetamodel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            treeViewerModel.getTree().deselectAll();

            // Set internal Resource of manual Mapping
            OntResource sourceOntResource = (OntResource) ((StructuredSelection) treeViewerMetamodel
                    .getSelection()).getFirstElement();

            recommendationProvider.selectOntResource(sourceOntResource);

            recommendationProvider.setSourceMetaOntResource(sourceOntResource);
            OntResource referenceMetaOntResource = recommendationProvider.getReferenceMetaOntResource();
            if (referenceMetaOntResource != null) {
                treeViewerMetamodelReference.setInput(referenceMetaOntResource);
                treeViewerMetamodelReference.refresh();
            } else {
                treeViewerMetamodelReference.setInput(ontologyModel.getOntologyModel()
                        .getOntResource("http://www.w3.org/2000/01/rdf-schema#Resource"));
                treeViewerMetamodelReference.refresh();
            }

            // TODO if equivalent reference class exists select the
            // external class and switch to revoke

            if (referenceMetaOntResource != null) {
                treeViewerMetamodelReference.setSelection(new StructuredSelection(referenceMetaOntResource),
                        true);
            }

        }

    });

    sashFormModel.setWeights(new int[] { 1, 1 });

    Composite compositeFileOperations = new Composite(sashForm, SWT.NONE);
    compositeFileOperations.setLayout(new GridLayout(2, true));

    Label lblFileName = new Label(compositeFileOperations, SWT.NONE);
    lblFileName.setText("Matching ontology file name");
    new Label(compositeFileOperations, SWT.NONE);

    textFileName = new Text(compositeFileOperations, SWT.BORDER);
    textFileName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnSave = new Button(compositeFileOperations, SWT.NONE);
    btnSave.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            Owl.saveToOwl(OntologyHelper.getOntologyURL(recommendationProvider.getSourceOntologyFileName()),
                    ontologyModel.getBaseOntology());

        }
    });
    btnSave.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    btnSave.setText("Save");
    sashForm.setWeights(new int[] { 173, 36, 193, 53 });
    m_bindingContext = initDataBindings();

}