Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilos Kleint2010-12-23 04:12:57 -0500
committerMilos Kleint2010-12-23 04:14:43 -0500
commit9d264509f45a73cb77c916348b708224efdb500d (patch)
tree7149ae19106974671f237e8c09b08615ccb6744c
parent94943d7320e2cc762f0c604d4178d0fc1526fde4 (diff)
downloadm2e-core-9d264509f45a73cb77c916348b708224efdb500d.tar.gz
m2e-core-9d264509f45a73cb77c916348b708224efdb500d.tar.xz
m2e-core-9d264509f45a73cb77c916348b708224efdb500d.zip
MNGECLIPSE-2674 we shall not enable all buttons when switching pages. The proper solution is to delegate decision to the place which has the necessary context. This will do until then.
-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