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
Scala Installations support stage II : choose your own installation #731
Scala Installations support stage II : choose your own installation #731
Conversation
Test PASSed. |
} | ||
} | ||
|
||
class LabelProvider extends org.eclipse.jface.viewers.LabelProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I have to nitpick, it would nice to have a pretty icon to go with that text ;-)
I didn't look too closely at the preferences code (and the publish-subscribe mechanism), but in my simple tests it worked well. I noticed that sources are not found for custom installations (not a big problem). I also noticed that the "Remove" button is not disabled for bundled/default (but it correctly doesn't remove them) |
@dragos The |
Do what your conscience dictates :) |
@dragos : what's your test case for sources jars not being found for custom installs ? in particular, what are the source jar file names ? |
Test PASSed. |
import org.eclipse.jface.viewers.ISelection | ||
import org.eclipse.jface.viewers.StructuredSelection | ||
import org.scalaide.core.internal.project.ScalaProject | ||
import org.scalaide.ui.internal.project.ScalaInstallationChoiceUIProviders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of unused imports in this list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test FAILed. |
I'll have to look through the code. In my tests so far, it worked well. I would like to suggest a simpler description string for Scala installations. I think it's very confusing, and I couldn't really parse it easily (see screenshot). I'd like the string in there to be really clear:
I think that currently it shows multi-bundle/bundle/legacy and some hash number. Users won't have a clue as to what that is, nor why should they care. For the dropdown (in preferences and in the classpath container) I'd also like to remove clutter (it's all valuable debugging info, but I don't think hey belong in user-facing strings). They should hopefully be very similar to what there's in
|
getName().fold(jarSeq)(str => str +: jarSeq).mkString | ||
} | ||
|
||
override def hashCode() = getHashString().hashCode() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should override equals
as well, otherwise this only solves the first step in a hashmap lookup. Equality is still checked when hashcodes match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dragos, as of now (huitseeker@6a83af6) the Scala Installations list looks like this : |
Some cleaning: - Project has simpler getDesiredScalaInstallationChoice. - actually it's easy to have Scala installation saving log (harder for reading)
- factory method for directoryScalaInstallations - more logging on install serialization - cleaner Classpath test project - cleaned imports
Tweaks the source jar resolution to be more strict
…ts to preferences.
Seems to be working fine at this point, except that I get a dialog for every library that is cross-compiled with a different version. My project has 4 dependencies with I do it once, but then the remaining 3 dependencies (each) trigger a dialog that is out dated (I already changed the Scala installation to a compatible one). I think the dialog should be shown only once, at the end of the classpath check. |
I'll try to fix it myself, let's see... :) |
@huitseeker Instead of more mutable state and flags, could we pull that code out of the loop? |
I can regularly get into the following bad state just by following the dialogs:
I start with a 2.10 install, I switch to 2.11 and hit apply. Then I get the dialog asking me to change the Scala installation (twice). I do it. Everything closes down, but the containers are still on 2.11 |
Here's pulling out the dialog from the loop. I still might get two dialogs, but only because of the explicit call to Should we just drop all this crazy UI logic that seems to never work well, and do less for the user? Just do whatever he tells us, and don't offer any quick fix dialogs. We could offer smarter quickfixes at the level of error markers, maybe?
|
- better name for scala installs - equals for ScalaInstallation - formatting, error messages typos - no Default & apply for Scala Installations - legacy bundles have a better tag - sparser labels for Scala isntallations - cleaner, unified names for installs in dialogs - don't modify the existing install in case of refused solution
@@ -144,22 +166,20 @@ class CompilerSettings extends PropertyPage with IWorkbenchPreferencePage with E | |||
|
|||
var useProjectSettingsWidget: Option[UseProjectSettingsWidget] = None | |||
var additionalParamsWidget: AdditionalParametersWidget = _ | |||
var dslWidget: Option[DesiredSourceLevelWidget] = None | |||
var dslWidget: Option[DesiredInstallationWidget] = None | |||
|
|||
def save(): Unit = { | |||
val project = getConcernedProject() | |||
val scalaProject = project flatMap (ScalaPlugin.plugin.asScalaProject(_)) | |||
scalaProject foreach (p => preferenceStore0.removePropertyChangeListener(p.compilerSettingsListener)) | |||
var wasClasspathChanged = new AtomicIntegerArray(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice this in the first part of this PR, but
- this
var
could be aval
, right? - is there no other way than to have an array of bits to encode what happened? I'd prefer to have at least symbolic constants for what each bit stands for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I don't believe it could : https://github.com/scala-ide/scala-ide/pull/731/files#diff-48db6f6626423cb0c8a6a4f96a5aaf3fR250
Incidentally, you'll noticeuseProjectSettingWidget
has been functioning the same way so far. - I can replace this with three
AtomicBoolean
s, but is there a fundamental reason for this or is it mostly cosmetic ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to var wasClasspathChanged
. I believe that one is never reassigned.
My main issue is with using 1
and 2
to refer to flags. I'm surprised I need to justify this, but here it goes: I can easily see myself messing this up next time I update this code. Having these constants have a name would be way more robust, and I believe, standard practice.. :)
Also corrects initialize semantics change in compiler settings upon background change
Also, more informative error markers.
Error markers do not create threading issues, especially since the Property Dialog they create is modal. The Dialogs go away.
Test PASSed. |
@huitseeker, do we need to update the docs/blog? |
@dragos Done since yesterday huitseeker/scala-ide.github.com@6cef1bc |
Scala Installations support stage II : choose your own installation
This is here to help advance review for the second phase of the Scala Installations support
The basic functionality is here, meaning you can choose a scala installation instead of a source level, and add your own scala installation as just a bunch of jars. A few missing items that will be added quickly:
Directory installation tests (@skyluc)Scala Installation switches tests (@huitseeker)Classpath Container edition window should set the initially selected container to the current oneClasspath Container edition should prohibit edition and redirect to compiler settings if both compiler and library containers are on classpathin Compiler Settings, Scala Installation combo field selection should update the Apply button and the dirtiness.A project with differently-versioned libraries ("cross-compiled" case of the classpath check, e.g. sbteclipse) should offer a Scala installation preference change.A project with the wrong scala-library ("previous version" case of the classpath check, currently suggesting-Xsource
) should offer a Scala installation preference changeDetection of a no-longer-valid scala installation (currently falling back to desired source level or platform) should offer a Scala Installation preference change.Change the "Installed Scalas" name on the workspace-wide install page to smoething elseAdapt w.r.t Don’t reuse platform classloader when ScalaInstallation matches its version #733