What causes Eclipse to not show FXML file errors until compilation? - eclipse

After installing e(FX)clipse (an eclipse plugin that deals with JavaFX files) the editor works the same way for all files not relating to JavaFX, as to be expected. However, FXML files (which the plugin should help with creation, reading, and editing) do not show errors from eclipse. While it will run properly if all code is correct, it becomes very tedious very fast having to carefully import each class by hand.
After looking through several threads I've found similar problems crop up, with varied solutions.
I have:
1.Used Project> Clean... several times
2.Removed and replaced the project build path
3.Gone through all validation settings for both Java and XML files
4.Checked Problems panel filters to ensure they weren't being hidden in XML files.
5.Checked for missing JavaFX user library.
6.Checked for Project> Build Automatically turned off.
7.Turned Project> Build Automatically on and off.
Say I have this code:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.ColumnConstraints?>
<GridPane xmlns:fx="http:javafx.com/fxml" alignment="center"
Hgap="10" Vgap="10">
<Button text="Button One" GridPane.rowIndex="0"
GridPane.columnIndex="0"></Button>
<Button text="Button Two" GridPane.rowIndex="0"
GridPane.columnIndex="1"></Button>
<Button text="Button Three" GridPane.rowIndex="1"
GridPane.columnIndex="0"></Button>
<Button text="Really extra long button Four" GridPane.rowIndex="3"
GridPane.columnIndex="0" GridPane.columnSpan="2"></Button>
<Button text="Button Five" GridPane.rowIndex="1"
GridPane.columnIndex="1"></Button>
</GridPane>
This should be, and is, errorless.
But once I change it to this:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets
<?import javafx.scene.ll.Label
<?import javafx.sceext.Font
<?import javafx.gnment="center"
Hgap="10" Vgap="10">
<Button text="Button One" GridPane.rowIndex="0"
GridPane.columnIndex="0"></Button>
<Button text="Button Two" GridPane.rowIndex="0"
GridPane.columnIndex="1"></Button>
<Button text="Button Three" GridPane.rowIndex=
<Button text="Really extra long button Four" GridPane.rowIndex="3"
GridPane.columnIndex="0" GridPane.columnSpan="2"></Button>
<Button text="Button Five" GridPane.rowIndex="1"
GridPane.columnIndex="1"></Button>
</GridPane>
Randomly mutilating it, it stays completely errorless until I attempt to run it. If I mess with the code in a more ordered way (to maximize potential errors) the result is the same.
No errors occur on the side of the code (preferred) or in the problems panel.

Related

Remove Block Programmatically in Magento2

We are able to remove block in Magento1 with unsetBlock() method, but in Magento2 it is not working. So, please help how can remove block in Magento2 programmatically ?
Use unsetElement() method to remove block.
as like
$layout = $this->getLayout();
$block = $layout->getBlock('catalog.topnav'); // block name
$layout->unsetElement('catalog.topnav');
You need to try this way, for example, I am removing compare from the sidebar so I override default.xml to app/design/frontend/Your_Theme/theme_name/Magento_Catalog/layout
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
</body>
To Remove particular block from page, Open your custom layout xml and place the below code under body Tag
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body><referenceBlock name="Your_Block" remove="true"/>
</body>
</page>
Change Your_Block this one to your block name need to be remove
Ideally there are different ways to do this. The best way of doing it is using a layout file.
1) If you have build a module you can create a layout which is an xml file in app/code/Namespace/Your_Module/view/frontend/layout/frontname_controllername_controlleraction.xml and add the below code
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="block_name" remove="true" />
</page>
2) If you have not created a custom module of your's you can simply write a custom xml in app/design/frontend/Custom_Theme/Theme_name/Module_Name/layout and add the below code.
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="block_name" remove="true" />
</page>

action-state not accept evaluate tags Spring Web Flow 2.3

Eclipse marks this error
cvc-complex-type.2.4.a: Invalid content was found starting with element 'action-state'. One of '{"http://www.springframework.org/schema/webflow":on-end, "http://www.springframework.org/schema/webflow":output, "http://www.springframework.org/schema/webflow":exception-handler, "http://www.springframework.org/schema/webflow":bean-import}' is expected.
on this flow code
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
abstract="true">
<global-transitions>
<transition on="logIn" to ="login" />
<transition on="signup" to="signup"/>
<transition on="logOut" to="logout"/>
</global-transitions>
<action-state id="logout">
<evaluate expression="login.logout(currentUser)" />
<transition on="successLogout" to="main" />
<transition on="failLogout" to="error" />
</action-state>
I only find action-state samples and everyone are writting like my code and people use the same XSD. Either, I have read XSD file and on action-state section tag evaluate is missing. Why eclipse marks this error?
Thanks in advance!
I think there has to be an order in which the elements are defined. Try defining the action-state before the global-transitions. If you hover your mouse pointer over the "flow" xml definition in your xml file this info appears (among others):
Content Model : (attribute*, secured?, persistence-context?, var*, input*, on-start?, (action-state | view-state | decision-state | subflow-state | end-state)*, global-transitions?, on-end?, output*, exception-handler*, bean-import*)
So, there is a strict sequence.

