Search in sources :

Example 6 with ProblemEditorPart

use of org.eclipse.emf.common.ui.editor.ProblemEditorPart in project InformationSystem by ObeoNetwork.

the class ExtensionUtilitiesEditor method updateProblemIndication.

/**
 * Updates the problems indication with the information described in the specified diagnostic.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void updateProblemIndication() {
    if (updateProblemIndication) {
        BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.obeonetwork.dsl.entity.editor", 0, null, new Object[] { editingDomain.getResourceSet() });
        for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
            if (childDiagnostic.getSeverity() != Diagnostic.OK) {
                diagnostic.add(childDiagnostic);
            }
        }
        int lastEditorPage = getPageCount() - 1;
        if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
            ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic);
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                setActivePage(lastEditorPage);
            }
        } else if (diagnostic.getSeverity() != Diagnostic.OK) {
            ProblemEditorPart problemEditorPart = new ProblemEditorPart();
            problemEditorPart.setDiagnostic(diagnostic);
            problemEditorPart.setMarkerHelper(markerHelper);
            try {
                addPage(++lastEditorPage, problemEditorPart, getEditorInput());
                setPageText(lastEditorPage, problemEditorPart.getPartName());
                setActivePage(lastEditorPage);
                showTabs();
            } catch (PartInitException exception) {
                EntityEditorPlugin.INSTANCE.log(exception);
            }
        }
        if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
            markerHelper.deleteMarkers(editingDomain.getResourceSet());
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                try {
                    markerHelper.createMarkers(diagnostic);
                } catch (CoreException exception) {
                    EntityEditorPlugin.INSTANCE.log(exception);
                }
            }
        }
    }
}
Also used : ProblemEditorPart(org.eclipse.emf.common.ui.editor.ProblemEditorPart) CoreException(org.eclipse.core.runtime.CoreException) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) Diagnostic(org.eclipse.emf.common.util.Diagnostic) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) PartInitException(org.eclipse.ui.PartInitException) Point(org.eclipse.swt.graphics.Point)

Example 7 with ProblemEditorPart

use of org.eclipse.emf.common.ui.editor.ProblemEditorPart in project InformationSystem by ObeoNetwork.

the class RequirementEditor method updateProblemIndication.

/**
 * Updates the problems indication with the information described in the specified diagnostic.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void updateProblemIndication() {
    if (updateProblemIndication) {
        BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.obeonetwork.dsl.requirement.editor", 0, null, new Object[] { editingDomain.getResourceSet() });
        for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
            if (childDiagnostic.getSeverity() != Diagnostic.OK) {
                diagnostic.add(childDiagnostic);
            }
        }
        int lastEditorPage = getPageCount() - 1;
        if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
            ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic);
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                setActivePage(lastEditorPage);
            }
        } else if (diagnostic.getSeverity() != Diagnostic.OK) {
            ProblemEditorPart problemEditorPart = new ProblemEditorPart();
            problemEditorPart.setDiagnostic(diagnostic);
            problemEditorPart.setMarkerHelper(markerHelper);
            try {
                addPage(++lastEditorPage, problemEditorPart, getEditorInput());
                setPageText(lastEditorPage, problemEditorPart.getPartName());
                setActivePage(lastEditorPage);
                showTabs();
            } catch (PartInitException exception) {
                RequirementEditorPlugin.INSTANCE.log(exception);
            }
        }
        if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
            markerHelper.deleteMarkers(editingDomain.getResourceSet());
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                try {
                    markerHelper.createMarkers(diagnostic);
                } catch (CoreException exception) {
                    RequirementEditorPlugin.INSTANCE.log(exception);
                }
            }
        }
    }
}
Also used : ProblemEditorPart(org.eclipse.emf.common.ui.editor.ProblemEditorPart) CoreException(org.eclipse.core.runtime.CoreException) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) Diagnostic(org.eclipse.emf.common.util.Diagnostic) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) PartInitException(org.eclipse.ui.PartInitException) Point(org.eclipse.swt.graphics.Point)

Example 8 with ProblemEditorPart

use of org.eclipse.emf.common.ui.editor.ProblemEditorPart in project InformationSystem by ObeoNetwork.

the class ApplicationEditor method updateProblemIndication.

/**
 * Updates the problems indication with the information described in the specified diagnostic.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void updateProblemIndication() {
    if (updateProblemIndication) {
        BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.obeonetwork.dsl.application.editor", 0, null, new Object[] { editingDomain.getResourceSet() });
        for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
            if (childDiagnostic.getSeverity() != Diagnostic.OK) {
                diagnostic.add(childDiagnostic);
            }
        }
        int lastEditorPage = getPageCount() - 1;
        if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
            ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic);
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                setActivePage(lastEditorPage);
            }
        } else if (diagnostic.getSeverity() != Diagnostic.OK) {
            ProblemEditorPart problemEditorPart = new ProblemEditorPart();
            problemEditorPart.setDiagnostic(diagnostic);
            problemEditorPart.setMarkerHelper(markerHelper);
            try {
                addPage(++lastEditorPage, problemEditorPart, getEditorInput());
                setPageText(lastEditorPage, problemEditorPart.getPartName());
                setActivePage(lastEditorPage);
                showTabs();
            } catch (PartInitException exception) {
                ApplicationEditorPlugin.INSTANCE.log(exception);
            }
        }
        if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
            markerHelper.deleteMarkers(editingDomain.getResourceSet());
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                try {
                    markerHelper.createMarkers(diagnostic);
                } catch (CoreException exception) {
                    ApplicationEditorPlugin.INSTANCE.log(exception);
                }
            }
        }
    }
}
Also used : ProblemEditorPart(org.eclipse.emf.common.ui.editor.ProblemEditorPart) CoreException(org.eclipse.core.runtime.CoreException) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) Diagnostic(org.eclipse.emf.common.util.Diagnostic) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) PartInitException(org.eclipse.ui.PartInitException) Point(org.eclipse.swt.graphics.Point)

Example 9 with ProblemEditorPart

use of org.eclipse.emf.common.ui.editor.ProblemEditorPart in project InformationSystem by ObeoNetwork.

the class DatabaseEditor method updateProblemIndication.

/**
 * Updates the problems indication with the information described in the specified diagnostic.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void updateProblemIndication() {
    if (updateProblemIndication) {
        BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.obeonetwork.dsl.database.editor", 0, null, new Object[] { editingDomain.getResourceSet() });
        for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
            if (childDiagnostic.getSeverity() != Diagnostic.OK) {
                diagnostic.add(childDiagnostic);
            }
        }
        int lastEditorPage = getPageCount() - 1;
        if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
            ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic);
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                setActivePage(lastEditorPage);
            }
        } else if (diagnostic.getSeverity() != Diagnostic.OK) {
            ProblemEditorPart problemEditorPart = new ProblemEditorPart();
            problemEditorPart.setDiagnostic(diagnostic);
            problemEditorPart.setMarkerHelper(markerHelper);
            try {
                addPage(++lastEditorPage, problemEditorPart, getEditorInput());
                setPageText(lastEditorPage, problemEditorPart.getPartName());
                setActivePage(lastEditorPage);
                showTabs();
            } catch (PartInitException exception) {
                DatabaseEditorPlugin.INSTANCE.log(exception);
            }
        }
        if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
            markerHelper.deleteMarkers(editingDomain.getResourceSet());
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                try {
                    markerHelper.createMarkers(diagnostic);
                } catch (CoreException exception) {
                    DatabaseEditorPlugin.INSTANCE.log(exception);
                }
            }
        }
    }
}
Also used : ProblemEditorPart(org.eclipse.emf.common.ui.editor.ProblemEditorPart) CoreException(org.eclipse.core.runtime.CoreException) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) Diagnostic(org.eclipse.emf.common.util.Diagnostic) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) PartInitException(org.eclipse.ui.PartInitException) Point(org.eclipse.swt.graphics.Point)

Example 10 with ProblemEditorPart

use of org.eclipse.emf.common.ui.editor.ProblemEditorPart in project InformationSystem by ObeoNetwork.

the class EnvironmentEditor method updateProblemIndication.

/**
 * Updates the problems indication with the information described in the specified diagnostic.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void updateProblemIndication() {
    if (updateProblemIndication) {
        BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.obeonetwork.dsl.environment.editor", 0, null, new Object[] { editingDomain.getResourceSet() });
        for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
            if (childDiagnostic.getSeverity() != Diagnostic.OK) {
                diagnostic.add(childDiagnostic);
            }
        }
        int lastEditorPage = getPageCount() - 1;
        if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
            ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic);
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                setActivePage(lastEditorPage);
            }
        } else if (diagnostic.getSeverity() != Diagnostic.OK) {
            ProblemEditorPart problemEditorPart = new ProblemEditorPart();
            problemEditorPart.setDiagnostic(diagnostic);
            problemEditorPart.setMarkerHelper(markerHelper);
            try {
                addPage(++lastEditorPage, problemEditorPart, getEditorInput());
                setPageText(lastEditorPage, problemEditorPart.getPartName());
                setActivePage(lastEditorPage);
                showTabs();
            } catch (PartInitException exception) {
                EnvironmentEditorPlugin.INSTANCE.log(exception);
            }
        }
        if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
            markerHelper.deleteMarkers(editingDomain.getResourceSet());
            if (diagnostic.getSeverity() != Diagnostic.OK) {
                try {
                    markerHelper.createMarkers(diagnostic);
                } catch (CoreException exception) {
                    EnvironmentEditorPlugin.INSTANCE.log(exception);
                }
            }
        }
    }
}
Also used : ProblemEditorPart(org.eclipse.emf.common.ui.editor.ProblemEditorPart) CoreException(org.eclipse.core.runtime.CoreException) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) Diagnostic(org.eclipse.emf.common.util.Diagnostic) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) PartInitException(org.eclipse.ui.PartInitException) Point(org.eclipse.swt.graphics.Point)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)30 ProblemEditorPart (org.eclipse.emf.common.ui.editor.ProblemEditorPart)30 BasicDiagnostic (org.eclipse.emf.common.util.BasicDiagnostic)30 Diagnostic (org.eclipse.emf.common.util.Diagnostic)30 Point (org.eclipse.swt.graphics.Point)30 PartInitException (org.eclipse.ui.PartInitException)30