Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Thienel2016-03-25 08:58:26 -0400
committerFlorian Thienel2016-03-25 08:59:51 -0400
commit49389d99f3f06683861590faaf65a2c4b472855d (patch)
tree4a690fffedd7dbc7d3f1f8febaf08076c4ac4ad6
parent972ba3311f1bd3c7f07a4015b2b03a02b2ced119 (diff)
downloadorg.eclipse.mylyn.docs.vex-49389d99f3f06683861590faaf65a2c4b472855d.tar.gz
org.eclipse.mylyn.docs.vex-49389d99f3f06683861590faaf65a2c4b472855d.tar.xz
org.eclipse.mylyn.docs.vex-49389d99f3f06683861590faaf65a2c4b472855d.zip
introduce a feature toggle preference to activate the new box model
Signed-off-by: Florian Thienel <florian@thienel.org>
-rw-r--r--org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/IVexWidget.java5
-rw-r--r--org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/BaseXmlDocumentEditor.java23
-rw-r--r--org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/VexWidget.java29
-rw-r--r--org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/XmlDocumentEditor.java (renamed from org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/BoxWidget.java)23
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/boxview/BoxDemoView.java6
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/VexPreferences.java6
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java24
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/outline/DocumentOutlinePage.java6
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/PreferenceInitializer.java11
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/RootPreferencePage.java2
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/views/DebugViewPage.java6
11 files changed, 101 insertions, 40 deletions
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/IVexWidget.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/IVexWidget.java
index bb2f0dc1..13c6626a 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/IVexWidget.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/IVexWidget.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.vex.core.internal.widget;
-import org.eclipse.vex.core.internal.css.IWhitespacePolicy;
import org.eclipse.vex.core.internal.css.StyleSheet;
import org.eclipse.vex.core.provisional.dom.ContentPosition;
import org.eclipse.vex.core.provisional.dom.IDocument;
@@ -51,10 +50,6 @@ public interface IVexWidget extends IDocumentEditor {
*/
void setStyleSheet(StyleSheet styleSheet);
- public void setWhitespacePolicy(IWhitespacePolicy whitespacePolicy);
-
- public IWhitespacePolicy getWhitespacePolicy();
-
/**
* Returns the value of the debugging flag.
*/
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/BaseXmlDocumentEditor.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/BaseXmlDocumentEditor.java
new file mode 100644
index 00000000..88454c20
--- /dev/null
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/BaseXmlDocumentEditor.java
@@ -0,0 +1,23 @@
+package org.eclipse.vex.core.internal.widget.swt;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.vex.core.internal.core.Rectangle;
+import org.eclipse.vex.core.internal.visualization.IBoxModelBuilder;
+import org.eclipse.vex.core.internal.widget.IDocumentEditor;
+
+public abstract class BaseXmlDocumentEditor extends Canvas implements IDocumentEditor, ISelectionProvider {
+
+ public BaseXmlDocumentEditor(final Composite parent, final int style) {
+ super(parent, style);
+ }
+
+ @Override
+ public abstract IVexSelection getSelection();
+
+ public abstract void setBoxModelBuilder(IBoxModelBuilder boxModelBuilder);
+
+ public abstract Rectangle getCaretArea();
+
+}
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/VexWidget.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/VexWidget.java
index e2516132..6f4166df 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/VexWidget.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/VexWidget.java
@@ -31,7 +31,6 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
@@ -54,7 +53,6 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.vex.core.internal.core.Caret;
@@ -67,6 +65,7 @@ import org.eclipse.vex.core.internal.core.Rectangle;
import org.eclipse.vex.core.internal.css.IWhitespacePolicy;
import org.eclipse.vex.core.internal.css.StyleSheet;
import org.eclipse.vex.core.internal.io.XMLFragment;
+import org.eclipse.vex.core.internal.visualization.IBoxModelBuilder;
import org.eclipse.vex.core.internal.widget.BaseVexWidget;
import org.eclipse.vex.core.internal.widget.IDocumentEditor;
import org.eclipse.vex.core.internal.widget.IHostComponent;
@@ -87,7 +86,7 @@ import org.eclipse.vex.core.provisional.dom.IProcessingInstruction;
/**
* An implementation of the Vex widget based on SWT.
*/
-public class VexWidget extends Canvas implements IVexWidget, ISelectionProvider {
+public class VexWidget extends BaseXmlDocumentEditor implements IVexWidget, ISelectionProvider {
public VexWidget(final Composite parent, final int style) {
super(parent, style);
@@ -124,7 +123,7 @@ public class VexWidget extends Canvas implements IVexWidget, ISelectionProvider
}
@Override
- public ISelection getSelection() {
+ public IVexSelection getSelection() {
return selection;
}
@@ -674,7 +673,7 @@ public class VexWidget extends Canvas implements IVexWidget, ISelectionProvider
int originY = 0;
private final List<ISelectionChangedListener> selectionListeners = new ArrayList<ISelectionChangedListener>();
- private ISelection selection;
+ private IVexSelection selection;
private final Runnable caretTimerRunnable = new Runnable() {
@Override
@@ -734,13 +733,7 @@ public class VexWidget extends Canvas implements IVexWidget, ISelectionProvider
@Override
public void fireSelectionChanged() {
-
- if (hasSelection()) {
- final List<? extends INode> nodes = getDocument().getNodes(getSelectedRange());
- selection = new StructuredSelection(nodes);
- } else {
- selection = new StructuredSelection(getCurrentNode());
- }
+ selection = new VexSelection(VexWidget.this);
final SelectionChangedEvent e = new SelectionChangedEvent(VexWidget.this, selection);
for (final ISelectionChangedListener listener : selectionListeners) {
@@ -1109,4 +1102,16 @@ public class VexWidget extends Canvas implements IVexWidget, ISelectionProvider
originY = y;
}
+ @Override
+ public void setBoxModelBuilder(final IBoxModelBuilder boxModelBuilder) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Rectangle getCaretArea() {
+ final Caret caret = impl.getCaret();
+ return new Rectangle(caret.getX(), caret.getY(), 1, 1);
+ }
+
}
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/BoxWidget.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/XmlDocumentEditor.java
index 5d571440..0f50f902 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/BoxWidget.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/widget/swt/XmlDocumentEditor.java
@@ -38,7 +38,6 @@ import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.vex.core.internal.core.ElementName;
import org.eclipse.vex.core.internal.core.Rectangle;
@@ -68,11 +67,11 @@ import org.eclipse.vex.core.provisional.dom.INode;
import org.eclipse.vex.core.provisional.dom.IProcessingInstruction;
/**
- * A widget to display the new box model.
+ * A widget to display and edit an XML document.
*
* @author Florian Thienel
*/
-public class BoxWidget extends Canvas implements ISelectionProvider, IDocumentEditor {
+public class XmlDocumentEditor extends BaseXmlDocumentEditor implements ISelectionProvider, IDocumentEditor {
private static final int SELECTION_CHANGE_NOTIFICATION_DELAY = 100;
private static final char CHAR_NONE = 0;
@@ -91,7 +90,7 @@ public class BoxWidget extends Canvas implements ISelectionProvider, IDocumentEd
private final ListenerList selectionChangedListeners = new ListenerList();
private Runnable lastSelectionChangeNotification = null;
- public BoxWidget(final Composite parent, final int style) {
+ public XmlDocumentEditor(final Composite parent, final int style) {
super(parent, style | SWT.NO_BACKGROUND);
mouseCursor = new org.eclipse.swt.graphics.Cursor(parent.getDisplay(), SWT.CURSOR_IBEAM);
@@ -127,6 +126,7 @@ public class BoxWidget extends Canvas implements ISelectionProvider, IDocumentEd
return document;
}
+ @Override
public void setBoxModelBuilder(final IBoxModelBuilder boxModelBuilder) {
controller.setBoxModelBuilder(boxModelBuilder);
}
@@ -135,7 +135,7 @@ public class BoxWidget extends Canvas implements ISelectionProvider, IDocumentEd
addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(final DisposeEvent e) {
- BoxWidget.this.widgetDisposed();
+ XmlDocumentEditor.this.widgetDisposed();
}
});
}
@@ -162,7 +162,7 @@ public class BoxWidget extends Canvas implements ISelectionProvider, IDocumentEd
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
- BoxWidget.this.keyPressed(e);
+ XmlDocumentEditor.this.keyPressed(e);
}
});
}
@@ -171,18 +171,18 @@ public class BoxWidget extends Canvas implements ISelectionProvider, IDocumentEd
addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(final MouseEvent e) {
- BoxWidget.this.mouseDoubleClick(e);
+ XmlDocumentEditor.this.mouseDoubleClick(e);
}
@Override
public void mouseDown(final MouseEvent e) {
- BoxWidget.this.mouseDown(e);
+ XmlDocumentEditor.this.mouseDown(e);
}
});
addMouseMoveListener(new MouseMoveListener() {
@Override
public void mouseMove(final MouseEvent e) {
- BoxWidget.this.mouseMove(e);
+ XmlDocumentEditor.this.mouseMove(e);
}
});
}
@@ -220,7 +220,7 @@ public class BoxWidget extends Canvas implements ISelectionProvider, IDocumentEd
final IVexWidgetHandler handler = KEY_MAP.get(keyStroke);
if (handler != null) {
try {
- handler.execute(new ExecutionEvent(null, Collections.emptyMap(), event, null), BoxWidget.this);
+ handler.execute(new ExecutionEvent(null, Collections.emptyMap(), event, null), XmlDocumentEditor.this);
} catch (final ReadOnlyException e) {
// TODO give feedback: the editor is read-only
} catch (final Exception ex) {
@@ -274,6 +274,7 @@ public class BoxWidget extends Canvas implements ISelectionProvider, IDocumentEd
controller.refreshAll();
}
+ @Override
public Rectangle getCaretArea() {
return cursor.getCaretArea();
}
@@ -321,7 +322,7 @@ public class BoxWidget extends Canvas implements ISelectionProvider, IDocumentEd
for (final Object listener : selectionChangedListeners.getListeners()) {
try {
- ((ISelectionChangedListener) listener).selectionChanged(new SelectionChangedEvent(BoxWidget.this, selection));
+ ((ISelectionChangedListener) listener).selectionChanged(new SelectionChangedEvent(XmlDocumentEditor.this, selection));
} catch (final Throwable t) {
t.printStackTrace();
// TODO remove listener?
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/boxview/BoxDemoView.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/boxview/BoxDemoView.java
index 4253f81d..717ab8b2 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/boxview/BoxDemoView.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/boxview/BoxDemoView.java
@@ -53,7 +53,7 @@ import org.eclipse.vex.core.internal.css.StyleSheetReader;
import org.eclipse.vex.core.internal.io.UniversalTestDocument;
import org.eclipse.vex.core.internal.visualization.CssBasedBoxModelBuilder;
import org.eclipse.vex.core.internal.widget.CssTableModel;
-import org.eclipse.vex.core.internal.widget.swt.BoxWidget;
+import org.eclipse.vex.core.internal.widget.swt.XmlDocumentEditor;
import org.eclipse.vex.core.internal.widget.swt.IVexSelection;
import org.eclipse.vex.core.provisional.dom.ContentRange;
import org.eclipse.vex.core.provisional.dom.IContent;
@@ -74,7 +74,7 @@ public class BoxDemoView extends ViewPart {
private static final IPath CSS_WORKSPACE_FILE = new Path("/test/box-demo.css");
private Composite boxWidgetParent;
- private BoxWidget boxWidget;
+ private XmlDocumentEditor boxWidget;
private IDocument document;
private Label offsetLabel;
@@ -156,7 +156,7 @@ public class BoxDemoView extends ViewPart {
boxWidget = null;
cleanStaleReferenceInShell();
}
- boxWidget = new BoxWidget(boxWidgetParent, SWT.V_SCROLL);
+ boxWidget = new XmlDocumentEditor(boxWidgetParent, SWT.V_SCROLL);
document = UniversalTestDocument.createTestDocumentWithAllFeatures(SAMPLE_COUNT);
boxWidget.setDocument(document);
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/VexPreferences.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/VexPreferences.java
index 643184ac..addd3a4c 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/VexPreferences.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/VexPreferences.java
@@ -40,6 +40,8 @@ public class VexPreferences implements IStyleSheetProvider {
public static final String LINE_WIDTH = "lineWidth";
+ public static final String EXPERIMENTAL_USE_NEW_BOX_MODEL = "useNewBoxmodel";
+
private static final String PREFERRED_STYLE_SUFFIX = ".style";
private final IPreferenceStore preferenceStore;
@@ -88,6 +90,10 @@ public class VexPreferences implements IStyleSheetProvider {
return preferenceStore.getInt(LINE_WIDTH);
}
+ public boolean getUseNewBoxModel() {
+ return preferenceStore.getBoolean(EXPERIMENTAL_USE_NEW_BOX_MODEL);
+ }
+
@Override
public StyleSheet getStyleSheet(final DocumentContentModel documentContentModel) {
Style style = null;
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java
index 343fd12f..5dfbce86 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java
@@ -102,8 +102,10 @@ import org.eclipse.vex.core.internal.validator.WTPVEXValidator;
import org.eclipse.vex.core.internal.visualization.CssBasedBoxModelBuilder;
import org.eclipse.vex.core.internal.widget.CssTableModel;
import org.eclipse.vex.core.internal.widget.IDocumentEditor;
-import org.eclipse.vex.core.internal.widget.swt.BoxWidget;
+import org.eclipse.vex.core.internal.widget.swt.BaseXmlDocumentEditor;
+import org.eclipse.vex.core.internal.widget.swt.XmlDocumentEditor;
import org.eclipse.vex.core.internal.widget.swt.IVexSelection;
+import org.eclipse.vex.core.internal.widget.swt.VexWidget;
import org.eclipse.vex.core.provisional.dom.AttributeChangeEvent;
import org.eclipse.vex.core.provisional.dom.BaseNodeVisitorWithResult;
import org.eclipse.vex.core.provisional.dom.ContentChangeEvent;
@@ -161,6 +163,8 @@ public class VexEditor extends EditorPart {
*/
public static final String ID = "org.eclipse.vex.ui.internal.editor.VexEditor"; //$NON-NLS-1$
+ private boolean useNewBoxModel;
+
private final boolean debugging;
private final ConfigurationRegistry configurationRegistry;
private final VexPreferences preferences;
@@ -173,7 +177,7 @@ public class VexEditor extends EditorPart {
private IDocument document;
private Style style;
- private BoxWidget editorWidget;
+ private BaseXmlDocumentEditor editorWidget;
private boolean dirty;
@@ -814,6 +818,9 @@ public class VexEditor extends EditorPart {
document.addDocumentListener(documentListener);
editorWidget.setBoxModelBuilder(new CssBasedBoxModelBuilder(style.getStyleSheet()));
+ if (!useNewBoxModel) {
+ ((VexWidget) editorWidget).setStyleSheet(style.getStyleSheet());
+ }
editorWidget.setWhitespacePolicy(reader.getWhitespacePolicy());
editorWidget.setTableModel(new CssTableModel(style.getStyleSheet()));
editorWidget.setDocument(document);
@@ -886,6 +893,9 @@ public class VexEditor extends EditorPart {
this.style = style;
if (editorWidget != null) {
editorWidget.setBoxModelBuilder(new CssBasedBoxModelBuilder(style.getStyleSheet()));
+ if (!useNewBoxModel) {
+ ((VexWidget) editorWidget).setStyleSheet(style.getStyleSheet());
+ }
editorWidget.setWhitespacePolicy(new CssWhitespacePolicy(style.getStyleSheet()));
editorWidget.setTableModel(new CssTableModel(style.getStyleSheet()));
preferences.setPreferredStyleId(doctype, style.getUniqueId());
@@ -983,7 +993,12 @@ public class VexEditor extends EditorPart {
gd.horizontalAlignment = GridData.FILL;
gd.verticalAlignment = GridData.FILL;
- editorWidget = new BoxWidget(parentControl, SWT.V_SCROLL);
+ useNewBoxModel = preferences.getUseNewBoxModel();
+ if (useNewBoxModel) {
+ editorWidget = new XmlDocumentEditor(parentControl, SWT.V_SCROLL);
+ } else {
+ editorWidget = new VexWidget(parentControl, SWT.V_SCROLL);
+ }
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
@@ -1025,6 +1040,9 @@ public class VexEditor extends EditorPart {
// Let's just hold on to it in case it comes back later
} else {
editorWidget.setBoxModelBuilder(new CssBasedBoxModelBuilder(style.getStyleSheet()));
+ if (!useNewBoxModel) {
+ ((VexWidget) editorWidget).setStyleSheet(style.getStyleSheet());
+ }
editorWidget.setWhitespacePolicy(new CssWhitespacePolicy(style.getStyleSheet()));
editorWidget.setTableModel(new CssTableModel(style.getStyleSheet()));
style = newStyle;
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/outline/DocumentOutlinePage.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/outline/DocumentOutlinePage.java
index ab64d90c..5169cc03 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/outline/DocumentOutlinePage.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/outline/DocumentOutlinePage.java
@@ -38,7 +38,7 @@ import org.eclipse.ui.part.Page;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.vex.core.internal.css.StyleSheet;
import org.eclipse.vex.core.internal.widget.IDocumentEditor;
-import org.eclipse.vex.core.internal.widget.swt.BoxWidget;
+import org.eclipse.vex.core.internal.widget.swt.BaseXmlDocumentEditor;
import org.eclipse.vex.core.provisional.dom.AttributeChangeEvent;
import org.eclipse.vex.core.provisional.dom.ContentChangeEvent;
import org.eclipse.vex.core.provisional.dom.IAttribute;
@@ -271,8 +271,8 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
- if (event.getSource() instanceof BoxWidget) {
- final BoxWidget vexWidget = (BoxWidget) event.getSource();
+ if (event.getSource() instanceof BaseXmlDocumentEditor) {
+ final BaseXmlDocumentEditor vexWidget = (BaseXmlDocumentEditor) event.getSource();
if (vexWidget.isFocusControl() && getTreeViewer() != null) {
final INode element = vexWidget.getCurrentNode();
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/PreferenceInitializer.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/PreferenceInitializer.java
index 61d23184..62c4d013 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/PreferenceInitializer.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/PreferenceInitializer.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Florian Thienel and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Thienel - initial API and implementation
+ *******************************************************************************/
package org.eclipse.vex.ui.internal.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
@@ -13,6 +23,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(VexPreferences.INDENTATION_CHAR_CHOICE, "\t");
store.setDefault(VexPreferences.INDENTATION_SIZE, 1);
store.setDefault(VexPreferences.LINE_WIDTH, 72);
+ store.setDefault(VexPreferences.EXPERIMENTAL_USE_NEW_BOX_MODEL, false);
}
}
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/RootPreferencePage.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/RootPreferencePage.java
index 30ef7583..c6528c9a 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/RootPreferencePage.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/preferences/RootPreferencePage.java
@@ -1,5 +1,6 @@
package org.eclipse.vex.ui.internal.preferences;
+import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
@@ -21,6 +22,7 @@ public class RootPreferencePage extends FieldEditorPreferencePage implements IWo
addField(new RadioGroupFieldEditor(VexPreferences.INDENTATION_CHAR_CHOICE, "Indentation", 1, new String[][] { { "Indent using tabs", VexPreferences.INDENTATION_CHAR_TAB },
{ "Indent using spaces", VexPreferences.INDENTATION_CHAR_SPACE } }, getFieldEditorParent()));
addField(new IntegerFieldEditor(VexPreferences.INDENTATION_SIZE, "Indentation size:", getFieldEditorParent()));
+ addField(new BooleanFieldEditor(VexPreferences.EXPERIMENTAL_USE_NEW_BOX_MODEL, "Use new box model (EXPERIMENTAL)", getFieldEditorParent()));
}
@Override
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/views/DebugViewPage.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/views/DebugViewPage.java
index 8d8adc6e..e3648e9c 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/views/DebugViewPage.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/views/DebugViewPage.java
@@ -39,7 +39,7 @@ import org.eclipse.ui.part.IPageBookViewPage;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.vex.core.internal.core.Rectangle;
import org.eclipse.vex.core.internal.layout.Box;
-import org.eclipse.vex.core.internal.widget.swt.BoxWidget;
+import org.eclipse.vex.core.internal.widget.swt.BaseXmlDocumentEditor;
import org.eclipse.vex.core.provisional.dom.ContentPosition;
import org.eclipse.vex.core.provisional.dom.ContentRange;
import org.eclipse.vex.core.provisional.dom.IDocument;
@@ -135,7 +135,7 @@ class DebugViewPage implements IPageBookViewPage {
private IPageSite site;
private final VexEditor editorPart;
- private BoxWidget documentEditor;
+ private BaseXmlDocumentEditor documentEditor;
private Composite composite;
private Label loadingLabel;
@@ -160,7 +160,7 @@ class DebugViewPage implements IPageBookViewPage {
loadingLabel = null;
}
- documentEditor = (BoxWidget) editorPart.getVexWidget();
+ documentEditor = (BaseXmlDocumentEditor) editorPart.getVexWidget();
final GridLayout layout = new GridLayout();
layout.numColumns = 1;

Back to the top