Customization of window layout and toolbar buttons

nagang
Posts: 32
Joined: Mon Jul 14, 2014 9:48 am

Customization of window layout and toolbar buttons

Post by nagang » Mon Jul 14, 2014 12:30 pm

I have customized the oxygen toolbar buttons, window layout and created a new framework with the existing DITA framework. I have to share these settings with my team mates, to do this I have to share the layout and framework file with them.
I have tried using add-ons for sharing the framework, I have few doubts:
1) Can I share the layout file also by using this Add-ons?

Is there any way other than this Add-ons installation so that these settings are automatically updated once the oxygen is installed?

alex_jitianu
Posts: 687
Joined: Wed Nov 16, 2005 11:11 am

Re: Customization of window layout and toolbar buttons

Post by alex_jitianu » Mon Jul 14, 2014 2:43 pm

Hello,

Yes, you can impose/share a layout file using the Add-ons like this:
- create an Oxygen plugin. The main idea is that from the plugin API you can set options, including the layout file. The API of interest is PluginWorkspace.setGlobalObjectProperty(String, Object). We have a sample plugin that uses this API to set a layout file (amongst other options). You can find out more about plugins and how to install the sample plugins project from topic Plugins for the Standalone Distribution. Once you create the project, the plugin of interest is the one named Impose Layout and Options, from folder oxygen-sdk-samples/oxygen-sample-plugins/oxygen-sample-plugin-impose-options
- pack the plugin as an add-on and publish it in the same update site as the add-on with the framework. The users will have to install them both.

Best regards,
Alex

nagang
Posts: 32
Joined: Mon Jul 14, 2014 9:48 am

Re: Customization of window layout and toolbar buttons

Post by nagang » Tue Jul 15, 2014 9:45 am

Hi ,

Thank you!!

Actually I have to share these settings, one thing is I want to apply these settings by default automatically that is I don't want them to update the url with my updates and then install the plug-in.

These changes have to be applied automatically once the oxygen installation is completed.

Is there any way to do this?

Regards,
Navaneetha

alex_jitianu
Posts: 687
Joined: Wed Nov 16, 2005 11:11 am

Re: Customization of window layout and toolbar buttons

Post by alex_jitianu » Tue Jul 15, 2014 12:15 pm

Hi,

Using only the add-ons system, the users will have to follow this procedure:
1. install and start Oxygen.
2. go to Help->Manage add-ons....
3. in the dialog there is a link to options and the user will have to add the update site URL there.
4. back in the Manage add-ons dialog, the user will see the two add-ons: the framework and the plugin. He'll have to select and install them both.

We intend to simplify a bit the procedure by making step 3. available in the same dialog, but either way, it's up to the user to install them.

If you want the user to have the framework and the plugin installed from the beginning, then you can either:
1. take an all platforms build of Oxygen and unzip it. Put the framework inside the "frameworks" folder and the plugin inside the "plugins" folder. Repack as ZIP and distribute it to the users. To be allowed to repack an Oxygen distribution you will have to apply for a Value Added Reseller agreement.
2. After installing Oxygen you could give them an installer that they should run. This installer should request from them the location of Oxygen and afterwards patch the installation by adding the framework and the plugin at the aforementioned locations.

Best regards,
Alex

Leonwilliam
Posts: 2
Joined: Fri Jul 25, 2014 7:21 am
Location: India
Contact:

Re: Customization of window layout and toolbar buttons

Post by Leonwilliam » Fri Jul 25, 2014 7:48 am

I too had a same problem, after following instructions provided as in the post now I fixed the issue. Thanks once again.

ArbitraryName
Posts: 16
Joined: Tue Aug 05, 2014 8:36 pm

Re: Customization of window layout and toolbar buttons

Post by ArbitraryName » Thu Sep 04, 2014 9:34 pm

So if I am reading this correctly...

You can create a layout properties file, enabling and disabling different features, and then set that progomatically via a plugin?

Radu
Posts: 6388
Joined: Fri Jul 09, 2004 5:18 pm

Re: Customization of window layout and toolbar buttons

Post by Radu » Fri Sep 05, 2014 8:45 am

Hi,

Yes, exactly. We have a sample plugin which can come together with an XML options file and with a layout file. On the first run of the application with the plugin enabled it will impose the options and the layout in the user's application.
You should try to follow Alex's steps above to install it and tell us if you run into any problems.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

ArbitraryName
Posts: 16
Joined: Tue Aug 05, 2014 8:36 pm

Re: Customization of window layout and toolbar buttons

Post by ArbitraryName » Fri Sep 05, 2014 10:18 pm

