Commit fe70bcf1 authored by andrei's avatar andrei

Fixed API/runtime incompatibilities with Eclipse 3.6

parent cd7ef272
......@@ -30,6 +30,8 @@ import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlink;
import org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector;
import org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer;
import org.eclipse.jdt.internal.ui.text.JavaWordFinder;
......@@ -1877,7 +1879,7 @@ public class BytecodeOutlineView extends ViewPart {
if (elements[i] == null) {
continue;
}
addHyperlinks(
addHyperlinks2(
links, wordRegion, (SelectionDispatchAction) openAction,
elements[i], elements.length > 1, dummyEditorForHyperlinks);
}
......@@ -1887,6 +1889,25 @@ public class BytecodeOutlineView extends ViewPart {
return links.toArray(new IHyperlink[links.size()]);
}
/**
* This method is added for compatibility with Eclipse 3.6 and 3.7 only!
* <p>
* Creates and adds Java element hyperlinks.
*
* @param hyperlinksCollector the list to which hyperlinks should be added
* @param wordRegion the region of the link
* @param openAction the action to use to open the Java elements
* @param element the Java element to open
* @param qualify <code>true</code> if the hyperlink text should show a qualified name for
* element
* @param editor the active Java editor
*
* @since 3.7.1
*/
protected void addHyperlinks2(List<IHyperlink> hyperlinksCollector, IRegion wordRegion, SelectionDispatchAction openAction, IJavaElement element, boolean qualify, JavaEditor editor) {
hyperlinksCollector.add(new JavaElementHyperlink(wordRegion, openAction, element, qualify));
}
}
private final class JavaConfiguration extends JavaSourceViewerConfiguration {
......
......@@ -33,9 +33,19 @@ import de.loskutov.bco.BytecodeOutlinePlugin;
public class HelpUtils {
private static String styleSheet;
private static final RGB BG_COLOR_RGB = Display.getDefault().getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB();
private static final RGB FG_COLOR_RGB = Display.getDefault().getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB();
private static final String DOC_BASE = "/" + BytecodeOutlinePlugin.getDefault().getBundle().getSymbolicName() + "/doc/";
private static RGB bg_color_rgb = new RGB(255, 255, 255);
private static RGB fg_color_rgb = new RGB(0, 0, 0);
static {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
bg_color_rgb = Display.getDefault().getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB();
fg_color_rgb = Display.getDefault().getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB();
}
});
}
private static String checkOpcodeName(String opcodeName) {
opcodeName = opcodeName.toLowerCase();
......@@ -139,9 +149,9 @@ public class HelpUtils {
css = HTMLPrinter.convertTopLevelFont(css, fontData);
StringBuilder sb = new StringBuilder(css);
sb.append("\nbody { background-color:");
appendColor(sb, BG_COLOR_RGB);
appendColor(sb, bg_color_rgb);
sb.append("; color:");
appendColor(sb, FG_COLOR_RGB);
appendColor(sb, fg_color_rgb);
sb.append("; }\n");
return sb.toString();
}
......
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