Syntax-Highlighting in Intellij - Custom Language - java

I am currently developing an Intellij-Plugin in Java for a custom language.
Is there any way, that I can easily and through my code register a file type and keywords for Syntax-Highlighting?

You can go into file > settings > editor > filetypes
Create new file name it however you like; say javascript custom
fill in the keyword you want highlighted by group (1-4)
** note to have it work it you will have to essentially recreate the entire list (which isn't to difficult via internet search for a keyword list)
Once your happy with the list simply add file name patterns on that file with a wild card *.js (this is the part that will use your custom file over the provided ** easy to go back/edit/delete your own file)
Here's an example I found online CSS Keyword list example

Related

How to add a none editable and dispalable original creator tag to a file

How to add a none editable and dispalable original creator tag to a file to prevent cheating in exams.
I looking for a way, as it says, to stop cheating in exams. A way that the originators name, student/employee no or the like is added to the file in a way that I or anyone else can read it BUT in such a way that regardless of how many times that file is either edited or copied that originators Id stay permanently visible, something like the copyright maker in a boo eg, File created by A.N. Other
Thanks in advance for all help & suggestion or pointers as to available software, if any, all appreciated
What you are asking is generally not possible for generic files.
If you want to apply this to a certain type of file, like a text document or an image, you may find editors for that kind of file that allow to set some fields only when a new document is created, fields that cannot be altered afterwards. This would require the editor to use some kind of encryption so that you cannot simply open the file in a different editor or in binary and change the fields.
Also, this would require to force everybody to use that editor. And still, if the editor supports copy- and pasting, anybody that gets a hold of a document can still copy it's contents into a new file and set the fields then.

implement Bookmark list in java

I am developing a program which has three JTextBox which my users can enter and check some text for right rule.
So I want add a ablitiy to my program that my users can add or remove their favorite text to a Favorite List and can create folder in Favorite list and put some text in it, such as Bookmark library in FireFox or other web browser.
I want use RandomAccessFile to save favorite list as a favorite source.
How do I implemet it? is there beter way to implement it? is there beter way from RandomAccessFile?
Can any one help me?
Thanks.
There could be lots of approaches. It all depends on what you want to achieve.
Consider using Java serialization mechanism. You can serialize a collection of bookmarks to a file. When your app starts, you deserialize it, and get the same collection data.
The advantages are: simple and easy implementation. The disadvantages: you can't look through stored bookmarks in a text editor or something. The same class hierarchy is to be used to load the serialized version.
XML is human-readable and provides easy interoperability. Other applications would be able to handle your list of bookmarks.
It usually takes more resources to parse the XML and load it to memory and then to create the internal object structures. Though you can use the DOM to traverse the tree all the time, it could be not as convenient as the internal data structure using specialized classes.
Random Access Files work best with fixed record sizes. It means all the fields of your bookmarks must be fixed-length. For example, the name of a bookmark is String. When you write it out to a file, you store it like an array of a fixed length, let's say 20. This automatically implies that if users give a bookmark the name which length is greater than 20, the remaining characters would be lost.
It is also easy to implement with the caveats above. Of course the records could be of variable length, but then you lose the random access to file because you cannot easily calculate the position of a specific record.
Firefox uses JSON for storing bookmarks and allows exporting to HTML. You can explore this too.
You can also store bookmarks, and things you want to keep between sessions in the Preferences,
see http://download.oracle.com/javase/6/docs/api/java/util/prefs/Preferences.html

java dyn parser

Im a novice java-programer, whos trying to create a small java app.
In the program im working on, I want to load the configurations from different ini-files.
The basic idea is, that I would have a library containing all the config files, the parser should read all of them and make configurations named after their filenames.
The parser should be created to work dynamicly, so it can read different types of configs.
example
House.ini
-> type0
-> id name height witdh length price_based_on_dimensions
-> id1 name1 height witdh length price_based_on_dimensions
These data should be saved to a config object named config.house. The tricky part is that a different config file, can have its type = type0 but with a different number of attributtes.
I realise that there is no simply solution to this, but any help and or guides to create a dynamic parser is welcome
I'm not really clear on the output you want to produce, but a Java INI parsing library might be a good place to start. For that, you should use ini4j.
Other then ini4j (which is a really good library) I personally prefer to use xml config files. To me they are easier to use and allow for easier configuration

Building an XML editor in java and RichFaces

I'm building an XML editor using the above technologies. In essence, I want to read in a whole XML file to a java object, and refer using this object to each element in the XML node tree (grouped into entries) to display the content locked, have separate padlocks for the user to click to 'unlock' an entry allow overwriting of the data, and to submit this entry. 'Add entry', 'Duplicate entry', 'Delete entry' are also functions I'd like to add.
I already use dom4j and XPath to access areas of the XML file so some of the work in theory is already done. Given the above, I was going to use these two together with inplaceInputs to allow the user to edit the XML and JSF validators to check the data coming in.
Is this the best way to approach this problem, or is there a more straightforward route than XPathing a whole record? I started looking at jaxb but I'm new at java and jsf but I've got the feeling I won't be by the end..
Thanks
You can try using SIMPLE FRAMEWORK API in java.It is dedicated for XML in java and will certainly suit your needs.You can access the entire xml BASED ON NODE,TRESS,CHILD.Morever writing and reading an XML is equally easy by using serializer and persister which will store the values in repsective setters and gettters.

Can't filter filenames in Talend Open Studio using regular expressions

This question is about Talend Open Studio code.
I use tSendmail component as a child job, that needs to be run when parent job fails (tFtpPut). However, in tFtpPut, file names are filtered by filename masks (for example, it will upload file named Eedoh, if I put Ee* as a mask), but in tSendMail that's not the case.
I understand that tFtpPut uses special characters from filesystem to make filename masks, and tSendMail should use Java regex. Problem is (as I saw in the source code), List.add(String) function is used to add filenames, so I can not use regex as parameter in .add function.
So, I need way to upload all files with names that match regular expression.
Btw, I have tried to change the source code (tried iterating the whole folder and adding all files whose names matches the regex), but it didn't help, an error ocured somewhere else and I was not able to track the issue.
For that problem, I would create a regexpr filter before the components (FTP and sendMail).
It is very easy with a tFilterRow component in "advanced mode". Your filter condition is inputrow.filenamefield.matches("java_regexpr").
This external filter is the same for both components and you don't have anymore to use the specific filter of the FTP component.

Categories

Resources