mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 82264: Enhance the Shared Libraries view. Implementing module's properties.
This commit is contained in:
parent
6aa0d47d52
commit
0db65d300f
4 changed files with 109 additions and 53 deletions
|
@ -1,3 +1,10 @@
|
|||
2005-02-14 Mikhail Khodjaiants
|
||||
Bug 82264: Enhance the Shared Libraries view.
|
||||
Implementing module's properties.
|
||||
* PropertyPageMessages.properties
|
||||
* CModuleProperties.java
|
||||
* ModulePropertyPage.java
|
||||
|
||||
2005-02-11 Mikhail Khodjaiants
|
||||
Bug 82264: Enhance the Shared Libraries view.
|
||||
Implementing module's properties.
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import org.eclipse.cdt.debug.core.model.ICModule;
|
||||
|
||||
/**
|
||||
|
@ -25,31 +25,52 @@ public class CModuleProperties {
|
|||
final static public String SYMBOLS_LOADED = "symbolsLoaded"; //$NON-NLS-1$
|
||||
final static public String SYMBOLS_FILE = "symbolsFile"; //$NON-NLS-1$
|
||||
|
||||
private HashMap fMap;
|
||||
public class Property {
|
||||
|
||||
private String fKey;
|
||||
private Object fValue;
|
||||
|
||||
/**
|
||||
* Constructor for Property.
|
||||
*/
|
||||
public Property( String key, Object value ) {
|
||||
fKey = key;
|
||||
fValue = value;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return fKey;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return fValue;
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList fProperties;
|
||||
|
||||
static CModuleProperties create( ICModule module ) {
|
||||
CModuleProperties p = new CModuleProperties();
|
||||
p.setProperty( TYPE, new Integer( module.getType() ) );
|
||||
p.setProperty( CPU, module.getCPU() );
|
||||
p.setProperty( BASE_ADDRESS, module.getBaseAddress() );
|
||||
p.setProperty( SIZE, new Long( module.getSize() ) );
|
||||
p.setProperty( SYMBOLS_LOADED, new Boolean( module.areSymbolsLoaded() ) );
|
||||
p.setProperty( SYMBOLS_FILE, module.getSymbolsFileName() );
|
||||
return p;
|
||||
return new CModuleProperties( module );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CModuleProperties.
|
||||
*/
|
||||
private CModuleProperties() {
|
||||
fMap = new HashMap( 5 );
|
||||
private CModuleProperties( ICModule module ) {
|
||||
fProperties = new ArrayList( 10 );
|
||||
fProperties.add( new Property( TYPE, new Integer( module.getType() ) ) );
|
||||
fProperties.add( new Property( CPU, module.getCPU() ) );
|
||||
fProperties.add( new Property( BASE_ADDRESS, module.getBaseAddress() ) );
|
||||
fProperties.add( new Property( SIZE, new Long( module.getSize() ) ) );
|
||||
fProperties.add( new Property( SYMBOLS_LOADED, new Boolean( module.areSymbolsLoaded() ) ) );
|
||||
fProperties.add( new Property( SYMBOLS_FILE, module.getSymbolsFileName() ) );
|
||||
}
|
||||
|
||||
private void setProperty( String key, Object value ) {
|
||||
fMap.put( key, value );
|
||||
public Property[] getProperties() {
|
||||
return (Property[])fProperties.toArray( new Property[fProperties.size()] );
|
||||
}
|
||||
|
||||
public Object[] getProperties() {
|
||||
return fMap.entrySet().toArray();
|
||||
public void dispose() {
|
||||
fProperties.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
||||
|
||||
import java.util.Map;
|
||||
import org.eclipse.cdt.core.IAddress;
|
||||
import org.eclipse.cdt.debug.core.model.ICModule;
|
||||
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
||||
|
@ -49,59 +48,57 @@ public class ModulePropertyPage extends PropertyPage {
|
|||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
|
||||
*/
|
||||
public String getColumnText( Object element, int columnIndex ) {
|
||||
if ( element instanceof Map.Entry ) {
|
||||
Map.Entry entry = (Map.Entry)element;
|
||||
if ( CModuleProperties.TYPE.equals( entry.getKey() ) ) {
|
||||
if ( element instanceof CModuleProperties.Property ) {
|
||||
CModuleProperties.Property property = (CModuleProperties.Property)element;
|
||||
if ( CModuleProperties.TYPE.equals( property.getKey() ) ) {
|
||||
if ( columnIndex == 0 ) {
|
||||
return "Type";
|
||||
return PropertyPageMessages.getString( "ModulePropertyPage.0" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
Integer type = (Integer)entry.getValue();
|
||||
if ( type.intValue() == ICModule.EXECUTABLE ) {
|
||||
return "executable";
|
||||
}
|
||||
if ( type.intValue() == ICModule.SHARED_LIBRARY ) {
|
||||
return "shared library";
|
||||
}
|
||||
if ( type.intValue() == ICModule.CORE ) {
|
||||
return "core file";
|
||||
}
|
||||
Integer type = (Integer)property.getValue();
|
||||
if ( type.intValue() == ICModule.EXECUTABLE ) {
|
||||
return PropertyPageMessages.getString( "ModulePropertyPage.1" ); //$NON-NLS-1$
|
||||
}
|
||||
if ( type.intValue() == ICModule.SHARED_LIBRARY ) {
|
||||
return PropertyPageMessages.getString( "ModulePropertyPage.2" ); //$NON-NLS-1$
|
||||
}
|
||||
if ( type.intValue() == ICModule.CORE ) {
|
||||
return PropertyPageMessages.getString( "ModulePropertyPage.3" ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
else if ( CModuleProperties.CPU.equals( entry.getKey() ) ) {
|
||||
else if ( CModuleProperties.CPU.equals( property.getKey() ) ) {
|
||||
if ( columnIndex == 0 ) {
|
||||
return "CPU";
|
||||
return PropertyPageMessages.getString( "ModulePropertyPage.4" ); //$NON-NLS-1$
|
||||
}
|
||||
String cpu = (String)entry.getValue();
|
||||
return ( cpu != null ) ? cpu : "not available";
|
||||
String cpu = (String)property.getValue();
|
||||
return ( cpu != null ) ? cpu : PropertyPageMessages.getString( "ModulePropertyPage.5" ); //$NON-NLS-1$
|
||||
}
|
||||
else if ( CModuleProperties.BASE_ADDRESS.equals( entry.getKey() ) ) {
|
||||
else if ( CModuleProperties.BASE_ADDRESS.equals( property.getKey() ) ) {
|
||||
if ( columnIndex == 0 ) {
|
||||
return "Base address";
|
||||
return PropertyPageMessages.getString( "ModulePropertyPage.6" ); //$NON-NLS-1$
|
||||
}
|
||||
IAddress address = (IAddress)entry.getValue();
|
||||
return ( address != null && !address.isZero() ) ? address.toHexAddressString() : "not available";
|
||||
IAddress address = (IAddress)property.getValue();
|
||||
return ( address != null && !address.isZero() ) ? address.toHexAddressString() : PropertyPageMessages.getString( "ModulePropertyPage.7" ); //$NON-NLS-1$
|
||||
}
|
||||
else if ( CModuleProperties.SIZE.equals( entry.getKey() ) ) {
|
||||
else if ( CModuleProperties.SIZE.equals( property.getKey() ) ) {
|
||||
if ( columnIndex == 0 ) {
|
||||
return "Size";
|
||||
return PropertyPageMessages.getString( "ModulePropertyPage.8" ); //$NON-NLS-1$
|
||||
}
|
||||
Long size = (Long)entry.getValue();
|
||||
return ( size != null && size.longValue() > 0 ) ? size.toString() : "not available";
|
||||
Long size = (Long)property.getValue();
|
||||
return ( size != null && size.longValue() > 0 ) ? size.toString() : PropertyPageMessages.getString( "ModulePropertyPage.9" ); //$NON-NLS-1$
|
||||
}
|
||||
else if ( CModuleProperties.SYMBOLS_LOADED.equals( entry.getKey() ) ) {
|
||||
else if ( CModuleProperties.SYMBOLS_LOADED.equals( property.getKey() ) ) {
|
||||
if ( columnIndex == 0 ) {
|
||||
return "Symbols";
|
||||
return PropertyPageMessages.getString( "ModulePropertyPage.10" ); //$NON-NLS-1$
|
||||
}
|
||||
Boolean loaded = (Boolean)entry.getValue();
|
||||
return ( loaded != null && loaded.booleanValue() ) ? "loaded" : "not loaded";
|
||||
Boolean loaded = (Boolean)property.getValue();
|
||||
return ( loaded != null && loaded.booleanValue() ) ? PropertyPageMessages.getString( "ModulePropertyPage.11" ) : PropertyPageMessages.getString( "ModulePropertyPage.12" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
else if ( CModuleProperties.SYMBOLS_FILE.equals( entry.getKey() ) ) {
|
||||
else if ( CModuleProperties.SYMBOLS_FILE.equals( property.getKey() ) ) {
|
||||
if ( columnIndex == 0 ) {
|
||||
return "Symbols file";
|
||||
return PropertyPageMessages.getString( "ModulePropertyPage.13" ); //$NON-NLS-1$
|
||||
}
|
||||
IPath path = (IPath)entry.getValue();
|
||||
return ( path != null ) ? path.toOSString() : "not found";
|
||||
IPath path = (IPath)property.getValue();
|
||||
return ( path != null ) ? path.toOSString() : PropertyPageMessages.getString( "ModulePropertyPage.14" ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -110,6 +107,8 @@ public class ModulePropertyPage extends PropertyPage {
|
|||
|
||||
public class ModulePropertyContentProvider implements IStructuredContentProvider {
|
||||
|
||||
private CModuleProperties fProperties = null;
|
||||
|
||||
/**
|
||||
* Constructor for ModulePropertyContentProvider.
|
||||
*/
|
||||
|
@ -122,7 +121,10 @@ public class ModulePropertyPage extends PropertyPage {
|
|||
*/
|
||||
public Object[] getElements( Object inputElement ) {
|
||||
if ( inputElement instanceof ICModule ) {
|
||||
return CModuleProperties.create( (ICModule)inputElement ).getProperties();
|
||||
if ( fProperties == null ) {
|
||||
fProperties = CModuleProperties.create( (ICModule)inputElement );
|
||||
}
|
||||
return fProperties.getProperties();
|
||||
}
|
||||
return new Object[0];
|
||||
}
|
||||
|
@ -131,12 +133,23 @@ public class ModulePropertyPage extends PropertyPage {
|
|||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||
*/
|
||||
public void dispose() {
|
||||
disposeProperties();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
|
||||
if ( oldInput != null && oldInput.equals( newInput ) )
|
||||
return;
|
||||
disposeProperties();
|
||||
}
|
||||
|
||||
private void disposeProperties() {
|
||||
if ( fProperties != null ) {
|
||||
fProperties.dispose();
|
||||
fProperties = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,3 +36,18 @@ SignalPropertyPage.2=Suspend the program when this signal happens.
|
|||
SignalPropertyPage.3=Error
|
||||
SignalPropertyPage.4=Operation failed.
|
||||
SignalPropertyPage.5=Unable to change signal properties.
|
||||
ModulePropertyPage.0=Type
|
||||
ModulePropertyPage.1=executable
|
||||
ModulePropertyPage.2=shared library
|
||||
ModulePropertyPage.3=core file
|
||||
ModulePropertyPage.4=CPU
|
||||
ModulePropertyPage.5=not available
|
||||
ModulePropertyPage.6=Base address
|
||||
ModulePropertyPage.7=not available
|
||||
ModulePropertyPage.8=Size
|
||||
ModulePropertyPage.9=not available
|
||||
ModulePropertyPage.10=Symbols
|
||||
ModulePropertyPage.11=loaded
|
||||
ModulePropertyPage.12=not loaded
|
||||
ModulePropertyPage.13=Symbols file
|
||||
ModulePropertyPage.14=not found
|
||||
|
|
Loading…
Add table
Reference in a new issue