Skip to main content
summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMustafa Yücel2017-06-29 16:54:53 -0400
committerJonah Graham2017-11-02 07:03:22 -0400
commit2e0f85e5143587204f7380ef8c8209fdf266e1d8 (patch)
tree7d896e7c7b4f1c077d043ac6f1b22bb16652766a /doc
parentebbe75d37f5b39a2815f82d07a08ea0602582451 (diff)
downloadorg.eclipse.cdt-2e0f85e5143587204f7380ef8c8209fdf266e1d8.tar.gz
org.eclipse.cdt-2e0f85e5143587204f7380ef8c8209fdf266e1d8.tar.xz
org.eclipse.cdt-2e0f85e5143587204f7380ef8c8209fdf266e1d8.zip
Bug 520340: enable CLI to CDT's code formatter
example usage: eclipse -nosplash -application org.eclipse.cdt.core.CodeFormatter -consoleLog \ -verbose -config .settings/org.eclipse.cdt.core.prefs src/ imported CodeFormatterApplication from eclipse.jdt.core: org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatterApplication.java revision 823698366b88fe7e6c1438813d7dd191ff9aa71f org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/messages.properties revision c2646812d22906feca88c2f52911ca7c4eae2299 Change-Id: Id934c8958c66f562bd2402dcbd8b7c60e39cc7a5 Signed-off-by: Mustafa Yücel <mustafa.yuecel@siemens.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/org.eclipse.cdt.doc.user/tasks/cdt_o_tasks.htm3
-rw-r--r--doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app.htm30
-rw-r--r--doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app_gen_config.htm45
-rw-r--r--doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app_run.htm106
-rw-r--r--doc/org.eclipse.cdt.doc.user/topics_Tasks.xml5
5 files changed, 189 insertions, 0 deletions
diff --git a/doc/org.eclipse.cdt.doc.user/tasks/cdt_o_tasks.htm b/doc/org.eclipse.cdt.doc.user/tasks/cdt_o_tasks.htm
index 336973b40d..2d916bc75f 100644
--- a/doc/org.eclipse.cdt.doc.user/tasks/cdt_o_tasks.htm
+++ b/doc/org.eclipse.cdt.doc.user/tasks/cdt_o_tasks.htm
@@ -80,6 +80,9 @@
<img src="../images/trans.gif" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_sel_search.htm">Selection Searching for C/C++ elements</a><br>
<img src="../images/trans.gif" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_set_src_fold.htm">Setting Source Folders</a><br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_sd.htm">Include paths and macros for C/C++ indexer</a><br>
+<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_format_app.htm">Using the Formatter Application</a><br>
+ <img src="../images/trans.gif" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_format_app_run.htm">Running the Formatter Application</a><br>
+ <img src="../images/trans.gif" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_format_app_gen_config.htm">Generating a Config File for the Formatter Application</a><br>
<p><img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" ></p>
</div></body>
diff --git a/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app.htm b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app.htm
new file mode 100644
index 0000000000..c7caa69496
--- /dev/null
+++ b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app.htm
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="en">
+ <head>
+<meta name="copyright" content="Copyright (c) Red Hat Incorporated 2006, 2017. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>
+ Using the Formatter Application
+ </title>
+ <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
+ </head>
+ <body>
+ <h1>
+ Using the Formatter Application
+ </h1>
+ <p>
+ The CDT has a command line Eclipse application that allows users to format C/C++ source code either with
+ the Eclipse default code formatter options or with custom options.
+ </p>
+ <p>
+ <img src="../images/ngtasks.gif" alt="Related tasks" width="143" height="21">
+ </p>
+ <p>
+ <a href="cdt_t_format_app_run.htm">Running the Formatter Application</a>
+ </p>
+ <p>
+ <a href="cdt_t_format_app_gen_config.htm">Generating a Config File for the Formatter Application</a>
+ </p>
+ </body>
+</html>
diff --git a/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app_gen_config.htm b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app_gen_config.htm
new file mode 100644
index 0000000000..1803088382
--- /dev/null
+++ b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app_gen_config.htm
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+ <head>
+ <meta name="copyright" content=
+ "Copyright (c) Red Hat Incorporated 2006, 2017. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." />
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <title>
+ Generating a Config File for the Formatter Application
+ </title>
+ <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type=
+ "text/css" />
+ </head>
+
+ <body>
+ <h1>
+ Generating a Config File for the Formatter Application
+ </h1>
+ <p>
+ Generating a config file for the formatter application involves modifying
+ the code formatter settings for a C/C++ project and copying
+ org.eclipse.cdt.core.prefs out of the .settings directory for that
+ project.
+ </p>
+ <ol>
+ <li>Select a C/C++ project, open the pop-up menu and choose
+ <strong>Properties</strong>.
+ </li>
+
+ <li>Select the <strong>C/C++ General &gt; Formatter</strong> page and
+ check <strong>Enable project specific settings</strong>.
+ </li>
+ <li>Select or edit a profile as explained above.
+ </li>
+ <li>Click <strong>OK</strong> when you are done.
+ </li>
+
+ <li>Use either a file manager or the command line to copy
+ <b><code>workspace/YourCProject/.settings/org.eclipse.cdt.core.prefs</code></b>
+ to a new location.
+ </li>
+ </ol>
+ </body>
+</html>
diff --git a/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app_run.htm b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app_run.htm
new file mode 100644
index 0000000000..98a2982d8a
--- /dev/null
+++ b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_format_app_run.htm
@@ -0,0 +1,106 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+ <head>
+ <meta name="copyright" content=
+ "Copyright (c) Red Hat Incorporated 2006, 2017. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." />
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <title>
+ Running the Formatter Application
+ </title>
+ <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type=
+ "text/css" />
+ </head>
+
+ <body>
+ <h1>
+ Running the Formatter Application
+ </h1>
+ <p>
+ Running the formatter application is as simple as running the
+ org.eclipse.cdt.core.CodeFormatter application from the commandline:
+ </p>
+<pre>
+ eclipse -application org.eclipse.cdt.core.CodeFormatter [ OPTIONS ] [ -config &lt;configFile&gt; ] &lt;files&gt;
+</pre>
+<p>When invoked on MacOS, the paths to point to the configuration file or the source files can be relative, but they will be computed
+from the location of the eclipse.ini file. This is a limitation of the Eclipse launcher on MacOS. On all other platforms, the relative paths
+are computed relative to the current user directory.</p>
+ <table border="1" cellspacing="0" cellpadding="5" width="600" summary="">
+ <tr>
+ <td width="25%">
+ &lt;files&gt;
+ </td>
+ <td>
+ C/C++ source/header files and/or directories to format. Only source/header file endings
+ (like .c .cpp or .h) will be formatted in the given directory.
+ </td>
+ </tr>
+ <tr>
+ <td width="25%">
+ -config &lt;configFile&gt;
+ </td>
+ <td>
+ Use the formatting style from the specified properties file.
+ Refer to <a href="cdt_t_format_app_gen_config.htm">Generating a Config File for the
+ Formatter Application</a> for details.
+ </td>
+ </tr>
+ </table>
+ <table border="1" cellspacing="0" cellpadding="5" width="600" summary="">
+ <thead>
+ <tr>
+ <th>
+ <p>
+ OPTIONS
+ </p>
+ </th>
+ <th>
+ <p>
+ Description
+ </p>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td valign="top" width="25%">
+ <p>
+ -help
+ </p>
+ </td>
+ <td valign="top">
+ <p>
+ Display the help message.
+ </p>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" width="25%">
+ <p>
+ -quiet
+ </p>
+ </td>
+ <td valign="top">
+ <p>
+ Only print error messages.
+ </p>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" width="25%">
+ <p>
+ -verbose
+ </p>
+ </td>
+ <td valign="top">
+ <p>
+ Be verbose about the formatting job.
+ </p>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </body>
+</html>
diff --git a/doc/org.eclipse.cdt.doc.user/topics_Tasks.xml b/doc/org.eclipse.cdt.doc.user/topics_Tasks.xml
index afb719e567..74ceea4042 100644
--- a/doc/org.eclipse.cdt.doc.user/topics_Tasks.xml
+++ b/doc/org.eclipse.cdt.doc.user/topics_Tasks.xml
@@ -93,4 +93,9 @@
</topic>
<topic label="Include paths and macros for C/C++ indexer" href="tasks/cdt_t_sd.htm"/>
+
+ <topic label="Using the Formatter Application" href="tasks/cdt_t_format_app.htm">
+ <topic label="Running the Formatter Application" href="tasks/cdt_t_format_app_run.htm"/>
+ <topic label="Generating a Config File for the Formatter Application" href="tasks/cdt_t_format_app_gen_config.htm"/>
+ </topic>
</toc>

Back to the top