Eclipse - Highlighting same word occurrence of random extension file - eclipse

Is there any option to make Eclipse highlight same occurrence of word in random extension file?
Eclipse works for known file types (.java, .php, py...), and it matches and highlights same occurrence but it won't match same words in random file types i.e. extension of .abcxyz?

According to the official Eclipse documentation:
To associate editors with various file types in the Workbench:
Open the command link General > Editors > File Associations
preference page.
Select the file type from the File types list, or
click Add to add a type that is not already on the list.
In the Associated editors list, select the editor that you want to
associate with that file type. To add an editor to the list:
a. Click Add. The Editor Selection dialog box opens.
b. Select Internal Editors or External Programs, depending on whether the editor that you want was built for the Workbench or runs
outside the Workbench.
c. If you select External Programs, you can click the Browse button to browse the file system.
d. Select the editor from the list and click OK.
Click on OK to finish associating the editor with the selected file type.
After doing this, Eclipse will be able to properly open files with any custom extension. The tricky part is the highlight thing, i.e., "how to highlight same occurrence of word". For that, you might need to create your custom syntax highlighting rules. According to this question and answer:
The Eclipse framework uses a fairly complex document model to do
syntax coloring (they call it coloring, not highlighting), it is not
as simple as it is in other editors.
If you really want to try and mess with it, you may want to read the
following from the Eclipse plug-in developer guide.
(The above link is now dead. This may be a similar document or this.)

Related

Why can't i use palette in netbeans 8.2?

I don't really get the function of palette. (IDE Tools -> Palette)
Great tool, works nice in html and php, but in javascript it doesn't let me add anything nor does it show anything i could use.
It is locked or something?
Why can't i use palette in netbeans 8.2?
You can, but probably not in the way that you want, assuming that you want to be able to use the Palette with JavaScript files, because:
The Palette in NetBeans is primarily intended to be used for form development. It is not a general purpose tool for the automatic insertion of code.
The content of the Palette window is context sensitive, and the categories available in the Palette at any time are directly tied to the type of the file currently open in the editor window. For example, the categories available in the Palette for *.html files are different to those for *.jsf files.
Some file types, including JavaScript files (*.js) and Java files (*.java), have no associated categories. Although you can add a new category to the Palette for file types which already have one or more categories, you cannot create a new category in the Palette for a file type with no existing categories. This means that you cannot use the Palette with *.js files.
While NetBeans does not provide a category for JavaScript in the palette, you could add one yourself, but it would have to be tied to one of the file types that are already supported (e.g. *.html or *.jsp, but not *.js). For example, you could:
Create a new category named JavaScript, and add it to the Palette for *.html files.
Add an item named alert to that category which would allow you to insert <script>alert('Hello world!');</script> into *.html files by double clicking that alert entry in the Palette.
It is locked or something?
"locked" isn't the appropriate term since that would imply that you could somehow unlock the functionality, but you can't. At least not through the Palette user interface. NetBeans just doesn't support the use of the Palette with *.js files.
The alternative to using the Palette for JavaScript files is to add your own code templates: Tools > Options > Editor > Code Templates > select Language JavaScript > click New

How to make UltraEdit autocomplete class members/functions of C++ class?

