Skip to content

Commit

Permalink
Confirmed fix #1285
Browse files Browse the repository at this point in the history
  • Loading branch information
fdodino committed Mar 14, 2018
1 parent 2f45c74 commit 9156896
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ class StaticDiagramConfiguration extends Observable implements Serializable {
def void saveConfiguration() {
if (this.resourceCanBeUsed) {
var File _file = null
//if (!this.isPlatformFile)
// _file = new File(staticDiagramFullName.adaptFile)
//else
if (!this.isPlatformFile)
_file = new File(staticDiagramFullName.adaptFile)
else
_file = new File(staticDiagramFullName)

val file = new FileOutputStream(_file)
Expand Down Expand Up @@ -395,45 +395,22 @@ class StaticDiagramConfiguration extends Observable implements Serializable {
*******************************************************
*/
override toString() {
val result = new StringBuffer() => [
append("Static Diagram {")
append("\n")
append(" relations = ")
append(this.relations)
append("\n")
append(" hidden components = ")
append(this.hiddenComponents)
append("\n")
append(" hidden parts = ")
append(this.hiddenParts)
append("\n")
append(" full path = ")
append(this.fullPath)
append("\n")
append(" original file name = ")
append(this.originalFileName)
append("\n")
append(" show variables = ")
append(this.showVariables)
append("\n")
append(" remember locations = ")
append(this.rememberLocationAndSizeShapes)
append("\n")
append(" locations = ")
append(this.locations)
append("\n")
append(" sizes = ")
append(this.sizes)
append("\n")
append(" outsiderElements = ")
append(this.outsiderElements)
append("\n")
append("}")
]
result.toString
'''
Static Diagram {
relations = «this.relations»
hidden components = «this.hiddenComponents»
hidden parts = «this.hiddenParts»
full path = «this.fullPath»
original file name = «this.originalFileName»
show variables = «this.showVariables»
remember locations = «this.rememberLocationAndSizeShapes»
locations = «this.locations»
sizes = «this.sizes»
outsider elements = «this.outsiderElements»
}
'''
}


/**
******************************************************
* INTERNAL METHODS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package org.uqbar.project.wollok.ui.diagrams.classes

import java.util.ArrayList
import java.util.Comparator
import java.util.List
import java.util.Map
import java.util.Observable
import java.util.Observer
import org.eclipse.core.resources.IResource
Expand All @@ -14,6 +16,7 @@ import org.eclipse.draw2d.graph.DirectedGraph
import org.eclipse.draw2d.graph.DirectedGraphLayout
import org.eclipse.draw2d.graph.Edge
import org.eclipse.draw2d.graph.Node
import org.eclipse.emf.common.util.URI
import org.eclipse.gef.DefaultEditDomain
import org.eclipse.gef.EditPart
import org.eclipse.gef.GraphicalEditPart
Expand Down Expand Up @@ -173,7 +176,7 @@ class StaticDiagramView extends ViewPart implements ISelectionListener, ISourceV
// all classes and named objects inheriting from a class
// new way: instead of adding imports we just detect them because of hierarchy
val classes = xtextDocument.readOnly[ classes ]
val mapOutsiderMethodContainers = configuration.resource.project.mapMethodContainers
val Map<URI, List<WMethodContainer>> mapOutsiderMethodContainers = configuration.resource.project.mapMethodContainers(configuration.isPlatformFile)
val outsiderElements = configuration.outsiderElements.map [ outsiderElement |
mapOutsiderMethodContainers.get(outsiderElement.realURI)?.findFirst [
outsiderElement.identifier.equals(it.identifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,16 @@ class AddOutsiderClassView extends Dialog {
])
]
treeWollokElements => [
val mapMethodContainers = project.mapMethodContainers
val mapMethodContainers = project.mapMethodContainers(configuration.platformFile)
// Show wollok files
// - that have any valid method container
// - avoiding current resource of static diagram
val wollokFiles = project.allWollokFiles.filter [
!mapMethodContainers.get(it).isEmpty && it !== configuration.resource.convertToEclipseURI
].toList
var List<URI> wollokFiles = newArrayList
if (!configuration.platformFile) {
wollokFiles = project.allWollokFiles.filter [
!mapMethodContainers.get(it).isEmpty && it !== configuration.resource.convertToEclipseURI
].toList
}
control.layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 0) => [
heightHint = 350
widthHint = 250
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.util.ArrayList
import java.util.Collections
import java.util.HashMap
import java.util.List
import java.util.Map
import org.eclipse.core.resources.IProject
import org.eclipse.emf.common.util.EList
import org.eclipse.emf.common.util.URI
Expand Down Expand Up @@ -594,7 +595,7 @@ class WMethodContainerExtensions extends WollokModelExtensions {
.toList
}

def static mapMethodContainers(IProject project) {
def static Map<URI, List<WMethodContainer>> mapMethodContainers(IProject project) {
val result = new HashMap<URI, List<WMethodContainer>>
project.allWollokFiles.forEach [ file | result.put(file, newArrayList)]
project
Expand All @@ -607,6 +608,11 @@ class WMethodContainerExtensions extends WollokModelExtensions {
]
result
}

def static Map<URI, List<WMethodContainer>> mapMethodContainers(IProject project, boolean platformFile) {
if (platformFile) return newHashMap
project.mapMethodContainers
}

def static getMethodContainers(URI uri) {
val resSet = new XtextResourceSet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ class WEclipseUtils {
}

def static convertToEclipseURI(IResource res) {
// URI.createFileURI(res.locationURI.rawPath.toString.replaceAll("%20", " "))
URI.createFileURI(res.locationURI.rawPath.toString)
URI.createFileURI(res.locationURI.rawPath.toString.replaceAll("%20", " "))
}

def static isWollokExtension(IResource file) {
Expand Down

0 comments on commit 9156896

Please sign in to comment.