Page 1 of 1

DITA menu customization

Posted: Tue Jan 20, 2015 4:15 pm
by mu258770
Hi Team,

We know that in oXygen eclipse, we can customize DITA menu by using Document type association and by changing dita.framework file.

But there are some items in the DITA menu which cannot be removed using this method. They are Refresh, Tag display mode, Profiling/conditional text.

If we want to remove some items from these, please let us know how can we do it.

Thanks in advance!

Regards,
Shabeer

Re: DITA menu customization

Posted: Tue Jan 20, 2015 4:38 pm
by alex_jitianu
Hi Shabeer,

Starting with version 17.0 the com.oxygenxml.author.actionBarContributorCustomizer extension point will be able to intercept and customize this menu too. Until then I think you could use Eclipse mechanisms for the filtering.

Best regards,
Alex

Re: DITA menu customization

Posted: Mon Feb 16, 2015 9:10 am
by mu258770
Hi Alex,

Thank you for the response!

Please let us know how we can remove or hide "review" related toolbar icons from oXygen eclipse.

Regards,
Shabeer

Re: DITA menu customization

Posted: Mon Feb 16, 2015 11:59 am
by Radu
Hi Shabeer,

Alex took a few days off.
You could extend the com.oxygenxml.author.actionBarContributorCustomizer extension and customize the Author coolbar like:

Code: Select all

          @Override
public void customizeAuthorPageInternalCoolbar(CoolBar coolbar,
WSAuthorEditorPage authorEditorPage) {
Control[] children = coolbar.getChildren();
//Hide review toolbar
children[2].setVisible(false);
}
Regards,
Radu

Re: DITA menu customization

Posted: Wed Feb 18, 2015 10:13 am
by mu258770
Hi Radu,

Thank you for the solution provided! It worked for us

I have two more queries :

1. After removing Review related coolbar icons, the coolbar looks to be a little odd. The place where we removed the items became white. Can we change this and make it better by removing the white space?

2. This is regarding DITA-> ID options submenu.

As of now, we are planning to remove ID options from the DITA menu by doing the changes in dita.framework file. But there is a problem doing this,

In DITA->ID options, "Auto Generate IDs for elements" and "Remove IDs when copying content in the same document" options are enabled (or checked) by default. But for us, the "Auto Generate IDs for elements" option should be disabled or unchecked. What can we do for this? Please help!

Thanks in Advance!

Regards,
Shabeer

Re: DITA menu customization

Posted: Wed Feb 18, 2015 1:34 pm
by Radu
Hi Shabeer,

Please see some answers below:
1. After removing Review related coolbar icons, the coolbar looks to be a little odd. The place where we removed the items became white. Can we change this and make it better by removing the white space?
Sorry, I could not find a better way to remove that extra white spaces.
2. This is regarding DITA-> ID options submenu.
As of now, we are planning to remove ID options from the DITA menu by doing the changes in dita.framework file. But there is a problem doing this,
In DITA->ID options, "Auto Generate IDs for elements" and "Remove IDs when copying content in the same document" options are enabled (or checked) by default. But for us, the "Auto Generate IDs for elements" option should be disabled or unchecked. What can we do for this? Please help!
If you are using Oxygen 16.1 in the OXYGEN_PLUGIN_DIR/frameworks/dita/resources folder there is an idGenerationDefaultOptions.xml file which contains the defaults used in the ID Generation Options dialog.

Regards,
Radu

Re: DITA menu customization

Posted: Wed Feb 18, 2015 2:39 pm
by mu258770
Hi Radu,

Thank you for the response!

We are using oxygen author 16.0. The mentioned XML file is not there in the specified version. Please let us know some alternative way for disabling "Auto generate IDs for elements".

Thank you!

Regards,
Shabeer

Re: DITA menu customization

Posted: Wed Feb 18, 2015 3:00 pm
by Radu
Hi Shabeer,

If you are using Oxygen 16.0 you would need to get the Java sources for the DITA framework Java customizations (the Java sources used to build the dita.jar) modify them to set defaults in the Java code and then re-compile the dita.jar. I don't see any other option.
My advice to you is to upgrade to 16.1.

Regards,
Radu

Re: DITA menu customization

Posted: Thu Feb 19, 2015 1:00 pm
by mu258770
Hi Radu,

