1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-05 08:05:24 +02:00

Bug 158300 - The inherit and history buttons have been modified to read the nearest containing group's text (if any) in addition to its own tooltip. It previously read just its tooltip.

This commit is contained in:
David Dykstal 2006-10-24 20:30:49 +00:00
parent 6914dc5e6a
commit 064d2fd62a
2 changed files with 30 additions and 4 deletions

View file

@ -31,6 +31,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
/**
* An InheritButton is a specialized control that
@ -89,10 +90,22 @@ public class InheritButton extends Composite {
createToggleImages(toggle.getBackground());
toggle.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard.
e.result = getToolTipText();
e.result = "";
}
public void getName(AccessibleEvent e) { // this is the one that apparently does supply the text heard.
e.result = getToolTipText();
e.result = toggle.getToolTipText();
String prefix = null;
Composite parent = toggle.getParent();
while (parent != null && prefix == null) {
if (parent instanceof Group) {
Group group = (Group) parent;
prefix = group.getText();
}
parent = parent.getParent();
}
if (prefix != null) {
e.result = prefix + " " + e.result;
}
}
});
toggle.addDisposeListener(new DisposeListener() {

View file

@ -40,6 +40,7 @@ import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
/**
@ -409,7 +410,7 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
{
historyCombo.removeModifyListener(listener);
}
/**
* Return the current history for the directory combo box
*/
@ -635,10 +636,22 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
historyButton.setToolTipText(SystemResources.RESID_WORKWITHHISTORY_BUTTON_TIP);
historyButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard.
e.result = historyButton.getToolTipText();
e.result = "";
}
public void getName(AccessibleEvent e) { // this is the one that apparently does supply the text heard.
e.result = historyButton.getToolTipText();
String prefix = null;
Composite parent = historyButton.getParent();
while (parent != null && prefix == null) {
if (parent instanceof Group) {
Group group = (Group) parent;
prefix = group.getText();
}
parent = parent.getParent();
}
if (prefix != null) {
e.result = prefix + " " + e.result;
}
}
});