diff --git a/packages/sirius-web/frontend/sirius-web-application/src/application/SiriusWebApplication.tsx b/packages/sirius-web/frontend/sirius-web-application/src/application/SiriusWebApplication.tsx
index 5a30ed69ee..24ced3d54f 100644
--- a/packages/sirius-web/frontend/sirius-web-application/src/application/SiriusWebApplication.tsx
+++ b/packages/sirius-web/frontend/sirius-web-application/src/application/SiriusWebApplication.tsx
@@ -13,40 +13,13 @@
import {
ConfirmationDialogContextProvider,
ExtensionProvider,
- ExtensionRegistry,
- RepresentationMetadata,
RepresentationPathContext,
ServerContext,
- WorkbenchViewContribution,
- representationFactoryExtensionPoint,
- workbenchMainAreaExtensionPoint,
- workbenchViewContributionExtensionPoint,
} from '@eclipse-sirius/sirius-components-core';
-import { DeckRepresentation } from '@eclipse-sirius/sirius-components-deck';
-import {
- DiagramRepresentation,
- NodeTypeContext,
- NodeTypeContextValue,
-} from '@eclipse-sirius/sirius-components-diagrams';
-import { FormDescriptionEditorRepresentation } from '@eclipse-sirius/sirius-components-formdescriptioneditors';
-import {
- DetailsView,
- FormRepresentation,
- PropertySectionContext,
- RelatedElementsView,
- RepresentationsView,
-} from '@eclipse-sirius/sirius-components-forms';
-import { GanttRepresentation } from '@eclipse-sirius/sirius-components-gantt';
-import { PortalRepresentation } from '@eclipse-sirius/sirius-components-portals';
-import { ExplorerView } from '@eclipse-sirius/sirius-components-trees';
-import { ValidationView } from '@eclipse-sirius/sirius-components-validation';
+import { NodeTypeContext, NodeTypeContextValue } from '@eclipse-sirius/sirius-components-diagrams';
+import { PropertySectionContext } from '@eclipse-sirius/sirius-components-forms';
import CssBaseline from '@material-ui/core/CssBaseline';
import { Theme, ThemeProvider } from '@material-ui/core/styles';
-import AccountTreeIcon from '@material-ui/icons/AccountTree';
-import Filter from '@material-ui/icons/Filter';
-import LinkIcon from '@material-ui/icons/Link';
-import MenuIcon from '@material-ui/icons/Menu';
-import WarningIcon from '@material-ui/icons/Warning';
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { ToastProvider } from '../../src/toast/ToastProvider';
@@ -55,10 +28,10 @@ import {
defaultNodeTypeRegistry,
} from '../diagrams/DiagramRepresentationConfiguration';
import { DiagramRepresentationConfigurationProps } from '../diagrams/DiagramRepresentationConfiguration.types';
+import { defaultExtensionRegistry } from '../extension/DefaultExtensionRegistry';
import { DefaultExtensionRegistryMergeStrategy } from '../extension/DefaultExtensionRegistryMergeStrategy';
import { propertySectionsRegistry } from '../forms/defaultPropertySectionRegistry';
import { ApolloGraphQLProvider } from '../graphql/ApolloGraphQLProvider';
-import { OnboardArea } from '../onboarding/OnboardArea';
import { Router } from '../router/Router';
import { siriusWebTheme as defaultTheme } from '../theme/siriusWebTheme';
import { SiriusWebApplicationProps } from './SiriusWebApplication.types';
@@ -70,13 +43,6 @@ const style = {
minHeight: '100vh',
};
-const getType = (representation: RepresentationMetadata): string => {
- const query = representation.kind.substring(representation.kind.indexOf('?') + 1, representation.kind.length);
- const params = new URLSearchParams(query);
- const type = params.get('type');
- return type;
-};
-
export const SiriusWebApplication = ({
httpOrigin,
wsOrigin,
@@ -102,86 +68,15 @@ export const SiriusWebApplication = ({
return `/projects/${editingContextId}/edit/${representationId}`;
};
- const workbenchViewContributions: WorkbenchViewContribution[] = [
- {
- side: 'left',
- title: 'Explorer',
- icon: ,
- component: ExplorerView,
- },
- {
- side: 'left',
- title: 'Validation',
- icon: ,
- component: ValidationView,
- },
- {
- side: 'right',
- title: 'Details',
- icon: ,
- component: DetailsView,
- },
- {
- side: 'right',
- title: 'Representations',
- icon: ,
- component: RepresentationsView,
- },
- {
- side: 'right',
- title: 'Related Elements',
- icon: ,
- component: RelatedElementsView,
- },
- ];
-
- const internalExtensionRegistry = new ExtensionRegistry();
- internalExtensionRegistry.addComponent(workbenchMainAreaExtensionPoint, {
- identifier: 'siriusweb_workbench#mainArea',
- Component: OnboardArea,
- });
- internalExtensionRegistry.putData(workbenchViewContributionExtensionPoint, {
- identifier: 'siriusweb_workbench#viewContribution',
- data: workbenchViewContributions,
- });
-
- internalExtensionRegistry.putData(representationFactoryExtensionPoint, {
- identifier: 'siriusweb_workbench#representationFactory_diagram',
- data: [(representation) => (getType(representation) === 'Diagram' ? DiagramRepresentation : null)],
- });
- internalExtensionRegistry.putData(representationFactoryExtensionPoint, {
- identifier: 'siriusweb_workbench#representationFactory_form',
- data: [(representation) => (getType(representation) === 'Form' ? FormRepresentation : null)],
- });
- internalExtensionRegistry.putData(representationFactoryExtensionPoint, {
- identifier: 'siriusweb_workbench#representationFactory_formdescriptioneditor',
- data: [
- (representation) =>
- getType(representation) === 'FormDescriptionEditor' ? FormDescriptionEditorRepresentation : null,
- ],
- });
- internalExtensionRegistry.putData(representationFactoryExtensionPoint, {
- identifier: 'siriusweb_workbench#representationFactory_gantt',
- data: [(representation) => (getType(representation) === 'Gantt' ? GanttRepresentation : null)],
- });
- internalExtensionRegistry.putData(representationFactoryExtensionPoint, {
- identifier: 'siriusweb_workbench#representationFactory_deck',
- data: [(representation) => (getType(representation) === 'Deck' ? DeckRepresentation : null)],
- });
- internalExtensionRegistry.putData(representationFactoryExtensionPoint, {
- identifier: 'siriusweb_workbench#representationFactory_portal',
- data: [(representation) => (getType(representation) === 'Portal' ? PortalRepresentation : null)],
- });
-
if (extensionRegistry) {
- internalExtensionRegistry.addAll(
+ defaultExtensionRegistry.addAll(
extensionRegistry,
extensionRegistryMergeStrategy ? extensionRegistryMergeStrategy : new DefaultExtensionRegistryMergeStrategy()
);
}
return (
-
+
diff --git a/packages/sirius-web/frontend/sirius-web-application/src/extension/DefaultExtensionRegistry.tsx b/packages/sirius-web/frontend/sirius-web-application/src/extension/DefaultExtensionRegistry.tsx
new file mode 100644
index 0000000000..f1fb29b903
--- /dev/null
+++ b/packages/sirius-web/frontend/sirius-web-application/src/extension/DefaultExtensionRegistry.tsx
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Obeo.
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+import {
+ ExtensionRegistry,
+ RepresentationMetadata,
+ WorkbenchViewContribution,
+ representationFactoryExtensionPoint,
+ workbenchMainAreaExtensionPoint,
+ workbenchViewContributionExtensionPoint,
+} from '@eclipse-sirius/sirius-components-core';
+import { DeckRepresentation } from '@eclipse-sirius/sirius-components-deck';
+import { DiagramRepresentation } from '@eclipse-sirius/sirius-components-diagrams';
+import { FormDescriptionEditorRepresentation } from '@eclipse-sirius/sirius-components-formdescriptioneditors';
+import {
+ DetailsView,
+ FormRepresentation,
+ RelatedElementsView,
+ RepresentationsView,
+} from '@eclipse-sirius/sirius-components-forms';
+import { GanttRepresentation } from '@eclipse-sirius/sirius-components-gantt';
+import { PortalRepresentation } from '@eclipse-sirius/sirius-components-portals';
+import { ExplorerView } from '@eclipse-sirius/sirius-components-trees';
+import { ValidationView } from '@eclipse-sirius/sirius-components-validation';
+import AccountTreeIcon from '@material-ui/icons/AccountTree';
+import Filter from '@material-ui/icons/Filter';
+import LinkIcon from '@material-ui/icons/Link';
+import MenuIcon from '@material-ui/icons/Menu';
+import WarningIcon from '@material-ui/icons/Warning';
+import { OnboardArea } from '../onboarding/OnboardArea';
+
+const getType = (representation: RepresentationMetadata): string | null => {
+ const query = representation.kind.substring(representation.kind.indexOf('?') + 1, representation.kind.length);
+ const params = new URLSearchParams(query);
+ const type = params.get('type');
+ return type;
+};
+
+const defaultExtensionRegistry = new ExtensionRegistry();
+
+/*******************************************************************************
+ *
+ * Workbench main area
+ *
+ * Used to register the component used by default when no representation is opened
+ *
+ *******************************************************************************/
+defaultExtensionRegistry.addComponent(workbenchMainAreaExtensionPoint, {
+ identifier: `siriusweb_${workbenchMainAreaExtensionPoint.identifier}`,
+ Component: OnboardArea,
+});
+
+/*******************************************************************************
+ *
+ * Workbench views
+ *
+ * Used to register all the views available in the left and right of the workbench
+ *
+ *******************************************************************************/
+const workbenchViewContributions: WorkbenchViewContribution[] = [
+ {
+ side: 'left',
+ title: 'Explorer',
+ icon: ,
+ component: ExplorerView,
+ },
+ {
+ side: 'left',
+ title: 'Validation',
+ icon: ,
+ component: ValidationView,
+ },
+ {
+ side: 'right',
+ title: 'Details',
+ icon: ,
+ component: DetailsView,
+ },
+ {
+ side: 'right',
+ title: 'Representations',
+ icon: ,
+ component: RepresentationsView,
+ },
+ {
+ side: 'right',
+ title: 'Related Elements',
+ icon: ,
+ component: RelatedElementsView,
+ },
+];
+defaultExtensionRegistry.putData(workbenchViewContributionExtensionPoint, {
+ identifier: `siriusweb_${workbenchViewContributionExtensionPoint.identifier}`,
+ data: workbenchViewContributions,
+});
+
+/*******************************************************************************
+ *
+ * Workbench representation factories
+ *
+ * Used to register all the type of representations that are supported in Sirius Web
+ *
+ *******************************************************************************/
+
+defaultExtensionRegistry.putData(representationFactoryExtensionPoint, {
+ identifier: `siriusweb_${representationFactoryExtensionPoint.identifier}_diagram`,
+ data: [(representation) => (getType(representation) === 'Diagram' ? DiagramRepresentation : null)],
+});
+defaultExtensionRegistry.putData(representationFactoryExtensionPoint, {
+ identifier: `siriusweb_${representationFactoryExtensionPoint.identifier}_form`,
+ data: [(representation) => (getType(representation) === 'Form' ? FormRepresentation : null)],
+});
+defaultExtensionRegistry.putData(representationFactoryExtensionPoint, {
+ identifier: `siriusweb_${representationFactoryExtensionPoint.identifier}_formdescriptioneditor`,
+ data: [
+ (representation) =>
+ getType(representation) === 'FormDescriptionEditor' ? FormDescriptionEditorRepresentation : null,
+ ],
+});
+defaultExtensionRegistry.putData(representationFactoryExtensionPoint, {
+ identifier: `siriusweb_${representationFactoryExtensionPoint.identifier}_gantt`,
+ data: [(representation) => (getType(representation) === 'Gantt' ? GanttRepresentation : null)],
+});
+defaultExtensionRegistry.putData(representationFactoryExtensionPoint, {
+ identifier: `siriusweb_${representationFactoryExtensionPoint.identifier}_deck`,
+ data: [(representation) => (getType(representation) === 'Deck' ? DeckRepresentation : null)],
+});
+defaultExtensionRegistry.putData(representationFactoryExtensionPoint, {
+ identifier: `siriusweb_${representationFactoryExtensionPoint.identifier}_portal`,
+ data: [(representation) => (getType(representation) === 'Portal' ? PortalRepresentation : null)],
+});
+
+export { defaultExtensionRegistry };