diff --git a/src/org/ntlab/traceDebugger/BreakPointLabelProvider.java b/src/org/ntlab/traceDebugger/BreakPointLabelProvider.java index 0712e66..c9bf97c 100644 --- a/src/org/ntlab/traceDebugger/BreakPointLabelProvider.java +++ b/src/org/ntlab/traceDebugger/BreakPointLabelProvider.java @@ -1,40 +1,39 @@ -package org.ntlab.traceDebugger; - -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; - -public class BreakPointLabelProvider extends LabelProvider implements ITableLabelProvider { - - @Override - public String getColumnText(Object element, int columnIndex) { - if (element instanceof TraceBreakPoint) { - TraceBreakPoint tbp = (TraceBreakPoint)element; - switch (columnIndex) { - case 0: -// return tbp.isAvailable() ? "True" : "False"; - return ""; - case 1: - return String.valueOf(tbp.getLineNo()); - case 2: - return tbp.getReadableSignature(); - } - } - return "�e�X�g�p�e�L�X�g" + columnIndex; - } - - @Override - public Image getColumnImage(Object element, int columnIndex) { - if (columnIndex == 0 && element instanceof TraceBreakPoint) { - TraceBreakPoint tbp = (TraceBreakPoint)element; - if (tbp.isAvailable()) { - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); - } else { - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED); - } - } - return null; - } -} +package org.ntlab.traceDebugger; + +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Image; + +public class BreakPointLabelProvider extends LabelProvider implements ITableLabelProvider { + + @Override + public String getColumnText(Object element, int columnIndex) { + if (element instanceof TraceBreakPoint) { + TraceBreakPoint tbp = (TraceBreakPoint)element; + switch (columnIndex) { + case 0: + return ""; + case 1: + return String.valueOf(tbp.getLineNo()); + case 2: + return tbp.getReadableSignature(); + } + } + return "�e�X�g�p�e�L�X�g" + columnIndex; + } + + @Override + public Image getColumnImage(Object element, int columnIndex) { + if (columnIndex == 0 && element instanceof TraceBreakPoint) { + TraceBreakPoint tbp = (TraceBreakPoint)element; + if (tbp.isAvailable()) { + return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); + } else { + return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED); + } + } + return null; + } +} diff --git a/src/org/ntlab/traceDebugger/BreakPointView.java b/src/org/ntlab/traceDebugger/BreakPointView.java index 925cb5b..ab1ffc4 100644 --- a/src/org/ntlab/traceDebugger/BreakPointView.java +++ b/src/org/ntlab/traceDebugger/BreakPointView.java @@ -50,7 +50,6 @@ protected IAction resumeAction; protected IAction importBreakpointAction; protected Shell shell; -// protected TraceBreakPoints traceBreakPoints; protected DebuggingController debuggingController = DebuggingController.getInstance(); public static final String ID = "org.ntlab.traceDebugger.breakPointView"; public static final String DEBUG_ELCL = "Debug_elcl"; @@ -323,10 +322,6 @@ viewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, viewer); } - -// public TraceBreakPoints getTraceBreakPoints() { -// return traceBreakPoints; -// } public void reset() { viewer.setInput(new ArrayList()); @@ -336,7 +331,6 @@ } public void updateTraceBreakPoints(TraceBreakPoints traceBreakPoints) { -// this.traceBreakPoints = traceBreakPoints; viewer.setInput(traceBreakPoints.getAllTraceBreakPoints()); final Table table = viewer.getTable(); for (TableItem item : table.getItems()) { diff --git a/src/org/ntlab/traceDebugger/CallTreeModel.java b/src/org/ntlab/traceDebugger/CallTreeModel.java index 21278d3..eec8421 100644 --- a/src/org/ntlab/traceDebugger/CallTreeModel.java +++ b/src/org/ntlab/traceDebugger/CallTreeModel.java @@ -1,86 +1,77 @@ -package org.ntlab.traceDebugger; - -import java.util.ArrayList; -import java.util.List; - -import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; -import org.ntlab.traceAnalysisPlatform.tracer.trace.Trace; - -public class CallTreeModel { - private MethodExecution methodExecution; - private boolean isHighlighting; - private CallTreeModel parent; - private List children = new ArrayList<>(); - - public CallTreeModel(MethodExecution methodExecution) { - this.methodExecution = methodExecution; - } - - public MethodExecution getMethodExecution() { - return methodExecution; - } - - public String getSignature() { - return methodExecution.getSignature(); - } - - public String getCallTreeSignature() { - String signature = ""; - signature = getSignature(); - String objectType = methodExecution.getThisClassName(); - objectType = objectType.substring(objectType.lastIndexOf(".") + 1); - boolean isConstructor = methodExecution.isConstructor(); - String declaringType = Trace.getDeclaringType(signature, isConstructor); - declaringType = declaringType.substring(declaringType.lastIndexOf(".") + 1); - String methodName = Trace.getMethodName(signature); - String args = "("; - String delimiter = ""; - String[] argArray = signature.split("\\(")[1].split(","); - for (String arg : argArray) { - args += (delimiter + arg.substring(arg.lastIndexOf(".") + 1)); - delimiter = ", "; - } - - StringBuilder sb = new StringBuilder(); - sb.append(objectType); - if (!declaringType.equals(objectType)) { - sb.append("(" + declaringType + ")"); - } - sb.append("." + methodName + args); - signature = sb.toString(); - return signature; - } - - public boolean isHighlighting() { - return isHighlighting; - } - - public void setHighlighting(boolean isHighlighting) { - this.isHighlighting = isHighlighting; - } - -// public List getChildren() { -// List children = methodExecution.getChildren(); -// List childrenCallTreeModels = new ArrayList<>(); -// for (MethodExecution child : children) { -// childrenCallTreeModels.add(new CallTreeModel(child)); -// } -// return childrenCallTreeModels; -// } - - public CallTreeModel getParent() { - return parent; - } - - public List getChildren() { - return children; - } - - public void setParent(CallTreeModel parent) { - this.parent = parent; - } - - public void addChildren(CallTreeModel child) { - this.children.add(child); - } -} +package org.ntlab.traceDebugger; + +import java.util.ArrayList; +import java.util.List; + +import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; +import org.ntlab.traceAnalysisPlatform.tracer.trace.Trace; + +public class CallTreeModel { + private MethodExecution methodExecution; + private boolean isHighlighting; + private CallTreeModel parent; + private List children = new ArrayList<>(); + + public CallTreeModel(MethodExecution methodExecution) { + this.methodExecution = methodExecution; + } + + public MethodExecution getMethodExecution() { + return methodExecution; + } + + public String getSignature() { + return methodExecution.getSignature(); + } + + public String getCallTreeSignature() { + String signature = ""; + signature = getSignature(); + String objectType = methodExecution.getThisClassName(); + objectType = objectType.substring(objectType.lastIndexOf(".") + 1); + boolean isConstructor = methodExecution.isConstructor(); + String declaringType = Trace.getDeclaringType(signature, isConstructor); + declaringType = declaringType.substring(declaringType.lastIndexOf(".") + 1); + String methodName = Trace.getMethodName(signature); + String args = "("; + String delimiter = ""; + String[] argArray = signature.split("\\(")[1].split(","); + for (String arg : argArray) { + args += (delimiter + arg.substring(arg.lastIndexOf(".") + 1)); + delimiter = ", "; + } + + StringBuilder sb = new StringBuilder(); + sb.append(objectType); + if (!declaringType.equals(objectType)) { + sb.append("(" + declaringType + ")"); + } + sb.append("." + methodName + args); + signature = sb.toString(); + return signature; + } + + public boolean isHighlighting() { + return isHighlighting; + } + + public void setHighlighting(boolean isHighlighting) { + this.isHighlighting = isHighlighting; + } + + public CallTreeModel getParent() { + return parent; + } + + public List getChildren() { + return children; + } + + public void setParent(CallTreeModel parent) { + this.parent = parent; + } + + public void addChildren(CallTreeModel child) { + this.children.add(child); + } +} diff --git a/src/org/ntlab/traceDebugger/DebuggingController.java b/src/org/ntlab/traceDebugger/DebuggingController.java index 0d7790b..77dd02d 100644 --- a/src/org/ntlab/traceDebugger/DebuggingController.java +++ b/src/org/ntlab/traceDebugger/DebuggingController.java @@ -25,10 +25,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Shell; -import org.ntlab.traceAnalysisPlatform.tracer.trace.ArrayUpdate; -import org.ntlab.traceAnalysisPlatform.tracer.trace.FieldUpdate; import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; -import org.ntlab.traceAnalysisPlatform.tracer.trace.Statement; import org.ntlab.traceAnalysisPlatform.tracer.trace.TraceJSON; import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; import org.ntlab.traceDebugger.analyzerProvider.DeltaExtractionAnalyzer; @@ -122,7 +119,6 @@ TraceJSON trace = new TraceJSON(filePath); TraceDebuggerPlugin.setAnalyzer(new DeltaExtractionAnalyzer(trace)); VariableUpdatePointFinder.getInstance().setTrace(trace); -// final TraceBreakPoints traceBreakPoints = new TraceBreakPoints(trace); traceBreakPoints = new TraceBreakPoints(trace); // GUI�̑����GUI�̃C�x���g�f�B�X�p�b�`���s���Ă���X���b�h���炵������ł��Ȃ��̂ł������� @@ -166,7 +162,6 @@ : new InputDialog(null, "line Number dialog", "Input line number", "", null); if (inputDialog.open() != InputDialog.OK) return false; int lineNo = Integer.parseInt(inputDialog.getValue()); -// TraceBreakPoints traceBreakPoints = ((BreakPointView)TraceDebuggerPlugin.getActiveView(BreakPointView.ID)).getTraceBreakPoints(); boolean isSuccess = traceBreakPoints.addTraceBreakPoint(methodSignature, lineNo); if (!isSuccess) { if (TraceDebuggerPlugin.isJapanese()) { @@ -189,7 +184,6 @@ } return false; } -// TraceBreakPoints traceBreakPoints = ((BreakPointView)TraceDebuggerPlugin.getActiveView(BreakPointView.ID)).getTraceBreakPoints(); traceBreakPoints.importBreakpointFromEclipse(); ((BreakPointView)TraceDebuggerPlugin.getActiveView(BreakPointView.ID)).updateTraceBreakPoints(traceBreakPoints); return true; @@ -197,7 +191,6 @@ public boolean removeTraceBreakPointAction() { if (selectedTraceBreakPoint == null) return false; -// TraceBreakPoints traceBreakPoints = ((BreakPointView)TraceDebuggerPlugin.getActiveView(BreakPointView.ID)).getTraceBreakPoints(); traceBreakPoints.removeTraceBreakPoint(selectedTraceBreakPoint); ((BreakPointView)TraceDebuggerPlugin.getActiveView(BreakPointView.ID)).updateTraceBreakPoints(traceBreakPoints); return true; @@ -220,7 +213,6 @@ } return false; } -// TraceBreakPoints traceBreakPoints = ((BreakPointView)TraceDebuggerPlugin.getActiveView(BreakPointView.ID)).getTraceBreakPoints(); debuggingTp = traceBreakPoints.getFirstTracePoint(); if (debuggingTp == null) { if (TraceDebuggerPlugin.isJapanese()) { @@ -235,21 +227,6 @@ isRunning = true; return true; } - -// public void terminateAction() { -// debuggingTp = null; -// if (currentLineMarker != null) { -// try { -// currentLineMarker.delete(); -// } catch (CoreException e) { -// e.printStackTrace(); -// } -// } -// ((CallStackView)TraceDebuggerPlugin.getActiveView(CallStackView.ID)).reset(); -// ((VariableView)TraceDebuggerPlugin.getActiveView(VariableView.ID)).reset(); -// ((BreakPointView)TraceDebuggerPlugin.getActiveView(BreakPointView.ID)).updateImagesForDebug(false); -// isRunning = false; -// } public void terminateAction() { debuggingTp = null; @@ -354,7 +331,6 @@ if (debuggingTp == null) return false; long currentTime = debuggingTp.getStatement().getTimeStamp(); TracePoint previousTp = debuggingTp; -// TraceBreakPoints traceBreakPoints = ((BreakPointView)TraceDebuggerPlugin.getActiveView(BreakPointView.ID)).getTraceBreakPoints(); debuggingTp = traceBreakPoints.getNextTracePoint(currentTime); if (debugExecutionIsTerminated(debuggingTp)) return false; refresh(null, debuggingTp, false); @@ -415,7 +391,6 @@ if (debuggingTp == null) return false; TracePoint previousTp = debuggingTp; long currentTime = debuggingTp.getStatement().getTimeStamp(); -// TraceBreakPoints traceBreakPoints = ((BreakPointView)TraceDebuggerPlugin.getActiveView(BreakPointView.ID)).getTraceBreakPoints(); debuggingTp = traceBreakPoints.getPreviousTracePoint(currentTime); if (debugExecutionIsTerminated(debuggingTp)) return false; refresh(null, debuggingTp, false); @@ -460,7 +435,6 @@ callStackView.updateByTracePoint(to); VariableView variableView = ((VariableView)TraceDebuggerPlugin.getActiveView(VariableView.ID)); if (!isReturned && canDifferentialUpdateVariables) { -// variableView.updateVariablesByTracePoint(from, to, isReturned); variableView.updateVariablesForDifferential(from, to, isReturned); } else { variableView.updateVariablesByTracePoint(from, to, isReturned); diff --git a/src/org/ntlab/traceDebugger/DeltaMarkerView.java b/src/org/ntlab/traceDebugger/DeltaMarkerView.java index 62e663e..62b620b 100644 --- a/src/org/ntlab/traceDebugger/DeltaMarkerView.java +++ b/src/org/ntlab/traceDebugger/DeltaMarkerView.java @@ -4,7 +4,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; diff --git a/src/org/ntlab/traceDebugger/JavaElementFinder.java b/src/org/ntlab/traceDebugger/JavaElementFinder.java index 5f087c4..a75085b 100644 --- a/src/org/ntlab/traceDebugger/JavaElementFinder.java +++ b/src/org/ntlab/traceDebugger/JavaElementFinder.java @@ -1,240 +1,233 @@ -package org.ntlab.traceDebugger; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.ntlab.traceAnalysisPlatform.tracer.trace.ClassInfo; -import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; -import org.ntlab.traceAnalysisPlatform.tracer.trace.TraceJSON; - -public class JavaElementFinder { - - public static IFile findIFile(MethodExecution methodExecution) { - TraceJSON trace = (TraceJSON)TraceDebuggerPlugin.getAnalyzer().getTrace(); - String declaringClassName = methodExecution.getDeclaringClassName(); - declaringClassName = declaringClassName.replace(".", ""); - ClassInfo info = trace.getClassInfo(declaringClassName); - if (info == null) { - // �����N���X�̏ꍇ�͂��̊O�̃N���X����ClassInfo���擾���� (Java�̃\�[�X�t�@�C�����擾���邽��) - StringBuilder tmp = new StringBuilder(); - tmp.append(declaringClassName.substring(0, declaringClassName.lastIndexOf("."))); - info = trace.getClassInfo(tmp.toString()); - } - if (info == null) return null; - - String tmp = info.getPath(); - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IProject[] projects = workspace.getRoot().getProjects(); - String projectName = ""; - String srcForderName = "/src"; - String outputClassPath = null; - IPath projectOutputLocation = null; - boolean hasFoundSrcForderName = false; - for (IProject project : projects) { - projectName = project.getFullPath().toString(); - if (!(tmp.contains(projectName + "/"))) continue; - IJavaProject javaProject = JavaCore.create(project); - try { - projectOutputLocation = javaProject.getOutputLocation(); // �v���W�F�N�g�S�̂̏o�̓t�H���_ - for (IClasspathEntry entry : javaProject.getResolvedClasspath(true)) { - if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE) continue; - IPath srcForderPath = entry.getPath(); - srcForderName = srcForderPath.toString(); - IPath outputLocation = entry.getOutputLocation(); // �\�[�X���̏o�̓t�H���_ - if (outputLocation != null) { - URI path = PathUtility.workspaceRelativePathToAbsoluteURI(outputLocation, workspace); - outputClassPath = PathUtility.URIPathToPath(path.getPath()); - } - hasFoundSrcForderName = true; - break; - } - } catch (JavaModelException e) { - e.printStackTrace(); - } - if (hasFoundSrcForderName) break; - } - if (outputClassPath == null && projectOutputLocation != null) { - URI path = PathUtility.workspaceRelativePathToAbsoluteURI(projectOutputLocation, workspace); - outputClassPath = PathUtility.URIPathToPath(path.getPath()); - } -// tmp = tmp.replace(tmp.substring(0, tmp.lastIndexOf(projectName)), ""); - if (outputClassPath != null && tmp.startsWith(outputClassPath)) { - tmp = srcForderName + tmp.substring(outputClassPath.length()); - } else { - tmp = tmp.replace(tmp.substring(0, tmp.indexOf(projectName)), ""); - tmp = tmp.replace("/bin", srcForderName.substring(srcForderName.lastIndexOf("/"))); - } - tmp = tmp.replace(".class", ".java"); - String filePath = tmp; - IPath path = new Path(filePath); - return ResourcesPlugin.getWorkspace().getRoot().getFile(path); - } - - public static IType findIType(MethodExecution methodExecution) { - String declaringClassName = methodExecution.getDeclaringClassName(); - declaringClassName = declaringClassName.replace(".", ""); - return findIType(methodExecution, declaringClassName); - } - - public static IType findIType(MethodExecution methodExecution, String declaringClassName) { - String projectPath = getLoaderPath(methodExecution, declaringClassName); -// if (projectPath == null) projectPath = previousJavaProjectPath; - if (projectPath != null) { - IJavaProject javaProject = findJavaProject(projectPath); - if (javaProject != null) { -// previousJavaProjectPath = projectPath; - try { - return javaProject.findType(declaringClassName); - } catch (JavaModelException e) { - e.printStackTrace(); - } - } - } - return null; - } - - private static String getLoaderPath(MethodExecution methodExecution, String declaringClassName) { - TraceJSON traceJSON = (TraceJSON)TraceDebuggerPlugin.getAnalyzer().getTrace(); - ClassInfo classInfo = traceJSON.getClassInfo(declaringClassName); - if (classInfo == null && methodExecution != null) { - declaringClassName = methodExecution.getThisClassName(); - classInfo = traceJSON.getClassInfo(declaringClassName); - } - String loaderPath = null; - if (classInfo != null) { - // �Ȃ���loaderPath���擾�ł��Ă��Ȃ����߁A���ۂɏo�͂����JSON�g���[�X���Q�l�ɂ���path����^���Ă݂� - String path = classInfo.getPath(); - String declaringClassNameString = declaringClassName.replace(".", "/"); - loaderPath = path.substring(0, path.lastIndexOf(declaringClassNameString)); // path����N���X�̊��S���薼�ȍ~��S�ĊO�������̂�projectPath�ɂ��Ă݂� - } - return loaderPath; - } - - private static IJavaProject findJavaProject(String projectPath) { - IJavaProject javaProject = null; - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IProject[] projects = root.getProjects(); - for (IProject project : projects) { - if (checkProjectPath(project, projectPath)) { - javaProject = JavaCore.create(project); - break; - } - } - return javaProject; - } - - private static boolean checkProjectPath(IProject project, String projectPath) { - String projectLocation = project.getLocation().toString(); -// if (projectPath.startsWith(projectLocation)) { -// String[] projectPathSplit = projectPath.split(projectLocation); -// return (projectPathSplit[1].charAt(0) == '/'); // �v���W�F�N�g���̑O����v�ɂ�鑼�v���W�F�N�g�Ƃ̌딻�������� -// } - if (projectPath.startsWith(projectLocation)) { - String[] projectPathSplit = projectPath.split(projectLocation); - return (projectPathSplit[1].charAt(0) == '/'); // �v���W�F�N�g���̑O����v�ɂ�鑼�v���W�F�N�g�Ƃ̌딻�������� - } else if (projectPath.startsWith(projectLocation.substring(1))) { - String[] projectPathSplit = projectPath.split(projectLocation.substring(1)); - return (projectPathSplit[1].charAt(0) == '/'); // �v���W�F�N�g���̑O����v�ɂ�鑼�v���W�F�N�g�Ƃ̌딻�������� - } - return false; - } - - public static IMethod findIMethod(MethodExecution methodExecution, IType type) { - IMethod method = null; - if (type != null) { - String methodSignature = methodExecution.getSignature(); - method = findIMethod(type, methodSignature); - } - return method; - } - - public static IMethod findIMethod(IType type, String methodSignature) { - try { - for (IMethod method : type.getMethods()) { - if (checkMethodSignature(type, method, methodSignature)) { - return method; - } - } - } catch (JavaModelException e) { - e.printStackTrace(); - } - return null; - } - - private static boolean checkMethodSignature(IType type, IMethod method, String methodSignature) { - String fqcn = type.getFullyQualifiedName(); - fqcn = fqcn.replace("$", "."); - try { - StringBuilder jdtMethodSignature = new StringBuilder(); - jdtMethodSignature.append((method.isConstructor()) ? (fqcn + "(") : (fqcn + "." + method.getElementName() + "(")); - if (methodSignature.contains(jdtMethodSignature)) { - // ������v���Ă����ꍇ�Ɍ���A�������X�g����������ł���v���邩�ǂ����𔻒� (�I�[�o�[���[�h�ɂ��딻��������) - jdtMethodSignature.append(String.join(",", parseFQCNParameters(type, method)) + ")"); // �S�����̃V�O�l�`�������S����N���X���ɕϊ�����,�ŋ�؂��������� - return methodSignature.contains(jdtMethodSignature); - } - } catch (JavaModelException e) { - e.printStackTrace(); - } - return false; - } - - public static String resolveType(IType type, String typeName) { - try { - String[][] resolveTypes = type.resolveType(typeName); - if (resolveTypes != null) { - if (resolveTypes[0][0].isEmpty()) { - return (resolveTypes[0][1]); // �f�t�H���g�p�b�P�[�W�̏ꍇ�̓p�b�P�[�W����.�͓���Ȃ� - } else { - return (resolveTypes[0][0] + "." + resolveTypes[0][1]); // ���S����N���X�� - } - } - } catch (JavaModelException e) { - e.printStackTrace(); - } - return null; - } - - /** - * IMethod����擾�ł���S�����̃V�O�l�`�������S����N���X���ɒu�������Ċi�[�������X�g��Ԃ� - * - * @param type - * @param method - * @return - */ - private static List parseFQCNParameters(IType type, IMethod method) throws JavaModelException { - List parameters = new ArrayList<>(); - for (String parameterType : method.getParameterTypes()) { - String readableType = Signature.toString(parameterType); // �V�O�l�`���̕�������^���̕�����ɕϊ� (�z��͌���[]���‚�) - String[] readableTypeSplit = { "", "" }; // �^����[]�̕����p - int firstBracketIndex = readableType.indexOf("[]"); - final int NO_BRACKET_INDEX = -1; - if (firstBracketIndex == NO_BRACKET_INDEX) { - readableTypeSplit[0] = readableType; // �^�� - } else { - readableTypeSplit[0] = readableType.substring(0, firstBracketIndex); // �^�� - readableTypeSplit[1] = readableType.substring(firstBracketIndex); // �^���̌���[]�S�� - } - String tmp = resolveType(type, readableTypeSplit[0]); - if (tmp != null) { - readableTypeSplit[0] = tmp; - } - parameters.add(readableTypeSplit[0] + readableTypeSplit[1]); - } - return parameters; - } -} +package org.ntlab.traceDebugger; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IMethod; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.Signature; +import org.ntlab.traceAnalysisPlatform.tracer.trace.ClassInfo; +import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; +import org.ntlab.traceAnalysisPlatform.tracer.trace.TraceJSON; + +public class JavaElementFinder { + + public static IFile findIFile(MethodExecution methodExecution) { + TraceJSON trace = (TraceJSON)TraceDebuggerPlugin.getAnalyzer().getTrace(); + String declaringClassName = methodExecution.getDeclaringClassName(); + declaringClassName = declaringClassName.replace(".", ""); + ClassInfo info = trace.getClassInfo(declaringClassName); + if (info == null) { + // �����N���X�̏ꍇ�͂��̊O�̃N���X����ClassInfo���擾���� (Java�̃\�[�X�t�@�C�����擾���邽��) + StringBuilder tmp = new StringBuilder(); + tmp.append(declaringClassName.substring(0, declaringClassName.lastIndexOf("."))); + info = trace.getClassInfo(tmp.toString()); + } + if (info == null) return null; + + String tmp = info.getPath(); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IProject[] projects = workspace.getRoot().getProjects(); + String projectName = ""; + String srcForderName = "/src"; + String outputClassPath = null; + IPath projectOutputLocation = null; + boolean hasFoundSrcForderName = false; + for (IProject project : projects) { + projectName = project.getFullPath().toString(); + if (!(tmp.contains(projectName + "/"))) continue; + IJavaProject javaProject = JavaCore.create(project); + try { + projectOutputLocation = javaProject.getOutputLocation(); // �v���W�F�N�g�S�̂̏o�̓t�H���_ + for (IClasspathEntry entry : javaProject.getResolvedClasspath(true)) { + if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE) continue; + IPath srcForderPath = entry.getPath(); + srcForderName = srcForderPath.toString(); + IPath outputLocation = entry.getOutputLocation(); // �\�[�X���̏o�̓t�H���_ + if (outputLocation != null) { + URI path = PathUtility.workspaceRelativePathToAbsoluteURI(outputLocation, workspace); + outputClassPath = PathUtility.URIPathToPath(path.getPath()); + } + hasFoundSrcForderName = true; + break; + } + } catch (JavaModelException e) { + e.printStackTrace(); + } + if (hasFoundSrcForderName) break; + } + if (outputClassPath == null && projectOutputLocation != null) { + URI path = PathUtility.workspaceRelativePathToAbsoluteURI(projectOutputLocation, workspace); + outputClassPath = PathUtility.URIPathToPath(path.getPath()); + } + if (outputClassPath != null && tmp.startsWith(outputClassPath)) { + tmp = srcForderName + tmp.substring(outputClassPath.length()); + } else { + tmp = tmp.replace(tmp.substring(0, tmp.indexOf(projectName)), ""); + tmp = tmp.replace("/bin", srcForderName.substring(srcForderName.lastIndexOf("/"))); + } + tmp = tmp.replace(".class", ".java"); + String filePath = tmp; + IPath path = new Path(filePath); + return ResourcesPlugin.getWorkspace().getRoot().getFile(path); + } + + public static IType findIType(MethodExecution methodExecution) { + String declaringClassName = methodExecution.getDeclaringClassName(); + declaringClassName = declaringClassName.replace(".", ""); + return findIType(methodExecution, declaringClassName); + } + + public static IType findIType(MethodExecution methodExecution, String declaringClassName) { + String projectPath = getLoaderPath(methodExecution, declaringClassName); + if (projectPath != null) { + IJavaProject javaProject = findJavaProject(projectPath); + if (javaProject != null) { + try { + return javaProject.findType(declaringClassName); + } catch (JavaModelException e) { + e.printStackTrace(); + } + } + } + return null; + } + + private static String getLoaderPath(MethodExecution methodExecution, String declaringClassName) { + TraceJSON traceJSON = (TraceJSON)TraceDebuggerPlugin.getAnalyzer().getTrace(); + ClassInfo classInfo = traceJSON.getClassInfo(declaringClassName); + if (classInfo == null && methodExecution != null) { + declaringClassName = methodExecution.getThisClassName(); + classInfo = traceJSON.getClassInfo(declaringClassName); + } + String loaderPath = null; + if (classInfo != null) { + // �Ȃ���loaderPath���擾�ł��Ă��Ȃ����߁A���ۂɏo�͂����JSON�g���[�X���Q�l�ɂ���path����^���Ă݂� + String path = classInfo.getPath(); + String declaringClassNameString = declaringClassName.replace(".", "/"); + loaderPath = path.substring(0, path.lastIndexOf(declaringClassNameString)); // path����N���X�̊��S���薼�ȍ~��S�ĊO�������̂�projectPath�ɂ��Ă݂� + } + return loaderPath; + } + + private static IJavaProject findJavaProject(String projectPath) { + IJavaProject javaProject = null; + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IProject[] projects = root.getProjects(); + for (IProject project : projects) { + if (checkProjectPath(project, projectPath)) { + javaProject = JavaCore.create(project); + break; + } + } + return javaProject; + } + + private static boolean checkProjectPath(IProject project, String projectPath) { + String projectLocation = project.getLocation().toString(); + if (projectPath.startsWith(projectLocation)) { + String[] projectPathSplit = projectPath.split(projectLocation); + return (projectPathSplit[1].charAt(0) == '/'); // �v���W�F�N�g���̑O����v�ɂ�鑼�v���W�F�N�g�Ƃ̌딻�������� + } else if (projectPath.startsWith(projectLocation.substring(1))) { + String[] projectPathSplit = projectPath.split(projectLocation.substring(1)); + return (projectPathSplit[1].charAt(0) == '/'); // �v���W�F�N�g���̑O����v�ɂ�鑼�v���W�F�N�g�Ƃ̌딻�������� + } + return false; + } + + public static IMethod findIMethod(MethodExecution methodExecution, IType type) { + IMethod method = null; + if (type != null) { + String methodSignature = methodExecution.getSignature(); + method = findIMethod(type, methodSignature); + } + return method; + } + + public static IMethod findIMethod(IType type, String methodSignature) { + try { + for (IMethod method : type.getMethods()) { + if (checkMethodSignature(type, method, methodSignature)) { + return method; + } + } + } catch (JavaModelException e) { + e.printStackTrace(); + } + return null; + } + + private static boolean checkMethodSignature(IType type, IMethod method, String methodSignature) { + String fqcn = type.getFullyQualifiedName(); + fqcn = fqcn.replace("$", "."); + try { + StringBuilder jdtMethodSignature = new StringBuilder(); + jdtMethodSignature.append((method.isConstructor()) ? (fqcn + "(") : (fqcn + "." + method.getElementName() + "(")); + if (methodSignature.contains(jdtMethodSignature)) { + // ������v���Ă����ꍇ�Ɍ���A�������X�g����������ł���v���邩�ǂ����𔻒� (�I�[�o�[���[�h�ɂ��딻��������) + jdtMethodSignature.append(String.join(",", parseFQCNParameters(type, method)) + ")"); // �S�����̃V�O�l�`�������S����N���X���ɕϊ�����,�ŋ�؂��������� + return methodSignature.contains(jdtMethodSignature); + } + } catch (JavaModelException e) { + e.printStackTrace(); + } + return false; + } + + public static String resolveType(IType type, String typeName) { + try { + String[][] resolveTypes = type.resolveType(typeName); + if (resolveTypes != null) { + if (resolveTypes[0][0].isEmpty()) { + return (resolveTypes[0][1]); // �f�t�H���g�p�b�P�[�W�̏ꍇ�̓p�b�P�[�W����.�͓���Ȃ� + } else { + return (resolveTypes[0][0] + "." + resolveTypes[0][1]); // ���S����N���X�� + } + } + } catch (JavaModelException e) { + e.printStackTrace(); + } + return null; + } + + /** + * IMethod����擾�ł���S�����̃V�O�l�`�������S����N���X���ɒu�������Ċi�[�������X�g��Ԃ� + * + * @param type + * @param method + * @return + */ + private static List parseFQCNParameters(IType type, IMethod method) throws JavaModelException { + List parameters = new ArrayList<>(); + for (String parameterType : method.getParameterTypes()) { + String readableType = Signature.toString(parameterType); // �V�O�l�`���̕�������^���̕�����ɕϊ� (�z��͌���[]���‚�) + String[] readableTypeSplit = { "", "" }; // �^����[]�̕����p + int firstBracketIndex = readableType.indexOf("[]"); + final int NO_BRACKET_INDEX = -1; + if (firstBracketIndex == NO_BRACKET_INDEX) { + readableTypeSplit[0] = readableType; // �^�� + } else { + readableTypeSplit[0] = readableType.substring(0, firstBracketIndex); // �^�� + readableTypeSplit[1] = readableType.substring(firstBracketIndex); // �^���̌���[]�S�� + } + String tmp = resolveType(type, readableTypeSplit[0]); + if (tmp != null) { + readableTypeSplit[0] = tmp; + } + parameters.add(readableTypeSplit[0] + readableTypeSplit[1]); + } + return parameters; + } +} diff --git a/src/org/ntlab/traceDebugger/TraceBreakPoint.java b/src/org/ntlab/traceDebugger/TraceBreakPoint.java index 44b17f0..8855810 100644 --- a/src/org/ntlab/traceDebugger/TraceBreakPoint.java +++ b/src/org/ntlab/traceDebugger/TraceBreakPoint.java @@ -1,124 +1,101 @@ -package org.ntlab.traceDebugger; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; -import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodInvocation; -import org.ntlab.traceAnalysisPlatform.tracer.trace.Statement; -import org.ntlab.traceAnalysisPlatform.tracer.trace.Trace; -import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; - -public class TraceBreakPoint { - private List tracePoints = new ArrayList<>(); - private String methodSignature; - private String readableSignature; - private int lineNo; - private List methodExecutions = new ArrayList<>(); - private boolean isAvailable = false; - - private TraceBreakPoint(String methodSignature, int lineNo, boolean isAvailable, String readableSignature) { - this.methodSignature = methodSignature; - this.lineNo = lineNo; - this.isAvailable = isAvailable; - this.readableSignature = readableSignature; - } - - public static TraceBreakPoint createNewTraceBreakPoint(String methodSignature, int lineNo, boolean isAvailable, String readableSignature) - throws IllegalArgumentException { - TraceBreakPoint newTraceBreakPoint = new TraceBreakPoint(methodSignature, lineNo, isAvailable, readableSignature); - boolean isValid = newTraceBreakPoint.initTracePoints(methodSignature, lineNo); - if (!isValid) throw new IllegalArgumentException(); - return newTraceBreakPoint; - } - - private boolean initTracePoints(String methodSignature, int lineNo) { - Trace trace = TraceDebuggerPlugin.getAnalyzer().getTrace(); - methodExecutions = trace.getMethodExecutions(methodSignature); - if (methodExecutions.isEmpty()) return false; - tracePoints.clear(); - for (MethodExecution me : methodExecutions) { - int order = 0; - for (Statement statement : me.getStatements()) { - if (statement.getLineNo() == lineNo) { - tracePoints.add(me.getTracePoint(order)); - break; - } - order++; - } - } - if (tracePoints.isEmpty()) return false; - Collections.sort(tracePoints, new Comparator() { - @Override - public int compare(TracePoint o1, TracePoint o2) { - long o1Time = getTime(o1); - long o2Time = getTime(o2); - return (o1Time < o2Time) ? -1 : 1; - } - private long getTime(TracePoint tp) { - Statement statement = tp.getStatement(); - if (statement instanceof MethodInvocation) { - return ((MethodInvocation)statement).getCalledMethodExecution().getEntryTime(); - } - return statement.getTimeStamp(); - } - }); - return true; - } - - public String getMethodSignature() { - return methodSignature; - } - - public String getReadableSignature() { - return readableSignature; -// MethodExecution methodExecution = methodExecutions.iterator().next(); -// String signature = methodExecution.getSignature(); -// String objectType = methodExecution.getThisClassName(); -// objectType = objectType.substring(objectType.lastIndexOf(".") + 1); -// boolean isConstructor = methodExecution.isConstructor(); -// String declaringType = Trace.getDeclaringType(signature, isConstructor); -// declaringType = declaringType.substring(declaringType.lastIndexOf(".") + 1); -// String methodName = Trace.getMethodName(signature); -// String args = "("; -// String delimiter = ""; -// String[] argArray = signature.split("\\(")[1].split(","); -// for (String arg : argArray) { -// args += (delimiter + arg.substring(arg.lastIndexOf(".") + 1)); -// delimiter = ", "; -// } -// -// StringBuilder sb = new StringBuilder(); -// sb.append(objectType); -// if (!declaringType.equals(objectType)) { -// sb.append("(" + declaringType + ")"); -// } -// sb.append("." + methodName + args); -// return sb.toString(); - } - - public int getLineNo() { - return lineNo; - } - - public List getMethodExecutions() { - return methodExecutions; - } - - public List getTracePoints() { - return tracePoints; - } - - public boolean isAvailable() { - return isAvailable; - } - - public void setAvailable(boolean isAvailable) { - this.isAvailable = isAvailable; - } - - public void changeAvailable() { - isAvailable = !isAvailable; - } -} +package org.ntlab.traceDebugger; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; +import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodInvocation; +import org.ntlab.traceAnalysisPlatform.tracer.trace.Statement; +import org.ntlab.traceAnalysisPlatform.tracer.trace.Trace; +import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; + +public class TraceBreakPoint { + private List tracePoints = new ArrayList<>(); + private String methodSignature; + private String readableSignature; + private int lineNo; + private List methodExecutions = new ArrayList<>(); + private boolean isAvailable = false; + + private TraceBreakPoint(String methodSignature, int lineNo, boolean isAvailable, String readableSignature) { + this.methodSignature = methodSignature; + this.lineNo = lineNo; + this.isAvailable = isAvailable; + this.readableSignature = readableSignature; + } + + public static TraceBreakPoint createNewTraceBreakPoint(String methodSignature, int lineNo, boolean isAvailable, String readableSignature) + throws IllegalArgumentException { + TraceBreakPoint newTraceBreakPoint = new TraceBreakPoint(methodSignature, lineNo, isAvailable, readableSignature); + boolean isValid = newTraceBreakPoint.initTracePoints(methodSignature, lineNo); + if (!isValid) throw new IllegalArgumentException(); + return newTraceBreakPoint; + } + + private boolean initTracePoints(String methodSignature, int lineNo) { + Trace trace = TraceDebuggerPlugin.getAnalyzer().getTrace(); + methodExecutions = trace.getMethodExecutions(methodSignature); + if (methodExecutions.isEmpty()) return false; + tracePoints.clear(); + for (MethodExecution me : methodExecutions) { + int order = 0; + for (Statement statement : me.getStatements()) { + if (statement.getLineNo() == lineNo) { + tracePoints.add(me.getTracePoint(order)); + break; + } + order++; + } + } + if (tracePoints.isEmpty()) return false; + Collections.sort(tracePoints, new Comparator() { + @Override + public int compare(TracePoint o1, TracePoint o2) { + long o1Time = getTime(o1); + long o2Time = getTime(o2); + return (o1Time < o2Time) ? -1 : 1; + } + private long getTime(TracePoint tp) { + Statement statement = tp.getStatement(); + if (statement instanceof MethodInvocation) { + return ((MethodInvocation)statement).getCalledMethodExecution().getEntryTime(); + } + return statement.getTimeStamp(); + } + }); + return true; + } + + public String getMethodSignature() { + return methodSignature; + } + + public String getReadableSignature() { + return readableSignature; + } + + public int getLineNo() { + return lineNo; + } + + public List getMethodExecutions() { + return methodExecutions; + } + + public List getTracePoints() { + return tracePoints; + } + + public boolean isAvailable() { + return isAvailable; + } + + public void setAvailable(boolean isAvailable) { + this.isAvailable = isAvailable; + } + + public void changeAvailable() { + isAvailable = !isAvailable; + } +} diff --git a/src/org/ntlab/traceDebugger/TraceBreakPoints.java b/src/org/ntlab/traceDebugger/TraceBreakPoints.java index 2fd08bf..b1e3eea 100644 --- a/src/org/ntlab/traceDebugger/TraceBreakPoints.java +++ b/src/org/ntlab/traceDebugger/TraceBreakPoints.java @@ -14,7 +14,6 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.jdt.internal.debug.core.breakpoints.JavaLineBreakpoint; -import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodInvocation; import org.ntlab.traceAnalysisPlatform.tracer.trace.Statement; import org.ntlab.traceAnalysisPlatform.tracer.trace.Trace; diff --git a/src/org/ntlab/traceDebugger/TracePointsLabelProvider.java b/src/org/ntlab/traceDebugger/TracePointsLabelProvider.java index 278b1fb..3d4ae2b 100644 --- a/src/org/ntlab/traceDebugger/TracePointsLabelProvider.java +++ b/src/org/ntlab/traceDebugger/TracePointsLabelProvider.java @@ -1,63 +1,55 @@ -package org.ntlab.traceDebugger; - -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; -import org.ntlab.traceAnalysisPlatform.tracer.trace.Trace; -import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; - -public class TracePointsLabelProvider extends LabelProvider implements ITableLabelProvider { - - @Override - public String getColumnText(Object element, int columnIndex) { - if (element instanceof TracePoint) { - TracePoint tp = (TracePoint)element; - switch (columnIndex) { - case 0: - return String.valueOf(tp.getStatement().getLineNo()); - case 1: - return getReadableSignature(tp.getMethodExecution()); - } - } - return "�e�X�g�p�e�L�X�g" + columnIndex; - } - - @Override - public Image getColumnImage(Object element, int columnIndex) { -// return getImage(element); - return null; - } - -// @Override -// public Image getImage(Object element) { -// return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); -// } - - private String getReadableSignature(MethodExecution methodExecution) { - String signature = methodExecution.getSignature(); - String objectType = methodExecution.getThisClassName(); - objectType = objectType.substring(objectType.lastIndexOf(".") + 1); - boolean isConstructor = methodExecution.isConstructor(); - String declaringType = Trace.getDeclaringType(signature, isConstructor); - declaringType = declaringType.substring(declaringType.lastIndexOf(".") + 1); - String methodName = Trace.getMethodName(signature); - String args = "("; - String delimiter = ""; - String[] argArray = signature.split("\\(")[1].split(","); - for (String arg : argArray) { - args += (delimiter + arg.substring(arg.lastIndexOf(".") + 1)); - delimiter = ", "; - } - - StringBuilder sb = new StringBuilder(); - sb.append(objectType); - if (!declaringType.equals(objectType)) { - sb.append("(" + declaringType + ")"); - } - sb.append("." + methodName + args); - return sb.toString(); - } +package org.ntlab.traceDebugger; + +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Image; +import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; +import org.ntlab.traceAnalysisPlatform.tracer.trace.Trace; +import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; + +public class TracePointsLabelProvider extends LabelProvider implements ITableLabelProvider { + + @Override + public String getColumnText(Object element, int columnIndex) { + if (element instanceof TracePoint) { + TracePoint tp = (TracePoint)element; + switch (columnIndex) { + case 0: + return String.valueOf(tp.getStatement().getLineNo()); + case 1: + return getReadableSignature(tp.getMethodExecution()); + } + } + return "�e�X�g�p�e�L�X�g" + columnIndex; + } + + @Override + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + private String getReadableSignature(MethodExecution methodExecution) { + String signature = methodExecution.getSignature(); + String objectType = methodExecution.getThisClassName(); + objectType = objectType.substring(objectType.lastIndexOf(".") + 1); + boolean isConstructor = methodExecution.isConstructor(); + String declaringType = Trace.getDeclaringType(signature, isConstructor); + declaringType = declaringType.substring(declaringType.lastIndexOf(".") + 1); + String methodName = Trace.getMethodName(signature); + String args = "("; + String delimiter = ""; + String[] argArray = signature.split("\\(")[1].split(","); + for (String arg : argArray) { + args += (delimiter + arg.substring(arg.lastIndexOf(".") + 1)); + delimiter = ", "; + } + + StringBuilder sb = new StringBuilder(); + sb.append(objectType); + if (!declaringType.equals(objectType)) { + sb.append("(" + declaringType + ")"); + } + sb.append("." + methodName + args); + return sb.toString(); + } } \ No newline at end of file diff --git a/src/org/ntlab/traceDebugger/VariableView.java b/src/org/ntlab/traceDebugger/VariableView.java index e47f9a7..ed40c40 100644 --- a/src/org/ntlab/traceDebugger/VariableView.java +++ b/src/org/ntlab/traceDebugger/VariableView.java @@ -156,7 +156,6 @@ public void updateVariablesForDifferential(TracePoint from, TracePoint to, boolean isReturned) { variables.updateForDifferential(from, to, isReturned); -// viewer.setInput(variables.getVariablesTreeNodes()); viewer.refresh(); } } diff --git a/src/org/ntlab/traceDebugger/Variables.java b/src/org/ntlab/traceDebugger/Variables.java index b22e95d..705653f 100644 --- a/src/org/ntlab/traceDebugger/Variables.java +++ b/src/org/ntlab/traceDebugger/Variables.java @@ -187,7 +187,6 @@ } private void createSpecialVariables(TracePoint from, TracePoint to, boolean isReturned) { -// List list = new ArrayList<>(); List specialVariablesOfUseSide = new ArrayList<>(); List specialVariablesDefSide = new ArrayList<>(); String parentNodeNameOfUseSide = null; diff --git a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java index cd2ecaf..6a28e62 100644 --- a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java +++ b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java @@ -156,15 +156,11 @@ List> relatedAliasesList = new ArrayList<>(); relatedAliasesList.add(dstSideAliases); relatedAliasesList.add(srcSideAliases); -// String[] messagesTemplates = TraceDebuggerPlugin.isJapanese() ? new String[]{"�Q�Ɛ摤%03d", "�Q�ƌ���%03d"} -// : new String[]{"ReferredSide%03d", "ReferringSide%03d"}; String[] markerIDList = {DST_SIDE_DELTA_MARKER, SRC_SIDE_DELTA_MARKER}; for (int i = 0; i < relatedAliasesList.size(); i++) { List relatedAliases = relatedAliasesList.get(i); Collections.reverse(relatedAliases); -// int cnt = 1; for (Alias alias : relatedAliases) { -// String message = String.format(messagesTemplates[i], cnt++); markAndOpenJavaFileForAlias(alias, "", markerIDList[i]); } } @@ -252,7 +248,6 @@ Map attributes = new HashMap<>(); setAttributesForAlias(attributes, alias, file, markerId); if (!(attributes.containsKey(IMarker.LINE_NUMBER))) { -// attributes.put(IMarker.LINE_NUMBER, alias.getLineNo() + " (no marker)"); attributes.put(IMarker.LINE_NUMBER, alias.getLineNo()); } attributes.put(IMarker.MESSAGE, message); @@ -318,7 +313,6 @@ markerIdToMarkers.put(markerId, markerList); } markerList.add(marker); -// orderedMarkers.add(marker); } private void setAttributesForAlias(final Map attributes, Alias alias, IFile file, String markerId) { diff --git a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaRelatedAliasCollector.java b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaRelatedAliasCollector.java index f933e4c..5542610 100644 --- a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaRelatedAliasCollector.java +++ b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaRelatedAliasCollector.java @@ -78,11 +78,6 @@ } else { dstSideIdList.add(to); } -// if (srcSideIdList.contains(from)) { -// srcSideIdList.add(to); -// } else if (dstSideIdList.contains(from)) { -// dstSideIdList.add(to); -// } } public List getRelatedAliases() { diff --git a/src/org/ntlab/traceDebugger/analyzerProvider/ExtractedStructure.java b/src/org/ntlab/traceDebugger/analyzerProvider/ExtractedStructure.java index 8bea6d8..922d9b6 100644 --- a/src/org/ntlab/traceDebugger/analyzerProvider/ExtractedStructure.java +++ b/src/org/ntlab/traceDebugger/analyzerProvider/ExtractedStructure.java @@ -1,107 +1,67 @@ -package org.ntlab.traceDebugger.analyzerProvider; - -import java.util.ArrayList; -import java.util.List; - -import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; -import org.ntlab.traceAnalysisPlatform.tracer.trace.Reference; -import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; - - -public class ExtractedStructure { - - private Delta delta = new Delta(); - private MethodExecution coordinator = null; - private MethodExecution parent = null; - private MethodExecution creationCallTree; -// private List srcSideRelatedTracePoints = new ArrayList<>(); -// private List dstSideRelatedTracePoints = new ArrayList<>(); -// private List srcSideRelatedAliases = new ArrayList<>(); -// private List dstSideRelatedAliases = new ArrayList<>(); - - public Delta getDelta() { - return delta; - } - - public MethodExecution getCoordinator() { - return coordinator; - } - - /** - * ������ ������ɍ폜���邱�� - * @param coordinator - */ - public void setCoordinator(MethodExecution coordinator) { - this.coordinator = coordinator; - } - - public void createParent(MethodExecution methodExecution) { - coordinator = methodExecution; - parent = null; - } - -// public void addParent(MethodExecution callTree) { -// if (parent == null) -// coordinator.addChild(parent = callTree); -// else -// parent.addChild(parent = callTree); -// } -// -// public void addChild(MethodExecution callTree) { -// if (parent == null) -// coordinator.addChild(callTree); -// else -// parent.addChild(callTree); -// } -// - public void addSrcSide(Reference reference) { - delta.addSrcSide(reference); - } - - public void addDstSide(Reference reference) { - delta.addDstSide(reference); - } - - public void changeParent() { - } - - public void setCreationMethodExecution(MethodExecution callTree) { - creationCallTree = callTree; - } - - public MethodExecution getCreationCallTree() { - return creationCallTree; - } - -// public List getSrcSideRelatedTracePoints() { -// return srcSideRelatedTracePoints; -// } -// -// public List getDstSideRelatedTracePoints() { -// return dstSideRelatedTracePoints; -// } -// -// public void addSrcSideRelatedTracePoint(TracePoint tp) { -// srcSideRelatedTracePoints.add(tp); -// } -// -// public void addDstSideRelatedTracePoint(TracePoint tp) { -// dstSideRelatedTracePoints.add(tp); -// } - -// public List getSrcSideRelatedAliases() { -// return srcSideRelatedAliases; -// } -// -// public List getDstSideRelatedAliases() { -// return dstSideRelatedAliases; -// } -// -// public void addSrcSideRelatedAlias(Alias alias) { -// srcSideRelatedAliases.add(alias); -// } -// -// public void addDstSideRelatedAlias(Alias alias) { -// dstSideRelatedAliases.add(alias); -// } -} +package org.ntlab.traceDebugger.analyzerProvider; + +import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; +import org.ntlab.traceAnalysisPlatform.tracer.trace.Reference; + + +public class ExtractedStructure { + + private Delta delta = new Delta(); + private MethodExecution coordinator = null; + private MethodExecution parent = null; + private MethodExecution creationCallTree; + + public Delta getDelta() { + return delta; + } + + public MethodExecution getCoordinator() { + return coordinator; + } + + /** + * ������ ������ɍ폜���邱�� + * @param coordinator + */ + public void setCoordinator(MethodExecution coordinator) { + this.coordinator = coordinator; + } + + public void createParent(MethodExecution methodExecution) { + coordinator = methodExecution; + parent = null; + } + +// public void addParent(MethodExecution callTree) { +// if (parent == null) +// coordinator.addChild(parent = callTree); +// else +// parent.addChild(parent = callTree); +// } +// +// public void addChild(MethodExecution callTree) { +// if (parent == null) +// coordinator.addChild(callTree); +// else +// parent.addChild(callTree); +// } +// + public void addSrcSide(Reference reference) { + delta.addSrcSide(reference); + } + + public void addDstSide(Reference reference) { + delta.addDstSide(reference); + } + + public void changeParent() { + } + + public void setCreationMethodExecution(MethodExecution callTree) { + creationCallTree = callTree; + } + + public MethodExecution getCreationCallTree() { + return creationCallTree; + } +}