tweezy23 / anyedittools

Automatically exported from code.google.com/p/anyedittools
2 stars 0 forks source link

"save" buttons on Eclipse 4.2 doesn't trigger auto-remove of trailing spaces (Eclipse bug 379257) #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
To reproduce the problem:

1. On the General/Editors/AnyEdit Tools/Auto-convert tab, check "Remove 
trailing whitespace" checkbox
1. Open a Java source file in the Java editor
2. Add some whitespace to any line
3. Save the file 

The trailing whitespace is unaltered: it should be removed.

The environment is:
AnyEditTools 2.4.2.201205131655 on Eclipse Juno (4.2.0) on Windows XP SP3

I believe this worked on Eclipse Indigo SP2 (3.7.2).

Original issue reported on code.google.com by np.shar...@gmail.com on 15 Aug 2012 at 2:29

GoogleCodeExporter commented 9 years ago
Hi,
I can't reproduce. Please check if you have project specific settings which set 
to the opposite value.
Regards,
Andrey

Original comment by iloveeclipse on 15 Aug 2012 at 8:21

GoogleCodeExporter commented 9 years ago

Original comment by iloveeclipse on 15 Aug 2012 at 8:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It doesn't work for any filetype. 
My config is: 

Version: Juno Release
Build id: 20120614-1722
Windows 7 64bits

AnyEditTools (2.4.2.201205131655) "AnyEdit Tools"

Original comment by capape...@gmail.com on 18 Sep 2012 at 11:56

GoogleCodeExporter commented 9 years ago
I still can't reproduce. 
Installed Eclipse 4.2 from scratch, installed AnyEdit Tools, created new Java 
project, new Java class, entered few spaces, saved and every space is gone.
Please provide a reproducible step by step example.
Please also check if you have any related errors in the error log view.

Original comment by iloveeclipse on 18 Sep 2012 at 6:54

GoogleCodeExporter commented 9 years ago
Hello I attach a java file that has a trailing space in a comment. I also 
attach a properties file

Original comment by capape...@gmail.com on 19 Sep 2012 at 6:25

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, I'm not sure if my English is too bad?
Can you please carefully read my comments above?

I CANNOT REPRODUCE THIS.
LEASE PROVIDE A REPRODUCIBLE STEP BY STEP EXAMPLE.
PLEASE ALSO CHECK IF YOU HAVE ANY RELATED ERRORS IN THE ERROR LOG VIEW.

Original comment by iloveeclipse on 19 Sep 2012 at 6:35

GoogleCodeExporter commented 9 years ago
Simply open the files I've attached and save them with remove trailing space 
options checked in preferences. The trailing spaces don't dissapear.

I sent a replay yesterday to the mail sent by the track system, I copy it here 
because it doesn't appear (the mail said to reply to send a comment):

"In my case I got an Eclipse update and Indigo turned into Juno. I can send all 
the plugins installed jn my Eclipse. I think it may be some kind of 
incompatibility with other plugin. Removing trailing spaces in java works for 
me  because I use the java style formatter option on saving files,  but it 
doesn't work with other files: jsp, txt, properties,etc.. Neither it works with 
some javadocs comments, where the style formatter is doing it badly . I don't 
have my work computer with me now, but tomorrow I'll send you an example of 
these type of comments.

Thank you very much."

Original comment by capape...@gmail.com on 19 Sep 2012 at 6:41

GoogleCodeExporter commented 9 years ago
Ok,
I didn't received your email about upgrade. So most likely the upgrade went 
wrong and AnyEdit doesn't properly work since.

Please download a fresh copy of Eclipse 4.2, DO NOT UPGRADE ANYTHING, install 
fresh copy of AnyEdit and try to save.

As I said, it just works for me and I also see no reason why it shouldn't - 
except the broken installation.

Regards,
Andrey

Original comment by iloveeclipse on 19 Sep 2012 at 7:09

GoogleCodeExporter commented 9 years ago
I have installed eclipse 4.2 classic, java edition and J2EE edition, without 
success. Of course, all fresh installations.

In three cases, first I installed eclipse, after anyedit, and then create a 
java proyect and then copy the two file I attached before. None of eclipse 
instances worked. May be some path or java version?

Regards,
Antonio

Original comment by capape...@gmail.com on 19 Sep 2012 at 2:11

GoogleCodeExporter commented 9 years ago
Antonio, please make sure you have no errors in the error log and you use a 
fresh workspace / no project specific AnyEdit settings.

I haven't tried on all Eclipse packages, but 4.2 classic is working fine for 
me. I have of course different OS - Kubuntu, but this shoulnd't be a big 
difference.

