Skip to content

Commit

Permalink
Merge pull request #40 from TelescopeSt/32-Add-menu-entry-to-open-demo
Browse files Browse the repository at this point in the history
32-Add-menu-entry-to-open-demo
  • Loading branch information
jecisc committed Jun 28, 2019
2 parents 5548c1f + 14d261a commit c322560
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
23 changes: 22 additions & 1 deletion src/Telescope-Cytoscape/TLCytoscapeWebSocketDelegate.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,28 @@ TLCytoscapeWebSocketDelegate class >> menuCommandOn: aBuilder [
iconName: #smallOk;
parent: #Telescope;
help: 'This action will enable the deployment mode of Telescope';
action: [ self beDeployment ]
action: [ self beDeployment ].
(aBuilder item: #'Open web demo')
order: 1;
iconName: #glamorousOver;
parent: #Telescope;
help: 'Open the web demo of Telescope';
action: [ self openWebDemo ]
]

{ #category : #'accessing-convenience' }
TLCytoscapeWebSocketDelegate class >> openWebDemo [
| port url |
WAServerManager default adaptors
ifEmpty: [ (ZnZincServerAdaptor port: (port := 8087)) start ]
ifNotEmpty: [ :adaptors | adaptors detect: #isRunning ifFound: [ :anAdaptor | port := anAdaptor server port ] ifNone: [ (ZnZincServerAdaptor port: (port := 8087)) start ] ].
url := 'http://localhost:' , port asString , '/TelescopeDemo'.
self flag: #pharo6.
self flag: #pharo7.
self class environment
at: #WebBrowser
ifPresent: [ :class | class openOn: url ]
ifAbsent: [ self class environment at: #OSProcess ifPresent: [ :class | class command: 'open ' , url ] ifAbsent: [ self inform: 'Open ' , url , ' or install WebBrowser/OSProcess.' ] ]
]

{ #category : #accessing }
Expand Down
15 changes: 7 additions & 8 deletions src/Telescope-Cytoscape/TLVisualization.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ TLVisualization >> openOnWeb [
webAppVisualization := TLWebAppVisualization singleton.
webAppVisualization visualization: self.
WAServerManager default adaptors
ifEmpty: [ (ZnZincServerAdaptor port: (port := 8085)) start ]
ifNotEmpty: [ :adaptors | adaptors detect: #isRunning ifFound: [ :anAdaptor | port := anAdaptor server port ] ifNone: [ (ZnZincServerAdaptor port: (port := 8085)) start ] ].
ifEmpty: [ (ZnZincServerAdaptor port: (port := 8087)) start ]
ifNotEmpty: [ :adaptors | adaptors detect: #isRunning ifFound: [ :anAdaptor | port := anAdaptor server port ] ifNone: [ (ZnZincServerAdaptor port: (port := 8087)) start ] ].
url := 'http://localhost:' , port asString , '/UserVisualization'.
self flag: #pharo6.
SystemVersion current major < 7
ifTrue: [ self class environment
at: #OSProcess
ifPresent: [ :class | class command: 'open http://localhost:' , port asString , '/UserVisualization' ]
ifAbsent: [ self inform: 'Open ' , url , ' or install OSProcess.' ] ]
ifFalse: [ WebBrowser openOn: url ]
self flag: #pharo7.
self class environment
at: #WebBrowser
ifPresent: [ :class | class openOn: url ]
ifAbsent: [ self class environment at: #OSProcess ifPresent: [ :class | class command: 'open ' , url ] ifAbsent: [ self inform: 'Open ' , url , ' or install WebBrowser/OSProcess.' ] ]
]

0 comments on commit c322560

Please sign in to comment.