1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fix for bug 83051: Add global variables deletes existing ones when new added.

This commit is contained in:
Mikhail Khodjaiants 2005-01-19 19:04:24 +00:00
parent 2a48843261
commit f2d65ec383
6 changed files with 39 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2005-01-19 Mikhail Khodjaiants
Fix for bug 83051: Add global variables deletes existing ones when new added.
* ICGlobalVariableManager.java
* CGlobalVariableManager.java
* CVariableFactory.java
2005-01-18 Mikhail Khodjaiants
Fix for bug 82858: NPE when adding global variable to variable view.
* CDebugTarget.java

View file

@ -38,4 +38,11 @@ public interface ICGlobalVariableManager {
* Removes all global variables from this manager.
*/
public void removeAllGlobals();
/**
* Returns the array of descriptors of global varibales added to this manager.
*
* @return the array of descriptors
*/
public IGlobalVariableDescriptor[] getDescriptors();
}

View file

@ -250,9 +250,6 @@ public class CGlobalVariableManager implements ICGlobalVariableManager {
throw new CoreException( s );
}
/**
* @return Returns the initialDescriptors.
*/
private IGlobalVariableDescriptor[] getInitialDescriptors() {
return fInitialDescriptors;
}
@ -268,4 +265,18 @@ public class CGlobalVariableManager implements ICGlobalVariableManager {
DebugPlugin.log( e );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICGlobalVariableManager#getDescriptors()
*/
public IGlobalVariableDescriptor[] getDescriptors() {
if ( fGlobals == null )
return getInitialDescriptors();
IGlobalVariableDescriptor[] result = new IGlobalVariableDescriptor[fGlobals.size()];
Iterator it = fGlobals.iterator();
for ( int i = 0; it.hasNext(); ++i ) {
result[i] = ((ICGlobalVariable)it.next()).getDescriptor();
}
return result;
}
}

View file

@ -48,6 +48,13 @@ public class CVariableFactory {
public String toString() {
return MessageFormat.format( "{0}::{1}", new String[] { getPath().toOSString(), getName() } ); //$NON-NLS-1$
}
public boolean equals( Object obj ) {
if ( !(obj instanceof IGlobalVariableDescriptor) )
return false;
IGlobalVariableDescriptor d = (IGlobalVariableDescriptor)obj;
return ( getName().compareTo( d.getName() ) == 0 && getPath().equals( d.getPath() ) );
}
};
}

View file

@ -1,3 +1,7 @@
2005-01-19 Mikhail Khodjaiants
Fix for bug 83051: Add global variables deletes existing ones when new added.
* AddGlobalsActionDelegate.java
2005-01-18 Mikhail Khodjaiants
Fix for bug 82800: Make "Resume At Line" action retargettable.
* plugin.xml

View file

@ -263,6 +263,7 @@ public class AddGlobalsActionDelegate extends ActionDelegate implements IViewAct
if ( info != null && gvm != null ) {
fGlobals = info.getGlobals();
ListSelectionDialog dlg = createDialog();
dlg.setInitialSelections( gvm.getDescriptors() );
if ( dlg.open() == Window.OK ) {
List list = Arrays.asList( dlg.getResult() );
IGlobalVariableDescriptor[] selections = (IGlobalVariableDescriptor[])list.toArray( new IGlobalVariableDescriptor[list.size()] );