Use hyperlink for tree objects - eclipse-rcp

Can i use hyperlink to my treeobject. I have four nodes in my tree. i want each each node to be hyperlinked. Is this possible in Eclipse Rcp? Help is needed. Sample code will be useful. I have used the rcp mail Template.

You can make your custom tree node and store the link as a data object in the tree node. Then add a selection listener to the tree. When any of the tree node is selected you will get an event from which you can extract the data object and use the information to open a new view or anything elese that you want to do.

Related

Including list view of relationship entity on update page

I am trying to extend an update view to include a list view of some related items below the edit form.
I have two models, Publishers and Volumes, which have a many to many relationship. What I am trying to do is this.... when a user clicks on the edit button for a publisher, I want them to go to a page with the standard edit fields, but also have a list view below the form that lists all of the volumes that are connected to that publisher via their relationship.
Is there an easy way to do this?
I hope this makes sense.
As #tabacitu mentioned, Backpack doesn't currently have an built in solution for this. That said, this could maybe work for you:
This would allow you to use all functionality of the nested list view including interacting with the entities without conflicting at all with the parent
Step 1, Build your normal CRUDs
Build out two normal CRUDs, one for Publishers, and one for Volumes
Step 2, Make a frameless layout
copy vendor/backpack/base/layout.blade.php
name it frameless-layout.blade.php
remove #include('backpack::inc.main_header') and #include('backpack::inc.sidebar')
Step 3, Make a custom list view
copy vendor/backpack/crud/list.blade.php
name it sub-list.blade.php
change the top line to #extends('backpack::frameless-layout')
Step 4, Make a custom field
Create a custom form field that contains an iFrame
Inside your custom field template, have it set the url of the iFrame to the "list" url of the related resource
You'd also need to utilize List Filters and a method for setting them dynamically so that the sub-list shows only the records related to the parent
Step 5, Configure and use the field
In your crud controllers, use the addField to add the the configuration for the new field and its related model
Indeed, there's no standard functionality to do that in Backpack. It's a pretty unusual way to do things. But it's not too difficult to achieve it.
If there aren't too many Vendors for one Publisher (as I expect it's the case here), I would keep it simple and NOT try to include the entire Backpack list view (with ajax, buttons, filters, etc) on top of the form. I would add a standard HTML table with the entries (and optionally buttons to Edit Vendor with target=_blank).
Here's how I would go about it:
In the Publisher CRUD, I would use a custom view for the Edit operation; you can do that using $this->crud->setEditView('edit_publisher_with_vendors') in your setup() method;
In that custom edit view (edit_publisher_with_vendors.blade.php in my example), I would copy-paste everything inside the edit.blade.php view that Backpack/CRUD is using, and add a table with the Vendors on top of the Edit form; notice you have the current entry as $entry in this view; since there's a relationship on the model, you would be able to check if it has vendors using $entry->vendors()->count(), and get the vendors using $entry->vendors.
Hope it helps.

How to add an Eclipse CompareEditor inside a View?

How can I open an Eclipse CompareEditor inside a View?
More specifically, I want the view to contain a SashForm. In the left sash I put some information about the commit, and in the right sash I want to put a compare editor that compares the commit to its parent. Is there such a thing even possible?
I've succeeded in using a GitCompareEditorInput from eGit and the CompareUI class to open a separate compare editor or a dialog with the compare editor (that compares a certain commit to its parent). But now I am interested in putting that compare editor inside another view, as detailed above.
Thanks
Update:
I have tried CompareEditorInput.createContents(compositeParent) but I only get two empty rectangles.
The key to hosting a CompareEditorInput class appears to be providing a class which implements org.eclipse.compare.ICompareContainer. Once you have this you connect it to the input using CompareEditorInput.setContainer(container).
org.eclipse.compare.internal.CompareContainer provides a partial implementation of the container but this is internal so should only be used as a guide rather than used directly.

How do we define global properties in CQ5

