Author: dmaliarevich
Date: 2009-06-29 07:50:33 -0400 (Mon, 29 Jun 2009)
New Revision: 16243
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertContributionItem.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-3504, popup menu structure for inserting tags
from palette was changed.
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertContributionItem.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertContributionItem.java 2009-06-29
07:10:56 UTC (rev 16242)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertContributionItem.java 2009-06-29
11:50:33 UTC (rev 16243)
@@ -80,30 +80,59 @@
@Override
public void fill(Menu menu, int index) {
+ /*
+ *
https://jira.jboss.org/jira/browse/JBIDE-3504
+ * Adding 'Insert tag from Palette' menu item.
+ */
+ final MenuItem fromPaletteItem;
+ if (index < 0) {
+ fromPaletteItem = new MenuItem(menu, SWT.CASCADE);
+ } else {
+ fromPaletteItem = new MenuItem(menu, SWT.CASCADE, index);
+ }
+ /*
+ * Increasing parent menu item index.
+ */
+ index++;
+ fromPaletteItem.setText(VpeUIMessages.FROM_PALETTE);
+ /*
+ * Creating menu for 'Insert tag from Palette' item.
+ */
+ final Menu fromPaletteMenu = new Menu(menu);
+ /*
+ * Tie menu with the item.
+ */
+ fromPaletteItem.setMenu(fromPaletteMenu);
+ /*
+ * Setting each InsertType to correct position in the menu
+ */
for (final InsertType insertItem : InsertType.values()) {
- final MenuItem item;
- if (index < 0) {
- item = new MenuItem(menu, SWT.CASCADE);
- } else {
- item = new MenuItem(menu, SWT.CASCADE,
- index + insertItem.ordinal());
- }
-
- final String itemName = insertItem.getMessage();
- item.setText(itemName);
-
- final Menu paletteManu = new Menu(menu);
- item.setMenu(paletteManu);
-
+ /*
+ * Use MenuManager to create submenu.
+ */
final MenuManager paletteManuManager = new MenuManager(
- VpeUIMessages.FROM_PALETTE);
+ insertItem.getMessage());
final XModelObject model = ModelUtilities.getPreferenceModel()
- .getByPath("%Palette%"); //$NON-NLS-1$
-
- paletteManuManager.addMenuListener(
- new InsertMenuListener(model, insertItem));
+ .getByPath("%Palette%"); //$NON-NLS-1$
+ paletteManuManager.addMenuListener(new InsertMenuListener(
+ model, insertItem));
paletteManuManager.setRemoveAllWhenShown(true);
- paletteManuManager.fill(paletteManu, -1);
+ /*
+ * Place menu items to the correct menu.
+ */
+ if (insertItem.equals(InsertType.REPLACE_WITH)) {
+ /*
+ * Replace item will be placed in the parent menu.
+ * Because of this its position index is required.
+ */
+ paletteManuManager.fill(menu, index);
+ index++;
+ } else {
+ /*
+ * Fill 'Insert tag from palette' menu with insert items.
+ */
+ paletteManuManager.fill(fromPaletteMenu, -1);
+ }
}
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-06-29
07:10:56 UTC (rev 16242)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-06-29
11:50:33 UTC (rev 16243)
@@ -64,12 +64,12 @@
RESTORE_PREVIOUS_LOCATION=Restore Previous Location
BACKGROUND_COLOR_TIP=Choose background color
SETUP_TEMPLATE_FOR_MENU=Setup Template for <{0}>...
-INSERT_AROUND=Insert Around
-INSERT_BEFORE=Insert Before
-INSERT_AFTER=Insert After
-REPLACE_WITH=Replace With
-INSERT_INTO=Insert Into
-FROM_PALETTE=From Palette
+INSERT_AROUND=Around
+INSERT_BEFORE=Before
+INSERT_AFTER=After
+REPLACE_WITH=Replace with Palette tag
+INSERT_INTO=Into
+FROM_PALETTE=Insert tag from Palette
PAGE_DESIGN_OPTIONS_ABOUT=Here you can configure Visual Page Editor options, which will
be used for generating a preview
ACTUAL_RUN_TIME_FOLDERS_ABOUT=These options will be used by Visual Page Editor for
replacing absolute and relative path values when generating a preview
INCLUDED_CSS_FILES_ABOUT=These CSS files will be linked by Visual Page Editor when
generating a preview