Skip to content

Commit

Permalink
Merge pull request eclipsesource#24 from eclipsesource/tortmayr/pre-r…
Browse files Browse the repository at this point in the history
…elease

Prepare packages for publish
  • Loading branch information
tortmayr authored Jan 31, 2019
2 parents f73ba21 + c420be5 commit 633b83b
Show file tree
Hide file tree
Showing 16 changed files with 1,322 additions and 1,306 deletions.
2 changes: 1 addition & 1 deletion client/theia-ecore/sprotty-ecore/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sprotty-ecore",
"version": "0.1.0",
"version": "0.2.0",
"description": "sprotty diagrams for Ecore",
"author": "EclipseSource Muenchen GmbH",
"license": "Apache-2.0",
Expand Down
13 changes: 9 additions & 4 deletions client/theia-ecore/sprotty-ecore/src/di.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ import {
undoRedoModule,
viewportModule,
LocalModelSource
} from "glsp-sprotty/lib";
} from "sprotty/lib";
import { Container, ContainerModule } from "inversify";
import { ClassNode, Icon, Link, EdgeWithMultiplicty } from "./model";
import { AggregationEdgeView, ArrowEdgeView, ClassNodeView, CompositionEdgeView, IconView, InheritanceEdgeView, LinkView } from "./views";