The only thing which can be related is some problems with the file encoding - 
but I've tried your files and they are just fine.

BTW, can you confirm that everything else works as expected - e.g. converting 
tabs to spaces, upper case to camel case etc - from the editor context menu?

Original comment by iloveeclipse on 19 Sep 2012 at 2:22

GoogleCodeExporter commented 9 years ago
The workspaces are new and projects are new. Something strange: after I convert 
spaces to tabs or tabs to spaces the trailing space is gone, but If I save the 
file it doesn't work, the space remains.

Original comment by capape...@gmail.com on 19 Sep 2012 at 2:34

GoogleCodeExporter commented 9 years ago
I had the "everything works, but save not" problem with early 4.2 versions, see 
issue 67. But that one was fixed in M7. 

It must be something with your environment (as I can't see the problem in the 
Windows 7 VM) - can it be that your Eclipse still see some parts of Eclipse 
milestone plugins? If you have ever tried old 4.2 builds, your config area 
might be broken?

Please unzip Eclipse 4.2 classic into some temp directory and run tests from 
there, do not use any exiting links or install to "Programs".

Original comment by iloveeclipse on 19 Sep 2012 at 3:19

GoogleCodeExporter commented 9 years ago
I've  downloaded eclipse 4.2 this morning to test it, and extract it to a temp 
directory as you say. This is my version now:

Eclipse SDK
Version: 4.2.0
Build id: I20120608-1400

Thank you

Original comment by capape...@gmail.com on 19 Sep 2012 at 3:41

GoogleCodeExporter commented 9 years ago
Downloaded eclipse-SDK-4.2-win32-x86_64
Classic version, 64-bit, windows 7 x64.

Version: 4.2.0
Build id: I20120608-1400

Created a new workspace.
Installed market.
Installed AnyEdit.
Checked: create new line at the end of the file
Checked: Convert tabs <-> spaces
Created: test.java
Added a few words on 1 line and some trailing spaces, no new line after.
Save.

Nothing happened. Trailing spaces still there and no new line.

Original comment by gpelt...@gmail.com on 20 Sep 2012 at 10:43

GoogleCodeExporter commented 9 years ago
Just to be clear: I didn't install eclipse. Just unzipped it and ran 
eclipse.exe.

Original comment by gpelt...@gmail.com on 20 Sep 2012 at 10:45

GoogleCodeExporter commented 9 years ago
I downloaded 32-bit version (eclipse-SDK-4.2-win32.zip) and went through every 
step. Same issue.

Original comment by gpelt...@gmail.com on 20 Sep 2012 at 10:59

GoogleCodeExporter commented 9 years ago
I've tried again a fresh Eclipse 4.2 classic - it just works.
This time I was running Windows 7 32 bit in the VM.

Could it be, that all people complaining about not working AnyEdit on Eclipse 
4.2 use Windows 7 *64* bit??? If yes, I can't help - this must be Eclipse 
Windows 64 bit build issue.

