Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Thienel2016-01-14 14:46:40 -0500
committerFlorian Thienel2016-01-14 14:46:40 -0500
commit847efaf4326d19d415a2b3c8985046e7ccb71a26 (patch)
tree6288f0a845e67801bd1bd60be86baa635433843f
parent4df461ef353dc5cc1da35c9d22deaedf62dcc8ad (diff)
downloadorg.eclipse.mylyn.docs.vex-847efaf4326d19d415a2b3c8985046e7ccb71a26.tar.gz
org.eclipse.mylyn.docs.vex-847efaf4326d19d415a2b3c8985046e7ccb71a26.tar.xz
org.eclipse.mylyn.docs.vex-847efaf4326d19d415a2b3c8985046e7ccb71a26.zip
replace further dependencies to the editor widget class
Signed-off-by: Florian Thienel <florian@thienel.org>
-rw-r--r--org.eclipse.vex.ui.tests/src/org/eclipse/vex/ui/internal/editor/tests/HandlerUtilTest.java230
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexActionBarContributor.java34
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java17
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractAddColumnHandler.java20
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractMoveColumnHandler.java30
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractVexWidgetHandler.java8
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/StyleMenu.java2
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/VexHandlerUtil.java22
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/outline/DocumentOutlinePage.java39
-rw-r--r--org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/views/DebugViewPage.java146
10 files changed, 279 insertions, 269 deletions
diff --git a/org.eclipse.vex.ui.tests/src/org/eclipse/vex/ui/internal/editor/tests/HandlerUtilTest.java b/org.eclipse.vex.ui.tests/src/org/eclipse/vex/ui/internal/editor/tests/HandlerUtilTest.java
index 06e215d8..336594e1 100644
--- a/org.eclipse.vex.ui.tests/src/org/eclipse/vex/ui/internal/editor/tests/HandlerUtilTest.java
+++ b/org.eclipse.vex.ui.tests/src/org/eclipse/vex/ui/internal/editor/tests/HandlerUtilTest.java
@@ -1,114 +1,116 @@
-/*******************************************************************************
- * Copyright (c) 2013 Carsten Hiesserich 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:
- * Carsten Hiesserich - initial API and implementation
- *******************************************************************************/
-package org.eclipse.vex.ui.internal.editor.tests;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URL;
-import java.util.List;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.vex.core.internal.css.StyleSheet;
-import org.eclipse.vex.core.internal.css.StyleSheetReader;
-import org.eclipse.vex.core.internal.dom.Document;
-import org.eclipse.vex.core.internal.io.XMLFragment;
-import org.eclipse.vex.core.internal.widget.BaseVexWidget;
-import org.eclipse.vex.core.internal.widget.IVexWidget;
-import org.eclipse.vex.core.internal.widget.MockHostComponent;
-import org.eclipse.vex.core.provisional.dom.IElement;
-import org.eclipse.vex.core.provisional.dom.IProcessingInstruction;
-import org.eclipse.vex.ui.internal.handlers.VexHandlerUtil;
-import org.junit.Before;
-import org.junit.Test;
-
-public class HandlerUtilTest {
-
- private IVexWidget widget;
- private IElement table;
-
- @Before
- public void setUp() throws Exception {
- widget = new BaseVexWidget(new MockHostComponent());
- final URL url = this.getClass().getResource("/tests/resources/tableTest.css");
- final StyleSheet styleSheet = new StyleSheetReader().read(url);
- widget.setDocument(new Document(new QualifiedName(null, "root")), styleSheet);
- widget.insertElement(new QualifiedName(null, "root"));
- table = widget.insertElement(new QualifiedName(null, "table"));
- }
-
- @Test
- public void testGetCurrentTableRow() throws Exception {
- widget.moveTo(table.getStartPosition().moveBy(1));
- widget.insertFragment(new XMLFragment("<tr><td>content</td><td>td2</td></tr>").getDocumentFragment());
-
- final IElement currentRow = table.childElements().first();
- assertEquals("tr", currentRow.getLocalName());
- widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
- assertEquals(currentRow, VexHandlerUtil.getCurrentTableRow(widget));
- }
-
- @Test
- public void testAddRowAbove() {
- widget.moveTo(table.getStartPosition().moveBy(1));
- widget.insertFragment(new XMLFragment("<tr><td>content</td><td>td2</td></tr>").getDocumentFragment());
-
- final IElement currentRow = table.childElements().first();
- widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
- VexHandlerUtil.duplicateTableRow(widget, currentRow, true);
- final List<? extends IElement> rows = table.childElements().asList();
- assertEquals("Expecting two rows", 2, rows.size());
- assertEquals("Expecting old row on 2nd position", currentRow, rows.get(1));
- assertEquals("Expecting both cells to be created in new row", 2, rows.get(0).childElements().asList().size());
- }
-
- @Test
- public void testAddRowBelow() {
- widget.moveTo(table.getStartPosition().moveBy(1));
- widget.insertFragment(new XMLFragment("<tr><td>content</td><td>td2</td></tr>").getDocumentFragment());
-
- final IElement currentRow = table.childElements().first();
- widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
- VexHandlerUtil.duplicateTableRow(widget, currentRow, false);
- final List<? extends IElement> rows = table.childElements().asList();
- assertEquals("Expecting two rows", 2, rows.size());
- assertEquals("Expecting old row on 1st position", currentRow, rows.get(0));
- assertEquals("Expecting both cells to be created in new row", 2, rows.get(1).childElements().asList().size());
- }
-
- @Test
- public void testDuplicateComments() {
- widget.moveTo(table.getStartPosition().moveBy(1));
- widget.insertFragment(new XMLFragment("<tr><td>content</td><td>td2</td><!--comment--></tr>").getDocumentFragment());
-
- final IElement currentRow = table.childElements().first();
- widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
- VexHandlerUtil.duplicateTableRow(widget, currentRow, false);
- final List<? extends IElement> rows = table.childElements().asList();
- assertEquals("comment", rows.get(1).children().last().getText());
- }
-
- @Test
- public void testDuplicateProcessingInstructions() {
- widget.moveTo(table.getStartPosition().moveBy(1));
- widget.insertFragment(new XMLFragment("<tr><?target data?><td>content</td><td>td2</td></tr>").getDocumentFragment());
-
- final IElement currentRow = table.childElements().first();
- widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
- VexHandlerUtil.duplicateTableRow(widget, currentRow, false);
- final List<? extends IElement> rows = table.childElements().asList();
- assertTrue("Expecting a processing instruction", rows.get(1).children().withoutText().first() instanceof IProcessingInstruction);
- assertEquals("Expecting all childs to be copied", 3, rows.get(1).children().withoutText().asList().size());
- final IProcessingInstruction pi = (IProcessingInstruction) rows.get(1).children().first();
- assertEquals("target", pi.getTarget());
- assertEquals("data", pi.getText());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013 Carsten Hiesserich 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:
+ * Carsten Hiesserich - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.vex.ui.internal.editor.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.vex.core.internal.css.StyleSheet;
+import org.eclipse.vex.core.internal.css.StyleSheetReader;
+import org.eclipse.vex.core.internal.dom.Document;
+import org.eclipse.vex.core.internal.io.XMLFragment;
+import org.eclipse.vex.core.internal.widget.BaseVexWidget;
+import org.eclipse.vex.core.internal.widget.CssTableModel;
+import org.eclipse.vex.core.internal.widget.IVexWidget;
+import org.eclipse.vex.core.internal.widget.MockHostComponent;
+import org.eclipse.vex.core.provisional.dom.IElement;
+import org.eclipse.vex.core.provisional.dom.IProcessingInstruction;
+import org.eclipse.vex.ui.internal.handlers.VexHandlerUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+public class HandlerUtilTest {
+
+ private IVexWidget widget;
+ private IElement table;
+
+ @Before
+ public void setUp() throws Exception {
+ widget = new BaseVexWidget(new MockHostComponent());
+ final URL url = this.getClass().getResource("/tests/resources/tableTest.css");
+ final StyleSheet styleSheet = new StyleSheetReader().read(url);
+ widget.setTableModel(new CssTableModel(styleSheet));
+ widget.setDocument(new Document(new QualifiedName(null, "root")), styleSheet);
+ widget.insertElement(new QualifiedName(null, "root"));
+ table = widget.insertElement(new QualifiedName(null, "table"));
+ }
+
+ @Test
+ public void testGetCurrentTableRow() throws Exception {
+ widget.moveTo(table.getStartPosition().moveBy(1));
+ widget.insertFragment(new XMLFragment("<tr><td>content</td><td>td2</td></tr>").getDocumentFragment());
+
+ final IElement currentRow = table.childElements().first();
+ assertEquals("tr", currentRow.getLocalName());
+ widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
+ assertEquals(currentRow, VexHandlerUtil.getCurrentTableRow(widget));
+ }
+
+ @Test
+ public void testAddRowAbove() {
+ widget.moveTo(table.getStartPosition().moveBy(1));
+ widget.insertFragment(new XMLFragment("<tr><td>content</td><td>td2</td></tr>").getDocumentFragment());
+
+ final IElement currentRow = table.childElements().first();
+ widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
+ VexHandlerUtil.duplicateTableRow(widget, currentRow, true);
+ final List<? extends IElement> rows = table.childElements().asList();
+ assertEquals("Expecting two rows", 2, rows.size());
+ assertEquals("Expecting old row on 2nd position", currentRow, rows.get(1));
+ assertEquals("Expecting both cells to be created in new row", 2, rows.get(0).childElements().asList().size());
+ }
+
+ @Test
+ public void testAddRowBelow() {
+ widget.moveTo(table.getStartPosition().moveBy(1));
+ widget.insertFragment(new XMLFragment("<tr><td>content</td><td>td2</td></tr>").getDocumentFragment());
+
+ final IElement currentRow = table.childElements().first();
+ widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
+ VexHandlerUtil.duplicateTableRow(widget, currentRow, false);
+ final List<? extends IElement> rows = table.childElements().asList();
+ assertEquals("Expecting two rows", 2, rows.size());
+ assertEquals("Expecting old row on 1st position", currentRow, rows.get(0));
+ assertEquals("Expecting both cells to be created in new row", 2, rows.get(1).childElements().asList().size());
+ }
+
+ @Test
+ public void testDuplicateComments() {
+ widget.moveTo(table.getStartPosition().moveBy(1));
+ widget.insertFragment(new XMLFragment("<tr><td>content</td><td>td2</td><!--comment--></tr>").getDocumentFragment());
+
+ final IElement currentRow = table.childElements().first();
+ widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
+ VexHandlerUtil.duplicateTableRow(widget, currentRow, false);
+ final List<? extends IElement> rows = table.childElements().asList();
+ assertEquals("comment", rows.get(1).children().last().getText());
+ }
+
+ @Test
+ public void testDuplicateProcessingInstructions() {
+ widget.moveTo(table.getStartPosition().moveBy(1));
+ widget.insertFragment(new XMLFragment("<tr><?target data?><td>content</td><td>td2</td></tr>").getDocumentFragment());
+
+ final IElement currentRow = table.childElements().first();
+ widget.moveTo(currentRow.children().first().getStartPosition().moveBy(1));
+ VexHandlerUtil.duplicateTableRow(widget, currentRow, false);
+ final List<? extends IElement> rows = table.childElements().asList();
+ assertTrue("Expecting a processing instruction", rows.get(1).children().withoutText().first() instanceof IProcessingInstruction);
+ assertEquals("Expecting all childs to be copied", 3, rows.get(1).children().withoutText().asList().size());
+ final IProcessingInstruction pi = (IProcessingInstruction) rows.get(1).children().first();
+ assertEquals("target", pi.getTarget());
+ assertEquals("data", pi.getText());
+ }
+}
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexActionBarContributor.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexActionBarContributor.java
index 58630bb0..46e71f87 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexActionBarContributor.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexActionBarContributor.java
@@ -26,7 +26,7 @@ import org.eclipse.ui.texteditor.FindNextAction;
import org.eclipse.ui.texteditor.FindReplaceAction;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-import org.eclipse.vex.core.internal.widget.swt.VexWidget;
+import org.eclipse.vex.core.internal.widget.IDocumentEditor;
import org.eclipse.vex.core.provisional.dom.DocumentValidationException;
import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorActionBarContributor;
@@ -45,7 +45,7 @@ public class VexActionBarContributor extends XMLMultiPageEditorActionBarContribu
return (VexEditor) activeEditor;
}
- public VexWidget getVexWidget() {
+ public IDocumentEditor getDocumentEditor() {
if (activeEditor != null) {
return ((VexEditor) activeEditor).getVexWidget();
} else {
@@ -116,12 +116,12 @@ public class VexActionBarContributor extends XMLMultiPageEditorActionBarContribu
private final IAction undoAction = new UndoAction();
private void enableActions() {
- final VexWidget widget = getVexWidget();
- copyAction.setEnabled(widget != null && widget.hasSelection());
- cutAction.setEnabled(widget != null && widget.hasSelection());
- deleteAction.setEnabled(widget != null && widget.hasSelection());
- redoAction.setEnabled(widget != null && widget.canRedo());
- undoAction.setEnabled(widget != null && widget.canUndo());
+ final IDocumentEditor editor = getDocumentEditor();
+ copyAction.setEnabled(editor != null && editor.hasSelection());
+ cutAction.setEnabled(editor != null && editor.hasSelection());
+ deleteAction.setEnabled(editor != null && editor.hasSelection());
+ redoAction.setEnabled(editor != null && editor.canRedo());
+ undoAction.setEnabled(editor != null && editor.canUndo());
}
private final ISelectionListener selectionListener = new ISelectionListener() {
@@ -134,21 +134,21 @@ public class VexActionBarContributor extends XMLMultiPageEditorActionBarContribu
private class CopyAction extends Action {
@Override
public void run() {
- getVexWidget().copySelection();
+ getDocumentEditor().copySelection();
}
};
private class CutAction extends Action {
@Override
public void run() {
- getVexWidget().cutSelection();
+ getDocumentEditor().cutSelection();
}
}
private class DeleteAction extends Action {
@Override
public void run() {
- getVexWidget().deleteSelection();
+ getDocumentEditor().deleteSelection();
}
};
@@ -156,7 +156,7 @@ public class VexActionBarContributor extends XMLMultiPageEditorActionBarContribu
@Override
public void run() {
try {
- getVexWidget().paste();
+ getDocumentEditor().paste();
} catch (final DocumentValidationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -167,15 +167,15 @@ public class VexActionBarContributor extends XMLMultiPageEditorActionBarContribu
private class SelectAllAction extends Action {
@Override
public void run() {
- getVexWidget().selectAll();
+ getDocumentEditor().selectAll();
}
};
private class RedoAction extends Action {
@Override
public void run() {
- if (getVexWidget().canRedo()) {
- getVexWidget().redo();
+ if (getDocumentEditor().canRedo()) {
+ getDocumentEditor().redo();
}
}
};
@@ -183,8 +183,8 @@ public class VexActionBarContributor extends XMLMultiPageEditorActionBarContribu
private class UndoAction extends Action {
@Override
public void run() {
- if (getVexWidget().canUndo()) {
- getVexWidget().undo();
+ if (getDocumentEditor().canUndo()) {
+ getDocumentEditor().undo();
}
}
}
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 c17fa109..22a42047 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
@@ -52,6 +52,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -99,6 +100,8 @@ import org.eclipse.vex.core.internal.dom.DocumentTextPosition;
import org.eclipse.vex.core.internal.io.DocumentReader;
import org.eclipse.vex.core.internal.io.DocumentWriter;
import org.eclipse.vex.core.internal.validator.WTPVEXValidator;
+import org.eclipse.vex.core.internal.widget.CssTableModel;
+import org.eclipse.vex.core.internal.widget.IDocumentEditor;
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;
@@ -525,7 +528,7 @@ public class VexEditor extends EditorPart {
/**
* Returns the VexWidget that implements this editor.
*/
- public VexWidget getVexWidget() {
+ public IDocumentEditor getVexWidget() {
return vexWidget;
}
@@ -800,6 +803,7 @@ public class VexEditor extends EditorPart {
vexWidget.setDebugging(debugging);
vexWidget.setWhitespacePolicy(reader.getWhitespacePolicy());
+ vexWidget.setTableModel(new CssTableModel(style.getStyleSheet()));
vexWidget.setDocument(document, style.getStyleSheet());
vexWidget.setReadOnly(isEditorInputReadOnly());
@@ -1042,7 +1046,8 @@ public class VexEditor extends EditorPart {
// update context service
final ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
final DocumentContextSourceProvider contextProvider = (DocumentContextSourceProvider) service.getSourceProvider(DocumentContextSourceProvider.IS_COLUMN);
- final Rectangle caretArea = Rectangle.NULL; // TODO get the real caret area form the BoxWidget
+ final Point caretLocation = vexWidget.toDisplay(vexWidget.getLocationForContentAssist());
+ final Rectangle caretArea = new Rectangle(caretLocation.x, caretLocation.y, 1, 1); // TODO get the real caret area form the BoxWidget
contextProvider.fireUpdate(vexWidget, caretArea);
}
};
@@ -1185,14 +1190,14 @@ public class VexEditor extends EditorPart {
@Override
protected void inDocumentReplaceSelection(final CharSequence text) {
- final VexWidget vexWidget = getVexWidget();
+ final IDocumentEditor documentEditor = getVexWidget();
// because of Undo this action must be atomic
- vexWidget.doWork(new Runnable() {
+ documentEditor.doWork(new Runnable() {
@Override
public void run() {
- vexWidget.deleteSelection();
- vexWidget.insertText(text.toString());
+ documentEditor.deleteSelection();
+ documentEditor.insertText(text.toString());
}
});
}
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractAddColumnHandler.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractAddColumnHandler.java
index 115921c3..469eb721 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractAddColumnHandler.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractAddColumnHandler.java
@@ -19,7 +19,7 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.vex.core.internal.dom.CopyOfElement;
import org.eclipse.vex.core.internal.layout.LayoutUtils.ElementOrRange;
-import org.eclipse.vex.core.internal.widget.swt.VexWidget;
+import org.eclipse.vex.core.internal.widget.IDocumentEditor;
import org.eclipse.vex.core.provisional.dom.ContentPosition;
import org.eclipse.vex.core.provisional.dom.IElement;
@@ -33,12 +33,12 @@ public abstract class AbstractAddColumnHandler extends AbstractHandler {
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
- final VexWidget widget = VexHandlerUtil.computeWidget(event);
- widget.doWork(new Runnable() {
+ final IDocumentEditor editor = VexHandlerUtil.getDocumentEditor(event);
+ editor.doWork(new Runnable() {
@Override
public void run() {
try {
- addColumn(widget);
+ addColumn(editor);
} catch (final ExecutionException e) {
throw new RuntimeException(e);
}
@@ -47,8 +47,8 @@ public abstract class AbstractAddColumnHandler extends AbstractHandler {
return null;
}
- private void addColumn(final VexWidget widget) throws ExecutionException {
- final int indexToDup = VexHandlerUtil.getCurrentColumnIndex(widget);
+ private void addColumn(final IDocumentEditor editor) throws ExecutionException {
+ final int indexToDup = VexHandlerUtil.getCurrentColumnIndex(editor);
// adding possible?
if (indexToDup == -1) {
@@ -56,7 +56,7 @@ public abstract class AbstractAddColumnHandler extends AbstractHandler {
}
final List<IElement> cellsToDup = new ArrayList<IElement>();
- VexHandlerUtil.iterateTableCells(widget, new TableCellCallbackAdapter() {
+ VexHandlerUtil.iterateTableCells(editor, new TableCellCallbackAdapter() {
@Override
public void onCell(final ElementOrRange row, final ElementOrRange cell, final int rowIndex, final int cellIndex) {
if (cellIndex == indexToDup && cell instanceof IElement) {
@@ -66,14 +66,14 @@ public abstract class AbstractAddColumnHandler extends AbstractHandler {
});
for (final IElement element : cellsToDup) {
- widget.moveTo(addBefore() ? element.getStartPosition() : element.getEndPosition().moveBy(1));
- widget.insertElement(element.getQualifiedName()).accept(new CopyOfElement(element));
+ editor.moveTo(addBefore() ? element.getStartPosition() : element.getEndPosition().moveBy(1));
+ editor.insertElement(element.getQualifiedName()).accept(new CopyOfElement(element));
}
// Place caret in first new cell
final IElement firstCell = cellsToDup.get(0);
final ContentPosition position = new ContentPosition(firstCell, firstCell.getStartOffset() + 1);
- widget.moveTo(position);
+ editor.moveTo(position);
}
/**
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractMoveColumnHandler.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractMoveColumnHandler.java
index 3644239f..3140b009 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractMoveColumnHandler.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractMoveColumnHandler.java
@@ -17,7 +17,7 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.vex.core.internal.layout.LayoutUtils.ElementOrRange;
-import org.eclipse.vex.core.internal.widget.swt.VexWidget;
+import org.eclipse.vex.core.internal.widget.IDocumentEditor;
import org.eclipse.vex.core.provisional.dom.ContentPositionRange;
/**
@@ -30,20 +30,20 @@ public abstract class AbstractMoveColumnHandler extends AbstractHandler {
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
- final VexWidget widget = VexHandlerUtil.computeWidget(event);
- final VexHandlerUtil.RowColumnInfo rcInfo = VexHandlerUtil.getRowColumnInfo(widget);
+ final IDocumentEditor editor = VexHandlerUtil.getDocumentEditor(event);
+ final VexHandlerUtil.RowColumnInfo rcInfo = VexHandlerUtil.getRowColumnInfo(editor);
if (rcInfo == null || !movingPossible(rcInfo)) {
return null;
}
- widget.doWork(new Runnable() {
+ editor.doWork(new Runnable() {
@Override
public void run() {
final List<Object> sourceCells = new ArrayList<Object>();
final List<Object> targetCells = new ArrayList<Object>();
- computeCells(widget, rcInfo, sourceCells, targetCells);
- swapCells(widget, sourceCells, targetCells);
+ computeCells(editor, rcInfo, sourceCells, targetCells);
+ swapCells(editor, sourceCells, targetCells);
}
}, true);
return null;
@@ -54,9 +54,9 @@ public abstract class AbstractMoveColumnHandler extends AbstractHandler {
*/
protected abstract boolean moveRight();
- private void computeCells(final VexWidget widget, final VexHandlerUtil.RowColumnInfo rcInfo, final List<Object> sourceCells, final List<Object> targetCells) {
+ private void computeCells(final IDocumentEditor editor, final VexHandlerUtil.RowColumnInfo rcInfo, final List<Object> sourceCells, final List<Object> targetCells) {
- VexHandlerUtil.iterateTableCells(widget, new TableCellCallbackAdapter() {
+ VexHandlerUtil.iterateTableCells(editor, new TableCellCallbackAdapter() {
private Object leftCell;
@@ -73,7 +73,7 @@ public abstract class AbstractMoveColumnHandler extends AbstractHandler {
});
}
- private void swapCells(final VexWidget widget, final List<Object> sourceCells, final List<Object> targetCells) {
+ private void swapCells(final IDocumentEditor editor, final List<Object> sourceCells, final List<Object> targetCells) {
// Iterate the deletions in reverse, so that we don't mess up offsets
// that are in anonymous cells, which are not stored as positions.
@@ -86,16 +86,16 @@ public abstract class AbstractMoveColumnHandler extends AbstractHandler {
final Object target = targetCells.get(i);
final ContentPositionRange sourceRange = VexHandlerUtil.getOuterRange(source);
final ContentPositionRange targetRange = VexHandlerUtil.getOuterRange(target);
- widget.moveTo(moveRight() ? targetRange.getStartPosition() : targetRange.getEndPosition());
- widget.savePosition(new Runnable() {
+ editor.moveTo(moveRight() ? targetRange.getStartPosition() : targetRange.getEndPosition());
+ editor.savePosition(new Runnable() {
@Override
public void run() {
- widget.moveTo(sourceRange.getStartPosition());
- widget.moveTo(sourceRange.getEndPosition(), true);
- widget.cutSelection();
+ editor.moveTo(sourceRange.getStartPosition());
+ editor.moveTo(sourceRange.getEndPosition(), true);
+ editor.cutSelection();
}
});
- widget.paste();
+ editor.paste();
}
}
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractVexWidgetHandler.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractVexWidgetHandler.java
index 8a0f2fcf..0783bc37 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractVexWidgetHandler.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractVexWidgetHandler.java
@@ -34,7 +34,7 @@ public abstract class AbstractVexWidgetHandler extends AbstractHandler implement
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
- execute(event, VexHandlerUtil.computeWidget(event));
+ execute(event, VexHandlerUtil.getDocumentEditor(event));
return null;
}
@@ -59,12 +59,12 @@ public abstract class AbstractVexWidgetHandler extends AbstractHandler implement
}
final IWorkbenchWindow window = (IWorkbenchWindow) windowObject;
- final VexWidget widget = VexHandlerUtil.computeWidget(window);
- if (widget == null) {
+ final IDocumentEditor editor = VexHandlerUtil.getDocumentEditor(window);
+ if (editor == null) {
return;
}
- final IElement currentElement = widget.getCurrentElement();
+ final IElement currentElement = editor.getCurrentElement();
final String name;
if (currentElement != null) {
name = currentElement.getPrefixedName();
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/StyleMenu.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/StyleMenu.java
index 098c2f6e..2e4afbc5 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/StyleMenu.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/StyleMenu.java
@@ -33,7 +33,7 @@ public class StyleMenu extends ContributionItem {
public void fill(final Menu menu, final int index) {
final IWorkbench workbench = PlatformUI.getWorkbench();
final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- final VexEditor editor = VexHandlerUtil.computeVexEditor(window);
+ final VexEditor editor = VexHandlerUtil.getActiveVexEditor(window);
if (editor == null) {
return;
}
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/VexHandlerUtil.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/VexHandlerUtil.java
index d92c8d7d..db1c527d 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/VexHandlerUtil.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/VexHandlerUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2013 John Krasnay and others.
+ * Copyright (c) 2004, 2016 John Krasnay 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
@@ -9,6 +9,7 @@
* John Krasnay - initial API and implementation
* Igor Jacy Lino Campista - Java 5 warnings fixed (bug 311325)
* Carsten Hiesserich - use a visitor to create a new table row
+ * Florian Thienel - introduce IDocumentEditor
*******************************************************************************/
package org.eclipse.vex.ui.internal.handlers;
@@ -30,7 +31,6 @@ import org.eclipse.vex.core.internal.layout.ElementOrRangeCallback;
import org.eclipse.vex.core.internal.layout.LayoutUtils;
import org.eclipse.vex.core.internal.layout.LayoutUtils.ElementOrRange;
import org.eclipse.vex.core.internal.widget.IDocumentEditor;
-import org.eclipse.vex.core.internal.widget.swt.VexWidget;
import org.eclipse.vex.core.provisional.dom.BaseNodeVisitor;
import org.eclipse.vex.core.provisional.dom.ContentPosition;
import org.eclipse.vex.core.provisional.dom.ContentPositionRange;
@@ -50,25 +50,25 @@ import org.eclipse.vex.ui.internal.editor.VexEditor;
*/
public final class VexHandlerUtil {
- public static VexWidget computeWidget(final ExecutionEvent event) throws ExecutionException {
+ public static IDocumentEditor getDocumentEditor(final ExecutionEvent event) throws ExecutionException {
final IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
- VexWidget widget = null;
+ IDocumentEditor documentEditor = null;
if (activeEditor instanceof VexEditor) {
- widget = ((VexEditor) activeEditor).getVexWidget();
+ documentEditor = ((VexEditor) activeEditor).getVexWidget();
}
- assertNotNull(widget, "Can not compute VexWidget.");
- return widget;
+ assertNotNull(documentEditor, "Can not compute document editor.");
+ return documentEditor;
}
- public static VexWidget computeWidget(final IWorkbenchWindow window) {
- final VexEditor editor = computeVexEditor(window);
+ public static IDocumentEditor getDocumentEditor(final IWorkbenchWindow window) {
+ final VexEditor editor = getActiveVexEditor(window);
if (editor == null) {
return null;
}
return editor.getVexWidget();
}
- public static VexEditor computeVexEditor(final ExecutionEvent event) throws ExecutionException {
+ public static VexEditor getActiveVexEditor(final ExecutionEvent event) throws ExecutionException {
final IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
if (activeEditor instanceof VexEditor) {
@@ -77,7 +77,7 @@ public final class VexHandlerUtil {
return null;
}
- public static VexEditor computeVexEditor(final IWorkbenchWindow window) {
+ public static VexEditor getActiveVexEditor(final IWorkbenchWindow window) {
final IEditorPart activeEditor = window.getActivePage().getActiveEditor();
if (activeEditor == null) {
return null;
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 e5c37d1e..3a054345 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
@@ -37,6 +37,7 @@ import org.eclipse.ui.part.IPageSite;
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.VexWidget;
import org.eclipse.vex.core.provisional.dom.AttributeChangeEvent;
import org.eclipse.vex.core.provisional.dom.ContentChangeEvent;
@@ -66,7 +67,7 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
public DocumentOutlinePage(final VexEditor vexEditor) {
super();
- this.vexEditor = vexEditor;
+ this.editorPart = vexEditor;
}
@Override
@@ -75,10 +76,10 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());
- vexEditor.addVexEditorListener(vexEditorListener);
- vexEditor.getEditorSite().getSelectionProvider().addSelectionChangedListener(selectionListener);
+ editorPart.addVexEditorListener(vexEditorListener);
+ editorPart.getEditorSite().getSelectionProvider().addSelectionChangedListener(selectionListener);
initToolbarActions();
- if (vexEditor.isLoaded()) {
+ if (editorPart.isLoaded()) {
showTreeViewer();
} else {
showLabel(Messages.getString("DocumentOutlinePage.loading")); //$NON-NLS-1$
@@ -88,8 +89,8 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
@Override
public void dispose() {
- vexEditor.removeVexEditorListener(vexEditorListener);
- vexEditor.getEditorSite().getSelectionProvider().removeSelectionChangedListener(selectionListener);
+ editorPart.removeVexEditorListener(vexEditorListener);
+ editorPart.getEditorSite().getSelectionProvider().removeSelectionChangedListener(selectionListener);
if (filterActionGroup != null) {
filterActionGroup.dispose();
}
@@ -170,7 +171,7 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
private TreeViewer treeViewer;
private OutlineFilterActionGroup filterActionGroup;
- private final VexEditor vexEditor;
+ private final VexEditor editorPart;
private IOutlineProvider outlineProvider;
@@ -209,7 +210,7 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
composite.layout();
- final DocumentType doctype = vexEditor.getDocumentType();
+ final DocumentType doctype = editorPart.getDocumentType();
if (doctype == null) {
return;
@@ -238,7 +239,7 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
((IToolBarContributor) outlineProvider).registerToolBarActions(this, getSite().getActionBars());
}
- outlineProvider.init(vexEditor);
+ outlineProvider.init(editorPart);
treeViewer.setContentProvider(outlineProvider.getContentProvider());
treeViewer.setLabelProvider(outlineProvider.getLabelProvider());
@@ -247,7 +248,7 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
filterActionGroup.setViewer(treeViewer);
treeViewer.setUseHashlookup(true);
- final IDocument document = vexEditor.getVexWidget().getDocument();
+ final IDocument document = editorPart.getVexWidget().getDocument();
treeViewer.setInput(document);
document.addDocumentListener(documentListener);
@@ -321,13 +322,13 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
lastExpandedElements = null;
final INode node = (INode) selected[0].getData();
selectedTreeNode = node;
- final VexWidget vexWidget = vexEditor.getVexWidget();
+ final IDocumentEditor documentEditor = editorPart.getVexWidget();
// Moving to the end of the element first is a cheap
// way to make sure we end up with the
// caret at the top of the viewport
- vexWidget.moveTo(node.getEndPosition());
- vexWidget.moveTo(node.getStartPosition().moveBy(1), true);
+ documentEditor.moveTo(node.getEndPosition());
+ documentEditor.moveTo(node.getStartPosition().moveBy(1), true);
}
}
}
@@ -346,9 +347,9 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
final TreeItem[] selected = treeViewer.getTree().getSelection();
if (selected.length > 0) {
final INode node = (INode) selected[0].getData();
- final VexWidget vexWidget = vexEditor.getVexWidget();
- vexWidget.moveTo(node.getStartPosition().moveBy(1));
- vexWidget.setFocus();
+ final IDocumentEditor documentEditor = editorPart.getVexWidget();
+ documentEditor.moveTo(node.getStartPosition().moveBy(1));
+ editorPart.setFocus();
}
}
}
@@ -381,7 +382,7 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
// This cast is save because this event is only fired due to the attribute changes of elements.
final IElement parent = (IElement) event.getParent();
final IAttribute attr = parent.getAttribute(event.getAttributeName());
- if (vexEditor.getStyle().getStyleSheet().getStyles(parent).getOutlineContent() == attr) {
+ if (editorPart.getStyle().getStyleSheet().getStyles(parent).getOutlineContent() == attr) {
// Parent has to be refreshed, since it uses this attribute as outline content
getTreeViewer().refresh(outlineProvider.getOutlineElement(parent));
}
@@ -417,7 +418,7 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
} else if (outlineElement instanceof IElement) {
// This SHOULD always be the case
final IElement parent = ((IElement) outlineElement).getParentElement();
- if (parent != null && vexEditor.getStyle().getStyleSheet().getStyles(parent).getOutlineContent() == outlineElement) {
+ if (parent != null && editorPart.getStyle().getStyleSheet().getStyles(parent).getOutlineContent() == outlineElement) {
// Parent has to be refreshed, since it uses this element as content
getTreeViewer().refresh(outlineProvider.getOutlineElement(parent));
} else {
@@ -429,7 +430,7 @@ public class DocumentOutlinePage extends Page implements IContentOutlinePage {
private void initToolbarActions() {
- final Style style = vexEditor.getStyle();
+ final Style style = editorPart.getStyle();
if (style != null) {
filterActionGroup = new OutlineFilterActionGroup(style.getStyleSheet());
} else {
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 7c4ad1ee..211a03be 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
@@ -11,8 +11,6 @@
package org.eclipse.vex.ui.internal.views;
import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -39,13 +37,9 @@ import org.eclipse.ui.IActionBars;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.IPageBookViewPage;
import org.eclipse.ui.part.IPageSite;
-import org.eclipse.vex.core.internal.core.Caret;
import org.eclipse.vex.core.internal.core.Rectangle;
import org.eclipse.vex.core.internal.layout.Box;
-import org.eclipse.vex.core.internal.widget.BaseVexWidget;
-import org.eclipse.vex.core.internal.widget.IBoxFilter;
-import org.eclipse.vex.core.internal.widget.IHostComponent;
-import org.eclipse.vex.core.internal.widget.swt.VexWidget;
+import org.eclipse.vex.core.internal.widget.IDocumentEditor;
import org.eclipse.vex.core.provisional.dom.ContentPosition;
import org.eclipse.vex.core.provisional.dom.ContentRange;
import org.eclipse.vex.core.provisional.dom.IDocument;
@@ -57,7 +51,7 @@ import org.eclipse.vex.ui.internal.editor.VexEditor;
class DebugViewPage implements IPageBookViewPage {
public DebugViewPage(final VexEditor vexEditor) {
- this.vexEditor = vexEditor;
+ editorPart = vexEditor;
}
@Override
@@ -66,22 +60,23 @@ class DebugViewPage implements IPageBookViewPage {
composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());
- if (vexEditor.isLoaded()) {
+ if (editorPart.isLoaded()) {
createDebugPanel();
} else {
loadingLabel = new Label(composite, SWT.NONE);
loadingLabel.setText("Loading...");
}
- vexEditor.getEditorSite().getSelectionProvider().addSelectionChangedListener(selectionListener);
+ editorPart.getEditorSite().getSelectionProvider().addSelectionChangedListener(selectionListener);
}
@Override
public void dispose() {
- if (vexWidget != null && !vexWidget.isDisposed()) {
- vexWidget.removeMouseMoveListener(mouseMoveListener);
- }
- vexEditor.getEditorSite().getSelectionProvider().removeSelectionChangedListener(selectionListener);
+ // TODO find this information elsewhere
+ // if (documentEditor != null && !documentEditor.isDisposed()) {
+ // documentEditor.removeMouseMoveListener(mouseMoveListener);
+ // }
+ editorPart.getEditorSite().getSelectionProvider().removeSelectionChangedListener(selectionListener);
}
@Override
@@ -114,34 +109,34 @@ class DebugViewPage implements IPageBookViewPage {
private static final int WIDTH = 3;
private static final int HEIGHT = 4;
- private static Field implField;
- private static Field rootBoxField;
- private static Field caretField;
- private static Field hostComponentField;
- private static Method findInnermostBoxMethod;
-
- static {
- try {
- implField = VexWidget.class.getDeclaredField("impl");
- implField.setAccessible(true);
- rootBoxField = BaseVexWidget.class.getDeclaredField("rootBox");
- rootBoxField.setAccessible(true);
- caretField = BaseVexWidget.class.getDeclaredField("caret");
- caretField.setAccessible(true);
- hostComponentField = BaseVexWidget.class.getDeclaredField("hostComponent");
- hostComponentField.setAccessible(true);
- findInnermostBoxMethod = BaseVexWidget.class.getDeclaredMethod("findInnermostBox", IBoxFilter.class);
- findInnermostBoxMethod.setAccessible(true);
- } catch (final Exception e) {
- e.printStackTrace();
- // TODO: handle exception
- }
- }
+ // TODO find this information elsewhere
+ // private static Field implField;
+ // private static Field rootBoxField;
+ // private static Field caretField;
+ // private static Field hostComponentField;
+ // private static Method findInnermostBoxMethod;
+ //
+ // static {
+ // try {
+ // implField = VexWidget.class.getDeclaredField("impl");
+ // implField.setAccessible(true);
+ // rootBoxField = BaseVexWidget.class.getDeclaredField("rootBox");
+ // rootBoxField.setAccessible(true);
+ // caretField = BaseVexWidget.class.getDeclaredField("caret");
+ // caretField.setAccessible(true);
+ // hostComponentField = BaseVexWidget.class.getDeclaredField("hostComponent");
+ // hostComponentField.setAccessible(true);
+ // findInnermostBoxMethod = BaseVexWidget.class.getDeclaredMethod("findInnermostBox", IBoxFilter.class);
+ // findInnermostBoxMethod.setAccessible(true);
+ // } catch (final Exception e) {
+ // e.printStackTrace();
+ // // TODO: handle exception
+ // }
+ // }
private IPageSite site;
- private final VexEditor vexEditor;
- private VexWidget vexWidget;
- private BaseVexWidget impl;
+ private final VexEditor editorPart;
+ private IDocumentEditor documentEditor;
private Composite composite;
private Label loadingLabel;
@@ -166,16 +161,16 @@ class DebugViewPage implements IPageBookViewPage {
loadingLabel = null;
}
- vexWidget = vexEditor.getVexWidget();
- try {
- impl = (BaseVexWidget) implField.get(vexWidget);
- } catch (final IllegalArgumentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (final IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ documentEditor = editorPart.getVexWidget();
+ // try {
+ // impl = (BaseVexWidget) implField.get(vexWidget);
+ // } catch (final IllegalArgumentException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // } catch (final IllegalAccessException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
final GridLayout layout = new GridLayout();
layout.numColumns = 1;
@@ -266,7 +261,8 @@ class DebugViewPage implements IPageBookViewPage {
composite.layout();
- vexWidget.addMouseMoveListener(mouseMoveListener);
+ // TODO find this information elsewhere
+ // documentEditor.addMouseMoveListener(mouseMoveListener);
repopulate();
}
@@ -274,7 +270,7 @@ class DebugViewPage implements IPageBookViewPage {
private final ISelectionChangedListener selectionListener = new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
- if (vexWidget == null) {
+ if (documentEditor == null) {
createDebugPanel();
}
repopulate();
@@ -307,7 +303,6 @@ class DebugViewPage implements IPageBookViewPage {
}
private final MouseMoveListener mouseMoveListener = new MouseMoveListener() {
-
@Override
public void mouseMove(final MouseEvent e) {
final Rectangle rect = new Rectangle(e.x, e.y, 0, 0);
@@ -315,22 +310,27 @@ class DebugViewPage implements IPageBookViewPage {
setItemFromRect(mouseAbsItem, rect);
setItemRel(mouseRelItem, viewport, rect);
}
-
};
private Rectangle getCaretBounds() {
- final Caret caret = (Caret) getFieldValue(caretField, impl);
- return caret.getBounds();
+ // TODO find this information elsewhere
+ // final Caret caret = (Caret) getFieldValue(caretField, impl);
+ // return caret.getBounds();
+ return Rectangle.NULL;
}
private Rectangle getRootBoxBounds() {
- final Box rootBox = (Box) getFieldValue(rootBoxField, impl);
- return new Rectangle(rootBox.getX(), rootBox.getY(), rootBox.getWidth(), rootBox.getHeight());
+ // TODO find this information elsewhere
+ // final Box rootBox = (Box) getFieldValue(rootBoxField, impl);
+ // return new Rectangle(rootBox.getX(), rootBox.getY(), rootBox.getWidth(), rootBox.getHeight());
+ return Rectangle.NULL;
}
private Rectangle getViewport() {
- final IHostComponent hc = (IHostComponent) getFieldValue(hostComponentField, impl);
- return hc.getViewport();
+ // TODO find this information elsewhere
+ // final IHostComponent hc = (IHostComponent) getFieldValue(hostComponentField, impl);
+ // return hc.getViewport();
+ return Rectangle.NULL;
}
private Object getFieldValue(final Field field, final Object o) {
@@ -345,7 +345,7 @@ class DebugViewPage implements IPageBookViewPage {
setItemFromRect(documentItem, getRootBoxBounds());
setFromInnermostBox(boxItem, getInnermostBox());
final Rectangle viewport = getViewport();
- caretOffsetItem.setText(1, impl.getCaretPosition().toString());
+ caretOffsetItem.setText(1, documentEditor.getCaretPosition().toString());
caretOffsetContentItem.setText(1, getContent());
setItemFromRect(viewportItem, viewport);
setItemFromRect(caretAbsItem, getCaretBounds());
@@ -362,20 +362,22 @@ class DebugViewPage implements IPageBookViewPage {
}
private Box getInnermostBox() {
- try {
- return (Box) findInnermostBoxMethod.invoke(impl, IBoxFilter.TRUE);
- } catch (final IllegalArgumentException e) {
- return null;
- } catch (final IllegalAccessException e) {
- return null;
- } catch (final InvocationTargetException e) {
- return null;
- }
+ // TODO find this information elsewhere
+ // try {
+ // return (Box) findInnermostBoxMethod.invoke(impl, IBoxFilter.TRUE);
+ // } catch (final IllegalArgumentException e) {
+ // return null;
+ // } catch (final IllegalAccessException e) {
+ // return null;
+ // } catch (final InvocationTargetException e) {
+ // return null;
+ // }
+ return null;
}
private String getContent() {
- final ContentPosition offset = impl.getCaretPosition();
- final IDocument doc = impl.getDocument();
+ final ContentPosition offset = documentEditor.getCaretPosition();
+ final IDocument doc = documentEditor.getDocument();
final int len = 8;
final StringBuilder result = new StringBuilder();

Back to the top