Skip to content

Commit

Permalink
Fixing NPE while using the resource manager from the debugger object …
Browse files Browse the repository at this point in the history
…diagram
  • Loading branch information
javierfernandes committed Aug 3, 2016
1 parent 00a264a commit 7debc42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,11 @@ class ObjectDiagramView extends ViewPart implements ISelectionListener, ISourceV

// set new stack
graphicalViewer.contents = stackframe

layout()

// recover old positions
val newModels = (graphicalViewer.contents as StackFrameEditPart).children.<ValueEditPart,VariableModel>map[ ep | ep.model as VariableModel ]
val newModels = newModels
val alreadyDisplaying = newModels.filter[ map.containsKey(valueString) ].toList
alreadyDisplaying.forEach[vm |
val oldShape = map.get(vm.valueString)
Expand All @@ -309,10 +310,14 @@ class ObjectDiagramView extends ViewPart implements ISelectionListener, ISourceV
]

// tweak layout
val newNodes = newModels.filter[!alreadyDisplaying.contains(it)].toList
// val newNodes = newModels.filter[!alreadyDisplaying.contains(it)].toList
// relocateSolitaryNodes(newNodes)
}

def getEditPart() { graphicalViewer.contents as StackFrameEditPart }
def getChildrenEditParts() { if (editPart != null) editPart.children as List<ValueEditPart> else #[]}
def getNewModels() { childrenEditParts.map[ ep | ep.model as VariableModel ] }

def relocateSolitaryNodes(List<VariableModel> models) {
val nodesReferencedByJustOne = models.filter[m | m.targetConnections.size == 1]
nodesReferencedByJustOne.forEach[m |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import org.eclipse.ui.progress.UIJob
import org.uqbar.project.wollok.debugger.model.WollokVariable
import org.uqbar.project.wollok.ui.editor.WollokTextEditor
import org.uqbar.project.wollok.ui.launch.Activator
import org.eclipse.swt.widgets.Display
import org.eclipse.ui.PlatformUI

/**
*
Expand Down Expand Up @@ -49,7 +51,7 @@ class WollokDebugModelPresentation extends LabelProvider implements IDebugModelP

def synchronized getOrCreateResourceManager() {
if (resourceManager == null) {
resourceManager = new LocalResourceManager(JFaceResources.getResources())
resourceManager = new LocalResourceManager(JFaceResources.getResources(Display.^default))
}
resourceManager
}
Expand Down

0 comments on commit 7debc42

Please sign in to comment.