Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I install this plugin, gradle scripts show up with an Error icon. #277

Closed
sc1478 opened this issue Apr 3, 2017 · 33 comments
Closed

Comments

@sc1478
Copy link

sc1478 commented Apr 3, 2017

My need for this plugin is primarily to write Gradle plugins in groovy.

There is an issue, mostly cosmetic, that I can't solve. When this plugin is NOT installed, but the Buildship plugin IS installed, then the display of gradle buildscripts in the Project Explorer is correct (the gradle scripts have elephant icons).

2017-04-03_14-34-35

But after installing this plugin then the display of gradle buildscripts in Project Explorer is incorrect (Big fat ugly exclamation mark for the gradle scripts in project explorer, but no error messages in the Markers tab or Problems tab).

2017-04-03_14-44-51

This seems to be purely cosmetic but it's annoying. The gradle building within Eclipse is not affected. But, since I need to edit code for a gradle plugin, I want the groovy editor support, but it seems to mess up at least the cosmetics of the Eclipse Project Explorer.

@eric-milles
Copy link
Member

eric-milles commented Apr 3, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 3, 2017

I'll confirm that adding
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
in my project file makes the ugly exclamation points go away, but it doesn't revert to the elephant Gradle icon. It becomes something else (I can't quite make out what)

2017-04-03_16-00-09

And it seems wrong to have to do it. My project might have no connection to groovy other than its build script being written in gradle. It might be something like a project that packages a bunch of shell scripts into an RPM for example. If anything should add this nature it should be the Gradle project importer or else the Gradle project nature should somehow imply the groovy nature.

@eric-milles
Copy link
Member

eric-milles commented Apr 3, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 3, 2017

What would it take to just leave the original gradle elephant icon in place, as it would be if the Groovy plugin were not installed?

@eric-milles
Copy link
Member

eric-milles commented Apr 3, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 3, 2017

No, that doesn't work either. Although it shows up as the default editor, it looks like the groovy plugin has locked it. And I don't mind editing the script with the groovy editor - it's preferable actually, But changing that preference doesn't fix the icon.

2017-04-03_16-25-31

@sc1478
Copy link
Author

sc1478 commented Apr 3, 2017

Another odd thing is that the elephant shows up in other views such as the Git Repositories view.

@eric-milles
Copy link
Member

eric-milles commented Apr 4, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 4, 2017

I guess you've made the assumption that icon maps to editor choice. Is that correct? I'm not sure it is, given that many file types have several "Open With" choices.

To me, the elephant icon is highly desirable because it makes the build scripts for a project stand out from other files, regardless of what editor may be chosen to edit them. In any case, as it stands now,, once the groovy plugin is installed, I lose the elephant icon, no matter what editor I choose.

So I would be satisfied if

  1. I had the elephant icon if the default editor was the gradle editor
  2. I had the Open With option to use the (non-default) Groovy editor if I so chose, without then losing the icon.

@eric-milles
Copy link
Member

eric-milles commented Apr 4, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 4, 2017

Yes. While I was tempted to say, I want everything exactly the way I want it, I realized that you as developer could be whipsawed by competing demands. So I tried to keep mine reasonable.

I would say the groovy plugin should find *.gradle files interesting enough to provide the groovy editor as a non-default choice. Gradle editor would be default choice (if Buildship is installed), and the icon would show up as the elephant (either always, if that is possible, or at the very least when groovy has not been defined as the default editor). Often build scripts are simple enough that syntax highlighting etc. are not required. But they occasionally get more complex, when the syntax highlighting becomes a real help. Those cases could be handled with alternate Open With groovy editor.

If you don't mind, I'll stay out of the question of how you implement this. But thanks for your efforts.

@eric-milles
Copy link
Member

eric-milles commented Apr 4, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 4, 2017

Thanks. Please tell me how/where I can get this new version?

@eric-milles
Copy link
Member

eric-milles commented Apr 4, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 4, 2017

OK, your fix didn't help, sorry.

I have the new plugin installed: org.codehaus.groovy25.feature (2.9.2.xx-201704041513-e46) "Groovy-Eclipse" and I still get the exclamation point icon even though gradle editor is the default editor for these files.

@eric-milles
Copy link
Member

eric-milles commented Apr 4, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 4, 2017

2017-04-04_12-23-44

@sc1478
Copy link
Author

sc1478 commented Apr 4, 2017

2017-04-04_12-27-00

@sc1478 sc1478 closed this as completed Apr 4, 2017
@sc1478
Copy link
Author

sc1478 commented Apr 4, 2017

and here are the file associations

@eric-milles
Copy link
Member

eric-milles commented Apr 4, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 4, 2017

