Commit d79b0f73 authored by ekuleshov's avatar ekuleshov

reducing use of the internal api

parent e4d97a56
...@@ -199,9 +199,10 @@ public class BytecodeSourceMapper extends SourceMapper { ...@@ -199,9 +199,10 @@ public class BytecodeSourceMapper extends SourceMapper {
* @see org.eclipse.jdt.internal.core.SourceMapper#mapSource(IType, char[]) * @see org.eclipse.jdt.internal.core.SourceMapper#mapSource(IType, char[])
*/ */
public void mapSource(IType type, char[] contents, boolean force) { public void mapSource(IType type, char[] contents, boolean force) {
if (force) { // TODO commented out for now. there is no such method anymore in Eclipse 3.2M4
fSourceRanges.remove(type); // if (force) {
} // fSourceRanges.remove(type);
// }
super.mapSource(type, contents); super.mapSource(type, contents);
} }
......
...@@ -25,7 +25,6 @@ import org.eclipse.jdt.core.IMethod; ...@@ -25,7 +25,6 @@ import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.actions.AbstractToggleLinkingAction; import org.eclipse.jdt.internal.ui.actions.AbstractToggleLinkingAction;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuListener;
...@@ -63,6 +62,7 @@ import org.eclipse.swt.events.SelectionEvent; ...@@ -63,6 +62,7 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
...@@ -81,10 +81,10 @@ import org.eclipse.ui.IWorkbenchPart; ...@@ -81,10 +81,10 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.console.actions.TextViewerAction; import org.eclipse.ui.console.actions.TextViewerAction;
import org.eclipse.ui.internal.layout.TrimLayout;
import org.eclipse.ui.part.ViewPart; import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.texteditor.FindReplaceAction; import org.eclipse.ui.texteditor.FindReplaceAction;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.IUpdate; import org.eclipse.ui.texteditor.IUpdate;
import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds; import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
...@@ -144,7 +144,7 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -144,7 +144,7 @@ public class BytecodeOutlineView extends ViewPart {
protected Table stackTable; protected Table stackTable;
protected Table lvtTable; protected Table lvtTable;
protected JavaEditor javaEditor; protected ITextEditor javaEditor;
protected IJavaElement javaInput; protected IJavaElement javaInput;
protected IJavaElement lastChildElement; protected IJavaElement lastChildElement;
protected IJavaElement lastDecompiledElement; protected IJavaElement lastDecompiledElement;
...@@ -267,7 +267,7 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -267,7 +267,7 @@ public class BytecodeOutlineView extends ViewPart {
this.bytecodeChanged = bytecodeChanged; this.bytecodeChanged = bytecodeChanged;
} }
private void setInput(JavaEditor editor) { private void setInput(ITextEditor editor) {
javaEditor = null; javaEditor = null;
javaInput = null; javaInput = null;
lastDecompiledResult = null; lastDecompiledResult = null;
...@@ -352,20 +352,23 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -352,20 +352,23 @@ public class BytecodeOutlineView extends ViewPart {
} }
}); });
Composite mainComposite = new Composite(parent1, SWT.NONE); GridLayout parentLayout = new GridLayout();
TrimLayout tLayout = new TrimLayout(); parentLayout.numColumns = 1;
mainComposite.setLayout(tLayout); parentLayout.marginBottom = -5;
parentLayout.marginTop = -5;
parentLayout.marginLeft = -5;
parentLayout.marginRight = -5;
stackComposite = new Composite(mainComposite, SWT.NONE); parent1.setLayout(parentLayout);
tLayout.setCenterControl(stackComposite);
stackComposite = new Composite(parent1, SWT.NONE);
stackComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); stackComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
stackComposite.setLayout(new StackLayout()); stackComposite.setLayout(new StackLayout());
statusLineManager = new StatusLineManager(); statusLineManager = new StatusLineManager();
statusControl = statusLineManager.createControl(mainComposite, SWT.NONE); statusControl = statusLineManager.createControl(parent1, SWT.NONE);
tLayout.addTrim(statusControl, SWT.BOTTOM); statusControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
//statusLineManager.setErrorMessage("hallo!");
// init text viewer ans some related actions ----------------------------------- // init text viewer ans some related actions -----------------------------------
// TODO make init code clear // TODO make init code clear
...@@ -745,7 +748,7 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -745,7 +748,7 @@ public class BytecodeOutlineView extends ViewPart {
isVisible = true; isVisible = true;
// check if java editor is already open // check if java editor is already open
IEditorPart activeEditor = EclipseUtils.getActiveEditor(); IEditorPart activeEditor = EclipseUtils.getActiveEditor();
if (!(activeEditor instanceof JavaEditor)) { if (!(activeEditor instanceof ITextEditor)) {
// start monitoring again, even if current editor is not // start monitoring again, even if current editor is not
// supported - but we at front now // supported - but we at front now
activateView(); activateView();
...@@ -754,13 +757,13 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -754,13 +757,13 @@ public class BytecodeOutlineView extends ViewPart {
part = activeEditor; part = activeEditor;
// continue with setting input // continue with setting input
} }
if (isVisible && part instanceof JavaEditor) { if (isVisible && part instanceof ITextEditor) {
if (isActive() && part == javaEditor) { if (isActive() && part == javaEditor) {
return; return;
} }
activateView(); activateView();
setEnabled(true); setEnabled(true);
setInput((JavaEditor) part); setInput((ITextEditor) part);
refreshView(); refreshView();
} else if (part instanceof IEditorPart) { } else if (part instanceof IEditorPart) {
if (isActive()) { if (isActive()) {
...@@ -775,7 +778,7 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -775,7 +778,7 @@ public class BytecodeOutlineView extends ViewPart {
|| !(part instanceof IEditorPart)) { || !(part instanceof IEditorPart)) {
return; return;
} }
if (!(part instanceof JavaEditor)) { if (!(part instanceof ITextEditor)) {
deActivateView(); deActivateView();
return; return;
} }
...@@ -783,7 +786,7 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -783,7 +786,7 @@ public class BytecodeOutlineView extends ViewPart {
setEnabled(true); setEnabled(true);
} }
if (part != javaEditor) { if (part != javaEditor) {
setInput((JavaEditor) part); setInput((ITextEditor) part);
} else { } else {
if( ! updateSelection((ITextSelection) selection)){ if( ! updateSelection((ITextSelection) selection)){
return; return;
...@@ -1072,7 +1075,7 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -1072,7 +1075,7 @@ public class BytecodeOutlineView extends ViewPart {
protected void setSelectionInJavaEditor(Point selection) { protected void setSelectionInJavaEditor(Point selection) {
if (javaEditor != null && javaEditor.getViewer() == null) { if (javaEditor != null && javaEditor.getEditorInput() == null) {
// editor was closed - we should clean the reference // editor was closed - we should clean the reference
javaEditor = null; javaEditor = null;
javaInput = null; javaInput = null;
...@@ -1092,8 +1095,7 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -1092,8 +1095,7 @@ public class BytecodeOutlineView extends ViewPart {
try { try {
if (sourceLine > 0) { if (sourceLine > 0) {
IRegion lineInfo = javaEditor.getViewer().getDocument() IRegion lineInfo = javaEditor.getDocumentProvider().getDocument(javaEditor.getEditorInput()).getLineInformation(sourceLine-1);
.getLineInformation(sourceLine - 1);
EclipseUtils.selectInEditor(javaEditor, lineInfo EclipseUtils.selectInEditor(javaEditor, lineInfo
.getOffset(), lineInfo.getLength()); .getOffset(), lineInfo.getLength());
...@@ -1123,9 +1125,9 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -1123,9 +1125,9 @@ public class BytecodeOutlineView extends ViewPart {
} else { } else {
if (checkNewSelection) { if (checkNewSelection) {
IEditorPart activeEditor = EclipseUtils.getActiveEditor(); IEditorPart activeEditor = EclipseUtils.getActiveEditor();
if (activeEditor instanceof JavaEditor) { if (activeEditor instanceof ITextEditor) {
ITextSelection selection = EclipseUtils ITextSelection selection = EclipseUtils
.getSelection(((JavaEditor) activeEditor) .getSelection(((ITextEditor) activeEditor)
.getSelectionProvider()); .getSelectionProvider());
handleSelectionChanged(activeEditor, selection); handleSelectionChanged(activeEditor, selection);
return; return;
...@@ -1133,7 +1135,7 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -1133,7 +1135,7 @@ public class BytecodeOutlineView extends ViewPart {
} }
for (int i = 0; i < editorReferences.length; i++) { for (int i = 0; i < editorReferences.length; i++) {
IEditorPart editor = editorReferences[i].getEditor(false); IEditorPart editor = editorReferences[i].getEditor(false);
if (editor instanceof JavaEditor) { if (editor instanceof ITextEditor) {
return; return;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment