mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Added Properties for Binaries
This commit is contained in:
parent
3a4bc9b140
commit
3dc5e212e0
5 changed files with 38 additions and 104 deletions
|
@ -1,3 +1,13 @@
|
|||
2004-04-15 Alain Magloire
|
||||
|
||||
Added Properties for the Binaries.
|
||||
* src/org/eclipse/cdt/internal/ui/BinaryProjectSource.java
|
||||
* src/org/eclipse/cdt/internal/ui/CElementAdapterFactory.java
|
||||
* src/org/eclipse/cdt/internla/ui/CElementPropertySource.java
|
||||
|
||||
removed unused files
|
||||
* src/org/eclipse/cdt/internal/ui/CElementProperties.java
|
||||
|
||||
2004-04-15 Hoda Amer
|
||||
Fix for bug#58566 : [Refactoring] renaming #define statements
|
||||
Fix for bug#58335 : [Content Assist] Class forward declarations not reported
|
||||
|
|
|
@ -7,12 +7,14 @@ package org.eclipse.cdt.internal.ui;
|
|||
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||
import org.eclipse.ui.views.properties.FilePropertySource;
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
import org.eclipse.ui.views.properties.IPropertySource;
|
||||
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||
|
||||
public class BinaryPropertySource implements IPropertySource {
|
||||
public class BinaryPropertySource extends FilePropertySource implements IPropertySource {
|
||||
|
||||
private final static String ELF_CPU= "CElementProperties.elf_cpu"; //$NON-NLS-1$
|
||||
private final static String ELF_TEXT= "CElementProperties.elf_text"; //$NON-NLS-1$
|
||||
|
@ -78,6 +80,7 @@ public class BinaryPropertySource implements IPropertySource {
|
|||
}
|
||||
|
||||
public BinaryPropertySource(IBinary bin) {
|
||||
super((IFile)bin.getResource());
|
||||
binary= bin;
|
||||
}
|
||||
|
||||
|
@ -85,8 +88,9 @@ public class BinaryPropertySource implements IPropertySource {
|
|||
* @see IPropertySource#getPropertyDescriptors
|
||||
*/
|
||||
public IPropertyDescriptor[] getPropertyDescriptors() {
|
||||
if (fgPropertyDescriptors == null)
|
||||
if (fgPropertyDescriptors == null) {
|
||||
initializeBinaryDescriptors();
|
||||
}
|
||||
return fgPropertyDescriptors;
|
||||
}
|
||||
|
||||
|
@ -94,12 +98,12 @@ public class BinaryPropertySource implements IPropertySource {
|
|||
* @see IPropertySource#getPropertyValue
|
||||
*/
|
||||
public Object getPropertyValue(Object name) {
|
||||
// if (element != null) {
|
||||
// Object returnValue = super.getPropertyValue(name);
|
||||
//
|
||||
// if(returnValue != null)
|
||||
// return returnValue;
|
||||
// }
|
||||
if (element != null) {
|
||||
Object returnValue = super.getPropertyValue(name);
|
||||
if(returnValue != null) {
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
if (name.equals(IBasicPropertyConstants.P_TEXT)) {
|
||||
return binary.getElementName();
|
||||
} else if (name.equals(ICElementPropertyConstants.P_ELF_CPU)) {
|
||||
|
@ -143,15 +147,18 @@ public class BinaryPropertySource implements IPropertySource {
|
|||
* Return the Property Descriptors for the file type.
|
||||
*/
|
||||
private void initializeBinaryDescriptors() {
|
||||
// IPropertyDescriptor[] superDescriptors = super.getPropertyDescriptors();
|
||||
// int superLength = superDescriptors.length;
|
||||
// IPropertyDescriptor[] binDescriptors = getInitialPropertyDescriptor();
|
||||
// int binLength = binDescriptors.length;
|
||||
// fgPropertyDescriptors = new IPropertyDescriptor[superLength + binLength];
|
||||
// System.arraycopy(superDescriptors, 0, fgPropertyDescriptors, 0, superLength);
|
||||
// System.arraycopy(binDescriptors, 0, fgPropertyDescriptors, superLength, binLength);
|
||||
if (element != null) {
|
||||
IPropertyDescriptor[] superDescriptors = super.getPropertyDescriptors();
|
||||
int superLength = superDescriptors.length;
|
||||
IPropertyDescriptor[] binDescriptors = getInitialPropertyDescriptor();
|
||||
int binLength = binDescriptors.length;
|
||||
fgPropertyDescriptors = new IPropertyDescriptor[superLength + binLength];
|
||||
System.arraycopy(superDescriptors, 0, fgPropertyDescriptors, 0, superLength);
|
||||
System.arraycopy(binDescriptors, 0, fgPropertyDescriptors, superLength, binLength);
|
||||
} else {
|
||||
fgPropertyDescriptors = getInitialPropertyDescriptor();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
|
||||
|
|
|
@ -49,14 +49,12 @@ public class CElementAdapterFactory implements IAdapterFactory {
|
|||
if (IPropertySource.class.equals(key)) {
|
||||
if (celem instanceof IBinary) {
|
||||
return new BinaryPropertySource((IBinary)celem);
|
||||
} else if (celem.getElementType() == ICElement.C_UNIT) {
|
||||
IResource file = celem.getResource();
|
||||
if (file != null && file instanceof IFile) {
|
||||
return new FilePropertySource((IFile)file);
|
||||
}
|
||||
} else {
|
||||
res = celem.getResource();
|
||||
if (res != null) {
|
||||
if (res instanceof IFile) {
|
||||
return new FilePropertySource((IFile)res);
|
||||
}
|
||||
return new ResourcePropertySource(res);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
package org.eclipse.cdt.internal.ui;
|
||||
|
||||
/*
|
||||
* (c) Copyright IBM Corp. 2000, 2001.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
import org.eclipse.ui.views.properties.IPropertySource;
|
||||
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.ui.*;
|
||||
|
||||
public class CElementProperties implements IPropertySource {
|
||||
|
||||
private final static String LABEL= "CElementProperties.name"; //$NON-NLS-1$
|
||||
|
||||
private ICElement fCElement;
|
||||
|
||||
// Property Descriptors
|
||||
static private IPropertyDescriptor[] fgPropertyDescriptors;
|
||||
|
||||
static {
|
||||
// resource name
|
||||
String displayName= CUIPlugin.getResourceString(LABEL);
|
||||
PropertyDescriptor descriptor= new PropertyDescriptor(IBasicPropertyConstants.P_TEXT, displayName);
|
||||
descriptor.setAlwaysIncompatible(true);
|
||||
|
||||
fgPropertyDescriptors= new IPropertyDescriptor[] { descriptor };
|
||||
}
|
||||
|
||||
public CElementProperties(ICElement elem) {
|
||||
fCElement= elem;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IPropertySource#getPropertyDescriptors
|
||||
*/
|
||||
public IPropertyDescriptor[] getPropertyDescriptors() {
|
||||
return fgPropertyDescriptors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IPropertySource#getPropertyValue
|
||||
*/
|
||||
public Object getPropertyValue(Object name) {
|
||||
if (name.equals(IBasicPropertyConstants.P_TEXT)) {
|
||||
return fCElement.getElementName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IPropertySource#setPropertyValue
|
||||
*/
|
||||
public void setPropertyValue(Object name, Object value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IPropertySource#getEditableValue
|
||||
*/
|
||||
public Object getEditableValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IPropertySource#isPropertySet
|
||||
*/
|
||||
public boolean isPropertySet(Object property) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IPropertySource#resetPropertyValue
|
||||
*/
|
||||
public void resetPropertyValue(Object property) {
|
||||
}
|
||||
}
|
|
@ -5,14 +5,13 @@ package org.eclipse.cdt.internal.ui;
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
import org.eclipse.ui.views.properties.IPropertySource;
|
||||
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.ui.*;
|
||||
|
||||
public class CElementPropertySource implements IPropertySource {
|
||||
|
||||
private final static String LABEL= "CElementProperties.name"; //$NON-NLS-1$
|
||||
|
|
Loading…
Add table
Reference in a new issue