Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/man
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2014-04-25 14:05:37 +0000
committerAlexander Kurtakov2014-04-26 05:35:49 +0000
commit9f5e0ed5dfda7ac2bf14f4b59228135bdbcb6a10 (patch)
tree6460ae9326e2948a1c746798febd00f82321f638 /man
parentfe48cecc1b6ba671cf0a70014e760413dae4cce9 (diff)
downloadorg.eclipse.linuxtools-9f5e0ed5dfda7ac2bf14f4b59228135bdbcb6a10.tar.gz
org.eclipse.linuxtools-9f5e0ed5dfda7ac2bf14f4b59228135bdbcb6a10.tar.xz
org.eclipse.linuxtools-9f5e0ed5dfda7ac2bf14f4b59228135bdbcb6a10.zip
Change tabs to spaces; elim trailing whitespace.
To comply with Sonar style requirements, replace all tab characters with four whitespace characters/spaces, and remove all trailing whitespace. Perform this change to all Java and XML files. Also replace tabs with "\t" in test strings that require tabs, and edit STPIndenterTest so that it doesn't rely on indented comments. Change-Id: I48c3c5449a58fe5310967d998a05df1a28fbcbb0 Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com> Reviewed-on: https://git.eclipse.org/r/25561 Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'man')
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java80
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManDocument.java84
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java74
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/ManPathPage.java58
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/Messages.java32
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceConstants.java8
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceInitializer.java22
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/views/ManTextViewer.java66
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java216
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/views/ManView.java70
10 files changed, 355 insertions, 355 deletions
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java
index 509771dcc1..33e6b5f67e 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java
@@ -18,45 +18,45 @@ import org.osgi.framework.BundleContext;
*/
public class Activator extends AbstractUIPlugin {
- /** The plug-in ID */
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.man"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
- * )
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
- * )
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.man"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
}
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManDocument.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManDocument.java
index 98f3102543..73253fc202 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManDocument.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManDocument.java
@@ -21,50 +21,50 @@ import org.eclipse.jface.text.Document;
// TODO consider bold and underline symbols to handle ranges.
public class ManDocument extends Document {
- private static final String BOLD = "\b"; //$NON-NLS-1$
- private List<Integer> boldSymbols = new ArrayList<>();
- private List<Integer> underlineSymbols = new ArrayList<>();
+ private static final String BOLD = "\b"; //$NON-NLS-1$
+ private List<Integer> boldSymbols = new ArrayList<>();
+ private List<Integer> underlineSymbols = new ArrayList<>();
- /**
- * Creates an IDocument for the given man page and taking care for marking
- * bold and underline symbols.
- *
- * @param manPage
- * The man page to create document for.
- */
- public ManDocument(String manPage) {
- StringBuilder sb = new ManParser().getRawManPage(manPage);
- while (sb.indexOf(BOLD) != -1) {
- int index = sb.indexOf(BOLD);
- if (sb.charAt(index - 1) == '_') {
- sb.replace(index - 1, index + 2,
- sb.substring(index + 1, index + 2));
- underlineSymbols.add(index - 1);
- } else {
- sb.replace(index - 1, index + 1,
- sb.substring(index - 1, index - 1));
- boldSymbols.add(index - 1);
- }
- }
- set(sb.toString());
+ /**
+ * Creates an IDocument for the given man page and taking care for marking
+ * bold and underline symbols.
+ *
+ * @param manPage
+ * The man page to create document for.
+ */
+ public ManDocument(String manPage) {
+ StringBuilder sb = new ManParser().getRawManPage(manPage);
+ while (sb.indexOf(BOLD) != -1) {
+ int index = sb.indexOf(BOLD);
+ if (sb.charAt(index - 1) == '_') {
+ sb.replace(index - 1, index + 2,
+ sb.substring(index + 1, index + 2));
+ underlineSymbols.add(index - 1);
+ } else {
+ sb.replace(index - 1, index + 1,
+ sb.substring(index - 1, index - 1));
+ boldSymbols.add(index - 1);
+ }
+ }
+ set(sb.toString());
- }
+ }
- /**
- * Returns the indexes of bold symbols.
- *
- * @return List of bold symbols.
- */
- public List<Integer> getBoldSymbols() {
- return boldSymbols;
- }
+ /**
+ * Returns the indexes of bold symbols.
+ *
+ * @return List of bold symbols.
+ */
+ public List<Integer> getBoldSymbols() {
+ return boldSymbols;
+ }
- /**
- * Returns the indexes of underline symbols.
- *
- * @return List of underline symbols.
- */
- public List<Integer> getUnderlinedSymbols() {
- return underlineSymbols;
- }
+ /**
+ * Returns the indexes of underline symbols.
+ *
+ * @return List of underline symbols.
+ */
+ public List<Integer> getUnderlinedSymbols() {
+ return underlineSymbols;
+ }
}
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java
index ff5fde659a..fbd5d8b08b 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java
@@ -22,45 +22,45 @@ import org.eclipse.linuxtools.internal.man.preferences.PreferenceConstants;
/**
* Parser for the man executable output.
- *
+ *
*/
public class ManParser {
- /**
- * Returns the raw representation of the man executable for a given man page
- * i.e. `man ls`.
- *
- * @param manPage
- * The man page to fetch.
- * @return Raw output of the man command.
- */
- public StringBuilder getRawManPage(String manPage) {
- String manExecutable = Activator.getDefault().getPreferenceStore()
- .getString(PreferenceConstants.P_PATH);
- ProcessBuilder builder = new ProcessBuilder(manExecutable, manPage);
- builder.redirectErrorStream(true);
- Process process;
- StringBuilder sb = new StringBuilder();
- try {
- process = builder.start();
- if (!(System.getProperty("os.name").toLowerCase() //$NON-NLS-1$
- .indexOf("windows") == 0)) { //$NON-NLS-1$
- process.waitFor();
- }
+ /**
+ * Returns the raw representation of the man executable for a given man page
+ * i.e. `man ls`.
+ *
+ * @param manPage
+ * The man page to fetch.
+ * @return Raw output of the man command.
+ */
+ public StringBuilder getRawManPage(String manPage) {
+ String manExecutable = Activator.getDefault().getPreferenceStore()
+ .getString(PreferenceConstants.P_PATH);
+ ProcessBuilder builder = new ProcessBuilder(manExecutable, manPage);
+ builder.redirectErrorStream(true);
+ Process process;
+ StringBuilder sb = new StringBuilder();
+ try {
+ process = builder.start();
+ if (!(System.getProperty("os.name").toLowerCase() //$NON-NLS-1$
+ .indexOf("windows") == 0)) { //$NON-NLS-1$
+ process.waitFor();
+ }
- String line = null;
- try (InputStream manContent = process.getInputStream();
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(manContent))) {
- while ((line = reader.readLine()) != null) {
- sb.append(line + "\n"); //$NON-NLS-1$
- }
- }
- } catch (IOException | InterruptedException e1) {
- Status status = new Status(IStatus.ERROR, e1.getMessage(),
- Activator.PLUGIN_ID);
- Activator.getDefault().getLog().log(status);
- }
- return sb;
- }
+ String line = null;
+ try (InputStream manContent = process.getInputStream();
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(manContent))) {
+ while ((line = reader.readLine()) != null) {
+ sb.append(line + "\n"); //$NON-NLS-1$
+ }
+ }
+ } catch (IOException | InterruptedException e1) {
+ Status status = new Status(IStatus.ERROR, e1.getMessage(),
+ Activator.PLUGIN_ID);
+ Activator.getDefault().getLog().log(status);
+ }
+ return sb;
+ }
}
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/ManPathPage.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/ManPathPage.java
index fecb8c94ed..f49a11e48f 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/ManPathPage.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/ManPathPage.java
@@ -21,37 +21,37 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
*/
public class ManPathPage extends FieldEditorPreferencePage implements
- IWorkbenchPreferencePage {
+ IWorkbenchPreferencePage {
- /**
- * Preference page for setting the man path.
- */
- public ManPathPage() {
- super(GRID);
- setPreferenceStore(Activator.getDefault().getPreferenceStore());
- setDescription(Messages.ManPathPage_0);
- }
+ /**
+ * Preference page for setting the man path.
+ */
+ public ManPathPage() {
+ super(GRID);
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription(Messages.ManPathPage_0);
+ }
- /**
- * Creates the field editors. Field editors are abstractions of the common
- * GUI blocks needed to manipulate various types of preferences. Each field
- * editor knows how to save and restore itself.
- */
- @Override
- public void createFieldEditors() {
- addField(new FileFieldEditor(PreferenceConstants.P_PATH,
- Messages.ManPathPage_1, getFieldEditorParent()));
- }
+ /**
+ * Creates the field editors. Field editors are abstractions of the common
+ * GUI blocks needed to manipulate various types of preferences. Each field
+ * editor knows how to save and restore itself.
+ */
+ @Override
+ public void createFieldEditors() {
+ addField(new FileFieldEditor(PreferenceConstants.P_PATH,
+ Messages.ManPathPage_1, getFieldEditorParent()));
+ }
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- @Override
- public void init(IWorkbench workbench) {
- // nothing to do
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ @Override
+ public void init(IWorkbench workbench) {
+ // nothing to do
+ }
} \ No newline at end of file
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/Messages.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/Messages.java
index 7d757fd84e..2e82c542b3 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/Messages.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/Messages.java
@@ -14,23 +14,23 @@ import org.eclipse.osgi.util.NLS;
/**
* Message constants.
- *
+ *
*/
public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.man.preferences.messages"; //$NON-NLS-1$
- /**
- * Preference page title.
- */
- public static String ManPathPage_0;
- /**
- * Preference page label.
- */
- public static String ManPathPage_1;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.man.preferences.messages"; //$NON-NLS-1$
+ /**
+ * Preference page title.
+ */
+ public static String ManPathPage_0;
+ /**
+ * Preference page label.
+ */
+ public static String ManPathPage_1;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
- private Messages() {
- }
+ private Messages() {
+ }
}
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceConstants.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceConstants.java
index 12cbcdbc37..2f2a1dcd18 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceConstants.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceConstants.java
@@ -15,9 +15,9 @@ package org.eclipse.linuxtools.internal.man.preferences;
*/
public class PreferenceConstants {
- /**
- * Path preference constant.
- */
- public static final String P_PATH = "pathPreference"; //$NON-NLS-1$
+ /**
+ * Path preference constant.
+ */
+ public static final String P_PATH = "pathPreference"; //$NON-NLS-1$
}
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceInitializer.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceInitializer.java
index 92075141c2..ddaf08d97d 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceInitializer.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/preferences/PreferenceInitializer.java
@@ -19,16 +19,16 @@ import org.eclipse.linuxtools.internal.man.Activator;
*/
public class PreferenceInitializer extends AbstractPreferenceInitializer {
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
- * initializeDefaultPreferences()
- */
- @Override
- public void initializeDefaultPreferences() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- store.setDefault(PreferenceConstants.P_PATH, "/usr/bin/man"); //$NON-NLS-1$
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
+ * initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ store.setDefault(PreferenceConstants.P_PATH, "/usr/bin/man"); //$NON-NLS-1$
+ }
}
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/views/ManTextViewer.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/views/ManTextViewer.java
index 9480fb8fcd..208fbef6fc 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/views/ManTextViewer.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/views/ManTextViewer.java
@@ -19,42 +19,42 @@ import org.eclipse.swt.widgets.Composite;
/**
* Text viewer for a man page.
- *
+ *
*/
public class ManTextViewer extends SourceViewer {
- /**
- * Creates a resizable text viewer.
- *
- * @param parent
- */
- public ManTextViewer(Composite parent) {
- super(parent, null, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- // setEditable(false);
- }
+ /**
+ * Creates a resizable text viewer.
+ *
+ * @param parent
+ */
+ public ManTextViewer(Composite parent) {
+ super(parent, null, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ // setEditable(false);
+ }
- /**
- * Sets the document to display.
- *
- * @param document
- * The document to display.
- */
- public void setDocument(ManDocument document) {
- super.setDocument(document);
- TextPresentation style = new TextPresentation();
- for (int underlineSymbol : document.getUnderlinedSymbols()) {
- StyleRange styleRange = new StyleRange(underlineSymbol, 1, null,
- null, SWT.NORMAL);
- styleRange.underline = true;
- style.addStyleRange(styleRange);
- }
- for (int boldSymbol : document.getBoldSymbols()) {
- style.mergeStyleRange(new StyleRange(boldSymbol, 1, null, null,
- SWT.BOLD));
- }
- getTextWidget().setBackground(
- getControl().getDisplay().getSystemColor(SWT.COLOR_GRAY));
- changeTextPresentation(style, true);
- }
+ /**
+ * Sets the document to display.
+ *
+ * @param document
+ * The document to display.
+ */
+ public void setDocument(ManDocument document) {
+ super.setDocument(document);
+ TextPresentation style = new TextPresentation();
+ for (int underlineSymbol : document.getUnderlinedSymbols()) {
+ StyleRange styleRange = new StyleRange(underlineSymbol, 1, null,
+ null, SWT.NORMAL);
+ styleRange.underline = true;
+ style.addStyleRange(styleRange);
+ }
+ for (int boldSymbol : document.getBoldSymbols()) {
+ style.mergeStyleRange(new StyleRange(boldSymbol, 1, null, null,
+ SWT.BOLD));
+ }
+ getTextWidget().setBackground(
+ getControl().getDisplay().getSystemColor(SWT.COLOR_GRAY));
+ changeTextPresentation(style, true);
+ }
}
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java
index bf39c54d3f..aeb0f98361 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java
@@ -18,123 +18,123 @@ import org.eclipse.linuxtools.internal.man.parser.ManParser;
*/
public class ManPage {
- private StringBuilder rawContent;
- private StringBuilder strippedTextPage;
+ private StringBuilder rawContent;
+ private StringBuilder strippedTextPage;
- /**
- * Creates the man page which includes retrieving the raw content and
- * changing format symbols to html.
- *
- * @param manPage
- * The man page.
- */
- public ManPage(String manPage) {
- parse(new ManParser().getRawManPage(manPage));
- }
+ /**
+ * Creates the man page which includes retrieving the raw content and
+ * changing format symbols to html.
+ *
+ * @param manPage
+ * The man page.
+ */
+ public ManPage(String manPage) {
+ parse(new ManParser().getRawManPage(manPage));
+ }
- // TODO make bold and underline be ranges instead of separate symbols.
- private void parse(StringBuilder rawManPage) {
- StringBuilder sb = new StringBuilder();
- sb.append(rawManPage);
+ // TODO make bold and underline be ranges instead of separate symbols.
+ private void parse(StringBuilder rawManPage) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(rawManPage);
- while (sb.indexOf("_\b") != -1) { //$NON-NLS-1$
- int index = sb.indexOf("_\b"); //$NON-NLS-1$
- sb.replace(index, index + 3,
- "<u>" + sb.substring(index + 2, index + 3) + "</u>"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- while (sb.indexOf("\b") != -1) { //$NON-NLS-1$
- int index = sb.indexOf("\b"); //$NON-NLS-1$
- sb.replace(index - 1, index + 2,
- "<b>" + sb.substring(index - 1, index) + "</b>"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- rawContent = sb;
- }
+ while (sb.indexOf("_\b") != -1) { //$NON-NLS-1$
+ int index = sb.indexOf("_\b"); //$NON-NLS-1$
+ sb.replace(index, index + 3,
+ "<u>" + sb.substring(index + 2, index + 3) + "</u>"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ while (sb.indexOf("\b") != -1) { //$NON-NLS-1$
+ int index = sb.indexOf("\b"); //$NON-NLS-1$
+ sb.replace(index - 1, index + 2,
+ "<b>" + sb.substring(index - 1, index) + "</b>"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ rawContent = sb;
+ }
- /**
- * Returns html representation of the man page. The whole man page is kept
- * in one giant &lt;pre&gt; block with bold and underline symbols.
- *
- * @return The whole html man page.
- */
- public StringBuilder getHtmlPage() {
- StringBuilder sb = new StringBuilder();
- sb.append("<pre>").append(rawContent).append("</pre>"); //$NON-NLS-1$ //$NON-NLS-2$
- return sb;
- }
+ /**
+ * Returns html representation of the man page. The whole man page is kept
+ * in one giant &lt;pre&gt; block with bold and underline symbols.
+ *
+ * @return The whole html man page.
+ */
+ public StringBuilder getHtmlPage() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<pre>").append(rawContent).append("</pre>"); //$NON-NLS-1$ //$NON-NLS-2$
+ return sb;
+ }
- /**
- * Returns stripped representation of the man page. Stripped parts are:
- * <ul>
- * <li>Header - all the parts before <b>NAME</b></li>
- * <li>Footer - all the parts from <b>AUTHOR</b> till the end</li>
- * </ul>
- *
- * @return The stripped html content of the man page.
- */
- public StringBuilder getStrippedHtmlPage() {
- StringBuilder sb = getStrippedPage();
- sb.insert(0, "<pre>"); //$NON-NLS-1$
- sb.append("</pre>"); //$NON-NLS-1$
- return sb;
- }
+ /**
+ * Returns stripped representation of the man page. Stripped parts are:
+ * <ul>
+ * <li>Header - all the parts before <b>NAME</b></li>
+ * <li>Footer - all the parts from <b>AUTHOR</b> till the end</li>
+ * </ul>
+ *
+ * @return The stripped html content of the man page.
+ */
+ public StringBuilder getStrippedHtmlPage() {
+ StringBuilder sb = getStrippedPage();
+ sb.insert(0, "<pre>"); //$NON-NLS-1$
+ sb.append("</pre>"); //$NON-NLS-1$
+ return sb;
+ }
- /**
- * Returns stripped representation of the man page in the format it was
- * received from executing man. Stripped parts are:
- * <ul>
- * <li>Header - all the parts before <b>NAME</b></li>
- * <li>Footer - all the parts from <b>AUTHOR</b> till the end</li>
- * </ul>
- *
- * @return The stripped plain text content of the man page.
- * @since 1.1
- */
- public StringBuilder getStrippedPage() {
- StringBuilder sb = new StringBuilder();
- sb.append(rawContent);
- // The raw content may or may not be HTML
- if (sb.indexOf("<b>N</b>") != -1) { //$NON-NLS-1$
- sb.delete(0, sb.indexOf("<b>N</b>")); //$NON-NLS-1$
- } else if (sb.indexOf("NAME") != -1) { //$NON-NLS-1$
- sb.delete(0, sb.indexOf("NAME")); //$NON-NLS-1$
- }
+ /**
+ * Returns stripped representation of the man page in the format it was
+ * received from executing man. Stripped parts are:
+ * <ul>
+ * <li>Header - all the parts before <b>NAME</b></li>
+ * <li>Footer - all the parts from <b>AUTHOR</b> till the end</li>
+ * </ul>
+ *
+ * @return The stripped plain text content of the man page.
+ * @since 1.1
+ */
+ public StringBuilder getStrippedPage() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(rawContent);
+ // The raw content may or may not be HTML
+ if (sb.indexOf("<b>N</b>") != -1) { //$NON-NLS-1$
+ sb.delete(0, sb.indexOf("<b>N</b>")); //$NON-NLS-1$
+ } else if (sb.indexOf("NAME") != -1) { //$NON-NLS-1$
+ sb.delete(0, sb.indexOf("NAME")); //$NON-NLS-1$
+ }
- if (sb.indexOf("<b>A</b><b>U</b><b>T</b><b>H</b><b>O</b><b>R</b>") != -1) { //$NON-NLS-1$
- sb.delete(
- sb.indexOf("<b>A</b><b>U</b><b>T</b><b>H</b><b>O</b><b>R</b>"), //$NON-NLS-1$
- sb.length());
- } else if (sb.indexOf("AUTHOR") != -1) { //$NON-NLS-1$
- sb.delete(sb.indexOf("AUTHOR"), //$NON-NLS-1$
- sb.length());
- }
+ if (sb.indexOf("<b>A</b><b>U</b><b>T</b><b>H</b><b>O</b><b>R</b>") != -1) { //$NON-NLS-1$
+ sb.delete(
+ sb.indexOf("<b>A</b><b>U</b><b>T</b><b>H</b><b>O</b><b>R</b>"), //$NON-NLS-1$
+ sb.length());
+ } else if (sb.indexOf("AUTHOR") != -1) { //$NON-NLS-1$
+ sb.delete(sb.indexOf("AUTHOR"), //$NON-NLS-1$
+ sb.length());
+ }
- return sb;
- }
+ return sb;
+ }
- /**
- * Removes all HTML markings are returns a text only version.
- *
- * @return a text only version of the manpage
- * @since 1.1
- */
- public StringBuilder getStrippedTextPage() {
- if (this.strippedTextPage == null) {
- this.strippedTextPage = getStrippedPage();
- int index = strippedTextPage.indexOf("<b>"); //$NON-NLS-1$
- while (index != -1) {
- strippedTextPage.replace(index, index + 3, ""); //$NON-NLS-1$
- strippedTextPage.replace(index + 1, index + 5, ""); //$NON-NLS-1$
- index = strippedTextPage.indexOf("<b>"); //$NON-NLS-1$
- }
+ /**
+ * Removes all HTML markings are returns a text only version.
+ *
+ * @return a text only version of the manpage
+ * @since 1.1
+ */
+ public StringBuilder getStrippedTextPage() {
+ if (this.strippedTextPage == null) {
+ this.strippedTextPage = getStrippedPage();
+ int index = strippedTextPage.indexOf("<b>"); //$NON-NLS-1$
+ while (index != -1) {
+ strippedTextPage.replace(index, index + 3, ""); //$NON-NLS-1$
+ strippedTextPage.replace(index + 1, index + 5, ""); //$NON-NLS-1$
+ index = strippedTextPage.indexOf("<b>"); //$NON-NLS-1$
+ }
- index = strippedTextPage.indexOf("<u>"); //$NON-NLS-1$
- while (index != -1) {
- strippedTextPage.replace(index, index + 3, ""); //$NON-NLS-1$
- strippedTextPage.replace(index + 1, index + 5, ""); //$NON-NLS-1$
- index = strippedTextPage.indexOf("<u>"); //$NON-NLS-1$
- }
- }
+ index = strippedTextPage.indexOf("<u>"); //$NON-NLS-1$
+ while (index != -1) {
+ strippedTextPage.replace(index, index + 3, ""); //$NON-NLS-1$
+ strippedTextPage.replace(index + 1, index + 5, ""); //$NON-NLS-1$
+ index = strippedTextPage.indexOf("<u>"); //$NON-NLS-1$
+ }
+ }
- return strippedTextPage;
- }
+ return strippedTextPage;
+ }
}
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/views/ManView.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/views/ManView.java
index 51c85d386c..8e80c3167b 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/views/ManView.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/views/ManView.java
@@ -22,43 +22,43 @@ import org.eclipse.ui.part.ViewPart;
public class ManView extends ViewPart {
- /**
- * The ID of the view as specified by the extension.
- */
- public static final String ID = "org.eclipse.linuxtools.man.views.ManView"; //$NON-NLS-1$
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.eclipse.linuxtools.man.views.ManView"; //$NON-NLS-1$
- private ManTextViewer viewer;
+ private ManTextViewer viewer;
- /**
- * This is a callback that will allow us to create the viewer and initialize
- * it.
- */
- @Override
- public void createPartControl(Composite parent) {
- viewer = new ManTextViewer(parent);
- // Create the help context id for the viewer's control
- PlatformUI
- .getWorkbench()
- .getHelpSystem()
- .setHelp(viewer.getControl(),
- "org.eclipse.linuxtools.man.viewer"); //$NON-NLS-1$
- }
+ /**
+ * This is a callback that will allow us to create the viewer and initialize
+ * it.
+ */
+ @Override
+ public void createPartControl(Composite parent) {
+ viewer = new ManTextViewer(parent);
+ // Create the help context id for the viewer's control
+ PlatformUI
+ .getWorkbench()
+ .getHelpSystem()
+ .setHelp(viewer.getControl(),
+ "org.eclipse.linuxtools.man.viewer"); //$NON-NLS-1$
+ }
- /**
- * Sets the man page to dispaly
- *
- * @param manPageName
- * The name of the man page to display.
- */
- public void setManPageName(String manPageName) {
- viewer.setDocument(new ManDocument(manPageName));
- }
+ /**
+ * Sets the man page to dispaly
+ *
+ * @param manPageName
+ * The name of the man page to display.
+ */
+ public void setManPageName(String manPageName) {
+ viewer.setDocument(new ManDocument(manPageName));
+ }
- /**
- * Passing the focus request to the viewer's control.
- */
- @Override
- public void setFocus() {
- viewer.getControl().setFocus();
- }
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
} \ No newline at end of file

Back to the top