Open Part From Id In Application.e4xmi - java

I have a part that is defined as "Part Descriptor" in the Application.e4xmi. And I have the following structure under the "Windows and Dialogs" node:
- Trimmed Window
- Controls
- Part Sash Container
- Part Stack
Part - A
- Part - B
I tried adding a Placeholder, but it doesn't let me select anything. I know how to add a part programmatically (even though it's ugly in E4), but I want to do it inside the Application.e4xmi, because that's the right place.
How do I add the part defined in the "Part Descriptor"?

Related

How to redirect user from root node to it's child node in Magnolia CMS

My project is developed using Magnolia 5.3 and Blossom and is using Enterprise Edition - Standard version of magnolia.
I am new for Magnolia and this project.
This project is for different countries and in different languages.
It has the first page for the country and language listing.
For ex. www.localhost:8080 shows this country listing page.
When user clicks on any link of this page, then he is redirected to country home page with chosen language.
For Example:
Country C1 with language L1 has the URL: www.localhost:8080/C1/L1
And this shows the content of country root page i.e. C1
Each country has the same heirarchy in Magnolia CMS
C1 - Root Node of country C1
C1/XYZ1 - Page 1
C1/XYZ2 - Page 2
C2 - Root Node of country C2
C2/XYZ1 - Page 1
C2/XYZ2 - Page 2
and so on.
So if I want to access any root page of country then URL will be:
www.localhost:8080/C1/L1
And If I want to access any child page then URL will be:
www.localhost:8080/C1/L1/XYZ1
This is fine so far.
But now I want to remove or hide the country root page from the user.
So If user manually type www.localhost:8080/C1/L1 then
User should be warn with no page found or
User is redirected to page1 i.e. www.localhost:8080/C1/L1/XYZ1 and show page1 content.
I have tried with setting virtualURIMapping but this do not work.
I also tried to remove C1 page but I can not remove as this is the root page and it is not possible to remove root without it's children.
Please help and guide me, how can I do this?
Thanks,
Manoj
If you are using Enterprise version, all you have to do is configure domain for your site to have it recognized properly and then Magnolia will hide root node automatically from all links.
If you are using Community edition, it's not possible as this feature is only in Enterprise.
However if you instead want to redirect to a subpage of the selected site (as it seems to now after your update of the question), you need to create a virtual URI mapping to do this.
There are many possible ways to create such mapping, one of them would be:
1) in AdminCentral, go to Configuration app and open config:/modules/ui-admincentral/virtualURIMapping\default
2) change class to info.magnolia.multisite.MultiSiteRegexpVirtualURIMapping
3) change fromURI to \$
4) change toUri to redirect:/XYZ1\.html
5) add property site and set it's value to C1 (assuming your site in WebDev/Sites is called C1)
This will work only if you have your domains mapped properly in the site configuration. If you don't get it working on the first try, try to play with it, change the values, double check you have all config correctly. Try to maybe also look in the code of the mapping to make sure you understand how it work. And most importantly, check other VirtualURIMappings you have configured (you can see all in Config Info app).
Additional disclaimer: If you set virtual uri mapping incorrectly (specially since this one is regex based so it is super easy to "expand" it to react on all urls), it is possible to make your instance inaccessible. Make sure when you do this, you do so on your development instance and that you have backup and can go back. Only apply such change on production via importing previously created and tested mapping.
HTH,
Jan

Override eclipse Plugin in Project explorer

In my project the user sees the red cross icon on the file containing an error and the folders above. When the (modelling nature of the sirius) plugin is added to the project the red cross dissapears on the file (not on the folders).
How can i keep the error icon on the file?
I can get information about the content extension which probably causes the problem
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); ProjectExplorer expl = (ProjectExplorer) page.findView(IPageLayout.ID_PROJECT_EXPLORER);
INavigatorContentService content = expl.getNavigatorContentService();
INavigatorContentExtension siriusext = content.getContentExtensionById("org.eclipse.sirius.ui.resource.content.session");
siriusext.getDescriptor().getAppearsBeforeId();
The problem is probably the sirius INavigatorContentService because it is set to appear before id "org.eclipse.jdt.java.ui.javaContent"
(siriusext.getDescriptor().getAppearsBeforeId())
How can i (have the modelling nature and) keep the error icon on the file?
Any help is appreciated!
I answered your question on the Sirius forum [1].
The problem seems to come from the getImage() implementation in the label provider used by the INavigatorExtension provided by Sirius.
A workaround could be to try to provide your own navigator content with an Override element targeting the Sirius Content Management (org.eclipse.sirius.ui.resource.content.session) as suppressed extension and provide your own label provider (which could extend the Sirius one and specifically handle the file case in getImage, but you might loose the M decorator on files handled by Sirius).
Could you open a bugzilla [2] to track the issue ? Then the team will have the possibility to analyze the issue and try to find a proper solution.
Regards,
Maxime
[1] https://www.eclipse.org/forums/index.php?t=msg&th=877968&goto=1498330&#msg_1498330
[2] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=sirius

