Eclipse JFace FieldEditor for Dates? - java

I'm building a preferences editor for my Eclipse RCP application using the existing IWorkbenchPreferencePage framework (see http://www.eclipse.org/articles/Article-Field-Editors/field_editors.html for a good tutorial).
It has editors for a number of different types of data:
BooleanFieldEditor
IntegerFieldEditor
StringFieldEditor
RadioGroupFieldEditor
ColorFieldEditor
FontFieldEditor
DirectoryFieldEditor
FileFieldEditor
PathEditor
However, one thing which doesn't seem to exist is a nice DateFieldEditor (ideally with a button to bring up a calendar to allow choosing of a particular date).
So my question is, does such a org.eclipse.jface.preference.FieldEditor subclass exist, either in standard JFace or in a 3rd party plugin or project?
Alternatively, even a SWT calendar component would be useful, because I could build the rest on top of that pretty easily.

JFace doesn't have such a FieldEditor. But there is an official feature request for a DateFieldEditor that even has a basic implementation attached to it. At the very least you could use that as a template to create your own field editor, if it doesn't work for you as is.

Related

How to implement repsonsive design in Eclipse RAP?

The Eclipse RAP (Remote Application Platform) project provides a way to write web applications using SWT.
Due to single sourcing, the written code can also be used in desktop SWT/RCP applications.
Since it is a framework for web applications I was wondering if it supports responsive design?
If so, a simple example would be great. It does not need to be RCP compatible.
I didn't find a lot on the internet, has there been any efforts towards supporting responsive design?
Due to the fact that RAP shields you from web technology, native CSS and other web-techniques won't work.
To summarize the comments, you will likely have to implement one or more custom layouts that adapt to the available space and show/hide/resize the managed controls accordingly.
You may also want to use custom controls or manipulate existing controls to adapt to the available space. in some places. For example, hide texts on toolbar buttons when space becomes rare.
RAP theming can also be leveraged to a certain extent in order to change the appearance and space of certain controls.
Further reading:
EclipseCon 2014 talk: https://www.eclipsecon.org/na2014/sites/default/files/slides/Responsive%20Applications%20Tutorial%20-%20EclipseCon%202014.pdf
A blog post with code examples about responsive UIs with SWT: http://www.codeaffine.com/2014/02/24/responsive-uis-with-eclipse-and-swt/
RAP Theming: https://eclipse.org/rap/developers-guide/devguide.php?topic=theming.html
Understanding SWT Layouts: https://www.eclipse.org/articles/article.php?file=Article-Understanding-Layouts/index.html (ignore the deprecation warning, the core concepts haven't changed since)
You can make it responsive with the use of Passe-Partout created by Tabris. This works in RAP and should be compatible with RCP.
They have made a custom layout : FluidGridLayout.
It's best you use it through the factory class com.eclipsesource.tabris.passepartout.PassePartout.
Source can be found on github:
https://github.com/eclipsesource/tabris/tree/master/com.eclipsesource.tabris.passepartout
Add this plugin to your dependency or just copy the source in your project.
See the blogpost at eclipsesource for basic info:
https://eclipsesource.com/products/tabris/eclipse-rap-documentation/responsive-design/
The great thing about it, is that you program it all in java.
Only issue that I now experience is with scrolling.
In my case I have a workbench and my editorpart needs a scrolledcomposite, only set to V_SCROLL. I've added two resize listeners to set the new minsize of the scrolledcomposite.
One resize listener on the display when the entire browser resizes.
A second resize listener for the parent when only the editorpart resizes. (fe when a view is resized or the editorpart is maximized)

Source Editor in Eclipse plug-in

