Eclipse won't compile SWT file properly after SFTP transfer - eclipse

I was coding earlier today using Textastic 9 on my iPhone today using files I had downloaded over SFTP. I sent them back to my computer (the whole project transferred to my phone), and now three of the four work. They compile correctly, and the colour coding works perfectly. The last one, however, only colour codes specific keywords and strings. It won't accept variable names and anything from a separate library/file, say org.eclipse.swt.SWT.
Here's a screenshot of that file:
Here's another file that also went through SFTP that's working perfectly:
I'm also getting the error Syntax error on tokens, SimpleName expected on a return; statement. I've also tried pasting the code in Notepad, deleting the file, and pasting it into a new file. That doesn't work.
Thanks to #Ros5292
It turns out the display() method had parameters with incorrect capitalisation. I fixed this, clicked on the Design tab, selected the root method, and it compiles. It still doesn't allow me to use other files, color code, etc.

Thanks to #Ros5292
It turns out the display() method had parameters with incorrect capitalisation. I fixed this, clicked on the Design tab, selected the root method, and it works. The colour coding and stuff were messed up due to a few errors because the file was technically new, and it hadn't compiled properly for the first time ever.

Related

Xcode 10.1 highlighting off by one (or more) lines in Version Editor for storyboard file

When I use Version Editor to compare changes, or when committing changes, the changed lines are showing incorrectly (each one is showing offset by one or more lines). Typically I only experience this when opening my storyboard file, rather than code files. Does anyone know the cause and/or how to fix? Thanks
EDIT: This issue persists for me in Xcode 10.2
OK I discovered what had been causing this for me. I had been putting carriage returns into strings in interface builder using CTRL-RETURN, when I should have been using OPTION-RETURN to do so. Changing those removed the issue for me. Still I think this is something that could be handled in a more forgiving and user-friendly way by Xcode.

When I press . (period) Eclipse tries to compile

As the title states, every time I press . on the keyboard, I get a popup message saying "This compilation unit is not on the build path of a Java project.". Now keep in mind I'm not even trying to compile at this point, i'm just trying to type a . without the program trying to compile my unfinished code on me. Does anyone know how to fix this?
. is usually treated as an auto-activation character when it comes to invoking content assist, and providing content assist often involves trying to compile what it can from the potentially broken syntax in your source file.
Reference for the relevant Preference page if you want to disable or otherwise alter this behavior: http://help.eclipse.org/oxygen/topic/org.eclipse.jdt.doc.user/reference/preferences/java/editor/ref-preferences-content-assist.htm?cp=1_4_2_0_5_0
Really, though, you should tell it that the correct parent folder of your source file is a Source folder (what ever would make your package structure match the folder structure). The automatic background feedback that shortens your edit/compile/run loop is one of the main reasons to use an IDE instead of another text editor that happens to provide syntax coloring.

Compiling swift source files stuck

I have been working on my project when suddenly I have not compiled anymore, it stays waiting in Compile swift source files ... I cleaned the project, the folder, deleted the app and nothing. Is there any way to know what is happening?
Is there any way to know what is happening?
Yes. Go into the Report Navigator which is the one selected by the little speech bubble at the top right of the navigator pane. It will give you a list of all the actions you have performed like builds and tests and runs. The current build will be at the top of the pane. Click on it.
In the main editor you will see some buttons at the top and maybe some messages. Click the All Messages button and it will show you a tree view of the current build. The bottom line will be what the build system is doing now. If it is not changing (i.e. new lines appearing) the build is stuck.
Almost certainly the bottom line will be something like Compile SomeFile.swift. Assuming it is, you can now triage the problem. The Swift compiler usually gets stuck on inferring types for complicated expressions. The way to triage this is to comment out the entire file and then add lines back until the problem reappears. Make sure that you always add enough back so that the file compiles without error.
Obviously, the last line you added back will be the one causing the problem. Usually it's an expression that concatenates strings together with non strings that causes the problem.
The problem is in dictionary [String:Any] when I change the dictionary to [String:String] the problem is resolved . Is very strange..

How to stop FlashDevelop suggestions in text files

