svn commit: r18059 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui
Bob Tarling <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bobtarling
Date: 2010-03-05 01:02:40-0800
New Revision: 18059
Modified:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBoxModel.java
Log:
Issue 5990: Fix exception and memory leak
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java?view=diff&pathrev=18059&r1=18058&r2=18059
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java 2010-03-05 01:02:40-0800
@@ -119,6 +119,11 @@
*/
private final Object target;
+ /**
+ * Identifies if the model element is a readonly modelelement
+ */
+ private final boolean readonly;
+
static {
// Extract the icon that is used by the tree control
// for the current look and feel
@@ -224,7 +229,8 @@
/**
* Constructor
* @param model The single item list model
- * @param singleRow true if we only ever want a single row
+ * @param expanded true if the control should be initially expanded
+ * @param expandable true if the control should be expandable
*/
public RowSelector(DefaultListModel model, boolean expanded, boolean expandable) {
super(new BorderLayout());
@@ -233,16 +239,23 @@
Object metaType = null;
if (model instanceof UMLModelElementListModel) {
+ // Temporary until SimpleListModel is used for all
target = ((UMLModelElementListModel) model).getTarget();
metaType = ((UMLModelElementListModel) model).getMetaType();
scroll = new OldScrollList(model, 1);
+ readonly = Model.getModelManagementHelper().isReadOnly(target);
} else if (model instanceof org.argouml.core.propertypanels.ui.SimpleListModel) {
target = ((org.argouml.core.propertypanels.ui.SimpleListModel) model).getUmlElement();
metaType = ((org.argouml.core.propertypanels.ui.SimpleListModel) model).getMetaType();
scroll = new ScrollListImpl(model, 1);
+ readonly = Model.getModelManagementHelper().isReadOnly(target);
} else {
+ // Temporary until SimpleListModel is used for all
target = null;
+ readonly = true;
}
+
+ assert (target != null);
LOG.info("Creating list for " + target);
@@ -277,7 +290,7 @@
moveTopAction = null;
moveBottomAction = null;
} else {
- if (!Model.getModelManagementHelper().isReadOnly(target)) {
+ if (!readonly) {
// TODO: Lets build this into a separate buildToolbar method
// Create actions and expander if we have multiple rows
@@ -445,7 +458,7 @@
*/
public void removeNotify() {
LOG.info("The RowSelector is being removed from a panel");
- if (!Model.getModelManagementHelper().isReadOnly(target)) {
+ if (!readonly) {
getList().removeListSelectionListener(deleteAction);
if (moveUpAction != null) {
getList().removeListSelectionListener(moveUpAction);
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBoxModel.java?view=diff&pathrev=18059&r1=18058&r2=18059
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBoxModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBoxModel.java 2010-03-05 01:02:40-0800
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * bobtarling
+ * Bob Tarling
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -56,7 +56,6 @@
import org.apache.log4j.Logger;
import org.argouml.model.AddAssociationEvent;
import org.argouml.model.AssociationChangeEvent;
-import org.argouml.model.AttributeChangeEvent;
import org.argouml.model.DeleteInstanceEvent;
import org.argouml.model.InvalidElementException;
import org.argouml.model.Model;
@@ -121,7 +120,7 @@
/**
* Flag to indicate whether the model is being build.
*/
- protected boolean buildingModel = false;
+ private boolean buildingModel = false;
/**
* Flag needed to prevent infinite recursion during processing of
@@ -424,7 +423,7 @@
}
public void removeModelEventListener() {
- Model.getPump().addModelEventListener(this, comboBoxTarget,
+ Model.getPump().removeModelEventListener(this, comboBoxTarget,
propertySetName);
removeOtherModelEventListeners(comboBoxTarget);
}
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2455338
To unsubscribe from this discussion, e-mail: [[email protected]].