1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added tooltips to the Memory view's tabs.

This commit is contained in:
Mikhail Khodjaiants 2002-11-13 19:58:23 +00:00
parent 9f5ea6519c
commit 7b0abedd4f
2 changed files with 37 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2002-11-13 Mikhail Khodjaiants
Added tooltips to the Memory view's tabs.
* MemoryControlArea.java
2002-11-13 Mikhail Khodjaiants
Added the 'Auto-Refresh by default' and 'Show ASCII by default' preferences
to the 'Memory Views' preference page.

View file

@ -69,6 +69,7 @@ public class MemoryControlArea extends Composite
fAddressText = createAddressText( this );
fMemoryText = createMemoryText( this, style, fPresentation );
setDefaultPreferences();
updateToolTipText();
}
private void setDefaultPreferences()
@ -257,6 +258,7 @@ public class MemoryControlArea extends Composite
getPresentation().setMemoryBlock( getMemoryBlock() );
}
setMemoryTextState();
updateToolTipText();
}
private void removeBlock() throws DebugException
@ -267,6 +269,7 @@ public class MemoryControlArea extends Composite
getPresentation().setMemoryBlock( null );
}
setMemoryTextState();
updateToolTipText();
}
public int getFormat()
@ -392,6 +395,16 @@ public class MemoryControlArea extends Composite
}
}
protected void setTabItemToolTipText( String text )
{
String newText = replaceMnemonicCharacters( text );
if ( getParent() instanceof CTabFolder )
{
CTabItem[] tabItems = ((CTabFolder)getParent()).getItems();
tabItems[fIndex].setToolTipText( "Memory View " + (fIndex + 1) + ": " + newText );
}
}
protected void refreshMemoryBlock()
{
if ( getMemoryBlock() != null )
@ -426,4 +439,24 @@ public class MemoryControlArea extends Composite
}
}
}
private void updateToolTipText()
{
setTabItemToolTipText( fAddressText.getText().trim() );
}
private String replaceMnemonicCharacters( String text )
{
StringBuffer sb = new StringBuffer( text.length() );
for ( int i = 0; i < text.length(); ++i )
{
char ch = text.charAt( i );
sb.append( ch );
if ( ch == '&' )
{
sb.append( ch );
}
}
return sb.toString();
}
}