Thank you for the response!

Please let us know what all changes have been done as part of Oxygen author 16.0 eclipse plugin upgrade to oxygen author 16.1.

Regards,
Shabeer

Re: DITA menu customization

Posted: Thu Feb 19, 2015 1:19 pm
by Radu
Hi Shabeer,

Our Oxygen 16.1 new features list is here:

http://www.oxygenxml.com/whatisnew16.1.html

We did not intentionally break any API so your customizations should work just as well with 16.1.

Regards,
Radu

Re: DITA menu customization

Posted: Mon Mar 02, 2015 4:46 pm
by alex_jitianu
Hello Shabeer,

After some more research I can offer this workaround. It's a little better than the previous recommendation since there wont be any extra space:

Code: Select all

CoolItem[] items = coolbar.getItems();
CoolItem coolItem = items[1];

coolItem.setControl(new Label(coolbar, SWT.NONE));

coolItem.setMinimumSize(0, 0);
coolItem.setSize(new Point(0, 0));

coolbar.update();
Best regards,
Alex

Re: DITA menu customization

Posted: Mon Jul 18, 2016 9:21 am
by mu258770
Hi team,

We would like to remove/ hide some items from DITA -> Profiling/Conditional Text in (like 2nd 3rd and 4th options) oxygen author 17.0 eclipse plugin version. We got previous reply as below when I asked for same question (that time we were using oxygen 16.0 )
Starting with version 17.0 the com.oxygenxml.author.actionBarContributorCustomizer extension point will be able to intercept and customize this menu too. Until then I think you could use Eclipse mechanisms for the filtering.
We have already removed some items using the same extension point using action definition id. Could you please let us know the exact ID of these menus if it is possible to remove using action definition id. Or the way we can achieve it.

Regards,
Shabeer

Re: DITA menu customization

Posted: Mon Jul 18, 2016 9:49 am
by Radu
Hi Shabeer,

So you are already using the ActionBarContributorCustomizer.customizeAuthorPageExtensionMenu(IMenuManager, AuthorAccess) API to customize the main DITA menu, right?
The ID of the "Profiling" sub-menu manager should be Profiling.

Regards,
Radu

Re: DITA menu customization

Posted: Mon Jul 18, 2016 10:39 am
by mu258770
Hi Radu,

We are currently using the extension point as <extension point="com.oxygenxml.author.actionBarContributorCustomizer">. This we have used for customizing XML menu items only. We never removed any items in DITA menu using the extension point.

Please see the current code which we used for removing XML -> Validate Cached menu item.

Code: Select all


public class CustomActionBarContributorCustomizer extends ActionBarContributorCustomizer {

private static final String VALIDATE_CACHED = "com.oxygenxml.editor.validate.cached"; //XML-->Validate_cached

/ @Override
public final List<IAction> customizeActionsContributedToDocumentMenu(List<IAction> actions)
{
List<IAction> allowed = new ArrayList<IAction>(actions);
for (Iterator<IAction> iterator = allowed.iterator(); iterator.hasNext();)
{
IAction iAction = (IAction)iterator.next();

if (iAction != null){
else if (VALIDATE_CACHED.equals(iAction.getActionDefinitionId())) {
iterator.remove();
}

}
}
return allowed;
}

}
Similarly do we need to use the new extension point is what you are saying. Also we do not need to remove complete set of Profiling items. Only one or two submenus in it like "Show excluded content". Please let us know more on these.

Regards,
Shabeer

Re: DITA menu customization

Posted: Mon Jul 18, 2016 11:23 am
by Radu
Hi Shabeer,

So what you need to do is to edit the CustomActionBarContributorCustomizer extension that you already have and add a new Java method to it:

Code: Select all

        /**
* CUSTOMIZE THE MAIN FRAMEWORK MENU (IN OUR CASE THE "DITA" menu)
*/
@Override
public void customizeAuthorPageExtensionMenu(IMenuManager extensionMenu,
AuthorAccess authorAccess) {
IContributionItem[] items = extensionMenu.getItems();
for (int i = 0; i < items.length; i++) {
if("Profiling".equals(items[i].getId())){
MenuManager profilingSubmenu = (MenuManager) items[i];
profilingSubmenu.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
IContributionItem[] subItems = manager.getItems();
for (int j = 0; j < subItems.length; j++) {
if("Profiling_Condition_Sets/Show_excluded_content".equals(subItems[j].getId())
|| "Profiling_Condition_Sets/Show_Profiling_Attributes".equals(subItems[j].getId())
|| "Profiling_Condition_Sets/Apply_profiling_styles".equals(subItems[j].getId())
){
//Remove it
manager.remove(subItems[j]);
}
}
}
});
}
}
}
That method will be called when the "DITA" menu manager is constructed.