export default (containerId: string) => {
export default (containerId: string, withSelectionSupport:boolean,needsServerLayout:boolean) => {
const classDiagramModule = new ContainerModule((bind, unbind, isBound, rebind) => {
rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope();
rebind(TYPES.LogLevel).toConstantValue(LogLevel.log);
Expand All @@ -71,14 +71,19 @@ export default (containerId: string) => {
configureModelElement(context, 'link', Link, LinkView)
configureViewerOptions(context, {
needsClientLayout: true,
needsServerLayout,
baseDiv: containerId
});
bind('EcoreDiagramModelSource').to(LocalModelSource).inSingletonScope();
});

const container = new Container();
container.load(defaultModule, selectModule, moveModule, boundsModule, undoRedoModule,
const modules=[defaultModule, moveModule, boundsModule, undoRedoModule,
viewportModule, fadeModule, hoverModule, exportModule, expandModule, buttonModule,
edgeEditModule, classDiagramModule);
edgeEditModule, classDiagramModule]
if (withSelectionSupport){
modules.push(selectModule)
}
container.load(...modules)
return container;
};
8 changes: 5 additions & 3 deletions client/theia-ecore/sprotty-ecore/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import '../css/diagram.css'
import "reflect-metadata";
import createEcoreDiagramContainer from "./di.config"
export { createEcoreDiagramContainer }
import 'reflect-metadata';
import createEcoreDiagramContainer from './di.config'
export { createEcoreDiagramContainer }
export * from './model'
export * from './views'
2 changes: 1 addition & 1 deletion client/theia-ecore/sprotty-ecore/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*/

import { boundsFeature, Expandable, expandFeature, fadeFeature, layoutableChildFeature, layoutContainerFeature, RectangularNode, SEdge, SShapeElement, SLabel } from "glsp-sprotty/lib";
import { boundsFeature, Expandable, expandFeature, fadeFeature, layoutableChildFeature, layoutContainerFeature, RectangularNode, SEdge, SShapeElement, SLabel } from "sprotty/lib";

export class ClassNode extends RectangularNode implements Expandable {
expanded: boolean = false;
Expand Down
2 changes: 1 addition & 1 deletion client/theia-ecore/sprotty-ecore/src/views.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/** @jsx svg */
import { svg }  from 'snabbdom-jsx';

import { RenderingContext, RectangularNodeView, IView, PolylineEdgeView, SEdge, Point, toDegrees, SLabelView} from "glsp-sprotty/lib";
import { RenderingContext, RectangularNodeView, IView, PolylineEdgeView, SEdge, Point, toDegrees, SLabelView} from "sprotty/lib";
import { VNode } from "snabbdom/vnode";
import { Icon, ClassNode, EdgeWithMultiplicty, Link } from './model';

Expand Down
4 changes: 2 additions & 2 deletions client/theia-ecore/theia-ecore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
],
"dependencies": {
"@theia/core": "latest",
"sprotty-ecore": "^0.1.0",
"glsp-theia-extension": "0.1.0-next.8f55d9d9"
"sprotty-ecore": "0.2.0",
"glsp-theia-extension": "0.1.0-next.e75f0bf1"
},
"devDependencies": {
"rimraf": "latest",
Expand Down
4 changes: 3 additions & 1 deletion client/theia-ecore/theia-ecore/src/browser/di.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ import { TYPES, KeyTool } from "glsp-sprotty/lib"
import { Container, injectable } from "inversify";
import { EcoreLanguage } from "../common/ecore-language";
import { GLSPTheiaDiagramServer } from 'glsp-theia-extension/lib/browser'
import {defaultGLSPModule} from 'glsp-sprotty/lib'

@injectable()
export class EcoreDiagramConfiguration implements DiagramConfiguration {
diagramType: string = EcoreLanguage.DiagramType

createContainer(widgetId: string): Container {
const container = createEcoreDiagramContainer(widgetId);
const container = createEcoreDiagramContainer(widgetId,true,true);
container.bind(TYPES.ModelSource).to(GLSPTheiaDiagramServer)
container.rebind(KeyTool).to(TheiaKeyTool).inSingletonScope()
container.bind(TYPES.IActionHandlerInitializer).to(SprottySelectionForwardingInitializer)
container.load(defaultGLSPModule)
return container;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
* Contributors:
* EclipseSource Muenchen GmbH - initial API and implementation
******************************************************************************/
import { injectable, inject } from "inversify";
import { TheiaFileSaver, DiagramWidgetRegistry } from "theia-glsp/lib";
import { OpenerOptions } from "@theia/core/lib/browser";
import URI from "@theia/core/lib/common/uri";
import { EditorManager, EditorPreferences } from "@theia/editor/lib/browser";
import { GLSPClientContribution, GLSPDiagramManager, GLSPTheiaSprottyConnector, GLSPDiagramWidget } from "glsp-theia-extension/lib/browser";
import { inject, injectable } from "inversify";
import { DiagramWidgetRegistry, TheiaFileSaver, DiagramWidgetFactory, DiagramWidgetOptions } from "theia-glsp/lib";
import { EcoreLanguage } from "../common/ecore-language";
import { GLSPTheiaSprottyConnector, GraphicalLanguageClientContribution, GLSPDiagramManager, GLSPPaletteContribution } from "glsp-theia-extension/lib/browser";
import { EcoreGLClientContribution } from "./ecore-glclient-contribution";
import { EditorManager } from "@theia/editor/lib/browser";
import URI from "@theia/core/lib/common/uri";
import { OpenerOptions } from "@theia/core/lib/browser";
import { RequestModelAction } from "glsp-sprotty/lib";



Expand All @@ -29,14 +30,13 @@ export class EcoreDiagramManager extends GLSPDiagramManager {

constructor(
@inject(EcoreGLClientContribution)
readonly languageClientContribution: GraphicalLanguageClientContribution,
readonly languageClientContribution: GLSPClientContribution,
@inject(TheiaFileSaver)
readonly theiaFileSaver: TheiaFileSaver,
@inject(EditorManager)
readonly editorManager: EditorManager,
@inject(DiagramWidgetRegistry)
readonly diagramWidgetRegistry: DiagramWidgetRegistry,
@inject(GLSPPaletteContribution) readonly paletteContribution: GLSPPaletteContribution) {
readonly diagramWidgetRegistry: DiagramWidgetRegistry) {
super();

}
Expand All @@ -53,10 +53,31 @@ export class EcoreDiagramManager extends GLSPDiagramManager {
this.languageClientContribution,
this.theiaFileSaver,
this.editorManager,
this.diagramWidgetRegistry,
this.paletteContribution)
this.diagramWidgetRegistry)

}
return this._diagramConnector
}
}

protected get diagramWidgetFactory(): DiagramWidgetFactory {
return options => new EcoreGLSPDiagramWidget(options, this.editorPreferences);
}
}

class EcoreGLSPDiagramWidget extends GLSPDiagramWidget{
constructor(options: DiagramWidgetOptions, readonly editorPreferences: EditorPreferences){
super(options,editorPreferences)
}

protected sendInitialRequestMessages() {
// this.actionDispatcher.dispatch(new RequestTypeHintsAction());
this.actionDispatcher.dispatch(new RequestModelAction({
sourceUri: decodeURIComponent(this.uri.toString()),
diagramType: this.diagramType,
needsClientLayout: 'true',
needsServerLayout: 'true'
}))
// this.actionDispatcher.dispatch(new RequestOperationsAction());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
* Contributors:
* EclipseSource Muenchen GmbH - initial API and implementation
******************************************************************************/
import { BaseGLSPClientContribution } from "glsp-theia-extension/lib/browser";
import { injectable } from "inversify";
import { BaseGraphicalLanguageClientContribution } from "glsp-theia-extension/lib/browser"
import { EcoreLanguage } from "../common/ecore-language";
@injectable()
export class EcoreGLClientContribution extends BaseGraphicalLanguageClientContribution {
export class EcoreGLClientContribution extends BaseGLSPClientContribution {
fileExtensions= [EcoreLanguage.FileExtension]
readonly id = EcoreLanguage.Id
readonly name = EcoreLanguage.Name
}
18 changes: 7 additions & 11 deletions client/theia-ecore/theia-ecore/src/browser/frontend-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@
* Contributors:
* EclipseSource Muenchen GmbH - initial API and implementation
******************************************************************************/
import { FrontendApplicationContribution, OpenHandler } from "@theia/core/lib/browser";
import { GLSPClientContribution } from "glsp-theia-extension/lib/browser";
import { ContainerModule, interfaces } from "inversify";

import { EcoreGLClientContribution } from "./ecore-glclient-contribution";
import { DiagramConfiguration, DiagramManagerProvider, DiagramManager } from "theia-glsp/lib";
import { DiagramConfiguration, DiagramManager, DiagramManagerProvider } from "theia-glsp/lib";
import { EcoreLanguage } from "../common/ecore-language";
import { EcoreDiagramConfiguration } from "./di.config";
import { EcoreDiagramManager } from "./ecore-diagram-manager.";
import { EcoreLanguage } from "../common/ecore-language";
import { FrontendApplicationContribution, OpenHandler } from "@theia/core/lib/browser";
import { GraphicalLanguageClientContribution, GLSPPaletteContribution } from "glsp-theia-extension/lib/browser";
import { MenuContribution, CommandContribution } from "@theia/core";
import { EcoreGLClientContribution } from "./ecore-glclient-contribution";


export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => {


bind(EcoreGLClientContribution).toSelf().inSingletonScope()
bind(GraphicalLanguageClientContribution).toDynamicValue(ctx => ctx.container.get(EcoreGLClientContribution)).inSingletonScope();
bind(GLSPClientContribution).toDynamicValue(ctx => ctx.container.get(EcoreGLClientContribution)).inSingletonScope();
bind(DiagramConfiguration).to(EcoreDiagramConfiguration).inSingletonScope()
bind(DiagramManagerProvider).toProvider<DiagramManager>(context => {
return () => {
Expand All @@ -37,8 +36,5 @@ export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Un
bind(FrontendApplicationContribution).toDynamicValue(context =>
context.container.get(EcoreDiagramManager))
bind(OpenHandler).toDynamicValue(context => context.container.get(EcoreDiagramManager))
bind(GLSPPaletteContribution).toSelf().inSingletonScope()
bind(MenuContribution).toDynamicValue(ctx => ctx.container.get(GLSPPaletteContribution)).inSingletonScope()
bind(CommandContribution).toDynamicValue(ctx => ctx.container.get(GLSPPaletteContribution)).inSingletonScope()
})

Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export namespace EcoreLanguage {
export const Name: string = "Ecore"
export const Label: string = "Ecore diagram"
export const DiagramType: string = "ecorediagram"
export const FileExtension: string= ".ecore"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* EclipseSource Muenchen GmbH - initial API and implementation
******************************************************************************/
import { IConnection } from "@theia/languages/lib/node";
import { BaseGraphicalLanguageServerContribution } from 'glsp-theia-extension/lib/node';
import { BaseGLSPServerContribution } from 'glsp-theia-extension/lib/node';
import { injectable } from "inversify";
import * as net from 'net';
import { createSocketConnection } from 'vscode-ws-jsonrpc/lib/server';
Expand All @@ -24,7 +24,7 @@ function getPort(): number | undefined {
}
}
@injectable()
export class EcoreGLServerContribution extends BaseGraphicalLanguageServerContribution {
export class EcoreGLServerContribution extends BaseGLSPServerContribution {
readonly id = EcoreLanguage.Id
readonly name = EcoreLanguage.Name

Expand Down
Loading

0 comments on commit 633b83b

Please # to comment.