-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[293] Lower the coupling between the workbench and the representations
Bug: #293 Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
- Loading branch information
1 parent
163fa6a
commit da2d821
Showing
9 changed files
with
99 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 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 { DiagramWebSocketContainer } from 'diagram/DiagramWebSocketContainer'; | ||
import { FormWebSocketContainer } from 'form/FormWebSocketContainer'; | ||
import React from 'react'; | ||
import { RepresentationComponentRegistry } from 'workbench/RepresentationContext.types'; | ||
import { RepresentationComponentProps } from './Workbench.types'; | ||
|
||
const registry: RepresentationComponentRegistry = { | ||
getComponent: (representation) => { | ||
if (representation.kind === 'Diagram') { | ||
return DiagramWebSocketContainer; | ||
} else if (representation.kind === 'Form') { | ||
return FormWebSocketContainer; | ||
} | ||
return (props: RepresentationComponentProps) => null; | ||
}, | ||
}; | ||
|
||
const value = { | ||
registry, | ||
}; | ||
export const RepresentationContext = React.createContext(value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.