1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 474612 - Number format detail Shall report Error details of selected

items

Change-Id: Ie96e37912f8f32cd632a8bd6c4c0497fb5f27c5f
This commit is contained in:
Alvaro Sanchez-Leon 2015-08-10 16:30:54 -04:00
parent fbee145ff0
commit 22e7d3a7ba
3 changed files with 20 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2009 IBM Corporation and others.
* Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -22,6 +22,7 @@ public class MessagesForNumberFormatDetailPane extends NLS {
public static String NumberFormatDetailPane_Spaces_label;
public static String NumberFormatDetailPane_CarriageReturn_label;
public static String NumberFormatDetailPane_DotDotDot_label;
public static String NumberFormatDetailPane__End_parentheses;
static {
// initialize resource bundle

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2006, 2009 IBM Corporation and others.
# Copyright (c) 2006, 2015 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -14,3 +14,4 @@ NumberFormatDetailPane_Name_label=Name :
NumberFormatDetailPane_Spaces_label=\t
NumberFormatDetailPane_CarriageReturn_label=\n
NumberFormatDetailPane_DotDotDot_label=...
NumberFormatDetailPane__End_parentheses=)

View file

@ -254,6 +254,7 @@ public class NumberFormatDetailPane implements IDetailPane2, IAdaptable, IProper
public static String SPACES = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Spaces_label;
public static String CRLF = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_CarriageReturn_label;
public static String DOTS = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_DotDotDot_label;
public static String PARENTHESES = MessagesForNumberFormatDetailPane.NumberFormatDetailPane__End_parentheses;
/**
* Job to compute the details for a selection
@ -353,7 +354,21 @@ public class NumberFormatDetailPane implements IDetailPane2, IAdaptable, IProper
@Override
protected void handleErrorOrWarning() {
detailComputed(null, getStatus().getMessage());
String rootMessage = new String(getStatus().getMessage()).trim();
// Provide a detail Error message to the user
StringBuilder finalResult = new StringBuilder(rootMessage);
IStatus[] statuses = getStatus().getChildren();
if (statuses != null) {
for (int i=0; i < statuses.length; i++) {
String childMessage = statuses[i].getMessage().trim();
// Avoid root message duplication
if (!childMessage.equals(rootMessage)) {
finalResult.append(CRLF + CRLF + (i+1) + PARENTHESES + childMessage);
}
}
}
detailComputed(null, finalResult.toString());
};
})
});