Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java9
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java7
2 files changed, 15 insertions, 1 deletions
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java
index 9eee3953..a6f129a7 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java
@@ -169,6 +169,15 @@ public abstract class FormUtils {
}
}
+ /**
+ * be very careful when using this method, see MNGECLIPSE-2674
+ * ideally this would be replaced by a distributed system where each component reacts to the
+ * readonly or not-readonly event and with the knowledge of the inner state decides what gets enabled/disabled
+ *
+ * @param composite
+ * @param readonly
+ * @deprecated so that you think hard before using it. Using it for disabling all controls is probably fine. Enabling all is NOT.
+ */
public static void setReadonly(Composite composite, boolean readonly) {
if(composite != null) {
for(Control control : composite.getChildren()) {
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
index 9714a3df..af917712 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
@@ -159,8 +159,13 @@ public abstract class MavenPomEditorPage extends FormPage implements Adapter {
super.setActive(active);
doLoadData(active);
+ //MNGECLIPSE-2674 checkreadonly is only calculated once, no need
+ // to update everytime this page gets active
boolean readOnly = pomEditor.checkReadOnly();
- FormUtils.setReadonly((Composite) getPartControl(), readOnly);
+ if (readOnly) {
+ // only perform when readonly==true, to prevent enabling all buttons on the page.
+ FormUtils.setReadonly((Composite) getPartControl(), readOnly);
+ }
}
public boolean isReadOnly() {

Back to the top