Class file editor : Source not found error for ILock, ClassPathSuite classes - junit

I am getting Class file editor : Source not found error for the classes in junit / hazelcast packages. Previously i got this error for all built in java classes. But after adding the Source zip file, i am able to see String.class and all. What i need to do for these classes. Please find the screenshot
Thanks in Advance!

Interestingly enough, your question contains all the concepts you need to know in order to answer it.
In order for your IDE to show you source code for any library you are using, the corresponding library needs to come with source code attached to it.
In other words: you managed to point your IDE to the ZIP file containing the source code for your JRE/JDK - thus your IDE knows what to show you when want to open up String.class
Now it seems that you are using other libraries as well. Maybe maybe, other libraries, have other, different source code ZIP files?!
Long story short: you need to add "source code" ZIPs for each and any additional library you are using and that you want to "peek into".
Within eclipse, you achieve that for example as described in that SO q/a. Side note: that is also something to keep in mind: you should do prior research before coming up with "new" questions. Especially when you are a beginner, you can be very sure that "your" question was asked here before.

Related

'refactor' move files in VSCode - es6

If I move ComponentFoo.js from folder X to folder Y, than a bunch of import statements break. Looking into this it seems there are many solutions for typescript, but what about js / es6? If I move a file in the editor, it should find all the import statements and update them to the new location. Is this possible?
Old post, but this might help some Googlers. This feature can be enabled and disabled in User Settings. For Javascript and Typescript, it's called "Updated Imports On File Move".
I had apparently disabled it and just figured the feature was broken :X
VS Code has built-in support for this for both javascript and typescript since VS Code 1.24.
For JavaScript specifically, you need to make sure VS code's language support can find all the references to the file so that imports referring symbols in that can be updated properly. Definitely create a jsconfig.json for your project, and also consider enabling semantic checking for JavaScript so that VS Code shows when imports are not being properly resolved
If your project is configured properly but files are not being updated, make sure you are running the latest VS Code insiders build and report an issue if it still doesn't work
for flutter developers you should move files one by one. vscode doesn't support multi file moving with refactor yet.
Just use IntelliJ. It handles all kinds of refactoring perfectly. I'm a huge fan of VS Code, but refacotoring is definetly not one of it's stengths. Some imports don't get detected, and the imports can get modified in a weird way. For example, I had an import like this:
import { myStore} from 'src/common/stores/myStore';
When moving the file of myStore.ts to a different folder, VS Code constructed this bull**it:
import { myStore} from 'src/common/composables/myStoreStore';
The line above is no typo!
Btw I'm using vetur, maybe thats causing it, I don't know ...

How to create visual studio extension for .cshtml files?

I am trying to create a visual studio 2017 extension. More specifically, I want to extend IntelliSense to create light bulb suggestions and fixes. For that, I am trying to go through the syntax of .cshtml file (both markup and c# code), and parse it so that I can get stuff like values of the attributes and tag names, so that I know when to show the light bulbs.
I went through the documentation on MSDN site. I found out how I could get the light bulbs to show up at specific caret location using ITextBuffer and Snapshot for [ContentType = "text"]. But for my problem, I want the light bulb to show up based on values of attributes and like. So, I think I will have to work with [ContentType = 'code']. I couldn't find proper documentation for that. I found this article
https://designprincipia.com/writing-a-visual-studio-extension-to-automate-code-generation-with-roslyn/
It tells how you can show a light bulb when your caret is on a method name and make a class file with that method name. Now, this is for a C# file and uses the Roslyn APIs to get the syntax tree and sementic model of the C# code.
Problem Comes down to this
I have a .cshtml file and I want to get the syntax tree of the markup and C# code in it. And, I think I should be able to get it because the editor higlights the markup and C# code of the file differently. Thus, it must be parsing it. But I am not able to do this.
So, for my approach I am trying to get the syntax tree. I want to know how this can be done. Please, tell me if this the wrong direction and what else I can do.
PS: This is my first question so please tell me if I have left any information and also I am new to Razor so maybe I am missing something there.
Thanks a lot for your time.
This might be useful:
using System.Web.Razor;
using System.Web.Razor.Parser.SyntaxTree;
var host = new RazorEngineHost(new CSharpRazorCodeLanguage());
var engine = new RazorTemplateEngine(host);
var result = engine.ParseTemplate(new StringReader(<STRING>)));
result.Document.Children provides detailed recursive tree structure.

Uploading a file using TCL

I'm a newbie working on OpenACS architecture and need to upload a .xml file through TCL. I went through the documentation and tried to work around with the code mentioned here: http://wiki.tcl.tk/13675
However, I'm unable to understand the code and the copy-paste won't work. Could someone please suggest a easier working way to upload a file in TCL? A working code would be of great help.
I need to upload a file through a HTTP form(with input type file parameter) and I'm asking for server-side code.
OpenACS already has file uploading built in (assuming you're using the OpenACS form builder aka ad_form, template::form - it has many names!). The specific widget you need to use is template::widget::file
A worked example is in the General Comments package (see file-ae.adp, file-add.tcl and file-add-2.tcl):
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-ae.adp?r=1.6
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-add.tcl?r=1.4
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-add-2.tcl?r=1.6
Specifically, look out for the 2 ad_page_contract parameters, and follow those variables down through the code:
upload_file:notnull
upload_file.tmpfile:tmpfile
Re-inventing network protocols is not so much worth in most cases, so I'd like to recommend using proven community libs. From my personal experience, I'm pretty glad to deal with libcurl (see http://curl.haxx.se/libcurl/tcl)

Sharing source between 2 projects?

I have a project containing a big package "global" of classes which is designed for Web, I need to share these classes with a new mobile project, but when i add them with :
Properties -> Flex Build Path -> Source path -> Add Folder
they start appearing with index [source path] before the package name, and since them Flash Builder start trowing error messages :
"A file found in a source-path must have the same package structure '', as the definition's package, 'global'."
How can i fix this issue ?
As we've discussed in the comments, I think it would be a better approach to compile your "global" classes into a library (.swc).
You were concerned about loading unnecessary classes: when you link to a library as 'merged', only the classes you use are actually compiled into the main application (and any classes they depend on), so there's no need to worry about that.
As a last argument I also think this is a more flexible approach. A compiled library is easier to reuse and version, so the code can more easily be distributed to other developers on your team.
Rename one of the packages with right click->refactor. Than is should work.
If not you can also try to have your two codes available at the same project, and then you can select which to run in Flash Builder, by right-clicking to that .as or .mxml file, and selecting set as ... (or something like that)
I guess if you will include 'src' fonder instead of 'src/global' that problem will disappear.

Intellij IDEA 11 Run Configuration Classpath Problems

I am using IDEA 11 and need to run a class with a main method but with additional classpath entries - both xml files and jars. I have tried adding them as Global Libraries, as additional source content roots, and as regular additional libraries, however none of these seem to pick up the xml files and so when I execute the run config I get FileNotFoundExceptions.
Please can anyone suggest something else as the printed classpath in the console never contains any of my custom definitions.
If I can't solve this I may have to resort to learning Eclipse just to get stuff done. This is making me a little crazy. I have tried all the suggestions I could find on SO but no luck so far.
Did you check the answers to the similar questions?
How load xml files, in IntelliJ IDEA
Intellij - how do I add a text file to the resources
Add a properties file to IntelliJ's classpath
Java - setting classpath
If it still doesn't work, please share a sample project via Dropbox.