toolbarPanel.add(buildButton(Icons.editorIcons.Redo(), "Redo", false, new SystemRedoCommand()));
toolbarPanel.add(buildSeparator());
toolbarPanel.add(buildButton(Icons.editorIcons.Resources(), "Project resources", false, new SystemShowDialogCommand(DynamicResourcesDialog.class)));
toolbarPanel.add(buildButton(Icons.editorIcons.Compile(), "Compile", false, new CurrentDocumentCompileCommand()));
toolbarPanel.add(buildSeparator());
toolbarPanel.add(buildButton(Icons.editorIcons.Bold(), "Bold", false, new SystemPasteCommand("\\textbf{ <text here> }")));
toolbarPanel.add(buildButton(Icons.editorIcons.Italic(), "Italic", false, new SystemPasteCommand("\\textit{ <text here> }")));
toolbarPanel.add(buildButton(Icons.editorIcons.Underline(), "Underline", false, new SystemPasteCommand("\\underline{ <text here> }")));
toolbarPanel.add(buildButton(Icons.editorIcons.FontColor(), "Color", false, new com.google.gwt.user.client.Command() {
@Override
public void execute() {
DynamicColorSelectionDialog.get(new ColorSelectionHandler() {
@Override
public void onSelection(ColorSelectionEvent event) {
String color = event.getSelectedItem().substring(1);
int r = Integer.valueOf(color.substring(0, 2), 16);
int g = Integer.valueOf(color.substring(2, 4), 16);
int b = Integer.valueOf(color.substring(4, 6), 16);
String texLabel = "c" + color;
CommandEvent.fire(new SystemPasteCommand("\\textcolor{" + texLabel + "}{ <text here> }",
new String[] { "\\usepackage{color}",
"\\definecolor{" + texLabel + "}{RGB}{" + r + "," + g + "," + b + "}" }));
}
}).center();
}
}));
toolbarPanel.add(buildSeparator());
toolbarPanel.add(buildButton(Icons.editorIcons.AlignLeft(), "Align Left", false, new SystemPasteCommand("\\begin{flushleft} <text here> \\end{flushleft}")));
toolbarPanel.add(buildButton(Icons.editorIcons.AlignMiddle(), "Align Middle", false, new SystemPasteCommand("\\begin{center} <text here> \\end{center}")));
toolbarPanel.add(buildButton(Icons.editorIcons.AlignRight(), "Align Right", false, new SystemPasteCommand("\\begin{flushright} <text here> \\end{flushright}")));
toolbarPanel.add(buildSeparator());
toolbarPanel.add(buildButton(Icons.editorIcons.UnorderedList(), "Insert List", false, new SystemPasteCommand("\\begin{itemize}\n \\item \n\\end{itemize}")));
//toolbarPanel.add(buildButton(Icons.editorIcons.Hyperlink(), "Insert Link", true, new SystemPasteCommand("\\url{ <text here> }")));
toolbarPanel.add(buildSeparator());
toolbarPanel.add(buildButton(Icons.latexGroupsIcons.AboveAndBelow(), SetAboveAndBelow.TITLE, true, new SystemToggleLatexToolbarCommand(SetAboveAndBelow.TITLE)));
toolbarPanel.add(buildButton(Icons.latexGroupsIcons.Accents(), SetAccents.TITLE, true, new SystemToggleLatexToolbarCommand(SetAccents.TITLE)));
toolbarPanel.add(buildButton(Icons.latexGroupsIcons.Arrows(), SetArrows.TITLE, true, new SystemToggleLatexToolbarCommand(SetArrows.TITLE)));