I'm currently using UltraEdit, which is armed with Ctags, to edit C++ files (.cpp). Its Ctags support automatically autocompletes symbols while I'm typing—but it can't correctly confine itself to only the members of a class, which is so blind. How to make UltraEdit smarter like Vim+ctags+cppcomplete? So far, I can't find any plugins on web.
UltraEdit doesn't do a great job of auto complete when compared to an IDE like Eclipse etc. because it doesn't know how to parse tokens in a language specific way - i.e. it has no way of knowing what your variable/method names are and listing just those for auto complete.
However, UltraEdit does have a default auto-complete feature built in (control+space) - UltraEdit will search back 50K in the active file from the cursor location for words that match a partially typed word and show these. Go to Advanced > Configuration > Editor > Auto-complete and you can tick the option to "show auto-complete dialog automatically" after X number of chars.
Also, you can set language specific auto-complete files (and UtlraEdit's website has a few predefined ones you can download). So for example you can fill this file with a bunch of class names or other common words/tokens and they will always appear in the auto-complete dialog for that file type too. Link a specific auto-complete file to a file type through preferences:
Advanced > Configuation > Editor > Word Wrap/Tab Settings
Click Change List
Type c or java or whatever the extension is > click Add > click OK
Under the text "select extension for settings or default", select the new extension you just made.
Click "Browse" to link that file type to a specific auto-complete file.
Click OK to exit the Configuration dialog.
Lastly, as of UltraEdit 18, the editor got a lot better with templates. While you have a c file open, display the template view: View > Views/Lists > Template List. You should see in that template list a bunch of smart template for common c structures such as IF, DO etc etc. You can also create your own here too.
Note that all these things (search tokens 50k back in the file; list tokens in the autocomplete file; list templates) will all show up on control+space.

How do I make an editor the default editor for all unknown files in Eclipse?

I regularly open files of different types in Eclipse. For many types, Eclipse uses the system editor by default. I don't want this to happen. I want Eclipse to use the built-in Text Editor for unknown file types. However all I can find are options to set the default editor for a certain file type, but not for all unknown ones. Is there an option to do this?
I don't think you can do this in one swoop, however:
Windows > Preferences > General > Editors > File Association.
If you don't have a LOT of unknown file types, just type *.junk, *.punk, *.clunck and add Text Editor as the default editor.
Sadly you can't use *.* here.
This issue with file associations is something that has always annoyed me with Eclipse. It is specially frustrating if you are trying to use Eclipse to edit files that don't have a file extension because then you can't even set a editor.
I searched over the Eclipse bug database and found my exact issue there. It was first reported in 2003 and up until now there is no solution for it. If you follow the long comment track over the years you will see that there is no way of setting a default editor for unknown file types. From what I gathered the problem boils down to eclipse not looking at the content of file to try to determine the type. Instead it fully depends on the file extension.
Some people have made suggestions for fixes but again nothing has come out of that. If you search the bug tracker DB you will find a lot more bugs created around this.
A clean solution to this is finally implemented in Eclipse.
On the Preferences > General > Editors > File Association page, you can now define an editor selection strategy for unassociated file types.
Source: https://www.eclipse.org/eclipse/news/4.6/platform.php#text-editor-selection-strategy
There is an Eclipse plugin that overrides the default behavior of the platform and opens text file of unknown type in the plain text editor of Eclipse instead in an external editor.
https://github.com/eclipselabs/default-text-editor

How can I get Eclipse File Search to skip certain files?

In my Eclipse project, I have a mixture of java files, xml, and various files with different file extensions. I want to perform searches on a regular basis on everything except for the java files, to look for certain settings.
Is there a way to tell Eclipse to search all the files, EXCEPT the one's with a .java extension?
The best thing you can do inside the file search dialog is to press the button "Choose" for the "File name patterns", then press "select all" and deselect "*.java".
But beware! This doesn't look for all file extensions in your project and lists them. It's a predefined set of extensions.
Yes, in your file search dialog, there is a "Choose" button next to the "file name patterns" textbox. It allows you to filter Select Types. After selection, you should just realize it is just regex of everything except for *.java.

searching in eclipse

how can I search something in all files in a given folder in eclipse
also how can I search up, it's seems like only going down the document
sometimes I am working on single files, so there is no project defined. I know about the search in project feature
If you go to Search>Files... you'll have an advanced search dialogue where you amongst others can specify the scope to search in (all of the workspace, selected resources only etc.). Is this what you're looking for?
And also, if searching through a single file (+), you have the standard search dialogue where you can specify search direction to either forward or backward.
Search forward in file: Edit -> Incremental Find Next
Search backward in file: Edit -> Incremental Find Previous
Search in multiple files: Search -> File -> Containing Text.
Search files in a specific subdirectory: Select the sub-directory -> Search -> File -> Scope: Selected resources.
I reccomend that you learn the short-cuts for these tasks. (Key-combination is found right beside the menu-item.)
When you are searching "Java Resources" with "File Search" with "Selected resources" checkbox checked - you will not get any results.
To search recursively a chosen folder for any files:
Select folder (it has to be folder)
Select FileSearch with "Selected resources" checked.
Good luck
Use the Remote Search Feature. Here you can browse for local folders. Some stupid name...
If default eclipse search is not sufficient for your needs, eclipse instasearch plugin is a very useful plugin for search needs inside eclipse.
It is based on lucene. This is also available in eclipse marketplace.
It has extensive feature set.
Instantly shows search results
Shows a preview using relevant lines
Periodically updates the index
Matches partial words (e.g. case in CamelCase)
Opens and highlights matches in files
Searches JAR source attachments
Supports filtering by extension/project/working set
If you want to search for anything without telling Eclipse what it is, use ctrl+shift+L (QuickEclipseSearch). This is the quickest way.
You can also use 'file search' (press ctrl+H) and navigate into file search using left and right arrrows on the top right corner of your windows. Or type 'file search' in the 'Quick Access' window.
If you are looking for a specific method, package, field,type or constructor use JAVA search.
If you want search in a particular file then just press ctr+F and type whatever you want to search in that current file.
Read all the answers above but couldn't figure out the solution working for me. Finally gave a thought process keeping in mind all the solutions provided here and voila it worked for what I'm looking here. Thanks stackoverflow, this site is awesome.
Solution I worked out:
Goto Navigator window in eclipse, select the folder where you want to perform the search operation, now click Alt a & f (shortcut) which opens the file search window. Now select the option "Selected resources" in 'scope' section and hit 'Search' button.
In MAC I use, control+H (^H), it opens a window, where you can search for any text within all the files.