Regards,
Radu

Re: DITA menu customization

Posted: Mon Jul 18, 2016 2:57 pm
by mu258770
Hi Radu,

Thank you for your quick response!

The solution worked well for us :)

We have one more query related to the toolbar items related to same "Profiling".How we could remove it from toolbar. We tried it using the below code, but it is removing all the toolbar items related to profiling and some additional items,

Code: Select all

          @Override
public void customizeAuthorPageInternalCoolbar(CoolBar coolbar,
WSAuthorEditorPage authorEditorPage) {
Control[] children = coolbar.getChildren();
//Hide review toolbar
children[2].setVisible(false);
}
Could you please let us know how we can remove specific items in the profiling toolbar group.

Regards,
Shabeer

Re: DITA menu customization

Posted: Tue Jul 19, 2016 8:59 am
by Radu
Hi Shabeer,

The Javadoc for the method customizeAuthorPageInternalCoolbar has a sample filter usage:

https://www.oxygenxml.com/InstData/Edit ... mizer.html

Basically in your case the filter would look something like:

Code: Select all

          public void customizeAuthorPageInternalCoolbar(CoolBar coolbar,
WSAuthorEditorPage authorEditorPage) {
CoolItem[] items = coolbar.getItems();
for (CoolItem coolItem : items) {
Control control = coolItem.getControl();
if (control instanceof ToolBar) {
ToolBar toolBar = (ToolBar) control;
ToolItem[] tollbarItems = toolBar.getItems();
for (ToolItem toolItem : tollbarItems) {
if("Profiling".equals(toolItem.getData("OXYGEN_ID"))){
//Remove it
toolItem.dispose();
}
}
}
}
}
Regards,
Radu

Re: DITA menu customization

Posted: Tue Jul 19, 2016 10:37 am
by mu258770
Hi Radu,

I have tried the solution provided, but it removes the complete Profiling items from toolbar. I have checked the URL which you have provided and could not find a way to remove only submenu of the "Profiling". Printed the oxygen ID's of the toolbar items and could see only "Profiling" coming in the log.

Code: Select all

CoolItem[] items = coolbar.getItems();
for (CoolItem coolItem : items) {
Control control = coolItem.getControl();
Object oxygenID = control.getData("OXYGEN_ID");
System.out.println(oxygenID);
if (control instanceof ToolBar) {
ToolBar toolBar = (ToolBar) control;
ToolItem[] tollbarItems = toolBar.getItems();
for (ToolItem toolItem : tollbarItems) {
System.out.println(" " + toolItem.getData("OXYGEN_ID"));
}
}
}


I tried the below also and it did not work

Code: Select all

if("Profiling_Condition_Sets/Show_excluded_content".equals(toolItem.getData("OXYGEN_ID"))){
//Remove it
toolItem.dispose();
}
Could you please let me know how we can remove the submenu items of "Profiling" from toolbar.


Thanks in advance.

Regards,
Shabeer

Re: DITA menu customization

Posted: Tue Jul 19, 2016 12:11 pm
by Radu
Hi Shabeer,

Oh, so you do not want to remove the entire drop down button, you just want to remove some actions from the drop down.
Unfortunately I do not see how this could be done using our current API. I will add an issue and try to come up with such a possibility in Oxygen 18.1.

Regards,
Radu

Re: DITA menu customization

Posted: Fri Oct 28, 2016 11:56 am
by Radu
Hi Shabeer,

We released Oxygen 18.1 a couple of weeks ago and with Oxygen 18.1 when you want to customize a drop-down tool item, you can cast it to the API interface "com.oxygenxml.editor.editors.xml.IDropDownToolItem" and add a filter to it.
Javadoc here:

https://www.oxygenxml.com/InstData/Edit ... ditorPage-

Regards,
Radu