I'm using FlashDevelop 4.6.1.30 in Windows, using it with HaxeFlixel.
The autocomplete suggestions appear when editing code - this is wanted, it is good.
They also appear when editing text files though - this is not wanted, it is not good.
Specifically, if I create a new text file in flash develop (so the file is called "readme.txt" or something), after typing a few words, FD tries to "guess" what I'm typing and pops up the suggestions list. This, of course, makes no sense when trying to type out things that aren't code.
Yes, I've seen this Flashdevelop - Disable autocomplete for txt files and no, it doesn't work - even after a restart.
Here is a screenshot showing it not working...
Can confirm, setting that option doesn't prevent completion in .txt files. Consider opening an issue on the FlashDevelop repository.
Looks like a bug.
For now you can simply disable the BasicCompletion plugin (check Disable and restart FlashDevelop).

Bypassing Lock on Generated Code in NetBeans 6.5?

In NetBeans the GUI Builder generates code that is off limits to you from the editor.
I know you can switch to Design Mode and specify custom code and then enter edit in indirectly that way, but it's a pain to not be able to edit text that's 2 lines from your cursor.
Can I allow editing within those regions... I promise I'll be careful :)
Thanks.
Note: I don't want to lose code generation
If you open it in an external editor, there are two possibilities:
there is no guarantee that the changes you make will work (and not break anything) in the Netbeans UI Editor
The next time you edit the file in Netbeans it will be regenerated.
Either way, probably not what you want. The best thing to do would probably be to make the whole design up in the gui editor and when you are happy with it, delete the comments and continue on.
[sarcasm]
With the drag and drop gui editor, what could you possibly want to change by hand anyway?
[/sarcasm] ;)
If you open the .java files in Notepad or WordPad, you'll find pairs of comments that say
// GEN-BEGIN: <name of section>
...
// GEN-END: <name of section>
Delete those comments, and two things will happen.
You'll be able to edit anywhere in the file in NetBeans.
NetBeans will not be able to regenerate the file from the GUI editor.
So it can be done, but don't do it unless you really mean it.
EDIT: "Note: I don't want to lose code generation." Ok, let's see here.
You want to change what is generated.
You don't want to lose code generation.
You don't want to use the facilities NetBeans provides for adding custom code.
It sounds like you're wishing yourself trouble. :D
I had a same problem. I extended JPanel with my own panel class and I was not able to pack it with the rest of UI. First I searched the web and I found your question. I was not able to find elegant solution to this problem.
Therefore, I decided to create another java class and copy NetBeans created code into it. It worked like a charm.
I agree, it would be nice if we can modify existing code like in .NET.
I copy the initcomponents() method, create my own method newInitComponents() paste the generated code, and override what needs to be overridden before i distribute the code. That way when a change is made in the editor, you can still copy paste the code into your new method. You keep the functionality without costing you the ability to override where necessary. Just call newInitComponents() in your constructor rather than the original. This is not the most efficient way of doing things, but it does what you want.
You can also try moving the .form file in
(project name)\src\(name of JFrame/JPanel).form
NetBeans will now see it as a .java file.
If you did not edit anything necessary for the GUI editor, you can move the .form file back into the src folder.
Can you subclass the class and redefine the method where this code is? Of course then you'll have to maintain the method over time as you make changes to the GUI.
You can maybe also look into AspectJ. It will modify the byte-code at build time and make the changes you define. Not sure if this gives you enough control over what code to change.
If you use APT you can rewrite source code at compile time. This way you can overwrite the code that's there at the moment. You could keep the new code in the same Java file along with comments to explain what is going on. This tutorial makes it pretty easy to get started. Copy that code, get it working, then tweak it to your liking. To find out where in the code the annotated method is call getPosition() on the Declaration.
Go to design page and select any one of the fields. Right click on any selected field and choose Customizer Code , In Customizer Code change all default code to custom creation . Now you can edit your design code as you like...
Very simple... the crappy UTF-8 did not let me compile one JasperReport (everything done by GUI). So, I needed to change Project to iso-8859-1. Result? The project is messed up and some of the things to correct are in the blocked parts of the code. So, I really NEED to edit those automatically generated parts. When they are regenerated, they will be fine because the project is now iso-8859-1.
Step # 1 Close the project in NetBeans
Step # 2 Delete the .form file from the source directory of your project
Reopen the project and it will be editable now!