Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

/**
* Abstract model for any Java-based model object. It has some presentation in AST.
Expand Down Expand Up @@ -1199,8 +1201,11 @@ private void highlightVisitedNodes(VisitedNodes visitedNodes) throws JavaModelEx
String unitSource = editor.getModelUnit().getSource();
boolean isCommitted = editorSource.equals(unitSource);
if (isCommitted) {
// TODO(scheglov)
// site.highlightVisitedNodes(visitedNodes.getNodes());
Set<Integer> lines = new HashSet<>();
for (ASTNode node : visitedNodes.getNodes()) {
lines.add(editor.getLineNumber(node.getStartPosition()));
}
site.highlightVisitedLines(lines);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -541,11 +542,11 @@ public void openSourcePosition(int position) {
m_designerEditor.getMultiMode().showSource();
}

// TODO(scheglov)
// @Override
// public void highlightVisitedNodes(Collection<ASTNode> nodes) {
// m_designerEditor.highlightVisitedNodes(nodes);
// }
@Override
public void highlightVisitedLines(Collection<Integer> lines) {
m_designerEditor.highlightVisitedLines(lines);
}

@Override
public void handleException(Throwable e) {
handleDesignException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
import org.eclipse.jdt.ui.IWorkingCopyManager;
import org.eclipse.jdt.ui.JavaUI;
Expand Down Expand Up @@ -200,12 +199,12 @@ public void showSourcePosition(final int position) {
}

/**
* Highlight lines with visited {@link ASTNode}s.
* Highlight the given lines, which were visited while evaluating the components.
*/
public void highlightVisitedNodes(final Collection<ASTNode> nodes) {
public void highlightVisitedLines(final Collection<Integer> lines) {
ExecutionUtils.runIgnore(() -> {
if (m_linesHighlighter != null) {
m_linesHighlighter.setVisitedNodes(nodes);
m_linesHighlighter.setVisitedLines(lines);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.eclipse.wb.internal.core.preferences.IPreferenceConstants;
import org.eclipse.wb.internal.core.utils.execution.ExecutionUtils;

import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.IDocument;
Expand All @@ -39,9 +38,7 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
* Helper for highlighting lines visited during rendering.
Expand Down Expand Up @@ -108,17 +105,11 @@ private void trackPreferences_getCurrentValues() {
// Access
//
////////////////////////////////////////////////////////////////////////////
public void setVisitedNodes(Collection<ASTNode> nodes) throws Exception {
public void setVisitedLines(Collection<Integer> lines) throws Exception {
// unmanage previous positions
for (Position position : m_linePositions) {
m_positionManager.unmanagePosition(position);
}
// prepare lines
Set<Integer> lines = new HashSet<>();
for (ASTNode node : nodes) {
int line = m_document.getLineOfOffset(node.getStartPosition());
lines.add(line);
}
// create new positions
m_linePositions.clear();
for (Integer line : lines) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.viewers.TreeViewer;

import java.util.Collection;

/**
* Provides access to the {@link DesignPage}.
*
Expand Down Expand Up @@ -49,12 +51,12 @@ public void showSourcePosition(int position) {
public void openSourcePosition(int position) {
}

// TODO(scheglov)
// /**
// * Highlight in editor lines with visited {@link ASTNode}s.
// */
// public void highlightVisitedNodes(Collection<ASTNode> nodes) {
// }
/**
* Highlight in editor the given lines, which were visited while evaluating the components.
*/
public void highlightVisitedLines(Collection<Integer> lines) {
}

/**
* Handles any unexpected {@link Exception}.
*/
Expand Down
Loading