Text duplication

I am working on simple text editor and on main panel, I have JList with currently opened files (CDocument class) and active document, which contents is shown (also CDocument class). I store opened files (CDocument objects) in vector and on the right side the active document is shown.
Now, at program start, there is no active document and opened document list is empty. After I click File->New, I create new, empty object from class CDocument. If I enter something into active document area (the red region on screenshot) and then I reclick File->New, I get new, empty (with no text - I've doublechecked with ) CDocument object. But, the text from previous active document still shows into newly created (red region - newly empty CDocument). I am busting my brain here because I do not know why?! Here is File->New code chunck:
`
if(e.getSource()==this.menuItemFileNew())
{
CDocument currentDocument=new CDocument();
if(this.panelMain().documentActive()!=null)
{
this.panelMain().remove(this.panelMain().documentActive());
}
this.panelMain().openedDocuments().add(currentDocument);
this.panelMain().setDocumentActive(currentDocument);
this.panelMain().add(panelMain().documentActive().pane(),
BorderLayout.CENTER);
this.panelMain().documentActive().addKeyListener(this);
this.panelMain().documentActive().requestFocus();
this.menuItemFileSave().setEnabled(true);
this.menuItemFileSaveAs().setEnabled(true);
this.menuItemFileClose().setEnabled(true);
this.menuItemFileCloseAll().setEnabled(true);
this.toolBarFileSwitcher().panelActiveDocumentInfo().
panelFileSizeInfo().updatePanel(this.panelMain().documentActive().getText().length(),
false);
this.toolBarFileSwitcher().listOpenedFiles().model().addElement(currentDocument.filename());
this.toolBarFileSwitcher().listOpenedFiles().setSelectedIndex(this.toolBarFileSwitcher().listOpenedFiles().model().size()-1);
this.toolBarFileSwitcher().setVisible(true);
}
`
Why is text shown, I've tried updateUI, repaint, nothing works!
Use Action to encapsulate functionality related to your CDocument data type. This will help ensure that all invocations are consistent. This example manages images, while this example illustrates a menu of files.

How to add navigation to a custom Magnolia CMS template?

I've managed to create a custom page template for Magnolia CMS pretty easily following this tutorial:
http://documentation.magnolia-cms.com/templates/introduction.html
However, I'm at the point where I'd like to insert the navigation into my template but I can't find a simple way to do so. It looks like other's have had this problem with no clear way to fix it. Does anyone know how to easily include the navigation? Thanks
If you're using Magnolia CE (Community Edition) 4.5.x, you need to know that basically every page template extends the one defined in /modules/standard-templating-kit/config/site/templates/prototype. There you have a node, /navigation. You can copy that node to your new custom template, and after that you can start playing with it's properties.
But before that, don't forget to include the navigation menu(s) somewhere in your main template file (.ftl) and make your template to use stk model class info.magnolia.module.templatingkit.templates.pages.STKPageModel (add an attribute to your template named modelClass, look at stkArticle (or stkSection), it's a good place to start)
Horizontal navigation:
[#if def.navigation.top]
[#include def.navigation.horizontal.template]
[/#if]
Vertical nav:
[#if def.navigation.top]
[#include def.navigation.vertical.template]
[/#if]
If you want to include your menu in another template included with a [#cms.area ...] tag,
you can use this code:
[#if model.root.def.navigation.top]
[#include model.root.def.navigation.vertical.template]
[/#if]

How to do custom Binding on JAVA (Netbeans IDE)

I want to find out how to do custom binding on java, I've searching on google but not found any.
It's simple problem,
I have two jSpinner, jSpin1 and jSpin2.
jSpin2 value is half from jSpin1.
when I do binding, there is
Binding source : jSpin1
Binding expression : ${value}
so the value in jSpin2 exactly the same with jSpin1. then how could I make its value half from jSpin1?
thank you.
As I Understand you use NetBeans GUI Builder. You can do it by the next steps:
- do right click on jSpin2 (in design view) and select ‘Properties’
- select ‘Binding’ at the top of dialog
- click on ‘...’ button on ‘value’ property
- select ‘jSpin1’ from ‘Binding Source’
- select ‘value’ from ‘Binding Expression’
- edit ‘Binding Expression’ to ‘${value/2}’
(Also you can put ‘jSpin1[${value/2}]’ in ‘value’ property)

Categories