mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +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
|
2005-02-11 Mikhail Khodjaiants
|
||||||
Bug 82264: Enhance the Shared Libraries view.
|
Bug 82264: Enhance the Shared Libraries view.
|
||||||
Implementing module's properties.
|
Implementing module's properties.
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
import org.eclipse.cdt.debug.core.model.ICModule;
|
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_LOADED = "symbolsLoaded"; //$NON-NLS-1$
|
||||||
final static public String SYMBOLS_FILE = "symbolsFile"; //$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 ) {
|
static CModuleProperties create( ICModule module ) {
|
||||||
CModuleProperties p = new CModuleProperties();
|
return new CModuleProperties( module );
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CModuleProperties.
|
* Constructor for CModuleProperties.
|
||||||
*/
|
*/
|
||||||
private CModuleProperties() {
|
private CModuleProperties( ICModule module ) {
|
||||||
fMap = new HashMap( 5 );
|
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 ) {
|
public Property[] getProperties() {
|
||||||
fMap.put( key, value );
|
return (Property[])fProperties.toArray( new Property[fProperties.size()] );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] getProperties() {
|
public void dispose() {
|
||||||
return fMap.entrySet().toArray();
|
fProperties.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.debug.core.model.ICModule;
|
import org.eclipse.cdt.debug.core.model.ICModule;
|
||||||
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
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)
|
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
|
||||||
*/
|
*/
|
||||||
public String getColumnText( Object element, int columnIndex ) {
|
public String getColumnText( Object element, int columnIndex ) {
|
||||||
if ( element instanceof Map.Entry ) {
|
if ( element instanceof CModuleProperties.Property ) {
|
||||||
Map.Entry entry = (Map.Entry)element;
|
CModuleProperties.Property property = (CModuleProperties.Property)element;
|
||||||
if ( CModuleProperties.TYPE.equals( entry.getKey() ) ) {
|
if ( CModuleProperties.TYPE.equals( property.getKey() ) ) {
|
||||||
if ( columnIndex == 0 ) {
|
if ( columnIndex == 0 ) {
|
||||||
return "Type";
|
return PropertyPageMessages.getString( "ModulePropertyPage.0" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else {
|
Integer type = (Integer)property.getValue();
|
||||||
Integer type = (Integer)entry.getValue();
|
if ( type.intValue() == ICModule.EXECUTABLE ) {
|
||||||
if ( type.intValue() == ICModule.EXECUTABLE ) {
|
return PropertyPageMessages.getString( "ModulePropertyPage.1" ); //$NON-NLS-1$
|
||||||
return "executable";
|
}
|
||||||
}
|
if ( type.intValue() == ICModule.SHARED_LIBRARY ) {
|
||||||
if ( type.intValue() == ICModule.SHARED_LIBRARY ) {
|
return PropertyPageMessages.getString( "ModulePropertyPage.2" ); //$NON-NLS-1$
|
||||||
return "shared library";
|
}
|
||||||
}
|
if ( type.intValue() == ICModule.CORE ) {
|
||||||
if ( type.intValue() == ICModule.CORE ) {
|
return PropertyPageMessages.getString( "ModulePropertyPage.3" ); //$NON-NLS-1$
|
||||||
return "core file";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( CModuleProperties.CPU.equals( entry.getKey() ) ) {
|
else if ( CModuleProperties.CPU.equals( property.getKey() ) ) {
|
||||||
if ( columnIndex == 0 ) {
|
if ( columnIndex == 0 ) {
|
||||||
return "CPU";
|
return PropertyPageMessages.getString( "ModulePropertyPage.4" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
String cpu = (String)entry.getValue();
|
String cpu = (String)property.getValue();
|
||||||
return ( cpu != null ) ? cpu : "not available";
|
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 ) {
|
if ( columnIndex == 0 ) {
|
||||||
return "Base address";
|
return PropertyPageMessages.getString( "ModulePropertyPage.6" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
IAddress address = (IAddress)entry.getValue();
|
IAddress address = (IAddress)property.getValue();
|
||||||
return ( address != null && !address.isZero() ) ? address.toHexAddressString() : "not available";
|
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 ) {
|
if ( columnIndex == 0 ) {
|
||||||
return "Size";
|
return PropertyPageMessages.getString( "ModulePropertyPage.8" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
Long size = (Long)entry.getValue();
|
Long size = (Long)property.getValue();
|
||||||
return ( size != null && size.longValue() > 0 ) ? size.toString() : "not available";
|
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 ) {
|
if ( columnIndex == 0 ) {
|
||||||
return "Symbols";
|
return PropertyPageMessages.getString( "ModulePropertyPage.10" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
Boolean loaded = (Boolean)entry.getValue();
|
Boolean loaded = (Boolean)property.getValue();
|
||||||
return ( loaded != null && loaded.booleanValue() ) ? "loaded" : "not loaded";
|
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 ) {
|
if ( columnIndex == 0 ) {
|
||||||
return "Symbols file";
|
return PropertyPageMessages.getString( "ModulePropertyPage.13" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
IPath path = (IPath)entry.getValue();
|
IPath path = (IPath)property.getValue();
|
||||||
return ( path != null ) ? path.toOSString() : "not found";
|
return ( path != null ) ? path.toOSString() : PropertyPageMessages.getString( "ModulePropertyPage.14" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -110,6 +107,8 @@ public class ModulePropertyPage extends PropertyPage {
|
||||||
|
|
||||||
public class ModulePropertyContentProvider implements IStructuredContentProvider {
|
public class ModulePropertyContentProvider implements IStructuredContentProvider {
|
||||||
|
|
||||||
|
private CModuleProperties fProperties = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for ModulePropertyContentProvider.
|
* Constructor for ModulePropertyContentProvider.
|
||||||
*/
|
*/
|
||||||
|
@ -122,7 +121,10 @@ public class ModulePropertyPage extends PropertyPage {
|
||||||
*/
|
*/
|
||||||
public Object[] getElements( Object inputElement ) {
|
public Object[] getElements( Object inputElement ) {
|
||||||
if ( inputElement instanceof ICModule ) {
|
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];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
@ -131,12 +133,23 @@ public class ModulePropertyPage extends PropertyPage {
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
disposeProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
* @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 ) {
|
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.3=Error
|
||||||
SignalPropertyPage.4=Operation failed.
|
SignalPropertyPage.4=Operation failed.
|
||||||
SignalPropertyPage.5=Unable to change signal properties.
|
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