Author: tfmorris
Date: 2008-08-19 17:21:10-0700
New Revision: 15591
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateCommentEdge.java
trunk/src/argouml-app/src/org/argouml/uml/ui/AbstractActionRemoveElement.java
trunk/src/argouml-app/src/org/argouml/uml/ui/UMLTextArea2.java
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelComment.java
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelModelElement.java
Log:
RESOLVED - task 5303: Comments in read-only extents should not be editable
http://argouml.tigris.org/issues/show_bug.cgi?id=5303
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java?view=diff&rev=15591&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java&r1=15590&r2=15591
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java 2008-08-19 17:21:10-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -247,7 +247,9 @@
@Override
public void mouseClicked(MouseEvent me) {
if (!readyToEdit) {
- if (Model.getFacade().isAModelElement(getOwner())) {
+ Object owner = getOwner();
+ if (Model.getFacade().isAModelElement(owner)
+ && !Model.getModelManagementHelper().isReadOnly(owner)) {
readyToEdit = true;
} else {
LOG.debug("not ready to edit note");
@@ -346,7 +348,9 @@
return;
}
if (!readyToEdit) {
- if (Model.getFacade().isAModelElement(getOwner())) {
+ Object owner = getOwner();
+ if (Model.getFacade().isAModelElement(owner)
+ && !Model.getModelManagementHelper().isReadOnly(owner)) {
storeBody("");
readyToEdit = true;
} else {
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateCommentEdge.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateCommentEdge.java?view=diff&rev=15591&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateCommentEdge.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateCommentEdge.java&r1=15590&r2=15591
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateCommentEdge.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateCommentEdge.java 2008-08-19 17:21:10-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2005-2007 The Regents of the University of California. All
+// Copyright (c) 2005-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -39,9 +39,21 @@
* If we're drawing to an edge then only allow if the start is a comment
* @see org.argouml.uml.diagram.ui.ModeCreateGraphEdge#isConnectionValid(org.tigris.gef.presentation.Fig, org.tigris.gef.presentation.Fig)
*/
+ @Override
protected final boolean isConnectionValid(Fig source, Fig dest) {
if (dest instanceof FigNodeModelElement) {
- return Model.getFacade().isAComment(source.getOwner());
+ Object srcOwner = source.getOwner();
+ Object dstOwner = dest.getOwner();
+ if (!Model.getFacade().isAModelElement(srcOwner)
+ || !Model.getFacade().isAModelElement(dstOwner)) {
+ return false;
+ }
+ if (Model.getModelManagementHelper().isReadOnly(srcOwner)
+ || Model.getModelManagementHelper().isReadOnly(dstOwner)) {
+ return false;
+ }
+ return Model.getFacade().isAComment(srcOwner)
+ || Model.getFacade().isAComment(dstOwner);
} else {
return true;
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/AbstractActionRemoveElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/AbstractActionRemoveElement.java?view=diff&rev=15591&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/AbstractActionRemoveElement.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/AbstractActionRemoveElement.java&r1=15590&r2=15591
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/AbstractActionRemoveElement.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/AbstractActionRemoveElement.java 2008-08-19 17:21:10-0700
@@ -27,6 +27,8 @@
import javax.swing.Action;
import org.argouml.i18n.Translator;
+import org.argouml.kernel.UmlModelMutator;
+import org.argouml.model.Model;
import org.tigris.gef.undo.UndoableAction;
/**
@@ -38,6 +40,7 @@
* @author [email protected]
* @since Jan 25, 2003
*/
+@UmlModelMutator
public class AbstractActionRemoveElement extends UndoableAction {
/**
@@ -110,7 +113,10 @@
*/
@Override
public boolean isEnabled() {
- return getObjectToRemove() != null && getTarget() != null;
+ return getObjectToRemove() != null
+ && !Model.getModelManagementHelper().isReadOnly(
+ getObjectToRemove()) && getTarget() != null
+ && !Model.getModelManagementHelper().isReadOnly(getTarget());
}
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/UMLTextArea2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/UMLTextArea2.java?view=diff&rev=15591&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/UMLTextArea2.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/UMLTextArea2.java&r1=15590&r2=15591
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/UMLTextArea2.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/UMLTextArea2.java 2008-08-19 17:21:10-0700
@@ -29,6 +29,7 @@
import javax.swing.JTextArea;
+import org.argouml.kernel.UmlModelMutator;
import org.argouml.ui.LookAndFeelMgr;
import org.argouml.ui.targetmanager.TargetListener;
import org.argouml.ui.targetmanager.TargettableModelView;
@@ -38,6 +39,7 @@
* @author [email protected]
* @since Dec 28, 2002
*/
+@UmlModelMutator
public class UMLTextArea2 extends JTextArea
implements PropertyChangeListener, TargettableModelView {
Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelComment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelComment.java?view=diff&rev=15591&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelComment.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelComment.java&r1=15590&r2=15591
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelComment.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelComment.java 2008-08-19 17:21:10-0700
@@ -29,6 +29,7 @@
import javax.swing.JScrollPane;
import org.argouml.i18n.Translator;
+import org.argouml.kernel.UmlModelMutator;
import org.argouml.model.Model;
import org.argouml.uml.ui.AbstractActionRemoveElement;
import org.argouml.uml.ui.ActionNavigateContainerElement;
@@ -79,7 +80,7 @@
addAction(getDeleteAction());
}
}
-
+@UmlModelMutator
class UMLCommentBodyDocument extends UMLPlainTextDocument {
/**
@@ -115,6 +116,7 @@
}
+@UmlModelMutator
class ActionDeleteAnnotatedElement extends AbstractActionRemoveElement {
/**
* Constructor.
Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelModelElement.java?view=diff&rev=15591&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelModelElement.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelModelElement.java&r1=15590&r2=15591
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelModelElement.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelModelElement.java 2008-08-19 17:21:10-0700
@@ -25,6 +25,7 @@
package org.argouml.uml.ui.foundation.core;
import java.awt.Component;
+import java.awt.Container;
import java.util.ArrayList;
import java.util.List;
@@ -177,6 +178,7 @@
/*
* @see org.argouml.uml.ui.PropPanel#setTarget(java.lang.Object)
*/
+ @Override
public void setTarget(Object target) {
super.setTarget(target);
/* This for e.g. a CommentEdge: */
@@ -184,7 +186,14 @@
boolean enable =
!Model.getModelManagementHelper().isReadOnly(target);
for (final Component component : getComponents()) {
- if (!(component instanceof JLabel)
+ if (component instanceof JScrollPane) {
+ Component c =
+ ((JScrollPane) component).getViewport().getView();
+ if (c.getClass().isAnnotationPresent(
+ UmlModelMutator.class)) {
+ c.setEnabled(enable);
+ }
+ } else if (!(component instanceof JLabel)
&& component.isEnabled() != enable) {
component.setEnabled(enable);
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.