5/06/2016

Setup Eclipse

(On Windows, cygwin or MinGW gcc must be installed. When creating a new project, Cygwin GCC must be selected.)

How to add an existing GIT project to Eclipse?
Install EGit from Market Place
Open Git Perspective, in Git Repositories | click Add an existing local Git Repository ...

In Project Explorer | Import | Git (Projects From Git) | Existing local repository | select the local Git Repository that was just imported.

Choose "Import using the New Project wizard" | Makefile Project with Existing Code | Fill the name and location of code.

After importing the Git repo, need to use the Exclude Build option to exclude some folders from building.
Right click on the folder | Resource Configurations | Exclude from Build | Select or Deselect | OK

Also need to mark some folders as derived, such as bazel-* folders. Right click on the folder | Resources | Click "Derived"

Also need to remove derived folders from sources. Project Property | C/C++ General | Path and Symbols | Source Location | Edit Filter | Remove bazel-bin,bazel-deepmap,bazel-testlogs etc.

Install Plugins:
Protocol Buffer: Install from Eclipse Marketplace
sudo snap install beautysh: Install Bash editor, then Save Actions: execute command on save beautysh $filename

C++ Formatter:
Install CppStyle from market place and use clang-format.


C++ symbol/function could not be resolved:



NOTE: The project must have the 'includes' folder, which contains the C++ headers, also make sure the static folder has all the necessary header files. If something doesn't resolve, DON'T rebuilt it over and over again. Just make sure the header can be found in the project and click Project | C++ Index | Resolve Un-resolved includes. If it doesn't resolve by doing that, rebuilding the whole thing doesn't help either.

First: Disable build automatically




1. Project Property | Preprocessor Include | Providers | CDT GCC Built-in Compiler Settings | Command to get compiler specs:
Add -std=c++11 to the Command to get compiler specs.

Open Window | Preferences | C/C++ | Build | Settings | Discovery | CDT GCC Build-in Compiler Settings
Append -std=c++11 to the Command to get compiler specs
Press OK

Rebuild the index: Project | C/C++ Index | Rebuild

2. Add third party dependency:
Project Property | C/C++ General | Paths and Symbols | Source Location | Link Folder
Choose the folder that has the third party dependency.

Add protos to the Source Location:
bazel-deepmap/bazel-out/local-fastbuild/genfiles/protos/

Project | Clean then Project | C/C++ Index | Rebuild

3. Enable auto completion
Window | Preferences | C/C++->Editor->Content Assist | Auto-Activation | Advanced
Enable: Help Proposals, Parsing-based Proposals, Template Proposals

Possible issues:
================
1. Column margin (ruler) is at wrong position:
Upgrade to Photon 4.8 version fixed it.

2. Ctrl + Click not working:

To work around the problem, you can disable the Change Log hyperlink by going to Window | Preferences | General | Editors | Text Editors | Hyperlinking, then untick "Changelog Detector"

Change selection color:
General | Editors | Text Editors, change Selection background color to #FF7F00

How to Import existing projects to a new workspace:
===================================================
Import | General | Existing Projects into workspace | Locate the workspace AND CHECK 'Copy projects into workspace'

/bin/cp -rf /mnt/machome/liangzou/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings ~/workspace/.metadata/.plugins/org.eclipse.core.runtime/

.md file editor
================
Use WikiText editor to open it.
Change settings: Colors and Fonts | WikiText | Monospace Font. Change it to Hack 9 (the same as Text Font).
General | Editors | Text Editors | WikiText | Appearance, change all places that use font-family: monospace to font-family: Hack, monospace; font-size: 9pt;

BUILD file editor
=================
TBD

Disable caret blinking
======================
For Ubuntu cinnamon, System settings | Keyboard turn off text cursor blinking
Then in Eclipse settings, search for caret, click Enable custom caret

Setup Java
==========
https://liangzou.blogspot.com/2016/05/bazel-eclipse-and-java-how-to-fix-class.html

Setup Python
============

https://liangzou.blogspot.com/2019/06/how-to-setup-eclipse-pydev-to-run-yapf.html

Enable pydev checking: Preferences | Spelling Add User defined dictionary: /home/liangzou/eclipse-workspace/user-dict.txt
Then click on the word that eclipse doesn't recognize, press ctrl + 1, then use up/down key and enter to select the options.

Setup Go Editor
===========
Need to disable AnyEdit Tools (Format some code on save if that editor doesn't support)






Setup Text Editor
=============
Show white spaces



Change the Transparency level to 255

No comments: