Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 220191 Details for
Bug 386149
[debugger] Debug Inspector window showing wrong order of arrays
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
path proposal
0001-Bug-386149-debugger-Debug-Inspector-window-showing-w.patch (text/plain), 3.15 KB, created by
Marc Aubry
on 2012-08-23 05:33:34 EDT
(
hide
)
Description:
path proposal
Filename:
MIME Type:
Creator:
Marc Aubry
Created:
2012-08-23 05:33:34 EDT
Size:
3.15 KB
patch
obsolete
>From e3ab089494cf80fd46fbd47d10f32c67c1e40661 Mon Sep 17 00:00:00 2001 >From: Marc Aubry <maubry@sierrawireless.com> >Date: Thu, 23 Aug 2012 11:03:15 +0200 >Subject: [PATCH] Bug 386149 - [debugger] Debug Inspector window showing wrong > order of arrays > >--- > .../debug/core/internal/LuaVariableComparator.java | 40 ++++++++++++++++++-- > 1 file changed, 37 insertions(+), 3 deletions(-) > >diff --git a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaVariableComparator.java b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaVariableComparator.java >index a20cea1..8ca016e 100644 >--- a/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaVariableComparator.java >+++ b/plugins/org.eclipse.koneki.ldt.debug.core/src/org/eclipse/koneki/ldt/debug/core/internal/LuaVariableComparator.java >@@ -12,6 +12,8 @@ package org.eclipse.koneki.ldt.debug.core.internal; > > import java.io.Serializable; > import java.util.Comparator; >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; > > import org.eclipse.debug.core.DebugException; > import org.eclipse.debug.core.model.IVariable; >@@ -20,10 +22,27 @@ import org.eclipse.koneki.ldt.debug.core.LuaDebugConstants; > public class LuaVariableComparator implements Comparator<IVariable>, Serializable { > private static final long serialVersionUID = -5828968181211469862L; > >- public int category(IVariable var) throws DebugException { >+ private static final Pattern BRACKET_PATTERN = Pattern.compile("^\\[(.*)\\]$"); //$NON-NLS-1$ >+ >+ private int category(IVariable var) throws DebugException { > return var.getReferenceTypeName().equals(LuaDebugConstants.TYPE_SPECIAL) ? 0 : 1; > } > >+ private String extractValueFromBracket(String key) { >+ Matcher matcher = BRACKET_PATTERN.matcher(key); >+ if (matcher.find()) >+ return matcher.group(1); >+ return null; >+ } >+ >+ private Integer getArrayVarIndex(IVariable var) throws DebugException { >+ try { >+ return Integer.valueOf(extractValueFromBracket(var.getName())); >+ } catch (NumberFormatException e) { >+ return null; >+ } >+ } >+ > @Override > public int compare(IVariable v1, IVariable v2) { > try { >@@ -34,10 +53,25 @@ public class LuaVariableComparator implements Comparator<IVariable>, Serializabl > return cat1 - cat2; > } > >- return v1.getName().compareTo(v2.getName()); >+ // Bug 386149 - [debugger] Debug Inspector window showing wrong order of arrays >+ // In arrays and tables key are also sorted but keys can be numbers and strings >+ // Instead to always sort my variable name, check if both var name is numbers, and compare by numbers >+ if (getArrayVarIndex(v1) != null && getArrayVarIndex(v2) != null) { >+ return getArrayVarIndex(v1) - getArrayVarIndex(v2); >+ } >+ // if just one of the var name is a number, put numbers first >+ else if (getArrayVarIndex(v1) != null) { >+ return -1; >+ } else if (getArrayVarIndex(v2) != null) { >+ return 1; >+ } >+ // if none of the vars name are numbers, compare name using String method >+ else { >+ return v1.getName().compareTo(v2.getName()); >+ } >+ > } catch (DebugException e) { > return 0; > } > } >- > } >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 386149
: 220191 |
237388