-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Asciidoctor console + preferences + improvements #147
- Loading branch information
Showing
10 changed files
with
158 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...tor-editor-plugin/src/main/java-eclipse/de/jcup/asciidoctoreditor/AsciiDoctorConsole.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package de.jcup.asciidoctoreditor; | ||
|
||
import org.eclipse.ui.console.ConsolePlugin; | ||
import org.eclipse.ui.console.IConsole; | ||
import org.eclipse.ui.console.IConsoleManager; | ||
import org.eclipse.ui.console.MessageConsole; | ||
import org.eclipse.ui.console.MessageConsoleStream; | ||
|
||
import de.jcup.asciidoctoreditor.preferences.AsciiDoctorEditorPreferences; | ||
|
||
public class AsciiDoctorConsole { | ||
|
||
public static void error(String message) { | ||
MessageConsole myConsole = output(message); | ||
|
||
if (AsciiDoctorEditorPreferences.getInstance().isConsoleAlwaysShownOnOutput()){ | ||
getConsoleManager().showConsoleView(myConsole); | ||
} | ||
} | ||
|
||
protected static MessageConsole output(String message) { | ||
MessageConsole myConsole = findConsole("Asciidoctor"); | ||
MessageConsoleStream out = myConsole.newMessageStream(); | ||
out.println(message); | ||
return myConsole; | ||
} | ||
|
||
public static MessageConsole findConsole(String name) { | ||
IConsoleManager conMan = getConsoleManager(); | ||
IConsole[] existing = conMan.getConsoles(); | ||
for (int i = 0; i < existing.length; i++) | ||
if (name.equals(existing[i].getName())) { | ||
return (MessageConsole) existing[i]; | ||
} | ||
// no console found, so create a new one | ||
MessageConsole myConsole = new MessageConsole(name, EclipseUtil.createImageDescriptor("icons/asciidoctor-editor.png", AsciiDoctorEditorActivator.PLUGIN_ID)); | ||
conMan.addConsoles(new IConsole[] { myConsole }); | ||
|
||
return myConsole; | ||
} | ||
|
||
protected static IConsoleManager getConsoleManager() { | ||
ConsolePlugin plugin = ConsolePlugin.getDefault(); | ||
IConsoleManager conMan = plugin.getConsoleManager(); | ||
return conMan; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters