Adding a list to a PreferencePage - preferences

Update:
So far I found class ListEditor which provides the functionality I'm searching for except the 'edit' button and only for one column.
The 'Proxy bypass' Page extends directly from PreferencePage. So there is no proper Base Class I could use.
--
The standard PDE way of adding Preference is to use field editors (for Boolean, String, Integer..) and subclass FieldEditorPreferencePage.
I'd like to integrate a list similar to the 'Network Connections' List in Preferences.
Network Connections Preferences http://img13.imageshack.us/img13/4489/screencapturegw.png
Is there a Standard List Class with Add/Edit/Remove Button I could use or is extending the PreferencePage and do all loading/saving manually the way to go?
the m2Eclipse Plugin also has a List m2Eclipse http://img695.imageshack.us/img695/1972/screencapture1.png
it uses TemplatePreferencePage, which has too much functionality

I remember looking for something similar to edit a list of classpaths and did not find it. JDT had something but it was too much for what I needed. I think you have to do it on your own. If you do something generic, you could file an enhancement request to platform UI at Eclipse and contribute it. Doing it on my own was not too much work.

My conclusion is there is no proper Base Class I could use.
However the Proxy Bypass Page is an example how to implement such a feature, it extends directly from PreferencePage

Related

Liferay 7.2 Customize Documents And Media Porlet

I have Liferay 7.2
I want to customize the html of the layout of the widget Documents AND Media
I tried to create a hook to document and media but it seems that is not the right way.
How can i do that?
First, the fact that you're talking about a hook tells me that you're coming from Liferay 6 or earlier. Forget the old module types ("war-style modules"), embrace the new "jar-style modules" or "OSGi modules", which leverage the OSGi methods and mechanisms in the foundation. The new module type that comes closest to the functionality of hooks would be a "module fragment".
Alternatively, if you want to create one module that overrides the JSPs of more than one other module (or overrides JSPs as a side effect to its main purpose), you may want to look into "JSP Bags".
Still, both methods are discouraged and should be taken as a last resort, according to Liferay's "Introduction to Customizing JSPs".
The preferred method would be to use Dynamic Includes (albeit they only work if the target portlet has been written to include inclusion points) or Portlet Filters (which basically allow you to programmatically edit the request to and response from the standard Portlet classes and JSPs).
Still, if you're aiming to replace most of the JSPs of the standard document and media widget (keep in mind: Widgets are still Portlets, they just have been renamed in the frontend), a module fragment still seems to the best way forward.
To identify the correct module, here are the necessary steps. I'll show it using the DLAdmin portlet from the control panel as an example:
Identify the portlet you want to edit: Look into the HTML using the DOM inspector of your browser. Look for section tags with IDs like <section class="portlet" id="portlet_com_liferay_document_library_web_portlet_DLAdminPortlet"> around the area of interest.
Now translate that ID into a package path with portlet class: com.liferay.document.library.web.portlet.DLAdminPortlet. Search for that class in the Liferay github repository. (Go there, press T, enter the class name, find its Java class source file. In case of multiple hits, you need to check the package path, too.)
Once you opened the source file, go back up in the file tree to the parent folder of the src folder. There's a bnd.bnd file. Take a look into it, it will tell you the Bundle-SymbolicName.
Use the Liferay IDE or Blade CLI (depending on your development environment) to create a module fragment for the module identified by the Bundle-SymbolicName.

Missing captioned images feature in TinyMCE and Plone5

I'm missing the function to enable captioned images in TinyMCE/Plone5. It was possible to enable that in the control panel with Plone4 (https://plone.org/documentation/manual/plone-4-user-manual/using-tinymce-as-visual-editor/images).
Now I'm using the new Plone5rc3 with TinyMCE 1.4.3, but the properties of TinyMCE in the control panel don't have the needed checkbox.
Does anybody know how to get that?
Thanks a lot!
So here's an answer in parts: you need several things for the captions to work:
Your <img> tags need to have the class captioned. I still need to find a good way to do that. The image picker will remove all other classes everytime you open it, so I guess a good way would be to change the classes that are added by the inline/left/right selection, but I've not easily found where those are defined.
You need the output filter, but fortunately, that is still there. However, the filter wants to see an IImageCaptioningEnabler, which is essentially a flag to turn the captioning mechanism on, and the old editors used to have that and currently, nothing in standard Plone does provide such a beast. If you're comfortable with add-on development, the class you want is
from plone.outputfilters.filters.resolveuid_and_caption import IImageCaptioningEnabler
from zope.interface import implements
class CaptioningAlwaysEnabled(object):
implements(IImageCaptioningEnabler)
available = True
with corresponding configure.zcml stanza
<utility factory=".resolveuid_and_caption.CaptioningAlwaysEnabled"
name="plone5-captions-always-enabled"
zcml:condition="have plone-5" />
(you can tell I patched buildout-cache/plone.outputfilters-2.1-py2.7.egg/plone/outputfilters/filters/configure.zcml and resolveuid_and_caption.py to include that, but of course, you shouldn't do that.)
If you're not comfortable with add-on development, you could, bizarrely enough, see if another editor provides that global switch, you don't need to have it set as your editor or the default editor. (Products.kupu would, but it doesn't install in 5.0. collective.ckeditor might, I can't try that right now due to missing dependencies.)
So, summary: no, you can't easily turn it on; you can turn it on with a bit of hacking; and if you file it as a feature request, it's the kind of thing that takes about fifteen minutes to fix for somebody who knows their way around the code.

How to find resources with label decorator's value in eclipse

I am working on an eclipse plugin in which I have used decorators to decorate my resources with different text as a prefix. Now I want to search these resources with the text which I have used while decorating the resources.
What I exactly want is to extend eclipse's open resource dialogue so that I can enter the text which I have used to decorate resources to find them.
So how could I achieve this...
Many thanks..
The Open Resource dialog is not really customizable.
The dialog class is org.eclipse.ui.internal.ide.dialogs.OpenResourceDialog. This extends FilteredResourcesSelectionDialog which contains most of the label providers and the like which you would have to change. However this class is not designed to be modified and would be hard to change.
FilteredResourcesSelectionDialog in turn is derived from FilteredItemsSelectionDialog which can be extended more easily, but you would have to duplicate a lot of code from OpenResourceDialog and FilteredResourcesSelectionDialog.

Papyrus: Hide/remove base_Class property from stereotypes

Is there a way to hide or remove the various base_Class properties that appear together with the properties defined for a stereotype? I am close to deploy a profile and I am pretty sure this will generate some confusion among the users.
Actually you really don't want to remove the 'base_*' properties as these indicate the meta class that your stereotypes extend. When a user goes to apply your profile, the meta class extension allows the UML editor e.g. Papyrus to display appropriate stereotypes for the target UML element. So if a user wants to apply your profile to a UML Class element, without the 'base_Class' property, nothing will show up. These extensions are linked to other elements within your profile so just removing them will cause your profile to "break" elsewhere. Other typical meta class extensions might be Property i.e. a 'base_Property' will show up. There are many others.
Oh ok cool. So when your users apply the profile to a model this takes place, as you know, primarily under the Profile->Applied stereotypes area of the Properties editor. The meta class extension properties are definitely not visible there, at least on my Papyrus version. Using Modeling Luna 4.4.0

How to combine Eclipse Databinding and UndoableOperations?

in my RCP - Project i'm using eclipse databinding to connect the ui with the backend. I want every change in an open editor to be undoable. My Domainmodell and UI are seperated in two different plugins.
My current approach is to implement my own UpdateValueStrategy class for the databinding. I extend the normal UpdateValueStrategy and override the doSet Methode.
From there i get the OperationHistory and the Global UndoContext, then i create a new Operation. I have various Operations like "ChangeCustomerName" and "ChangeCustomerNote".
Questions:
Do i need to implement the undo/redo - logic by my own, or is the framework somehow supporting my with this?
Is there a better place or way to create the undoable Operation then the doSet() of the UpdateValue - Strategy class. To access the textfield, which was changed is not to easy.
The answer you will get mostly is: Use EMF.Edit, it includes it out of the box with org.eclipse.emf.databinding.edit and there's an excellent tutorial on the net.
There is an open feature request in the Eclipse bugtracker about including undo/redo also in JFace databinding without EMF but it's not finished yet. It has also be discussed in the eclipse forum.