What you can do is install 32 bit JDK and 32 bit Eclipse and check if they 
would work on your Windows 7.
But honestly speaking I have no clue why Eclipse 4.2 can be broken on Windows 
64 bit. Probably simply some build issue.
Please try to check if the newest Eclipse 4.2.1 RC4 build 
(http://download.eclipse.org/eclipse/downloads/drops4/M20120914-1800/) has 
fixed the problem.
Regards,
Andrey

Original comment by iloveeclipse on 20 Sep 2012 at 7:24

GoogleCodeExporter commented 9 years ago
Hello again,

I have the same issue on OSX Mountain Lion with Juno. With Indigo is ok.
1.- Download eclipse
2.- Launch creating new workspace
3.- Install anyedit from install>new software>  
http://andrei.gmxhome.de/eclipse/
4.- Reboot eclipse
5.- New Java Project
6.- Check any edit preferences tab > spaces and remove trailing spaces
7.- New class with spaces
8.- Save.

I've tried with differents eclipses:

Eclipse SDK

Version: 4.2.0
Build id: I20120608-1400

Eclipse SDK

Version: 4.2.1
Build id: M20120914-1800

Eclipse SDK

Version: 4.3.0
Build id: I20120920-1300

Original comment by capape...@gmail.com on 22 Sep 2012 at 8:32

GoogleCodeExporter commented 9 years ago
Sorry, I forgot to mention that all eclipse are 64 bits:

eclipse-SDK-3.7.2-macosx-cocoa-x86_64.tar.gz
eclipse-SDK-4.2-macosx-cocoa-x86_64.tar.gz
eclipse-SDK-M20120914-1800-macosx-cocoa-x86_64.tar.gz
eclipse-SDK-4.3M2-macosx-cocoa-x86_64.tar.gz

Regards

Original comment by capape...@gmail.com on 22 Sep 2012 at 8:37

GoogleCodeExporter commented 9 years ago
Tried Juno x64 beta version on Windows 7 x64:
Version: 4.2.1
Build id: M20120914-1800

Issue is still there. It looks like the save action never executes.
- Tabs are not converted to spaces.
- Trailing spaces are not removed.
- No new line added at the end of the file.

Original comment by gpelt...@gmail.com on 22 Sep 2012 at 10:06

GoogleCodeExporter commented 9 years ago
Eclipse Juno 4.2.1 32bit

Saving by CTRL+S and CTRL+SHIFT+S works, but not when you click on the 
Save/Save All icons in the toolbar. It seems that replacing the original save 
actions with the "special" ones does not work.

Original comment by Ivan.Fur...@gmail.com on 19 Oct 2012 at 9:05

GoogleCodeExporter commented 9 years ago
Eclipse Juno 4.2.1 64-bit
Build id: M20120914-1800
Windows 7 x64

Just tested and same here. CTRL+S and CTRL+SHIFT+S does work, but not the save 
buttons.

Original comment by gpelt...@gmail.com on 19 Oct 2012 at 9:13

GoogleCodeExporter commented 9 years ago
"Remove "Print" button from global toolbar..." does not work too. This confirms 
my thoughts that replacing the original save actions in the toolbar with the 
"special" ones does not work.

Original comment by Ivan.Fur...@gmail.com on 19 Oct 2012 at 9:20

GoogleCodeExporter commented 9 years ago
There is no replacement anymore since 3.7.0, the save command is intercepted. 
In Eclipse 4.2 they seems either not to use the command for buttons or they do 
not notify listeners on command execution.
The same code works just fine in 3.8 / 4.2 with schortcuts, which means that 
the bug is in 4.2 save buttons. I will check if I can find related Eclipse bug. 
If not, I will file one.

Original comment by iloveeclipse on 19 Oct 2012 at 9:23

GoogleCodeExporter commented 9 years ago

Original comment by iloveeclipse on 19 Oct 2012 at 9:23

GoogleCodeExporter commented 9 years ago
It's the effect of:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=379257

I can't do anything about it as this is the core platform issue. Just accept 
the fact that 4.x stream is much buggier as the 3.x.

You can switch to 3.8 if you like - it offers the *same* functionality as 4.2 
and has not so much bugs.

Usually I would close this bug as "invalid", but I will keep it open as long as 
the Eclipse bug 379257 is not fixed.

Regards,
Andrey

Original comment by iloveeclipse on 21 Oct 2012 at 8:33

GoogleCodeExporter commented 9 years ago
Andrey, 
if I understand correctly the platform bug, you need to register the SAVE and 
SAVE_ALL actions in order to receive the event. Could you workaround it by 
finding a way to register them like in ActionBarAdvisor:
protected void makeActions(IWorkbenchWindow window) {
  register(ActionFactory.SAVE.create(window));
  register(ActionFactory.SAVE_ALL.create(window));
}

Original comment by Ivan.Fur...@gmail.com on 21 Oct 2012 at 10:10

GoogleCodeExporter commented 9 years ago
Ivan, the bug is in the platform code. 

I can't do *anything* here, please see for example the proposed patch:
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=de920516010
1e12ffdd1a089cf97c8e48ae824c1

The code is not accessible/not intended to be modified from 3rd party plugins 
like AnyEdit.

Original comment by iloveeclipse on 21 Oct 2012 at 10:44

GoogleCodeExporter commented 9 years ago
I see. Thanks for the reply. As an Eclipse developer I'm running into same 
situation frequently. Even much buggier than the 3.8, Eclipse 4.x is now the 
main Eclipse stream and in order to support and improve it we as Eclipse 
community *must* use it and report bugs :-). Rolling back to 3.8 is not an 
option for me. I hope that the patch from the bug will land up into Kepler 
master branch soon. Thanks again for the useful plugin.
Regards,
Ivan

Original comment by Ivan.Fur...@gmail.com on 21 Oct 2012 at 11:31

GoogleCodeExporter commented 9 years ago
It became worse - CTRL+S and CTRL+SHIFT+S stopped working in Kepler (4.3) M7+.

Original comment by Ivan.Fur...@gmail.com on 27 May 2013 at 7:43