This is what I see:

2017-04-04_12-35-36

The editor panes show the icon of whatever editor is active. In this view I have settings gradle open twice, one with the default gradle editor and once with groovy editor It would be nice if the groovy editor didn't show the error icon, but at least the gradle editor shows it correctly.

In the project explorer, it shows the error icon for all gradle scripts, even though groovy is the default editor..

@sc1478
Copy link
Author

sc1478 commented Apr 5, 2017

Eh, why is this closed? Your fix didn't solve the issue.

@sc1478 sc1478 reopened this Apr 5, 2017
@eric-milles
Copy link
Member

eric-milles commented Apr 5, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 5, 2017

Don't know how it got closed. I didn't do it, or at least not knowingly. :-)

@eric-milles
Copy link
Member

Can you send me the update site link for the Gradle plug-ins?

@sc1478
Copy link
Author

sc1478 commented Apr 5, 2017

@eric-milles
Copy link
Member

eric-milles commented Apr 5, 2017 via email

@sc1478
Copy link
Author

sc1478 commented Apr 5, 2017

I will but your image is not readable by me and may not be readable by the Gradle folks.

@eric-milles
Copy link
Member

Can you retest with the latest snapshot?

@aax
Copy link

aax commented Apr 7, 2017

With the latest snapshot, the following error occurs several times in our logs on startup. We don't have the buildship plugin installed.

!ENTRY org.eclipse.core.runtime 4 0 2017-04-07 16:03:37.656
!MESSAGE Invalid input url:platform:/plugin/org.eclipse.buildship.ui/icons/full/obj16/gradle_file.png
!STACK 0
java.io.IOException: Unable to resolve plug-in "platform:/plugin/org.eclipse.buildship.ui/icons/full/obj16/gradle_file.png".
at org.eclipse.core.internal.runtime.PlatformURLPluginConnection.parse(PlatformURLPluginConnection.java:61)
at org.eclipse.core.internal.runtime.FindSupport.find(FindSupport.java:290)
at org.eclipse.core.runtime.FileLocator.find(FileLocator.java:152)
at org.eclipse.jface.resource.URLImageDescriptor.getFilePath(URLImageDescriptor.java:209)
at org.eclipse.jface.resource.URLImageDescriptor.access$1(URLImageDescriptor.java:200)
at org.eclipse.jface.resource.URLImageDescriptor$URLImageFileNameProvider.getImagePath(URLImageDescriptor.java:53)
at org.eclipse.swt.internal.DPIUtil.validateAndGetImagePathAtZoom(DPIUtil.java:407)
at org.eclipse.swt.graphics.Image.(Image.java:684)
at org.eclipse.jface.resource.URLImageDescriptor.createImage(URLImageDescriptor.java:244)
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:224)
at org.codehaus.groovy.eclipse.ui.decorators.GroovyPluginImages.createDescriptor2(GroovyPluginImages.java:37)
at org.codehaus.groovy.eclipse.ui.decorators.GroovyPluginImages.(GroovyPluginImages.java:23)
at org.codehaus.groovy.eclipse.ui.decorators.GroovyImageDecorator.getJavaElementImageDescriptor(GroovyImageDecorator.java:101)
at org.codehaus.groovy.eclipse.ui.decorators.GroovyImageDecorator.decorateImage(GroovyImageDecorator.java:64)
at org.codehaus.groovy.eclipse.editor.GroovyEditor.getTitleImage(GroovyEditor.java:709)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditorErrorTickUpdater.updateEditorImage(JavaEditorErrorTickUpdater.java:73)
at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput(CompilationUnitEditor.java:1420)
at org.codehaus.groovy.eclipse.editor.GroovyEditor.doSetInput(GroovyEditor.java:875)
at org.eclipse.ui.texteditor.AbstractTextEditor$5.run(AbstractTextEditor.java:3154)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2126)
at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3172)
at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3197)
at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:362)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:318)
...

@sc1478
Copy link
Author

sc1478 commented Apr 7, 2017

Well, I DO, of course, have the buildship plugin installed and this release fixes my original issue. Everything looks good. .gradle build scripts open by default with the gradle script editor or optionally (Open with) the groovy editor. No matter which editor they are opened with, the Elephant icon is shown. This is all good.
Thanks.

But I suppose I will have to do one more test when aax's issue is addressed.

@eric-milles
Copy link
Member

Something had to give somewhere. I checked for the existence of the buildship icon and if it is found it is used. If not found, there will be a couple entries in the log. I may find a way to clean that up in the future, but I have already put way more time into this than I planned on.

@sc1478
Copy link
Author

sc1478 commented Apr 7, 2017

Thanks! I appreciate the effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants