Author: dmaliarevich
Date: 2009-04-21 08:03:28 -0400 (Tue, 21 Apr 2009)
New Revision: 14834
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4152, sash layout will be automatically update on
preference page option change.
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2009-04-21
08:07:15 UTC (rev 14833)
+++
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2009-04-21
12:03:28 UTC (rev 14834)
@@ -1315,7 +1315,7 @@
</Constraint>
<Editor name="List"/>
</XModelAttribute>
- <XModelAttribute default="Horizontal"
+ <XModelAttribute default="Vertical"
name="Visual/Source editors splitting"
xmlname="visual_source_editors_splitting">
<Constraint loader="List">
<value name="Horizontal"/>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-04-21
08:07:15 UTC (rev 14833)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-04-21
12:03:28 UTC (rev 14834)
@@ -492,9 +492,14 @@
cmpEd.setLayoutData(new GridData(GridData.FILL_BOTH));
// /////////////////////////////////////////////////////////////////
//container = new SashForm(cmpEd, SWT.VERTICAL);
- String editorsSplitting = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue();
+ String sashOrientation = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue();
+ /*
+ *
https://jira.jboss.org/jira/browse/JBIDE-4152
+ * Sash orientation can be changed to either vertical or horizontal.
+ */
container = new CustomSashForm(cmpEd, (CustomSashForm.LAYOUT_HORIZONTAL
- .equalsIgnoreCase(editorsSplitting) ? SWT.HORIZONTAL : SWT.VERTICAL));
+ .equalsIgnoreCase(sashOrientation) ? SWT.HORIZONTAL : SWT.VERTICAL));
+ container.setSashOrientation(sashOrientation);
if (editorSettings != null)
editorSettings.addSetting(new SashSetting(container));
@@ -678,6 +683,7 @@
public void nodeChanged(XModelTreeEvent event) {
selectionBar.setVisible(selectionBar.getAlwaysVisibleOption());
+ container.changeOrientation();
}
public void structureChanged(XModelTreeEvent event) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2009-04-21
08:07:15 UTC (rev 14833)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2009-04-21
12:03:28 UTC (rev 14834)
@@ -29,6 +29,8 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Sash;
+import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.messages.VpeUIMessages;
/**
@@ -45,7 +47,7 @@
public static final String copyright = "(c) Copyright IBM Corporation 2002.";
//$NON-NLS-1$
public static final String LAYOUT_HORIZONTAL = "Horizontal"; //$NON-NLS-1$
- public static final String LAYOUT_VERTICAL = "VERTICAL"; //$NON-NLS-1$
+ public static final String LAYOUT_VERTICAL = "Vertical"; //$NON-NLS-1$
/**
* Custom style bits. They set whether max to one side of the other
* is not permitted. For example, if NO_MAX_UP, then there will be only
@@ -110,6 +112,11 @@
WIDTH_INDEX = 4,
HEIGHT_INDEX = 5;
+ /*
+ * Stores current sash orientation
+ */
+ private String sashOrientation = Constants.EMPTY;
+
/**
* Constructor for CustomSashForm.
* @param parent
@@ -441,7 +448,6 @@
break;
}
}
-
currentSashInfo.sash.redraw(); // Make sure stipple goes away from the mouse up if
not over an arrow button.
fireDividerMoved();
}
@@ -936,5 +942,24 @@
public void removeWeightsChangeListener(PropertyChangeListener listener) {
listeners.removePropertyChangeListener(listener);
}
+
+ public String getSashOrientation() {
+ return sashOrientation;
+ }
+
+ public void setSashOrientation(String sashOrientation) {
+ this.sashOrientation = sashOrientation;
+ }
+ public boolean changeOrientation() {
+ String orientation = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue();
+ if (!getSashOrientation().equalsIgnoreCase(orientation)) {
+ setOrientation(CustomSashForm.LAYOUT_HORIZONTAL
+ .equalsIgnoreCase(orientation) ? SWT.HORIZONTAL : SWT.VERTICAL);
+ setSashOrientation(orientation);
+ return true;
+ }
+ return false;
+ }
+
}