Options popup do not appear for the extension

i am building a thunderbird extension and enabled the options popup by adding following to the install.rdf
<em:optionsURL>chrome://content/options.xul</em:optionsURL>
this enables the button but on clicking it nothing happens. the options.xul looks like as below
<?xml version="1.0"?>
<prefwindow id="EmailToOSN-prefs"
title="StockWatcher 2 Options"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="sw2-stock-pane" label="Stock Settings">
<preferences>
<preference id="pref_symbol" name="extensions.stockwatcher2.symbol" type="string"/>
</preferences>
<hbox align="center">
<label control="symbol" value="Stock to watch: "/>
<textbox preference="pref_symbol" id="symbol" maxlength="4"/>
</hbox>
</prefpane>
</prefwindow>
Assuming that you have a folder content where you have placed your code files
(including options.xul)
First you have to declare this "content" folder in your
chrome.manifest file by adding this line:
content extension_name content/
Second in your install.rdf file you must write this:
<em:optionsURL>chrome://extension_name/content/options.xul</em:optionsURL>
Third add this line in your options.xul file inside the prefwindow tab:
<script type="application/x-javascript" src="chrome://extension_name/content/options.js" />
where options.js will be your javascript code you will use for
this options window
Hope I helped...

Word 2007, Open XML - embedding an image

Do you know what basic information MUST include a paragraph (<w:p/>) in document.xml inside a *.docx document, that specifies an image? I do know there must be:
<a:blip r:embed="rId4" />
specifing the relationship id, but what else?
It's very hard to find it in Google and experimenting with cutting out tags from a ready document or reading the specification takes a lot of time.
An example with all the required tags would be greatly appreciated.
Word is rather picky concerning the input XML provided. To embed an image, you have to provide quite some information. Here is a simple example:
document.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:p>
<w:r>
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0">
<wp:extent cx="5943600" cy="3717290"/>
<wp:docPr id="1" name="Picture 0" descr="vlcsnap-325726.png"/>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:nvPicPr>
<pic:cNvPr id="0" name="myImage.png"/>
<pic:cNvPicPr/>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId4"/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</pic:blipFill>
<pic:spPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="5943600" cy="3717290"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>
</w:r>
</w:p>
</w:body>
</w:document>
document.xml.rels
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<!-- other relationships go here -->
<Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.png"/>
</Relationships>
And of course the image must be added to the package at the correct location (media/image1.png)
Since all this is rather complicated I would recommend you to use the OpenXML SDK 2.0 provided by Microsoft or another library, e.g. OpenXML4J. These libraries, especially the one from Microsoft can make your work a lot easier.

Custom tld function validation in eclipse

I am working in eclipse (Ganymede 3.4.1) and have created a ctl TLD :
<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd">
<tlib-version>2.0</tlib-version>
<short-name>Name</short-name>
<function>
<name>readExtendedField</name>
<function-class>uk.newsint.advertising.wsconnection.ConnectionManager</function-class>
<function-signature>
java.lang.String readExtendedField( uk.newsint.advertising.aws.ExtendedFields , java.lang.String )
</function-signature>
</function>
</taglib>
and referenced it in my jsp (excerpts):
<%# taglib uri="/WEB-INF/appUtils.tld" prefix="au"%>
<c:forEach items="${myAdsForm.result.resultList}" var="lin">
<tr>
<td>${au:readExtendedField(lin,"EXTRDATE")}</td>
</tr>
</c:forEach>
Eclipse is giving me an EL Sytax error on the this section${au:readExtendedField(lin,"EXTRDATE")} and assigning it to the first quote and the closing bracket {" and )}.
The expression works fine under tomcat but eclipse warns me when I try to commit to the repository and of course shows errors in the problems tab.
Has anyone else suffered this and does anyone have a fix?
You've probably already found your answer by now, but in case you haven't (and to enlighten anybody else that comes across this page, but your custom tags should be treated as tags, not merely elements inside another tag body. It should be <au:.../>