Author: dvinnichek
Date: 2010-10-26 11:17:02 -0400 (Tue, 26 Oct 2010)
New Revision: 26070
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/icons/text-formatting.gif
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowTextFormattingHandler.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
Log:
moved some vpe toolbar buttons to external toolbar
(
https://jira.jboss.org/browse/JBIDE-4701)
Added: trunk/vpe/plugins/org.jboss.tools.vpe/icons/text-formatting.gif
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe/icons/text-formatting.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2010-10-26 15:01:22 UTC (rev 26069)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2010-10-26 15:17:02 UTC (rev 26070)
@@ -87,14 +87,14 @@
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
- <!--command categoryId="org.jboss.tools.vpe.category"
+ <command categoryId="org.jboss.tools.vpe.category"
id="org.jboss.tools.vpe.commands.showTextFormattingCommand"
name="%vpe.toolbar.show_text_formatting">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
- </command-->
+ </command>
<command categoryId="org.jboss.tools.vpe.category"
id="org.jboss.tools.vpe.commands.showBundleAsELCommand"
name="%vpe.toolbar.show_bundle_as_el">
@@ -147,11 +147,11 @@
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+M2+6"/>
- <!--key
+ <key
commandId="org.jboss.tools.vpe.commands.showTextFormattingCommand"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="org.eclipse.ui.contexts.window"
- sequence="M1+M2+7"/-->
+ sequence="M1+M2+7"/>
<key
commandId="org.jboss.tools.vpe.commands.showBundleAsELCommand"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
@@ -218,12 +218,12 @@
style="toggle"
id="org.jboss.tools.vpe.menus.showNonVisualTagsCommand"
mnemonic="S"/>
- <!--command
+ <command
commandId="org.jboss.tools.vpe.commands.showTextFormattingCommand"
icon="icons/text-formatting.gif"
style="toggle"
id="org.jboss.tools.vpe.menus.showTextFormattingCommand"
- mnemonic="S"/-->
+ mnemonic="S"/>
<command
commandId="org.jboss.tools.vpe.commands.showBundleAsELCommand"
icon="icons/bundle-as-el.gif"
@@ -292,7 +292,7 @@
<reference
definitionId="org.jboss.tools.ui.structuredEditor"/>
</visibleWhen>
</command>
- <!--command
+ <command
commandId="org.jboss.tools.vpe.commands.showTextFormattingCommand"
icon="icons/text-formatting.gif"
style="toggle"
@@ -301,7 +301,7 @@
<visibleWhen checkEnabled="false">
<reference
definitionId="org.jboss.tools.ui.structuredEditor"/>
</visibleWhen>
- </command-->
+ </command>
<command
commandId="org.jboss.tools.vpe.commands.showBundleAsELCommand"
icon="icons/bundle-as-el.gif"
@@ -380,9 +380,9 @@
<handler
class="org.jboss.tools.vpe.handlers.ShowNonVisualTagsHandler"
commandId="org.jboss.tools.vpe.commands.showNonVisualTagsCommand"/>
- <!--handler
+ <handler
class="org.jboss.tools.vpe.handlers.ShowTextFormattingHandler"
-
commandId="org.jboss.tools.vpe.commands.showTextFormattingCommand"/-->
+
commandId="org.jboss.tools.vpe.commands.showTextFormattingCommand"/>
<handler
class="org.jboss.tools.vpe.handlers.ShowBundleAsELHandler"
commandId="org.jboss.tools.vpe.commands.showBundleAsELCommand"/>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2010-10-26
15:01:22 UTC (rev 26069)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2010-10-26
15:17:02 UTC (rev 26070)
@@ -1111,4 +1111,8 @@
public MozillaTooltipListener getTooltipListener() {
return tooltipListener;
}
+
+ public IVpeToolBarManager getVpeToolBarManager() {
+ return vpeToolBarManager;
+ }
}
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowTextFormattingHandler.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowTextFormattingHandler.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowTextFormattingHandler.java 2010-10-26
15:17:02 UTC (rev 26070)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.vpe.handlers;
+
+import java.util.Map;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.commands.IElementUpdater;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.menus.UIElement;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.VpeEditorPart;
+import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
+import org.jboss.tools.vpe.editor.toolbar.IVpeToolBarManager;
+import org.jboss.tools.vpe.editor.toolbar.VpeToolBarManager;
+import org.jboss.tools.vpe.editor.toolbar.format.FormatControllerManager;
+import org.jboss.tools.vpe.editor.toolbar.format.TextFormattingToolBar;
+
+/**
+ * Handler for ShowTextFormatting
+ */
+public class ShowTextFormattingHandler extends AbstractHandler implements
+ IElementUpdater {
+
+ /**
+ * The constructor.
+ */
+ public ShowTextFormattingHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information
+ * from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ boolean oldToggleState = HandlerUtil.toggleCommandState(event
+ .getCommand());
+ JspEditorPlugin
+ .getDefault()
+ .getPreferenceStore()
+ .setValue(IVpePreferencesPage.SHOW_TEXT_FORMATTING,
+ !oldToggleState);
+
+ Command command = event.getCommand();
+ ICommandService commandService = (ICommandService) PlatformUI
+ .getWorkbench().getService(ICommandService.class);
+ commandService.refreshElements(command.getId(), null);
+
+ return null;
+ }
+
+ @Override
+ public void updateElement(UIElement element, Map parameters) {
+
+ boolean toggleState = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IVpePreferencesPage.SHOW_TEXT_FORMATTING);
+
+ IEditorPart activeEditor = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if (!(activeEditor instanceof JSPMultiPageEditor)) {
+ return;
+ }
+
+ JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) activeEditor;
+ MozillaEditor mozillaEditor = ((VpeEditorPart) jspEditor
+ .getVisualEditor()).getVisualEditor();
+ IVpeToolBarManager vpeToolBarManager = mozillaEditor
+ .getVpeToolBarManager();
+
+ /*
+ * Update Text Formatting Bar
+ */
+ vpeToolBarManager.setToolbarVisibility(toggleState);
+ }
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowTextFormattingHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native