Commit f65088d2 authored by Sebastian Pretscher's avatar Sebastian Pretscher

Removed some unnecessery example stuff and created a subclass of

TextEditor
parent 85e6fbdd
package de.tum.in.www2.cupplugin.editors;
import org.eclipse.ui.editors.text.TextEditor;
public class CupTextEditor extends TextEditor {
public CupTextEditor() {
}
}
......@@ -44,10 +44,7 @@ import org.eclipse.ui.ide.IDE;
public class MultiPageEditor extends MultiPageEditorPart implements IResourceChangeListener{
/** The text editor used in page 0. */
private TextEditor editor;
/** The font chosen in page 1. */
private Font font;
private CupTextEditor editor;
/** The text widget used in page 2. */
private StyledText text;
......@@ -64,7 +61,7 @@ public class MultiPageEditor extends MultiPageEditorPart implements IResourceCha
*/
void createPage0() {
try {
editor = new TextEditor();
editor = new CupTextEditor();
int index = addPage(editor, getEditorInput());
setPageText(index, editor.getTitle());
} catch (PartInitException e) {
......@@ -172,20 +169,7 @@ public class MultiPageEditor extends MultiPageEditorPart implements IResourceCha
});
}
}
/**
* Sets the font related data to be applied to the text in page 2.
*/
void setFont() {
FontDialog fontDialog = new FontDialog(getSite().getShell());
fontDialog.setFontList(text.getFont().getFontData());
FontData fontData = fontDialog.open();
if (fontData != null) {
if (font != null)
font.dispose();
font = new Font(text.getDisplay(), fontData);
text.setFont(font);
}
}
/**
* Sorts the words in page 0, and shows them in page 2.
*/
......@@ -196,7 +180,7 @@ public class MultiPageEditor extends MultiPageEditorPart implements IResourceCha
StringTokenizer tokenizer =
new StringTokenizer(editorText, " \t\n\r\f!@#\u0024%^&*()-_=+`~[]{};:'\",.<>/?|\\");
ArrayList editorWords = new ArrayList();
ArrayList<String> editorWords = new ArrayList<String>();
while (tokenizer.hasMoreTokens()) {
editorWords.add(tokenizer.nextToken());
}
......
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