GoogleCodeExporter commented 9 years ago
It's just pity what goes on 4.x branch ...
Ivan, have you had chance to check 4.3 RC1?

I apologize I'm not using 4.x stream so I will need some time to setup 
environment and verify it / try to identify the root cause.

Any hint about new bug report related to this issue in eclipse bugzilla is 
welcome.

Thanks for reporting,
Regards,
Andrey

Original comment by iloveeclipse on 27 May 2013 at 8:12

GoogleCodeExporter commented 9 years ago
Hi Andrey,
Not working in Kepler RC1 too. I will look at bugzilla about related 
issues/changes.
Regards!
Ivan

Original comment by Ivan.Fur...@gmail.com on 27 May 2013 at 8:18

GoogleCodeExporter commented 9 years ago
RC3 shows same issue. The code in question asks for the active editor and 
receives nothing...

HandlerUtil.getActiveEditor(event) -> null
Internally it asks
if (event.getApplicationContext() instanceof IEvaluationContext)
and for some reason it is not implementing this interface. Actual type is 
org.eclipse.e4.core.commands.internal.HandlerServiceImpl$ExecutionContexts

Similar to 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=242246

or might be this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=360815

or this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=361136

Original comment by iloveeclipse on 18 Jun 2013 at 9:40

GoogleCodeExporter commented 9 years ago
@ Ivan: if you want to test & can compile from source, just build from head.
I've added a quick fix in 
http://code.google.com/a/eclipselabs.org/p/anyedittools/source/detail?r=5c9e2e51
b65aecd441052c0851dd9d02b0d193db

Original comment by iloveeclipse on 18 Jun 2013 at 9:49

GoogleCodeExporter commented 9 years ago
Thank you, Andrey... I will give it a try in the next couple of days.

Original comment by Ivan.Fur...@gmail.com on 19 Jun 2013 at 6:42

GoogleCodeExporter commented 9 years ago
Hi Andrey,
just did a smoke test and the version from git master is working for me (Kepler 
RC4). Both CTRL+S and "Save" action in the toolbar trigger the AnyEdit. 
Unfortunately, both CTRL+SHIFT+S and "Save All" action don't work.
Best,
Ivan

Original comment by Ivan.Fur...@gmail.com on 19 Jun 2013 at 7:11

GoogleCodeExporter commented 9 years ago
Andrey,
your fix in runSpecial2 is not correct.
...
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
if (window == null) {
  window = AnyEditToolsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
  if(window == null) {
     return;
  }
  // action has been disposed
  return; // ----------------------> remove this return
}
....
Best,
Ivan

Original comment by Ivan.Fur...@gmail.com on 19 Jun 2013 at 2:35

GoogleCodeExporter commented 9 years ago
... and another time we see the confirmation for the old good rule: "never ever 
commit at 12 pm".
Thanks Ivan. I've pushed 
http://code.google.com/a/eclipselabs.org/p/anyedittools/source/detail?r=a46ac589
cefd8b4201e8684b15b66ca7c5c12e27

If the fix does work for you, I can trigger a release build.

Original comment by iloveeclipse on 19 Jun 2013 at 5:45

GoogleCodeExporter commented 9 years ago
Hi Andrey... I've already tested the fix (changed and built it myself) before 
reporting it to you :-). Now everything is working - keybinding + toolbar 
actions for both "Save" and "Save All". For me the issue is fixed. Thanks again 
;-).

Original comment by Ivan.Fur...@gmail.com on 19 Jun 2013 at 5:59

GoogleCodeExporter commented 9 years ago
Thanks Ivan. I really appreciate your help. Released 2.4.4 just now.

Original comment by iloveeclipse on 19 Jun 2013 at 6:32

GoogleCodeExporter commented 9 years ago
Eclipse Juno 4.2.2 64-bit
Build id: M20130204-1200
Windows 8 x64

Confirmed fixed.

Thank you for this. Now I can fully use one of the best tools again.

Original comment by gpelt...@gmail.com on 19 Jun 2013 at 6:53

GoogleCodeExporter commented 9 years ago
Ah, I was about to go back to Juno... (where it worked!)
I installed (unzipped, in Windows) Kepler and imported the plugins from my Juno 
installation, and found out that AnyEdit wasn't working.
FYI, Eclipse doesn't detect an update, so I had to (re)install AnyEdit from the 
URL: http://andrei.gmxhome.de/eclipse/
After that, it worked fine.
Thanks for the udpate.

Original comment by PhiLho....@gmail.com on 19 Sep 2013 at 2:51