Thank you Radu!

Another follow on question. I would assume the user could still impose their own layout? Or will the login constantly overwrite their settings?

And is there any good way to disable features from the Window>Show View option. There are some features we never want on and are curious if we can disable those views entirely. Layouts would be preferable, or some other form of configuration vs code.

~AN

Radu
Posts: 6388
Joined: Fri Jul 09, 2004 5:18 pm

Re: Customization of window layout and toolbar buttons

Post by Radu » Mon Sep 08, 2014 8:24 am

Hi,
Another follow on question. I would assume the user could still impose their own layout? Or will the login constantly overwrite their settings?
Here's how the sample "Impose Layout and Options" plugin currently works (it can be modified in other ways of course by re-compiling the Java code):

Each plugin has a version (which is defined in the plugin.xml plugin definition file).
When Oxygen is started with this plugin available for the first time, the plugin will impose its options and remember that it has done so for its current version. So on each subsequent rerun, the plugin will not impose layouts and options anymore.
But when you deliver to the user a newer plugin with a newer version number, the newer plugin will impose again its options in the application on the first run.
And is there any good way to disable features from the Window>Show View option. There are some features we never want on and are curious if we can disable those views entirely. Layouts would be preferable, or some other form of configuration vs code.
We have another type of sample plugin called "Components Validator", it gets called for each action, toolbar and view in Oxygen and it decides whether the action/toolbar/view is available or not.
You would need to start from that sample plugin and modify its Java code according to your needs.
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

nagang
Posts: 32
Joined: Mon Jul 14, 2014 9:48 am

Re: Customization of window layout and toolbar buttons

Post by nagang » Mon Sep 22, 2014 8:21 am

Hi,

How can we use this plug-in in the oXygen plug-in version installed in eclipse?

Regards,
Navaneetha

Radu
Posts: 6388
Joined: Fri Jul 09, 2004 5:18 pm

Re: Customization of window layout and toolbar buttons

Post by Radu » Mon Sep 22, 2014 8:32 am

Hi,

Only the Oxygen standalone installation has support for plugins.
When Oxygen is installed as an Eclipse plugin, it does not support for Oxygen-specific plugins. It is itself a plugin in Eclipse and you can develop another Eclipse plugin which interacts with our plugin.
Probably when running Oxygen in Eclipse you can define in your custom Eclipse plugin an Eclipse perspective and thus control the layout.
For customizing toolbar buttons, if you look in the Oxygen Eclipse plugin.xml, it contains an extension point called actionBarContributorCustomizer which can be implemented in your Eclipse plugin in order to remove or add actions from the main toolbar.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

nagang
Posts: 32
Joined: Mon Jul 14, 2014 9:48 am

Re: Customization of window layout and toolbar buttons

Post by nagang » Fri Sep 26, 2014 9:48 am

Hi,

How can we use "save Layout" and "Load Layout" in Eclipse oXygen plug-in?

Regards,
Navaneetha

Radu
Posts: 6388
Joined: Fri Jul 09, 2004 5:18 pm

Re: Customization of window layout and toolbar buttons

Post by Radu » Fri Sep 26, 2014 9:54 am

Hi Navaneetha,

The "save Layout" and "Load Layout" are actions specific to the standalone Oxygen version, so they are not available in the Oxygen Eclipse plugin.
When using the Eclipse workbench you can create your own Eclipse plugin which defines a layout perspective and contribute it to the Eclipse workbench.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

nagang
Posts: 32
Joined: Mon Jul 14, 2014 9:48 am

Re: Customization of window layout and toolbar buttons

Post by nagang » Fri Sep 26, 2014 10:11 am

Thanks for the quick reply!!

I am new to Eclipse and oXygen can you please provide any sample code or steps to follow

Regards,
Navaneetha

Radu
Posts: 6388
Joined: Fri Jul 09, 2004 5:18 pm

Re: Customization of window layout and toolbar buttons

Post by Radu » Fri Sep 26, 2014 10:48 am

Hi,

If you look in the Oxygen Eclipse plugin's plugin.xml, you will see that it has an extension point which contributes 4 perspectives to the Eclipse workbench:

Code: Select all

  <extension point="org.eclipse.ui.perspectives">
<perspective class="com.oxygenxml.editor.perspective.XMLPerspectiveFactory"
icon="eclipseIcons/Oxygen16.gif"
id="com.oxygenxml.editor.xml.perspective" name="%content-type.name.6"/>
<perspective class="com.oxygenxml.editor.perspective.DBPerspectiveFactory"
icon="eclipseIcons/DbConnection16.gif"
id="com.oxygenxml.editor.db.perspective" name="%perspective.name.0"/>
<perspective
class="com.oxygenxml.editor.perspective.XSLTDebuggerPerspectiveFactory"
icon="eclipseIcons/DebuggerXSLTView16.gif"
id="com.oxygenxml.editor.debugger.perspective.xslt" name="%perspective.name.1"/>
<perspective
class="com.oxygenxml.editor.perspective.XQueryDebuggerPerspectiveFactory"
icon="eclipseIcons/DebuggerXQueryView16.gif"
id="com.oxygenxml.editor.debugger.perspective.xquery" name="%perspective.name.2"/>
</extension>
Here's some sample source code which shows how the XMLPerspectiveFactory is defined:

Code: Select all

public class XMLPerspectiveFactory implements IPerspectiveFactory {
/**
* The perspective id.
*/
public static final String PERSPECTIVE_ID = "com.oxygenxml.editor.xml.perspective";

/**
* Create the initial layout.
*
* @param layout The layout to be configured.
* @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
*/
@Override
public void createInitialLayout(IPageLayout layout) {
// Define actions.
defineActions(layout);
// Define layout.
defineLayout(layout);
}

/**
* Define the actions and shortcuts to be added to the layout.
*
* @param layout The layout to be configured.
*/
public void defineActions(IPageLayout layout) {
// Add wizard shortcuts.
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.project.new");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.project.sample");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.xml.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.html.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.xsl.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.xspec.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.fo.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.xsd.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.dtd.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.sch.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.rng.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.rnc.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.nvdl.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.wsdl.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.xquery.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.xproc.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.css.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.js.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.json.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.sql.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.importhtml.new.file");
layout.addNewWizardShortcut("com.oxygenxml.editor.newwizards.template.new.file");
// General new file and new folder stuff.
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");
// Add show view shortcuts.
layout.addShowViewShortcut(XPathResultsView.getViewID());
layout.addShowViewShortcut(XPathBuilderView.getViewID());
layout.addShowViewShortcut(ScenariosView.getViewID());
layout.addShowViewShortcut(OxygenTextView.getViewID());
layout.addShowViewShortcut(OxygenSequenceView.getViewID());
layout.addShowViewShortcut(OxygenResultsMapView.getViewID());
layout.addShowViewShortcut(DBExplorerView.getViewID());
layout.addShowViewShortcut(DBTableExplorerView.getViewID());
layout.addShowViewShortcut(OxygenDPIView.getViewID());
layout.addShowViewShortcut(OxygenBrowserView.getViewID());
layout.addShowViewShortcut(ModelView.getViewID());
layout.addShowViewShortcut(XSDPaletteView.getViewID());
layout.addShowViewShortcut(EditorPropertiesView.getViewID());
layout.addShowViewShortcut(WSDLView.getViewID());
layout.addShowViewShortcut(AttributesView.getViewID());
layout.addShowViewShortcut(FacetsView.getViewID());
layout.addShowViewShortcut(EntitiesView.getViewID());
layout.addShowViewShortcut(ElementsView.getViewID());
layout.addShowViewShortcut(XsltXQueryInputView.getViewID());
layout.addShowViewShortcut(AuthorReviewView.getViewID());

if (EditorPlugin.includesAuthor()) {
// Available only for "editor" and "author".
layout.addShowViewShortcut(DITAMapsManagerView.getViewID());
}
layout.addShowViewShortcut(DependencesHierarchyView.getViewID());
layout.addShowViewShortcut(ComponentDependencesHierarchyView.getViewID());
// General views.
layout.addShowViewShortcut("org.eclipse.ui.views.ResourceNavigator");
layout.addShowViewShortcut("org.eclipse.ui.views.ContentOutline");
layout.addShowViewShortcut("org.eclipse.ui.views.PropertySheet");
layout.addShowViewShortcut("org.eclipse.ui.views.TaskList");
layout.addShowViewShortcut("org.eclipse.search.SearchResultView");
}

/**
* Configure the layout.
* Adds the Oxygen's views and create folders for them.
*
* @param layout The layout to be configured.
*/
public void defineLayout(IPageLayout layout) {
// Get the editor area descriptor.
String editorArea = layout.getEditorArea();
// Create the adjacent folders.
IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25F, editorArea);
topLeft.addView("org.eclipse.ui.views.ResourceNavigator");
topLeft.addPlaceholder(DBExplorerView.getViewID());
if (EditorPlugin.includesAuthor()) {
// Available only for "editor" and "author".
topLeft.addView(DITAMapsManagerView.getViewID());
}
topLeft.addView(DependencesHierarchyView.getViewID());
// Top right area
IFolderLayout topRight = layout.createFolder("topRight", IPageLayout.RIGHT, 0.7F, editorArea);
topRight.addView(ModelView.getViewID());
topRight.addView(AttributesView.getViewID());
topRight.addPlaceholder(ComponentDependencesHierarchyView.getViewID());
topRight.addView(XPathBuilderView.getViewID());
topRight.addView(ScenariosView.getViewID());
topRight.addPlaceholder(AuthorReviewView.getViewID());