My Requirement is to have a global header and footer with author able properties.
So if we update the properties on one page it should be reflected across all pages.
What is the best approach to achieve this in CQ5.
ACS AEM Commons now supports this functionality without use of an iparsys - Shared Component Properties (http://adobe-consulting-services.github.io/acs-aem-commons/features/shared-component-properties.html)
Configure your menu with Shared and/or Global properties and you can simply template it directly onto all of your pages (no iparsys required). You can then edit the header/footer from any page on the site and it will by updated on all pages.
Unlike using design dialogs, Shared Component Properties supports standard content activation and internationalization (values stored below the homepage) and anything else you would expect from content.
If all of your pages site under a hierarchy, you could use an Inherited Paragraph System (iparsys). This is from an old version of the documentation, but is still a good intro:
The inherited paragraph system is a paragraph system that also allows
you to inherit the created paragraphs from the parent. You add
paragraphs to iparsys at for example, /content/geometrixx/en/products
and as result, all the subpages of products that also have iparsys
with the same name inherit the created paragraphs from the parent. On
each level, you can add more paragraphs, which are then inherited by
the children pages. You can also cancel paragraph inheritance at a
level at any time.
While not quite what you're describing in the original post (edit anywhere) it will allow you to edit the content once (at the parent page) and inherit the changes everywhere.
Traditionally you could create the components and swap the dialogs out for design dialogs. Basically you would rename your component dialog to design_dialog.
What this will do is save the changes you make to this object to a design path under etc. You can set a design path for site by going to the top level parent and setting a designPath property.
So node structure might look something like
parentNode
- #prop designPath = "designs/myapplication"
childNode1
childNode2
etc...
Any component using a design_dialog on the parentNode or its children nodes will get their information from the designPath. If you do not set a design path, the infomration is saved under etc/designs/default (or defaults, not sure, going off the top of my head).
There are some alternatives to this:
What our team did was in our siteHeader component we use http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/commons/inherit/InheritanceValueMap.html (inheritancevalue map) instead of the regular value map. The inherited value map will traverse the tree up looking for items from it's parents. This is a great source for learning how to use valuemap instead of just the default properties object:
http://experiencedelivers.adobe.com/cemblog/en/experiencedelivers/2013/02/valuemap-and-his-friend.html
This does get complicated with larger sites, and you'll have to do a lot of customization to get the system working the way you want, but it's an option if you don't want to have to manually set designPaths for every new site your authors create.
Alternatively, if you do like the idea of using designPaths and design_dialogs, you can always hook into the page creation workflow and have the page component add a designPath property on creation (this is a lot easier said than done though).
hope that helps

How can I only display projects inside a treeviewer eclipse plugin?

I am making a tree viewer in Eclipse which would be used to pick a project and then I would find out the location of the project and zip it up.
I can currently display a tree which shows all the projects but it also allows you to expand the tree.
I am doing this in a wizard so I am unable to any dialogs.
I think I would need a filter but after using Google for a while I was unable to figure out how I could do this.
This is how I am currently making the viewer.
TreeViewer view = new TreeViewer(composite,new WorkbenchLabelProvider(),new BaseWorkbenchContentProvider());
view.setInput(ResourcesPlugin.getWorkspace().getRoot());
It's showing you exactly what that content provider is written to show.
The short answer is to setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects()) and use the ArrayContentProvider with a ListViewer rather than the TableViewer.
The long answer is that the content provider you were using returns both the top level elements for the tree control using getElements() and any resource's children via getChildren(), and your case is not interested in the results of getChildren().
Projects are never nested so you only really need a TableViewer to show them. You can get the list of projects using:
IProject [] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
The same label provider will work.

is it possible for a node to extend/inherit jcr content node (properties and child nodes)

I need to add a new menu item to siteadmin under create->menu of /libs/wcm/core/content/siteadmin. Now, one way to do that might be to make a complete copy under apps/<my-app>/wcm/core/content/siteadmin which works fine. But, I would like to NOT do a deep/complete copy of siteadmin instead have my app/<my-app>/wcm/core/content/customsiteadmin extend the lib's siteadmin and be able to add the additional node that i require.
Can somebody tell me what node type/properties that I require on my customsiteadmin node to achieve the same?
PS: I have tried using sling:resourceSuperType=/libs/wcm/core/content/siteadmin to the customsideadmin node which doesn't work. I guess the sling:resourceSuperType is only for overriding script resolution? but the node that I'm trying to override is a like a content node
You can overlay individual files in /apps to override functionality of the files in /libs. The Adobe documentation has an example for foundation components, but this works for other CQ/AEM functionality as well. Even though the documentation instructs you to copy the entire component, you just need to have the modified file(s) under /apps.