I'm developing an Eclipse plug-in, mostly as a learning exercise, in which I have a wizard page. In this wizard page I would like to have a small text area that behaves like a code editor with the appropriate content assist and information hovers etc, much like the breakpoint properties wizard has for adding conditions.
I'm new to plug-in development and I may not have quite picked up the vocabulary, so I'm not having much luck searching for examples. Can someone please point me in the right direction?
I assume that you are looking for an embeddable Java source editor - and with that you hit a difficult topic.
The source viewer mentioned by Chris Gerken is called JDISourceViewer. It is instantiated and configured in JavaBreakpointConditionEditor::createControl.
If you cannot find the mentioned classes, or if you want to experiment with them, then open the Plug-ins view, find the org.eclipse.jdt.debug.ui plug-in and select Import As > Source Project from the context menu.
Unfortunately - in the beginning - the (Java) editors weren't designed to be embedded outside of the editor area and many editor participants (e.g. actions, formatter, etc) still expect an IEditorPart. Hence it is a quirky and complicated endeavour to use an editor in a dialog or the like.
Moreover, the Java source editing infrastructure is not exposed as public API. It isn't meant to be used by clients and can change at any time without prior notice. You will see respective warnings in yoyur code. For a learning exercise, however, that shouldn't matter much.

Creating a preferencs dialog for swing application

After years of working with shallow .properties files to hold preferences and settings of our application, we plan to create an MVC component for preferences dialog, backed up by some kind of model in file system or data base.
We aim to have something like eclipse (and many other IDE's and applications) has: a tree of application components on the left hand side of the dialog, each node in the list can have a matching preferences page with titles, sections, tabs and button groups.
We plan to make the GUI modular, and build according to xml files that define the GUI, and the relations between Swing controls to the matching properties.
So, before we begin inventing the wheel, I thought we could reuse some library that does exactly this.
I started investigating the eclipse source, but it's all SWT based, which I'm not sure how easy it is to integrate into our Swing based application.
So, does enyone know of a good java library to do the work for us?
One candidate is JIDE Dialogs. A variety of styles are supported.
You can start a demo from a browser here. In the tree on the left, select Jide Dialogs>Options Dialog Demo. Click one of the buttons that appear, to select a style.
In addition to providing the generic presentation layer for preferences, Eclipse's preferences framework also supports an optional persistence model, and a way to contribute preferences pages.

Eclipse Plugin Development: Extending default Java Editor/Text Hover

I've been trying develop my custom plugin for Eclipse, and basically I want to make is a "richer" version on the current TextHover. I don't know what widget(?) Eclipse uses to display the hovering text, but I want to use something different, like SWT Image or SWT Browser.
Most of the tutorials that I've read suggest that I have to implement my own Java Editor to do this, but I don't want the user to switch to my custom editor just for a simple feature (and I don't want to implement a whole editor).
Some Tests:
I've already created two Eclipse Plugin Projects. The first one is a extension for the JavaEditorTextHovers, and with this project I managed to show some custom Strings when hovering some random texts, but wasn't able to change the hover appearance. The second project was a editor plugin. With this last one I managed to get a Browser to appear when hovering a random text(this tutorial helped me), but again, this editor had nothing, no syntax coloring, no rules, etc., and for the previous reasons, I couldn't accept this has a solution.
Maybe if there was way to change the (or set a new) SourceViewerConfiguration of the current editor I could pass my custom SourceViewerConfiguration, but I'm not sure if this is possible.

Reusing Eclipse Run menu in Eclipse RCP application

I want to create an eclipse RCP application for a custom language. A programs which is written using the cutom language should be run and show it's output when the user click on the Run button.
Is it possible to integrate eclipse Run menu in eclipse RCP application with it's default features as we create NEW menu item by using ActionFactory? If it is possible how to do that?
Thanks in advance.
If you "just" want the Run menu along with the default entries, just include a dependency to org.eclipse.debug.ui.
You will then need to add launch configuration types for your specific language using the various extension point from the plugins org.eclipse.debug.core and org.eclipse.debug.ui.
As always, when it comes to the more advanced functionality of Eclipse, the easiest way to get access to the functionality is via resources and examples. Although it is a bit dated, the article "We Have Lift-off" (http://www.eclipse.org/articles/Article-Launch-Framework/launch.html) is the best starting point for this. Have a look at the various references to org.eclipse.debug.core.launchConfigurationTypes to find the best example to use asa starting point - in particular the ANT Build stuff as this is pretty simple...
In general you can find the plug-in that contributes a specific entry using the PDE Menu Spy (Alt-Shift-F2 on MacOS)...

Categories

Resources