Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2001-05-02 20:48:05 +0000
committercvs2001-05-02 20:48:05 +0000
commit7e3be1fe036be304c22583c9bf88abb0dfe9fa9d (patch)
treec9290a61836cf8eef6c94b83abbcf60646c6e077 /bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Splitter.java
downloadeclipse.platform.team-7e3be1fe036be304c22583c9bf88abb0dfe9fa9d.tar.gz
eclipse.platform.team-7e3be1fe036be304c22583c9bf88abb0dfe9fa9d.tar.xz
eclipse.platform.team-7e3be1fe036be304c22583c9bf88abb0dfe9fa9d.zip
*** empty log message ***v0_102+
Diffstat (limited to 'bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Splitter.java')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Splitter.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Splitter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Splitter.java
new file mode 100644
index 000000000..14c835e73
--- /dev/null
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Splitter.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+package org.eclipse.compare.internal;
+
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.custom.SashForm;
+
+public class Splitter extends SashForm {
+
+ private static final String VISIBILITY= "org.eclipse.compare.internal.visibility";
+
+
+ public Splitter(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public void setVisible(Control child, boolean visible) {
+
+ boolean wasEmpty= isEmpty();
+
+ child.setVisible(visible);
+ child.setData(VISIBILITY, new Boolean(visible));
+
+ if (wasEmpty != isEmpty()) {
+ Composite parent= getParent();
+ if (parent instanceof Splitter) {
+ Splitter sp= (Splitter) parent;
+ sp.setVisible(this, visible);
+ sp.layout();
+ }
+ } else {
+ layout();
+ }
+ }
+
+ private boolean isEmpty() {
+ Control[] controls= getChildren();
+ for (int i= 0; i < controls.length; i++)
+ if (isVisible(controls[i]))
+ return false;
+ return true;
+ }
+
+ private boolean isVisible(Control child) {
+ if (child instanceof Sash)
+ return false;
+ Object data= child.getData(VISIBILITY);
+ if (data instanceof Boolean)
+ return ((Boolean)data).booleanValue();
+ return true;
+ }
+
+ public void setMaximizedControl(Control control) {
+ if (control == null || control == getMaximizedControl())
+ super.setMaximizedControl(null);
+ else
+ super.setMaximizedControl(control);
+
+ // walk up
+ Composite parent= getParent();
+ if (parent instanceof Splitter)
+ ((Splitter) parent).setMaximizedControl(this);
+ else
+ layout(true);
+ }
+}

Back to the top