angelozerr / eclipse-wtp-webresources Goto Github PK
View Code? Open in Web Editor NEWProvides completion, hyperlink, hover inside WTP HTML editor for Web Resources (CSS, JS, Images)
License: Eclipse Public License 1.0
Provides completion, hyperlink, hover inside WTP HTML editor for Web Resources (CSS, JS, Images)
License: Eclipse Public License 1.0
Eclipse WTP Web Resources is mature and works well. It could be improved again, but I have decided to give up this project since @mickaelistria is moving step by step features of WTP WebResources inside the WTP HTML plugins. See:
Thank's @mickaelistria!
In my use-case, portlets, we have css files that are not imported in a html/jsp via s but instead of included by the portal container on the portlets behalf. I'd like the ability to extend the traversing class with an extension point so that when a user is in a portlet jsp file in a liferay project, and has css files that will be included by the portal (in a liferay-portlet.xml file) then my plugin could automatically add those files to be traversed.
It would be awesome if this plugin supports also CSS ids.
I updated the Eclipse JEE Package this morning. Since I have regular exception in the console log. I thought that it was an Eclipse Exception but it's link to this plugin. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=457537
Content of my eclipse bug :
Since the update I performed this morning, I have some exceptions in the Error console when I edit some html file or when I move the editor to split my screen in 2 distinct editors.
java.lang.NullPointerException
at org.eclipse.wst.html.webresources.core.utils.DOMHelper.getAttrByOffset(DOMHelper.java:316)
at org.eclipse.wst.html.webresources.core.utils.DOMHelper.getAttrByOffset(DOMHelper.java:308)
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validateCSS(WebResourcesValidator.java:408)
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validate(WebResourcesValidator.java:385)
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validateRegions(WebResourcesValidator.java:360)
at org.eclipse.wst.html.webresources.ui.validation.WebResourcesSourceValidator.validate(WebResourcesSourceValidator.java:88)
at org.eclipse.wst.sse.ui.internal.reconcile.validator.ReconcileStepForValidator.validate(ReconcileStepForValidator.java:381)
at org.eclipse.wst.sse.ui.internal.reconcile.validator.ReconcileStepForValidator.reconcileModel(ReconcileStepForValidator.java:259)
at org.eclipse.jface.text.reconciler.AbstractReconcileStep.reconcile(AbstractReconcileStep.java:95)
at org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorStrategy.reconcile(ValidatorStrategy.java:269)
at org.eclipse.wst.sse.ui.internal.reconcile.DocumentRegionProcessor.process(DocumentRegionProcessor.java:321)
at org.eclipse.wst.sse.ui.internal.reconcile.StructuredRegionProcessor.process(StructuredRegionProcessor.java:258)
at org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor$BackgroundThread.run(DirtyRegionProcessor.java:691)
Seeing image preview on hover is super.
there are ./ (relative) links like <img src="./img/eclipse48.png" alt="Enide Studio">
I noticed that for them there were no preview.
Also in _includes
there are / (absolute) links like <img alt="Enide 2015 for Windows x64" src="/img/enide-studio/icon-windows.png" />win64</a>
They were shown as error, until I checked wiki and found there's web-root-folder preference
Possibly it may make sense to add hyperlink to project properties from error message
e.g.
"Undefined Image file ("/img/enide-studio/icon-windows.png").
configure project web resources properties"
The plugin name says "Eclipse AngularJS UI" - looks like a copy-paste mistake.
See here
If a element is found it will set "hasExternal" to true and it will never consult the style from the project and it wont call extenders that pull in bootstrap css resources.
Like stated in http://stackoverflow.com/q/33502089/1814576, AngularJS directives and CSS classes are only resolved in the main HTML file.
In Angular templates, validation of directives and CSS fails, because of their "snippet" nature (the source files are not linked).
As most of the HTML is not specified in the main file but in templates, it would be very helpful if validation worked there. Maybe a first approach would be to provide the possibility to link templates with CSS files and angular modules in project preferences?
In the following HTML fragment the class valued is marked with an "Undefined CSS class" warning:
<span class="<?=$class_name?>">Text</span>
This is not very helpful, because the validator does not actually evaluate the PHP code. Therefore, it's better to skip the validation for values with PHP code inside.
Unable to disable validation with Validation preference page. For example such snippet:
<html><body>
<div class="someclass"></div>
</body></html>
will produce "Undefined CSS class" warning. There is no way to disable it because even if "Web Resources Validator" will be disabled (manual and build) warning message is still visible.
java.lang.ClassCastException: org.eclipse.wst.html.core.internal.document.ElementStyleImpl cannot be cast to org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validateCSS(WebResourcesValidator.java:409)
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validate(WebResourcesValidator.java:383)
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validateRegions(WebResourcesValidator.java:363)
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validate(WebResourcesValidator.java:97)
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validateFile(WebResourcesValidator.java:225)
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validateDelta(WebResourcesValidator.java:160)
at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validate(WebResourcesValidator.java:123)
at org.eclipse.wst.sse.ui.internal.reconcile.validator.ReconcileStepForValidator.validate(ReconcileStepForValidator.java:303)
at org.eclipse.wst.sse.ui.internal.reconcile.validator.ReconcileStepForValidator.reconcileModel(ReconcileStepForValidator.java:262)
at org.eclipse.jface.text.reconciler.AbstractReconcileStep.reconcile(AbstractReconcileStep.java:95)
at org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorStrategy.reconcile(ValidatorStrategy.java:269)
at org.eclipse.wst.sse.ui.internal.reconcile.DocumentRegionProcessor.process(DocumentRegionProcessor.java:321)
at org.eclipse.wst.sse.ui.internal.reconcile.StructuredRegionProcessor.process(StructuredRegionProcessor.java:258)
at org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor$BackgroundThread.run(DirtyRegionProcessor.java:691)
For example following my question from SO Undefined CSS/JavaScript/Image file in Eclipse it will be great if I could exclude some resources from validation path like for example described here: How do I remove javascript validation from my eclipse project?
While this is not yet Eclipse.org project can we reference it by EWW ?
Hello,
When trying to load a file without specify the protocol the editor shows this error (in the title):
for example:
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js"></script>
or
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
adding https or http solve this, but is should work without it,
Thanks a lot,
Ghassan
In alloyui jsp taglibs all css classes are added via the cssClass attribute like
<aui:button cssClass="btn-primary" ... />
It would be good if the webresources plugin had an extension point to allow adopters to add additional attributes that can activate the completion.
Data URI schemes are described here: http://en.wikipedia.org/wiki/Data_URI_scheme
The following html fragment is a valid representation of a "red dot" image:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
But EWW marks it with "Undefined Image file" error.
link/@href, script/@src, img/@src can use dynamic path (path can be a Freemarker, JSP expression). For instance for JSP Liferay page :
Today we ignore validation when <% it is found. See #14
It should be cool if we can provide a mean to resolve the dynamic path. My idea is to provide an URIResolver extension point to add custom https://github.com/angelozerr/eclipse-wtp-webresources/blob/master/org.eclipse.a.wst.html.webresources.core/src/org/eclipse/wst/html/webresources/core/providers/IURIResolver.java Today only https://github.com/angelozerr/eclipse-wtp-webresources/blob/master/org.eclipse.a.wst.html.webresources.core/src/org/eclipse/wst/html/webresources/core/providers/DefaultURIResolver.java is available
@gamerson what do you think about this idea?
Steps to reproduce:
<html>
<head>
<title>Title</title>
<link rel="stylesheet" type="text/css" href="/styles/temp.css" />
</head>
<body>
<div>
<a class="color" href="/">Link</a>
</div>
</body>
</html>
.color {
color: #ff0000;
}
Result:
QuickFix to create empty JS, CSS when not exists
The plugin cause eclipse freeze or being really slow when editing html files.
The memory usage is unstable when eclipse became slowly
java.lang.NullPointerException
at org.eclipse.wst.html.webresources.internal.core.WebResourcesFileManager.updateResource(WebResourcesFileManager.java:103)
at org.eclipse.wst.html.webresources.internal.core.WebResourcesFileManager.visit(WebResourcesFileManager.java:84)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:69)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:80)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:80)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:80)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:80)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:80)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:80)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:49)
at org.eclipse.wst.html.webresources.internal.core.WebResourcesFileManager.resourceChanged(WebResourcesFileManager.java:56)
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285)
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149)
at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:378)
at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1498)
at org.eclipse.core.internal.resources.Project.open(Project.java:1167)
at org.eclipse.core.internal.resources.Project.open(Project.java:1178)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.create(ProjectConfigurationManager.java:926)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$1.call(ProjectConfigurationManager.java:150)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$1.call(ProjectConfigurationManager.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166)
When project is closed log file is polluted with the same stacktrace. I'm not sure when this happens because this example is from our customer log (10x1mb log files just with this exception during same day). If you need more details, let me know.
!ENTRY org.eclipse.a.wst.html.webresources.core 4 0 2015-01-05 10:30:58.305
!MESSAGE Error while updating web resources project configuration
!STACK 1
org.eclipse.core.internal.resources.ResourceException: Resource '/GeschenkeDe' is not open.
at org.eclipse.core.internal.resources.Project.checkAccessible(Project.java:150)
at org.eclipse.core.internal.resources.Resource.checkAccessibleAndLocal(Resource.java:221)
at org.eclipse.core.internal.resources.Resource.getSessionProperty(Resource.java:1274)
at org.eclipse.wst.html.webresources.internal.core.WebResourcesProjectConfiguration.getConfiguration(WebResourcesProjectConfiguration.java:53)
at org.eclipse.wst.html.webresources.internal.core.WebResourcesProjectConfiguration.getOrCreateConfiguration(WebResourcesProjectConfiguration.java:58)
at org.eclipse.wst.html.webresources.internal.core.search.WebResourcesIndexManager.performAction(WebResourcesIndexManager.java:74)
at org.eclipse.wst.sse.core.indexing.AbstractIndexManager$1.run(AbstractIndexManager.java:1528)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.wst.sse.core.indexing.AbstractIndexManager$ResourceEventProcessingJob.run(AbstractIndexManager.java:1526)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Support for GitHub pages templates, Jekyll https://jekyllrb.com/
GitHub pages are actually run by Jekyll https://jekyllrb.com/
Jekill has templates pur into _layout
folder, e.g. https://github.com/red-flag/red-flag.github.io/tree/master/_layouts
/stylesheets/stylesheet.css
Simplest example at https://github.com/red-flag/red-flag.github.io
Consider the following project structure:
+ project
+ public
+ img
- myimage.png
+ deep
+ deep
+ deep
- template.phtml
The template.phtml file is not directly accessible, but via inclusion in another PHP/HTML resource. Therefore any relative paths does not really follow the project tree hierarchy and are marked as validation errors, e.g. <img src="/img/myimage.png" />
will be marked as error.
This situation can be improved by marking a folder in the project (i.e. "public" in the above case) as the web root folder. I am thinking about providing a project property for this. The user can right-click on the project, choose properties, then go to the Web Resources node and browse a folder to specify as Web Root. Then the validator should consider the value of this property.
Is such improvement acceptable? Any other suggestions to resolve the above case?
Consider the following snippet:
<img src="<?php echo $picture_path ?>">
In this case the src value is marked as error by the validator. This is not useful and actually annoying for users. Since the output of the PHP script cannot be determined during design time, it would be better to skip the validation when we have embedded PHP script in the src value.
In the following sample code:
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
<style>
.myclass {
color: green;
}
</style>
</head>
<body>
<p class="myclass"></p>
</body>
</html>
If I Ctrl+click on the "myclass" class name inside of the paragraph tag, I would expect that the cursor jumps to the .myclass definition in the page's head.
Currently this does not happen for classes defined in embedded CSS. It works correctly for classes defined in external CSS files.
Provide UI preferences to set folders which host web resources
Display Image when img/@src is hovered and for completion too
When I use autocomplete an class attribute I see too much proposals. For example, when I use twitter bootstrap, and I want to use "control-label" class, I didn't see in autocomplete because there are 15 proposals for "container" and 11 for "container-fluid".
In fact if you count all different names, there are only 3 proposals for the string "cont".
These all proposals are in bootstrap.css file. See the next picture to illustrate this issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.