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:
parent
2a48843261
commit
f2d65ec383
6 changed files with 39 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() ) );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()] );
|
||||
|
|
Loading…
Add table
Reference in a new issue