// Middle right area
IFolderLayout middleRight = layout.createFolder("middleRight", IPageLayout.BOTTOM, 0.5F, "topRight");
middleRight.addView(ElementsView.getViewID());
middleRight.addView(EntitiesView.getViewID());
middleRight.addView(XSDPaletteView.getViewID());
middleRight.addPlaceholder(FacetsView.getViewID());
middleRight.addPlaceholder(EditorPropertiesView.getViewID());
middleRight.addView(XsltXQueryInputView.getViewID());
// Bottom left area
IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.4F, "topLeft");
bottomLeft.addView("org.eclipse.ui.views.ContentOutline");
// Bottom right area
IFolderLayout bottomRight = layout.createFolder("bottomRight", IPageLayout.BOTTOM, 0.66F, editorArea);
bottomRight.addView(XPathResultsView.getViewID());
bottomRight.addView(OxygenTextView.getViewID());
bottomRight.addPlaceholder(OxygenSequenceView.getViewID());
bottomRight.addPlaceholder(OxygenResultsMapView.getViewID());
bottomRight.addPlaceholder(DBTableExplorerView.getViewID());
bottomRight.addView(OxygenDPIView.getViewID());
bottomRight.addView(OxygenBrowserView.getViewID());
bottomRight.addView(WSDLView.getViewID());
bottomRight.addView(IPageLayout.ID_PROBLEM_VIEW);
bottomRight.addView(IConsoleConstants.ID_CONSOLE_VIEW);
bottomRight.addPlaceholder("org.eclipse.search.SearchResultView");
}
}
As you see a perspective uses view IDs (you can obtain the view IDs from the Oxygen plugin.xml) and places the views in certain places in the Eclipse layout.

So if you create a custom Eclipse plugin, in your custom plugin's plugin.xml you could define a new perspective which places Oxygen views in certain places.

You can probably find resources online about creating new Eclipse plugins.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

nagang
Posts: 32
Joined: Mon Jul 14, 2014 9:48 am

Re: Customization of window layout and toolbar buttons

Post by nagang » Wed Oct 22, 2014 1:30 pm

Hi team,

I have one more query regarding customization in oxygen eclipse.

If we open any dita file in oxygen eclipse, there will be two extra menus appear on the menu bar as "XML" and "DITA". We found a way to add or hide menu items of "DITA" menu. But we do not know how to customize (hide submenu items or adding items) the "XML" menu items.

Please provide us support for this.

Regards,
Navaneetha

Radu
Posts: 6388
Joined: Fri Jul 09, 2004 5:18 pm

Re: Customization of window layout and toolbar buttons

Post by Radu » Wed Oct 22, 2014 2:58 pm

Hi Navaneetha,

I'm not sure what your current set-up is.
Almost all our contributions to the Eclipse main menu are done using the Java code in the action bar contributor "com.oxygenxml.editor.editors.xml.OxygenXMLEditorActionBarContributor" class.

Did you implement the com.oxygenxml.editor.editors.ActionBarContributorCustomizer.customizeActionsContributedToDocumentMenu(List<IAction>) callback in your plugin?
It should provide a list of actions from the XML menu which could be filtered.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

ashukuma
Posts: 10
Joined: Fri Nov 14, 2014 10:04 am

Re: Customization of window layout and toolbar buttons

Post by ashukuma » Fri Nov 14, 2014 12:12 pm

Hi,

I have installed oXygen Eclipse in my system. I am trying to open DITA file. On opening, I am getting XML and DITA menu items in toolbar. Is there anyway to customize/hide the XML menu so that it is not visible. Since, most of the menu items are related to validation and transformation.

I have gone through this thread and found that I will have to write code in some function to disable XML menu. Can anyone please describe how can I write code in Java to achieve this. I am new to Java and this seems to be a very complex scenario.

alex_jitianu
Posts: 687
Joined: Wed Nov 16, 2005 11:11 am

Re: Customization of window layout and toolbar buttons

Post by alex_jitianu » Fri Nov 14, 2014 5:25 pm

Hi,

Please see my answer on thread XML menu customization.

Best regards,
Alex

Post Reply