JBoss Tools SVN: r17895 - workspace/mareshkau.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-10-05 09:32:41 -0400 (Mon, 05 Oct 2009)
New Revision: 17895
Added:
workspace/mareshkau/xulrunner1.9.diff
Log:
Xulrunner 1.9 changes
Added: workspace/mareshkau/xulrunner1.9.diff
===================================================================
--- workspace/mareshkau/xulrunner1.9.diff (rev 0)
+++ workspace/mareshkau/xulrunner1.9.diff 2009-10-05 13:32:41 UTC (rev 17895)
@@ -0,0 +1,120 @@
+Index: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
+===================================================================
+--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (revision 17893)
++++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (working copy)
+@@ -50,8 +50,8 @@
+
+ public class XulRunnerBrowser implements nsIWebBrowserChrome,
+ nsIWebProgressListener, nsITooltipListener {
+- private static final String XULRUNNER_LOWER_VERSION = "1.8.1.2"; //$NON-NLS-1$
+- private static final String XULRUNNER_HIGHER_VERSION = "1.8.1.9"; //$NON-NLS-1$
++ private static final String XULRUNNER_LOWER_VERSION = "1.9.1.0"; //$NON-NLS-1$
++ private static final String XULRUNNER_HIGHER_VERSION = "1.9.1.9"; //$NON-NLS-1$
+ // TODO Sergey Vasilyev Think. May be XULRUNNER_BUNDLE shouldn't be final?
+ private static final String XULRUNNER_BUNDLE;
+ private static final String XULRUNNER_ENTRY = "/xulrunner"; //$NON-NLS-1$
+Index: 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 (revision 17893)
++++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (working copy)
+@@ -923,7 +923,7 @@
+ nsIEditingSession iEditingSession = (nsIEditingSession) getXulRunnerEditor().
+ getComponentManager().createInstanceByContractID(XPCOM.NS_EDITINGSESSION_CONTRACTID, null, nsIEditingSession.NS_IEDITINGSESSION_IID);
+ //make window editable
+- iEditingSession.makeWindowEditable(getXulRunnerEditor().getWebBrowser().getContentDOMWindow(), "html", true); //$NON-NLS-1$
++ iEditingSession.makeWindowEditable(getXulRunnerEditor().getWebBrowser().getContentDOMWindow(), "html", true,true,true); //$NON-NLS-1$
+ //here we setup editor for window
+ iEditingSession.setupEditorOnWindow(getXulRunnerEditor().getWebBrowser().getContentDOMWindow());
+ //getting some editor to disable some actions
+Index: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java
+===================================================================
+--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (revision 17893)
++++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (working copy)
+@@ -10,18 +10,14 @@
+ ******************************************************************************/
+ package org.jboss.tools.vpe.editor.util;
+
+-import java.lang.ref.Reference;
+-import java.lang.ref.SoftReference;
+ import java.util.ArrayList;
+ import java.util.HashSet;
+ import java.util.List;
+ import java.util.Set;
+-
+ import org.eclipse.swt.graphics.Point;
+ import org.eclipse.swt.graphics.Rectangle;
+ import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+ import org.jboss.tools.vpe.editor.template.VpeCreationData;
+-import org.mozilla.interfaces.nsIAccessibilityService;
+ import org.mozilla.interfaces.nsIAccessible;
+ import org.mozilla.interfaces.nsIDOMDocument;
+ import org.mozilla.interfaces.nsIDOMElement;
+@@ -33,7 +29,6 @@
+ import org.mozilla.interfaces.nsIDOMNodeList;
+ import org.mozilla.interfaces.nsIDOMRange;
+ import org.mozilla.interfaces.nsISelection;
+-import org.mozilla.xpcom.Mozilla;
+ import org.mozilla.xpcom.XPCOMException;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.NamedNodeMap;
+@@ -50,7 +45,7 @@
+ public static String FACELETS_URI = "http://java.sun.com/jsf/facelets"; //$NON-NLS-1$
+
+ private static final String ACCESSIBILITY_SERVICE_CONTRACT_ID = "@mozilla.org/accessibilityService;1"; //$NON-NLS-1$
+- private static Reference<nsIAccessibilityService> accessibilityServiceCache = null;
++// private static Reference<nsIAccessibilityService> accessibilityServiceCache = null;
+
+ private static Set<String> escapedTags;
+
+@@ -236,23 +231,23 @@
+ *
+ * @author yradtsevich
+ */
+- public static nsIAccessibilityService getAccessibilityService() {
+- nsIAccessibilityService accessibilityService = null;
+- if (accessibilityServiceCache != null) {
+- // get accessibilityService from cache
+- accessibilityService = accessibilityServiceCache.get();
+- }
+- if (accessibilityService == null) {
+- accessibilityService = (nsIAccessibilityService) Mozilla.getInstance()
+- .getServiceManager()
+- .getServiceByContractID(ACCESSIBILITY_SERVICE_CONTRACT_ID,
+- nsIAccessibilityService.NS_IACCESSIBILITYSERVICE_IID);
+-
+- // cache accessibilityService
+- accessibilityServiceCache = new SoftReference<nsIAccessibilityService>(accessibilityService);
+- }
+- return accessibilityService;
+- }
++// public static nsIAccessibilityService getAccessibilityService() {
++// nsIAccessibilityService accessibilityService = null;
++// if (accessibilityServiceCache != null) {
++// // get accessibilityService from cache
++// accessibilityService = accessibilityServiceCache.get();
++// }
++// if (accessibilityService == null) {
++// accessibilityService = (nsIAccessibilityService) Mozilla.getInstance()
++// .getServiceManager()
++// .getServiceByContractID(ACCESSIBILITY_SERVICE_CONTRACT_ID,
++// nsIAccessibilityService.NS_IACCESSIBILITYSERVICE_IID);
++//
++// // cache accessibilityService
++// accessibilityServiceCache = new SoftReference<nsIAccessibilityService>(accessibilityService);
++// }
++// return accessibilityService;
++// }
+
+ /**
+ * Returns on screen bounds of the {@code node}
+@@ -264,8 +259,8 @@
+ */
+ public static Rectangle getBounds(nsIDOMNode node) {
+ Rectangle bounds = null;
+-
+- nsIAccessible accessible = getAccessibilityService().getAccessibleFor(node);
++
++ nsIAccessible accessible = (nsIAccessible) node.queryInterface(nsIAccessible.NS_IACCESSIBLE_IID);
+ if (accessible != null) {
+ int[] xArray = new int[1]; // Left hand corner of the node
+ int[] yArray = new int[1]; // Top corner of the node
14 years, 8 months
JBoss Tools SVN: r17894 - workspace/mareshkau.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-10-05 09:31:44 -0400 (Mon, 05 Oct 2009)
New Revision: 17894
Removed:
workspace/mareshkau/jbosstools_XR1.9/
Log:
intead of branch will be used a diff
14 years, 8 months
JBoss Tools SVN: r17893 - in workspace/mareshkau: jbosstools_XR1.9 and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-10-05 09:27:45 -0400 (Mon, 05 Oct 2009)
New Revision: 17893
Added:
workspace/mareshkau/jbosstools_XR1.9/
workspace/mareshkau/jbosstools_XR1.9/MozillaEditor.java
workspace/mareshkau/jbosstools_XR1.9/VisualDomUtil.java
workspace/mareshkau/jbosstools_XR1.9/XulRunnerBrowser.java
Log:
Xulrunner 1.9 changes
Added: workspace/mareshkau/jbosstools_XR1.9/MozillaEditor.java
===================================================================
--- workspace/mareshkau/jbosstools_XR1.9/MozillaEditor.java (rev 0)
+++ workspace/mareshkau/jbosstools_XR1.9/MozillaEditor.java 2009-10-05 13:27:45 UTC (rev 17893)
@@ -0,0 +1,1187 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.mozilla;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IReusableEditor;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.eclipse.ui.editors.text.ILocationProvider;
+import org.eclipse.ui.internal.part.StatusPart;
+import org.eclipse.ui.part.EditorPart;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
+import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.preferences.VpeEditorPreferencesPage;
+import org.jboss.tools.vpe.editor.toolbar.IVpeToolBarManager;
+import org.jboss.tools.vpe.editor.toolbar.VpeDropDownMenu;
+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;
+import org.jboss.tools.vpe.editor.util.DocTypeUtil;
+import org.jboss.tools.vpe.editor.util.FileUtil;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+import org.jboss.tools.vpe.resref.core.VpeResourcesDialog;
+import org.jboss.tools.vpe.xulrunner.XPCOM;
+import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMEventTarget;
+import org.mozilla.interfaces.nsIDOMNamedNodeMap;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.interfaces.nsIEditingSession;
+import org.mozilla.interfaces.nsIEditor;
+import org.mozilla.interfaces.nsIHTMLAbsPosEditor;
+import org.mozilla.interfaces.nsIHTMLInlineTableEditor;
+import org.mozilla.interfaces.nsIHTMLObjectResizer;
+import org.mozilla.interfaces.nsIPlaintextEditor;
+
+public class MozillaEditor extends EditorPart implements IReusableEditor {
+ protected static final File INIT_FILE = new File(VpePlugin.getDefault().getResourcePath("ve"), "init.html"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String CONTENT_AREA_ID = "__content__area__"; //$NON-NLS-1$
+
+ /*
+ * Paths for tool bar icons
+ */
+ public static final String ICON_PREFERENCE = "icons/preference.gif"; //$NON-NLS-1$
+ public static final String ICON_PREFERENCE_DISABLED = "icons/preference_disabled.gif"; //$NON-NLS-1$
+ public static final String ICON_REFRESH = "icons/refresh.gif"; //$NON-NLS-1$
+ public static final String ICON_REFRESH_DISABLED = "icons/refresh_disabled.gif"; //$NON-NLS-1$
+ public static final String ICON_PAGE_DESIGN_OPTIONS = "icons/point_to_css.gif"; //$NON-NLS-1$
+ public static final String ICON_PAGE_DESIGN_OPTIONS_DISABLED = "icons/point_to_css_disabled.gif"; //$NON-NLS-1$
+ public static final String ICON_ORIENTATION_SOURCE_LEFT = "icons/source_left.gif"; //$NON-NLS-1$
+ public static final String ICON_ORIENTATION_SOURCE_TOP = "icons/source_top.gif"; //$NON-NLS-1$
+ public static final String ICON_ORIENTATION_VISUAL_LEFT = "icons/visual_left.gif"; //$NON-NLS-1$
+ public static final String ICON_ORIENTATION_VISUAI_TOP = "icons/visual_top.gif"; //$NON-NLS-1$
+ public static final String ICON_ORIENTATION_SOURCE_LEFT_DISABLED = "icons/source_left_disabled.gif"; //$NON-NLS-1$
+ public static final String ICON_NON_VISUAL_TAGS_SHOW = "icons/non-visusal-tags-show.png"; //$NON-NLS-1$
+ public static final String ICON_NON_VISUAL_TAGS_HIDE = "icons/non-visusal-tags-hide.png"; //$NON-NLS-1$
+ public static final String ICON_SELECTION_BAR_SHOW = "icons/selbar-show.gif"; //$NON-NLS-1$
+ public static final String ICON_SELECTION_BAR_HIDE = "icons/selbar-hide.gif"; //$NON-NLS-1$
+ public static final String ICON_TEXT_FORMATTING_SHOW = "icons/text-formatting-show.gif"; //$NON-NLS-1$
+ public static final String ICON_TEXT_FORMATTING_HIDE = "icons/text-formatting-hide.gif"; //$NON-NLS-1$
+ public static final String ICON_BUNDLE_AS_EL_SHOW = "icons/bundle-as-el-show.gif"; //$NON-NLS-1$
+ public static final String ICON_BUNDLE_AS_EL_HIDE = "icons/bundle-as-el-hide.gif"; //$NON-NLS-1$
+
+ static String SELECT_BAR = "SELECT_LBAR"; //$NON-NLS-1$
+ private XulRunnerEditor xulRunnerEditor;
+ private nsIDOMEventTarget documentEventTarget;
+ private nsIDOMElement contentArea;
+ private nsIDOMNode headNode;
+ private nsIDOMEventTarget contentAreaEventTarget;
+ private MozillaDomEventListener contentAreaEventListener;
+
+ private EditorLoadWindowListener editorLoadWindowListener;
+ private EditorDomEventListener editorDomEventListener;
+ private IVpeToolBarManager vpeToolBarManager;
+ private FormatControllerManager formatControllerManager = new FormatControllerManager();
+ private VpeController controller;
+ private boolean isRefreshPage = false;
+ private String doctype;
+
+ private static Map<String, String> layoutIcons;
+ private static Map<String, String> layoutNames;
+ private static List<String> layoutValues;
+ private int currentOrientationIndex = 1;
+ private ToolItem rotateEditorsItem;
+ private ToolItem showNonVisualTagsItem;
+ private ToolItem showSelectionBarItem;
+ private ToolItem showBundlesAsELItem;
+ private ToolItem showTextFormattingItem;
+ private boolean showNonVisualTags = false;
+ private boolean showSelectionBar = true;
+ private boolean showTextFormatting = true;
+ private boolean showBundlesAsEL = false;
+
+ static {
+ /*
+ * Values from <code>layoutValues</code> should correspond to the order
+ * when increasing the index of the array will cause
+ * the source editor rotation
+ */
+ layoutIcons = new HashMap<String, String>();
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE, ICON_ORIENTATION_SOURCE_LEFT);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE, ICON_ORIENTATION_SOURCE_TOP);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE, ICON_ORIENTATION_VISUAL_LEFT);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_VERT_TOP_VISUAL_VALUE, ICON_ORIENTATION_VISUAI_TOP);
+
+ layoutNames = new HashMap<String, String>();
+ layoutNames.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE, VpeUIMessages.SPLITTING_HORIZ_LEFT_SOURCE);
+ layoutNames.put(IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE, VpeUIMessages.SPLITTING_VERT_TOP_SOURCE);
+ layoutNames.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE, VpeUIMessages.SPLITTING_HORIZ_LEFT_VISUAL);
+ layoutNames.put(IVpePreferencesPage.SPLITTING_VERT_TOP_VISUAL_VALUE, VpeUIMessages.SPLITTING_VERT_TOP_VISUAL);
+
+ layoutValues= new ArrayList<String>();
+ layoutValues.add(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE);
+ layoutValues.add(IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE);
+ layoutValues.add(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE);
+ layoutValues.add(IVpePreferencesPage.SPLITTING_VERT_TOP_VISUAL_VALUE);
+
+ }
+
+ /**
+ * Used for manupalation of browser in design mode,
+ * for example enable or disable readOnlyMode
+ */
+ private nsIEditor editor;
+ private VpeDropDownMenu dropDownMenu = null;
+ private ToolBar verBar = null;
+
+ public void doSave(IProgressMonitor monitor) {
+ }
+
+ public void doSaveAs() {
+ }
+
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ super.setSite(site);
+ super.setInput(input);
+ }
+
+ public void setInput(IEditorInput input) {
+ boolean isVisualRefreshRequired = (getEditorInput() != null && getEditorInput() != input && controller != null);
+ super.setInput(input);
+ if(isVisualRefreshRequired) controller.visualRefresh();
+ }
+
+ public boolean isDirty() {
+ return false;
+ }
+
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ public void setController(VpeController controller){
+ this.controller = controller;
+ formatControllerManager.setVpeController(controller);
+ controller.setToolbarFormatControllerManager(formatControllerManager);
+ }
+
+ public ToolBar createVisualToolbar(Composite parent) {
+ verBar = new ToolBar(parent, SWT.VERTICAL|SWT.FLAT);
+ verBar.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+
+ ToolItem item = null;
+ item = createToolItem(verBar, SWT.BUTTON1, ICON_PREFERENCE,
+ ICON_PREFERENCE_DISABLED, VpeUIMessages.PREFERENCES, true);
+ item.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ VpeEditorPreferencesPage.openPreferenceDialog();
+ }
+ });
+
+ item = createToolItem(verBar, SWT.BUTTON1, ICON_REFRESH,
+ ICON_REFRESH_DISABLED, VpeUIMessages.REFRESH, true);
+ item.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ if(controller!=null) {
+ controller.visualRefresh();
+ }
+ }
+ });
+
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-3966
+ * Disabling Page Design Options for external files.
+ */
+ IEditorInput input = getEditorInput();
+ IFile file = null;
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) input).getFile();
+ } else if (input instanceof ILocationProvider) {
+ ILocationProvider provider = (ILocationProvider) input;
+ IPath path = provider.getPath(input);
+ if (path != null) {
+ file = FileUtil.getFile(input, path.lastSegment());
+ }
+ }
+ boolean fileExistsInWorkspace = ((file != null) && (file.exists()));
+ item = createToolItem(verBar, SWT.BUTTON1, ICON_PAGE_DESIGN_OPTIONS,
+ ICON_PAGE_DESIGN_OPTIONS_DISABLED,
+ VpeUIMessages.PAGE_DESIGN_OPTIONS, fileExistsInWorkspace);
+ item.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ IEditorInput input = getEditorInput();
+ Object fileLocation = null;
+ if (input instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput) input).getFile();
+ fileLocation = file;
+ } else if (input instanceof ILocationProvider) {
+ ILocationProvider provider = (ILocationProvider) input;
+ IPath path = provider.getPath(input);
+ if (path != null) {
+ fileLocation = path;
+ }
+ }
+ if (null != fileLocation) {
+ VpeResourcesDialog dialogNew =
+ new VpeResourcesDialog(PlatformUI.getWorkbench().getDisplay()
+ .getActiveShell(), fileLocation);
+ dialogNew.open();
+ } else {
+ VpePlugin.getDefault().logError("Could not open Vpe Resources Dialog."); //$NON-NLS-1$
+ }
+ }
+ });
+
+ /*
+ * Create ROTATE EDITORS tool bar icon
+ */
+ createRotateEditorsItem(verBar);
+
+ /*
+ * Create SHOW INVISIBLE TAGS tool bar icon
+ */
+ createShowNonVisualTagsItem(verBar);
+
+ /*
+ * Create SHOW SELECTION BAR tool bar icon
+ */
+ createShowSelectionBarItem(verBar);
+
+ /*
+ * Create SHOW BUNDLE'S MESSAGES AS EL tool bar icon
+ */
+ createShowBundlesAsELItem(verBar);
+
+ verBar.pack();
+ return verBar;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createPartControl(final Composite parent) {
+ //Setting Layout for the parent Composite
+// parent.setLayout(new FillLayout());
+
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-4062
+ * Creating scrollable eclipse element.
+ */
+// ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+// sc.setLayout(new FillLayout());
+// Composite composite = new Composite(parent, SWT.NATIVE);
+
+ GridLayout layout = new GridLayout(2,false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 2;
+ layout.verticalSpacing = 2;
+ layout.horizontalSpacing = 2;
+ layout.marginBottom = 0;
+ parent.setLayout(layout);
+// composite.setLayout(layout);
+// composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+
+ // Editors and Toolbar composite
+ Composite cmpEdTl = new Composite(parent, SWT.NONE);
+ GridLayout layoutEdTl = new GridLayout(1, false);
+ layoutEdTl.verticalSpacing = 0;
+ layoutEdTl.marginHeight = 0;
+ layoutEdTl.marginBottom = 3;
+ layoutEdTl.marginWidth = 0;
+ cmpEdTl.setLayout(layoutEdTl);
+ cmpEdTl.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-4429
+ * Toolbar was moved to VpeEditorPart.
+ * 'verBar' should be created in createVisualToolbar(..) in VpeEditorPart
+ * and only after that MozillaEditor should be created itself.
+ */
+ if (null != verBar) {
+ // Use vpeToolBarManager to create a horizontal toolbar.
+ vpeToolBarManager = new VpeToolBarManager();
+ if (vpeToolBarManager != null) {
+ vpeToolBarManager.createToolBarComposite(cmpEdTl);
+ vpeToolBarManager.addToolBar(new TextFormattingToolBar(formatControllerManager));
+
+ /*
+ * Create SHOW TEXT FORMATTING tool bar icon
+ */
+ createShowTextFormattingItem(verBar);
+ }
+ }
+
+ //Create a composite to the Editor
+ Composite cmpEd = new Composite (cmpEdTl, SWT.NATIVE);
+ GridLayout layoutEd = new GridLayout(1, false);
+ layoutEd.marginBottom = 0;
+ layoutEd.marginHeight = 1;
+ layoutEd.marginWidth = 0;
+ layoutEd.marginRight = 0;
+ layoutEd.marginLeft = 1;
+ layoutEd.verticalSpacing = 0;
+ layoutEd.horizontalSpacing = 0;
+ cmpEd.setLayout(layoutEd);
+ cmpEd.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ //TODO Add a paintListener to cmpEd and give him a border top and left only
+ Color buttonDarker = parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
+ cmpEd.setBackground(buttonDarker);
+
+ try {
+ xulRunnerEditor = new XulRunnerEditor(cmpEd) {
+ public void onLoadWindow() {
+ // if the first load page
+ if (!isRefreshPage()) {
+ super.onLoadWindow();
+// MozillaEditor.this.onLoadWindow();
+ }
+ // if only refresh page
+ else {
+
+ MozillaEditor.this.onReloadWindow();
+ setRefreshPage(false);
+ }
+
+ }
+ public void onElementResize(nsIDOMElement element, int constrains, int top, int left, int width, int height) {
+ if (editorDomEventListener != null) {
+ editorDomEventListener.elementResized(element, constrains, top, left, width, height);
+ }
+ }
+ public void onShowTooltip(int x, int y, String text) {
+ if (editorDomEventListener != null) {
+ editorDomEventListener.onShowTooltip(x, y, text);
+ }
+ }
+ public void onHideTooltip() {
+ if (editorDomEventListener != null) {
+ editorDomEventListener.onHideTooltip();
+ }
+ }
+ public void onDispose() {
+ removeDomEventListeners();
+ super.onDispose();
+ }
+ };
+ xulRunnerEditor.getBrowser().addProgressListener(new ProgressListener() {
+
+ public void changed(ProgressEvent event) {
+ }
+
+ public void completed(ProgressEvent event) {
+ MozillaEditor.this.onLoadWindow();
+ xulRunnerEditor.getBrowser().removeProgressListener(this);
+ }
+
+ });
+
+ setInitialContent();
+ // Wait while visual part is loaded
+ //commented by mareshkau, fix for jbide-3032
+// while (!loaded) {
+// if (!Display.getCurrent().readAndDispatch())
+// Display.getCurrent().sleep();
+// }
+ xulRunnerEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ } catch (Throwable t) {
+ showXulRunnerException(cmpEd, t);
+ }
+
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-4062
+ * Computing elements sizes to set up scroll bars.
+ */
+// Point totalSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+// sc.setContent(composite);
+// sc.setExpandHorizontal(true);
+// sc.setExpandVertical(true);
+// sc.setMinSize(totalSize);
+ }
+
+ /**
+ * Sets initial content to the {@link xulRunnerEditor}.
+ *
+ * @see #INIT_FILE
+ */
+ protected void setInitialContent() {
+ final String html = DocTypeUtil.prepareInitFile(
+ INIT_FILE, getEditorInput());
+
+ // Workaround of JBIDE-4345.
+ // Due to a bug in org.eclipse.swt.browser.Mozilla we cannot simply
+ // set initial html code as xulRunnerEditor.setText(html).
+ // Instead of it we create a temporary file containing
+ // the html code and set it to the Mozilla browser as URL.
+ File tmp = null;
+ Writer out = null;
+ try {
+ tmp = File.createTempFile(
+ "temp", ".html"); //$NON-NLS-1$//$NON-NLS-2$
+ tmp.deleteOnExit();
+ out = new FileWriter(tmp);
+ out.write(html);
+ } catch (IOException e) {
+ VpePlugin.getPluginLog().logError(e);
+ } finally {
+ try {
+ if (out != null) {
+ out.close();
+ if (tmp != null) {
+ xulRunnerEditor.setURL("file://" //$NON-NLS-1$
+ + tmp.getCanonicalPath());
+ }
+ }
+ } catch (IOException e) {
+ VpePlugin.getPluginLog().logError(e);
+ } finally {
+ if (tmp != null) {
+ tmp.delete();
+ }
+ }
+ }
+ }
+
+ /**
+ * Logs given {@code throwable} and shows error message in
+ * the {@code parent} composite.
+ */
+ protected void showXulRunnerException(Composite parent,
+ Throwable throwable) {
+ String errorMessage = MessageFormat.format(
+ VpeUIMessages.MOZILLA_LOADING_ERROR, throwable.getMessage());
+
+ VpePlugin.getPluginLog().logError(errorMessage, throwable);
+
+ parent.setLayout(new GridLayout());
+ Composite statusComposite = new Composite(parent, SWT.NONE);
+ Color bgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ Color fgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
+ parent.setBackground(bgColor);
+ parent.setForeground(fgColor);
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.widthHint = 0;
+ gridData.heightHint = 0;
+ statusComposite.setLayoutData(gridData);
+
+ IStatus displayStatus = new Status(IStatus.ERROR,
+ VpePlugin.PLUGIN_ID, errorMessage, throwable);
+ new StatusPart(statusComposite, displayStatus);
+
+ final Link link = new Link(parent, SWT.WRAP);
+ link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+ link.setBackground(bgColor);
+ link.setText(VpeUIMessages.MOZILLA_LOADING_ERROR_LINK_TEXT);
+ link.setToolTipText(VpeUIMessages.MOZILLA_LOADING_ERROR_LINK);
+ link.setForeground(link.getDisplay().getSystemColor(SWT.COLOR_BLUE));
+
+ link.addMouseListener(new MouseListener() {
+ public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
+ BusyIndicator.showWhile(link.getDisplay(), new Runnable() {
+ public void run() {
+ URL theURL=null;;
+ try {
+ theURL = new URL(VpeUIMessages.MOZILLA_LOADING_ERROR_LINK);
+ } catch (MalformedURLException e) {
+ VpePlugin.reportProblem(e);
+ }
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
+ try {
+ support.getExternalBrowser().openURL(theURL);
+ } catch (PartInitException e) {
+ VpePlugin.reportProblem(e);
+ }
+ }
+ });
+ }
+
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+ }
+
+ private ToolItem createToolItem(ToolBar parent, int type, String image, String disabledImage,
+ String toolTipText, boolean isEnabled) {
+
+ ToolItem item = new ToolItem(parent, type);
+ item.setImage(ImageDescriptor
+ .createFromFile(MozillaEditor.class, image).createImage());
+ item.setToolTipText(toolTipText);
+ if(disabledImage.length()!=0) {
+ item.setDisabledImage(ImageDescriptor
+ .createFromFile(MozillaEditor.class, disabledImage).createImage());
+ }
+ item.setEnabled(isEnabled);
+ // add dispose listener
+ item.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ // dispose tollitem's image
+ ((ToolItem) e.widget).getImage().dispose();
+ }
+ });
+ return item;
+ }
+
+ public void setFocus() {
+ if(xulRunnerEditor!=null) {
+ xulRunnerEditor.setFocus();
+ } else {
+ //link.setFocus();
+ }
+ }
+
+ public void dispose() {
+ if (vpeToolBarManager != null) {
+ vpeToolBarManager.dispose();
+ vpeToolBarManager = null;
+ }
+
+ if (dropDownMenu != null) {
+ dropDownMenu.dispose();
+ dropDownMenu = null;
+ }
+
+// removeDomEventListeners();
+ if(getController()!=null) {
+ controller.dispose();
+ controller=null;
+ }
+ if (xulRunnerEditor != null) {
+ xulRunnerEditor.dispose();
+ xulRunnerEditor = null;
+ }
+
+ this.controller = null;
+ formatControllerManager.setVpeController(null);
+ formatControllerManager=null;
+ super.dispose();
+
+ }
+
+ public void setEditorLoadWindowListener(EditorLoadWindowListener listener) {
+ editorLoadWindowListener = listener;
+ }
+
+ public void setEditorDomEventListener(EditorDomEventListener listener) {
+ editorDomEventListener = listener;
+ if (getContentAreaEventListener() != null) {
+
+ getContentAreaEventListener().setEditorDomEventListener(listener);
+ }
+ }
+
+ public nsIDOMDocument getDomDocument() {
+ return xulRunnerEditor.getDOMDocument();
+ }
+
+
+ public nsIDOMElement getContentArea() {
+ return contentArea;
+ }
+ /**
+ * Sets content area element
+ * @return
+ */
+ protected void setContentArea(nsIDOMElement element) {
+
+ this.contentArea=element;
+ }
+
+ public nsIDOMNode getHeadNode() {
+ return headNode;
+ }
+
+ public Menu getMenu() {
+ return xulRunnerEditor.getBrowser().getMenu();
+ }
+
+ public Control getControl() {
+ return xulRunnerEditor.getBrowser();
+ }
+
+ protected nsIDOMElement findContentArea() {
+ nsIDOMElement area = null;
+ nsIDOMNodeList nodeList = xulRunnerEditor.getDOMDocument().getElementsByTagName(HTML.TAG_BODY);
+ long length = nodeList.getLength();
+ for(long i=0; i<length; i++) {
+ nsIDOMNode node = nodeList.item(i);
+ if (isContentArea(node)) {
+ if (node.getNodeType() != nsIDOMNode.ELEMENT_NODE) {
+ throw new RuntimeException("The content area node should by element node."); //$NON-NLS-1$
+ }
+
+ area = (nsIDOMElement) node.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ break;
+ }
+ }
+ if (area == null) {
+ //fix for jbide-3396, if we can't find a boody element, we should create it
+ area = xulRunnerEditor.getDOMDocument().createElement(HTML.TAG_BODY);
+ xulRunnerEditor.getDOMDocument().getDocumentElement().appendChild(area);
+ }
+
+ nsIDOMNode root = xulRunnerEditor.getDOMDocument().getDocumentElement();
+
+ headNode = findHeadNode(root);
+
+ return area;
+ }
+
+ private nsIDOMNode findHeadNode(nsIDOMNode root){
+ nsIDOMNode headNode = findChildNode(root, HTML.TAG_HEAD);
+ return headNode;
+ }
+
+ private nsIDOMNode findChildNode(nsIDOMNode parent, String name) {
+ nsIDOMNodeList list = parent.getChildNodes();
+ nsIDOMNode node;
+ for (int i=0;i<list.getLength();i++) {
+ node = list.item(i);
+ if (node.getNodeName().equalsIgnoreCase(name)) {
+ return node;
+ }
+ }
+ return null;
+ }
+
+ private boolean isContentArea(nsIDOMNode node) {
+ boolean ret = false;
+ if (HTML.TAG_BODY.equalsIgnoreCase(node.getNodeName())) {
+ nsIDOMNamedNodeMap map = node.getAttributes();
+ if (map != null) {
+ long length = map.getLength();
+ for (int i = 0; i < length; i++) {
+ nsIDOMNode attr = map.item(i);
+ ret = attr.getNodeType() == nsIDOMNode.ATTRIBUTE_NODE
+ && HTML.ATTR_ID.equalsIgnoreCase(attr.getNodeName())
+ && CONTENT_AREA_ID.equalsIgnoreCase(attr.getNodeValue());
+ if (ret) {
+ break;
+ }
+ }
+ }
+ }
+ return ret;
+ }
+
+ private void onLoadWindow() {
+ contentArea = findContentArea();
+ addDomEventListeners();
+ addSelectionListener();
+ if (editorLoadWindowListener != null) {
+ editorLoadWindowListener.load();
+ }
+ }
+
+ protected void addDomEventListeners() {
+ if (contentArea != null) {
+ if (getContentAreaEventListener() != null) {
+ getContentAreaEventListener().setVisualEditor(xulRunnerEditor);
+ setContentAreaEventTarget((nsIDOMEventTarget) contentArea.queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID));
+
+ //add mozilla event handlers
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.CLICKEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.MOUSEDOWNEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.MOUSEUPEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.MOUSEMOVEEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.CONTEXTMENUEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.DRAGDROPEVENT, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.DRAGENTEREVENT, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.DRAGEXITEVENT,getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.DRAGGESTUREEVENT, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.DRAGOVEREVENT, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().addEventListener(MozillaDomEventListener.DBLCLICK, getContentAreaEventListener(), false);
+ documentEventTarget = (nsIDOMEventTarget) xulRunnerEditor.getDOMDocument().queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
+ documentEventTarget.addEventListener(MozillaDomEventListener.KEYPRESS, getContentAreaEventListener(), false);
+ } else {
+ //baseEventListener = new MozillaBaseEventListener();
+ }
+ }
+ }
+
+ protected void removeDomEventListeners() {
+ if (getContentAreaEventTarget() != null && getContentAreaEventListener() != null) {
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.CLICKEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.MOUSEDOWNEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.MOUSEUPEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.MOUSEMOVEEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.CONTEXTMENUEVENTTYPE, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.DRAGDROPEVENT, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.DRAGENTEREVENT, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.DRAGEXITEVENT, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.DRAGGESTUREEVENT, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.DRAGOVEREVENT, getContentAreaEventListener(), false);
+ getContentAreaEventTarget().removeEventListener(MozillaDomEventListener.DBLCLICK, getContentAreaEventListener(), false);
+
+ if (xulRunnerEditor.getDOMDocument() != null && documentEventTarget != null) {
+ documentEventTarget.removeEventListener(MozillaDomEventListener.KEYPRESS, getContentAreaEventListener(), false);
+ }
+ getContentAreaEventListener().setVisualEditor(null);
+ getContentAreaEventListener().setEditorDomEventListener(null);
+ setContentAreaEventTarget(null);
+ setContentAreaEventListener(null);
+ documentEventTarget = null;
+ }
+ }
+
+ private void addSelectionListener() {
+ if (getContentAreaEventListener() != null&&xulRunnerEditor!=null) {
+
+ xulRunnerEditor.addSelectionListener(getContentAreaEventListener());
+
+ }
+ }
+
+ public void setSelectionRectangle(/*nsIDOMElement*/nsIDOMNode element, int resizerConstrains, boolean scroll) {
+ if (getContentAreaEventListener() != null) {
+ xulRunnerEditor.setSelectionRectangle(element, resizerConstrains, scroll);
+ }
+ }
+
+ /**
+ * Show resizer markers
+ */
+ public void showResizer() {
+ if (getContentAreaEventListener() != null) {
+ xulRunnerEditor.showResizer();
+ }
+ }
+
+ /**
+ * Hide resizer markers
+ */
+ public void hideResizer() {
+ if (getContentAreaEventListener() != null) {
+ xulRunnerEditor.hideResizer();
+ }
+ }
+
+ /**
+ * @return the xulRunnerEditor
+ */
+ public XulRunnerEditor getXulRunnerEditor() {
+ return xulRunnerEditor;
+ }
+
+ /**
+ * @param xulRunnerEditor the xulRunnerEditor to set
+ */
+ protected void setXulRunnerEditor(XulRunnerEditor xulRunnerEditor) {
+ this.xulRunnerEditor = xulRunnerEditor;
+ }
+
+ /**
+ * @return the controller
+ */
+ public VpeController getController() {
+ return controller;
+ }
+
+ /**
+ * @return the contentAreaEventTarget
+ */
+ public nsIDOMEventTarget getContentAreaEventTarget() {
+ return contentAreaEventTarget;
+ }
+
+ /**
+ * @param contentAreaEventTarget the contentAreaEventTarget to set
+ */
+ public void setContentAreaEventTarget(nsIDOMEventTarget contentAreaEventTarget) {
+ this.contentAreaEventTarget = contentAreaEventTarget;
+ }
+
+ /**
+ * @return the contentAreaEventListener
+ */
+ public MozillaDomEventListener getContentAreaEventListener() {
+ if(contentAreaEventListener==null) {
+
+ contentAreaEventListener = new MozillaDomEventListener();
+ }
+ return contentAreaEventListener;
+ }
+
+ /**
+ * @param contentAreaEventListener the contentAreaEventListener to set
+ */
+ public void setContentAreaEventListener(
+ MozillaDomEventListener contentAreaEventListener) {
+
+ this.contentAreaEventListener = contentAreaEventListener;
+ }
+
+
+ /**
+ *
+ */
+ private void onReloadWindow() {
+ removeDomEventListeners();
+ xulRunnerEditor.removeResizerListener();
+ contentArea = findContentArea();
+ addDomEventListeners();
+ addSelectionListener();
+ xulRunnerEditor.addResizerListener();
+ controller.reinit();
+ }
+
+ /**
+ *
+ */
+ public void reload() {
+
+ doctype = DocTypeUtil.getDoctype(getEditorInput());
+ //coused page to be refreshed
+ setRefreshPage(true);
+ setInitialContent();
+ }
+ /**
+ * Initialized design mode in visual refresh
+ */
+ public void initDesingMode() {
+ editor=null;
+ getEditor();
+ }
+
+ /**
+ * @return Doctype for document
+ */
+ public String getDoctype() {
+ return doctype;
+ }
+
+ private boolean isRefreshPage() {
+ return isRefreshPage;
+ }
+
+ public void setRefreshPage(boolean isRefreshPage) {
+ this.isRefreshPage = isRefreshPage;
+ }
+
+ public void reinitDesignMode() {
+ editor=null;
+ getEditor();
+ }
+ /**
+ * Returns Editor for This Document
+ * @return
+ */
+ public nsIEditor getEditor() {
+
+ if(editor==null) {
+ //creating editing session
+ nsIEditingSession iEditingSession = (nsIEditingSession) getXulRunnerEditor().
+ getComponentManager().createInstanceByContractID(XPCOM.NS_EDITINGSESSION_CONTRACTID, null, nsIEditingSession.NS_IEDITINGSESSION_IID);
+ //make window editable
+ iEditingSession.makeWindowEditable(getXulRunnerEditor().getWebBrowser().getContentDOMWindow(), "html", true,true,true); //$NON-NLS-1$
+ //here we setup editor for window
+ iEditingSession.setupEditorOnWindow(getXulRunnerEditor().getWebBrowser().getContentDOMWindow());
+ //getting some editor to disable some actions
+ editor = iEditingSession.getEditorForWindow(getXulRunnerEditor().getWebBrowser().getContentDOMWindow());
+ editor.setFlags(nsIPlaintextEditor.eEditorReadonlyMask);
+ //here we hide nsIHTMLObjectResizers
+ nsIHTMLObjectResizer htmlObjectResizer = (nsIHTMLObjectResizer) editor.queryInterface(nsIHTMLObjectResizer.NS_IHTMLOBJECTRESIZER_IID);
+ //we disable abject resizers
+ htmlObjectResizer.hideResizers();
+ htmlObjectResizer.setObjectResizingEnabled(false);
+ //here we getting position editor and disable it's too
+ nsIHTMLAbsPosEditor htmlAbsPosEditor = (nsIHTMLAbsPosEditor) editor.queryInterface(nsIHTMLAbsPosEditor.NS_IHTMLABSPOSEDITOR_IID);
+ htmlAbsPosEditor.setAbsolutePositioningEnabled(false);
+ //here we getting inline table editor and disable it's too
+ nsIHTMLInlineTableEditor inlineTableEditor = (nsIHTMLInlineTableEditor) editor.queryInterface(nsIHTMLInlineTableEditor.NS_IHTMLINLINETABLEEDITOR_IID);
+ inlineTableEditor.setInlineTableEditingEnabled(false);
+
+ }
+ return editor;
+ }
+
+ public VpeDropDownMenu getDropDownMenu() {
+ return dropDownMenu;
+ }
+
+ private void createShowNonVisualTagsItem(ToolBar parent) {
+ showNonVisualTags = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
+ showNonVisualTagsItem = createToolItem(parent, SWT.BUTTON1,
+ showNonVisualTags ? ICON_NON_VISUAL_TAGS_SHOW
+ : ICON_NON_VISUAL_TAGS_HIDE, "", //$NON-NLS-1$
+ showNonVisualTags ? VpeUIMessages.SHOW_NON_VISUAL_TAGS
+ : VpeUIMessages.HIDE_NON_VISUAL_TAGS, true);
+ showNonVisualTagsItem.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ /*
+ * Switch the value
+ */
+ showNonVisualTags = !showNonVisualTags;
+
+ /*
+ * Update icon and tooltip
+ */
+ updateShowNonVisualTagsItem(showNonVisualTags);
+ /*
+ * Change flag
+ */
+ controller.getVisualBuilder().setShowInvisibleTags(
+ showNonVisualTags);
+ /*
+ * Update VPE
+ */
+ controller.visualRefresh();
+ }
+ });
+ }
+
+ private void updateShowNonVisualTagsItem(boolean showInvisibleTags) {
+ showNonVisualTagsItem.setImage(ImageDescriptor.createFromFile(
+ MozillaEditor.class,
+ showInvisibleTags ? ICON_NON_VISUAL_TAGS_SHOW
+ : ICON_NON_VISUAL_TAGS_HIDE).createImage());
+ showNonVisualTagsItem.setToolTipText(showInvisibleTags ? VpeUIMessages.SHOW_NON_VISUAL_TAGS
+ : VpeUIMessages.HIDE_NON_VISUAL_TAGS);
+ }
+
+ private void createShowSelectionBarItem(ToolBar parent) {
+ showSelectionBar = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_SELECTION_TAG_BAR);
+ showSelectionBarItem = createToolItem(parent, SWT.BUTTON1,
+ showSelectionBar ? ICON_SELECTION_BAR_SHOW
+ : ICON_SELECTION_BAR_HIDE, "", //$NON-NLS-1$
+ showSelectionBar ? VpeUIMessages.SHOW_SELECTION_BAR
+ : VpeUIMessages.HIDE_SELECTION_BAR, true);
+ showSelectionBarItem.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ /*
+ * Switch the value
+ */
+ showSelectionBar = !showSelectionBar;
+ /*
+ * Update icon and tooltip
+ */
+ updateShowSelectionBarItem(showSelectionBar);
+
+ /*
+ * Update Selection Bar
+ */
+ controller.getPageContext().getEditPart().updateSelectionBar(showSelectionBar);
+ }
+ });
+ }
+
+ private void updateShowSelectionBarItem(boolean showSelectionBar) {
+ showSelectionBarItem.setImage(ImageDescriptor.createFromFile(
+ MozillaEditor.class,
+ showSelectionBar ? ICON_SELECTION_BAR_SHOW
+ : ICON_SELECTION_BAR_HIDE).createImage());
+ showSelectionBarItem
+ .setToolTipText(showSelectionBar ? VpeUIMessages.SHOW_SELECTION_BAR
+ : VpeUIMessages.HIDE_SELECTION_BAR);
+ }
+
+ private void createShowBundlesAsELItem(ToolBar parent) {
+ showBundlesAsEL = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL);
+ showBundlesAsELItem = createToolItem(parent, SWT.BUTTON1,
+ showBundlesAsEL ? ICON_BUNDLE_AS_EL_SHOW
+ : ICON_BUNDLE_AS_EL_HIDE, "", //$NON-NLS-1$
+ showBundlesAsEL ? VpeUIMessages.SHOW_BUNDLES_AS_EL
+ : VpeUIMessages.SHOW_BUNDLES_AS_MESSAGES, true);
+ showBundlesAsELItem.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ /*
+ * Switch the value
+ */
+ showBundlesAsEL = !showBundlesAsEL;
+ /*
+ * Update icon and tooltip
+ */
+ updateShowBundlesAsELItem(showBundlesAsEL);
+
+ /*
+ * Update bundle messages.
+ */
+ controller.getPageContext().getBundle().updateShowBundleUsageAsEL(showBundlesAsEL);
+ controller.visualRefresh();
+ }
+ });
+ }
+
+ private void updateShowBundlesAsELItem(boolean showBundlesAsEL) {
+ showBundlesAsELItem.setImage(ImageDescriptor.createFromFile(
+ MozillaEditor.class,
+ showBundlesAsEL ? ICON_BUNDLE_AS_EL_SHOW
+ : ICON_BUNDLE_AS_EL_HIDE).createImage());
+ showBundlesAsELItem
+ .setToolTipText(showBundlesAsEL ? VpeUIMessages.SHOW_BUNDLES_AS_EL
+ : VpeUIMessages.SHOW_BUNDLES_AS_MESSAGES);
+ }
+
+ private void createShowTextFormattingItem(ToolBar parent) {
+ showTextFormatting = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_TEXT_FORMATTING);
+ showTextFormattingItem = createToolItem(parent,
+ SWT.BUTTON1,
+ showTextFormatting ? ICON_TEXT_FORMATTING_SHOW
+ : ICON_TEXT_FORMATTING_HIDE, "", //$NON-NLS-1$
+ showTextFormatting ? VpeUIMessages.SHOW_TEXT_FORMATTING
+ : VpeUIMessages.HIDE_TEXT_FORMATTING, true);
+ showTextFormattingItem.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ /*
+ * Switch the value
+ */
+ showTextFormatting = !showTextFormatting;
+
+ /*
+ * Update icon and tooltip
+ */
+ updateShowTextFormattingItem(showTextFormatting);
+
+ /*
+ * Update Text Formatting Bar
+ */
+ vpeToolBarManager.setToolbarVisibility(showTextFormatting);
+ }
+ });
+ }
+
+ private void updateShowTextFormattingItem(boolean showTextFormatting) {
+ showTextFormattingItem.setImage(ImageDescriptor.createFromFile(
+ MozillaEditor.class,
+ showTextFormatting ? ICON_TEXT_FORMATTING_SHOW
+ : ICON_TEXT_FORMATTING_HIDE).createImage());
+ showTextFormattingItem
+ .setToolTipText(showTextFormatting ? VpeUIMessages.SHOW_TEXT_FORMATTING
+ : VpeUIMessages.HIDE_TEXT_FORMATTING);
+ }
+
+ private void createRotateEditorsItem(ToolBar parent) {
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-4152
+ * Compute initial icon state and add it to the tool bar.
+ */
+ String newOrientation = JspEditorPlugin
+ .getDefault().getPreferenceStore().getString(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING);
+ currentOrientationIndex = layoutValues.indexOf(newOrientation);
+ rotateEditorsItem = createToolItem(parent, SWT.BUTTON1,
+ layoutIcons.get(newOrientation),
+ ICON_ORIENTATION_SOURCE_LEFT_DISABLED,
+ layoutNames.get(newOrientation), true);
+
+ rotateEditorsItem.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ /*
+ * Rotate editors orientation clockwise.
+ */
+ currentOrientationIndex++;
+ if (currentOrientationIndex >= layoutValues.size()) {
+ currentOrientationIndex = currentOrientationIndex % layoutValues.size();
+ }
+ String newOrientation = layoutValues.get(currentOrientationIndex);
+ /*
+ * Update icon and tooltip
+ */
+ updateRotateEditorsItem(newOrientation);
+ /*
+ * Call <code>filContainer()</code> from VpeEditorPart
+ * to redraw CustomSashForm with new layout.
+ */
+ getController().getPageContext().getEditPart().fillContainer(true, newOrientation);
+ }
+ });
+ }
+
+ private void updateRotateEditorsItem(String newOrientation) {
+ rotateEditorsItem.setImage(ImageDescriptor.createFromFile(
+ MozillaEditor.class, layoutIcons.get(newOrientation))
+ .createImage());
+ rotateEditorsItem.setToolTipText(layoutNames.get(newOrientation));
+ }
+
+ public void updateToolbarItemsAccordingToPreferences() {
+ String prefsOrientation = JspEditorPlugin
+ .getDefault().getPreferenceStore().getString(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING);
+ int prefsOrientationIndex = layoutValues.indexOf(prefsOrientation);
+ boolean prefsShowNonVisualTags = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
+ boolean prefsShowSelectionBar = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IVpePreferencesPage.SHOW_SELECTION_TAG_BAR);
+ boolean prefsShowBundlesAsEL = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getBoolean(
+ IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL);
+ boolean prefsShowTextFormatting = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IVpePreferencesPage.SHOW_TEXT_FORMATTING);
+
+ if (currentOrientationIndex != prefsOrientationIndex) {
+ currentOrientationIndex = prefsOrientationIndex;
+ updateRotateEditorsItem(prefsOrientation);
+ }
+ if (showNonVisualTags != prefsShowNonVisualTags) {
+ showNonVisualTags = prefsShowNonVisualTags;
+ updateShowNonVisualTagsItem(showNonVisualTags);
+ }
+ if (showSelectionBar != prefsShowSelectionBar) {
+ showSelectionBar = prefsShowSelectionBar;
+ updateShowSelectionBarItem(showSelectionBar);
+ }
+ if (showBundlesAsEL != prefsShowBundlesAsEL) {
+ showBundlesAsEL = prefsShowBundlesAsEL;
+ updateShowBundlesAsELItem(showBundlesAsEL);
+ }
+ if (showTextFormatting != prefsShowTextFormatting) {
+ showTextFormatting = prefsShowTextFormatting;
+ updateShowTextFormattingItem(showTextFormatting);
+ }
+ }
+}
Added: workspace/mareshkau/jbosstools_XR1.9/VisualDomUtil.java
===================================================================
--- workspace/mareshkau/jbosstools_XR1.9/VisualDomUtil.java (rev 0)
+++ workspace/mareshkau/jbosstools_XR1.9/VisualDomUtil.java 2009-10-05 13:27:45 UTC (rev 17893)
@@ -0,0 +1,383 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.util;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.mozilla.interfaces.nsIAccessible;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMEvent;
+import org.mozilla.interfaces.nsIDOMMouseEvent;
+import org.mozilla.interfaces.nsIDOMNSRange;
+import org.mozilla.interfaces.nsIDOMNSUIEvent;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.interfaces.nsIDOMRange;
+import org.mozilla.interfaces.nsISelection;
+import org.mozilla.xpcom.XPCOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+public class VisualDomUtil {
+
+ public static String JSF_CORE_URI = "http://java.sun.com/jsf/core"; //$NON-NLS-1$
+ public static String JSF_HTML_URI = "http://java.sun.com/jsf/html"; //$NON-NLS-1$
+ public static String RICH_FACES_URI = "http://richfaces.org/rich"; //$NON-NLS-1$
+ public static String A4J_URI = "http://richfaces.org/a4j"; //$NON-NLS-1$
+ public static String FACELETS_URI = "http://java.sun.com/jsf/facelets"; //$NON-NLS-1$
+
+ private static final String ACCESSIBILITY_SERVICE_CONTRACT_ID = "@mozilla.org/accessibilityService;1"; //$NON-NLS-1$
+// private static Reference<nsIAccessibilityService> accessibilityServiceCache = null;
+
+ private static Set<String> escapedTags;
+
+ static {
+ escapedTags = new HashSet<String>();
+ escapedTags.add("f:facet"); //$NON-NLS-1$
+ escapedTags.add("f:selectItem"); //$NON-NLS-1$
+ escapedTags.add("f:selectItems"); //$NON-NLS-1$
+ }
+
+ static public nsIDOMNode getAncestorNode(nsIDOMNode visualNode, String tagName){
+ if (tagName == null) return null;
+ nsIDOMNode element = visualNode;
+ while (true){
+ if (tagName.equalsIgnoreCase(element.getNodeName())) {
+ return element;
+ }
+ element = element.getParentNode();
+ if (element == null) {
+ break;
+ }
+ }
+ return null;
+ }
+
+ public static Point getMousePoint(nsIDOMMouseEvent mouseEvent) {
+ nsIDOMNSUIEvent uiEvent = (nsIDOMNSUIEvent) mouseEvent.queryInterface(nsIDOMNSUIEvent.NS_IDOMNSUIEVENT_IID);
+ return new Point(uiEvent.getPageX(), uiEvent.getPageY());
+ }
+
+ public static long getChildCount(nsIDOMNode node) {
+ long count = 0;
+ nsIDOMNodeList children = node.getChildNodes();
+ if (children != null) {
+ count = children.getLength();
+ }
+ return count;
+ }
+
+ public static nsIDOMNode getChildNode(nsIDOMNode node, long index) {
+ nsIDOMNode child = null;
+ nsIDOMNodeList children = node.getChildNodes();
+ if (children != null && index >= 0 && index < children.getLength()) {
+ child = children.item(index);
+ }
+ return child;
+ }
+
+ public static long getOffset(nsIDOMNode node) {
+ long offset = 0;
+ nsIDOMNode previousSibling = node;
+ while ((previousSibling = previousSibling.getPreviousSibling()) != null) {
+ offset++;
+ }
+ return offset;
+ }
+
+ public static nsIDOMNode getTargetNode(nsIDOMEvent event) {
+ return (nsIDOMNode) event.getTarget().queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+ }
+
+ public static boolean isSelectionContains(nsISelection selection, nsIDOMNode parent, int offset) {
+ if (selection.getIsCollapsed()) {
+ return false;
+ }
+ nsIDOMRange range = selection.getRangeAt(0);
+ boolean inSelection = isRangeContains(range, parent, offset);
+ if (inSelection) {
+ nsIDOMNode endContainer = (nsIDOMNode)range.getEndContainer();
+ if (endContainer.getNodeType() != Node.TEXT_NODE) {
+ int endOffset = range.getEndOffset();
+ inSelection = !(parent.equals(endContainer) && offset == endOffset);
+ }
+ }
+ return inSelection;
+ }
+
+ public static boolean isRangeContains(nsIDOMRange range, nsIDOMNode parent, int offset) {
+ nsIDOMNSRange domNSRange = (nsIDOMNSRange) range.queryInterface(nsIDOMNSRange.NS_IDOMNSRANGE_IID);
+ boolean inRange = domNSRange.isPointInRange(parent, offset);
+ return inRange;
+ }
+
+ /**
+ * Appends all children of the {@code node} to its parent at the point before the {@code node}
+ * and removes the {@code node} from the list of its parent's children.
+ *
+ * @param node should be not null
+ */
+ public static void replaceNodeByItsChildren(nsIDOMNode node) {
+ final nsIDOMNodeList subTableContainerChildren = node.getChildNodes();
+ final nsIDOMNode containerParent = node.getParentNode();
+ if (subTableContainerChildren != null) {
+ final int length = (int) subTableContainerChildren.getLength();
+ for (int i = 0; i < length; i++) {
+ final nsIDOMNode child = subTableContainerChildren.item(i);
+ node.removeChild(child);
+ containerParent.insertBefore(child, node);
+ }
+ }
+ containerParent.removeChild(node);
+ }
+
+ /**
+ * Sets the style of the attribute of the element to the value.
+ * If the sub-attribute is present already, it replaces its value.
+ * <P/>
+ * Example: {@code <element attributeName="subAttributeName : subAttributeValue;">}
+ * <P/>
+ * Should be used mainly to set HTML STYLE attribute:
+ * {@code setSubAttribute(div, "STYLE", "width", "100%")}
+ */
+ public static void setSubAttribute(nsIDOMElement element,
+ String attributeName, String subAttributeName,
+ String subAttributeValue) {
+ String attributeValue = element.getAttribute(attributeName);
+ if (attributeValue == null) {
+ attributeValue = ""; //$NON-NLS-1$
+ } else {// remove old sub-attribute from the attributeValue
+ attributeValue = VpeStyleUtil.deleteFromString(attributeValue,
+ subAttributeName, Constants.SEMICOLON);
+ }
+ if (attributeValue.length() > 0) {
+ if (!attributeValue.endsWith(Constants.SEMICOLON))
+ attributeValue += Constants.SEMICOLON;
+ }
+
+ attributeValue += subAttributeName + Constants.COLON
+ + subAttributeValue + Constants.SEMICOLON;
+
+ element.setAttribute(attributeName, attributeValue);
+ }
+
+ /**
+ * Copies all attributes from source node to visual node.
+ *
+ * @param sourceNode the source node
+ * @param visualElement the visual element
+ */
+ public static void copyAttributes(Node sourceNode, nsIDOMElement visualElement) {
+ NamedNodeMap namedNodeMap = sourceNode.getAttributes();
+ for (int i = 0; i < namedNodeMap.getLength(); i++) {
+ Node attribute = namedNodeMap.item(i);
+ // added by Max Areshkau fix for JBIDE-1568
+ try {
+
+ visualElement.setAttribute(attribute.getNodeName(), attribute.getNodeValue());
+ } catch (XPCOMException ex) {
+ // if error-code not equals error for incorrect name throws
+ // exception
+ // error code is NS_ERROR_DOM_INVALID_CHARACTER_ERR=0x80530005
+ if (ex.errorcode != 2152923141L) {
+ throw ex;
+ }
+ // else we ignore this exception
+ }
+ }
+ }
+
+ /**
+ * Copies all attributes from source node to visual node.
+ *
+ * @param sourceElement the source element
+ * @param attributes list names of attributes which will copy
+ * @param visualElement the visual element
+ */
+ public static void copyAttributes(Element sourceElement, List<String> attributes, nsIDOMElement visualElement) {
+
+ if (attributes == null)
+ return;
+
+ for (String attributeName : attributes) {
+
+ String attributeValue = sourceElement.getAttribute(attributeName);
+ if (attributeValue != null)
+ visualElement.setAttribute(attributeName, attributeValue);
+ }
+
+ }
+
+ /**
+ * Returns instance of {@link nsIAccessibilityService}.
+ *
+ * @author yradtsevich
+ */
+// public static nsIAccessibilityService getAccessibilityService() {
+// nsIAccessibilityService accessibilityService = null;
+// if (accessibilityServiceCache != null) {
+// // get accessibilityService from cache
+// accessibilityService = accessibilityServiceCache.get();
+// }
+// if (accessibilityService == null) {
+// accessibilityService = (nsIAccessibilityService) Mozilla.getInstance()
+// .getServiceManager()
+// .getServiceByContractID(ACCESSIBILITY_SERVICE_CONTRACT_ID,
+// nsIAccessibilityService.NS_IACCESSIBILITYSERVICE_IID);
+//
+// // cache accessibilityService
+// accessibilityServiceCache = new SoftReference<nsIAccessibilityService>(accessibilityService);
+// }
+// return accessibilityService;
+// }
+
+ /**
+ * Returns on screen bounds of the {@code node}
+ *
+ * @param node cannot be {@code null}
+ * @return bounds of the {@code node} or {@code null} if it is not accessible
+ *
+ * @author yradtsevich
+ */
+ public static Rectangle getBounds(nsIDOMNode node) {
+ Rectangle bounds = null;
+
+ nsIAccessible accessible = (nsIAccessible) node.queryInterface(nsIAccessible.NS_IACCESSIBLE_IID);
+ if (accessible != null) {
+ int[] xArray = new int[1]; // Left hand corner of the node
+ int[] yArray = new int[1]; // Top corner of the node
+ int[] widthArray = new int[1]; // Width of the node
+ int[] heightArray = new int[1]; // Height of the node
+
+ accessible.getBounds(xArray, yArray, widthArray, heightArray);
+ bounds = new Rectangle(xArray[0], yArray[0], widthArray[0], heightArray[0]);
+ }
+
+ return bounds;
+ }
+
+ /**
+ * Creates HTML container (element) borders of that are
+ * complete invisible to user.
+ * <P>
+ * It can be used to wrap visual HTML elements and text nodes without
+ * changing of their view in VPE.
+ * <P>
+ * Tag <code>span</code> is used as a default container.
+ *
+ * @param visualDocument the visual document. It is used to create the container.
+ * @return created borderless container
+ * @author yradtsevich
+ * @see #createBorderlessContainer(nsIDOMDocument, String)
+ */
+ public static nsIDOMElement createBorderlessContainer(
+ nsIDOMDocument visualDocument) {
+ return createBorderlessContainer(visualDocument, HTML.TAG_SPAN);
+ }
+
+ /**
+ * Creates a HTML tag that is used as a borderless container
+ * for other elements.
+ *
+ * @param visualDocument the visual document.
+ * @param containerName the name of the tag, that will be used as a container.
+ *
+ * @return created borderless container
+ */
+ public static nsIDOMElement createBorderlessContainer(
+ nsIDOMDocument visualDocument, String containerName) {
+ nsIDOMElement element = visualDocument.createElement(containerName);
+ element.setAttribute(HTML.ATTR_CLASS, HTML.CLASS_VPE_TEXT);
+ return element;
+ }
+
+ /**
+ * Appends a container for {@code source}'s children
+ * to {@code target} and adds a new object of {@link VpeChildrenInfo}
+ * in a way that all children will be placed in this container.
+ * @param source source element, cannot be {@code null}
+ * @param target target element, cannot be {@code null}
+ * @param creationData the creation data, cannot be {@code null}
+ * @param visualDocument the visual document, cannot be {@code null}
+ */
+ public static void appendChildrenInsertionPoint(Element source,
+ nsIDOMElement target, VpeCreationData creationData, nsIDOMDocument visualDocument) {
+ nsIDOMElement childrenContainer = createBorderlessContainer(visualDocument);
+ target.appendChild(childrenContainer);
+
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(childrenContainer);
+
+ NodeList childNodes = source.getChildNodes();
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ childrenInfo.addSourceChild(childNodes.item(i));
+ }
+
+ creationData.addChildrenInfo(childrenInfo);
+ }
+
+ /**
+ * Creates visual tag with additional text container
+ *
+ * @param sourceElement
+ * the source element
+ * @param templateContainer
+ * visual tag that contains template element
+ * @param borderlessContainerName
+ * the name of the borderless container
+ * @param visualDocument
+ * the visual document
+ * @return created {@code VpeCreationData} based on specified container name
+ * or template container.
+ */
+ public static VpeCreationData createTemplateWithTextContainer(
+ Element sourceElement, nsIDOMElement templateContainer,
+ String borderlessContainerName, nsIDOMDocument visualDocument) {
+ List<Node> children = new ArrayList<Node>();
+ VpeCreationData creationData = null;
+ NodeList nodeList = sourceElement.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node child = nodeList.item(i);
+ /*
+ * Do not display escaped tags.
+ * These tags are correct and should be processed
+ * by templates themselves.
+ */
+ if (!escapedTags.contains(child.getNodeName()) ) {
+ children.add(child);
+ }
+ }
+ if (children != null && children.size() > 0) {
+ nsIDOMElement topContainer = createBorderlessContainer(visualDocument, borderlessContainerName);
+ nsIDOMElement textContainer = createBorderlessContainer(visualDocument, borderlessContainerName);
+ topContainer.appendChild(textContainer);
+ topContainer.appendChild(templateContainer);
+ creationData = new VpeCreationData(topContainer);
+ VpeChildrenInfo textInfo = new VpeChildrenInfo(textContainer);
+ creationData.addChildrenInfo(textInfo);
+ for (Node child : children) {
+ textInfo.addSourceChild(child);
+ }
+ } else {
+ creationData = new VpeCreationData(templateContainer);
+ }
+ return creationData;
+ }
+}
Added: workspace/mareshkau/jbosstools_XR1.9/XulRunnerBrowser.java
===================================================================
--- workspace/mareshkau/jbosstools_XR1.9/XulRunnerBrowser.java (rev 0)
+++ workspace/mareshkau/jbosstools_XR1.9/XulRunnerBrowser.java 2009-10-05 13:27:45 UTC (rev 17893)
@@ -0,0 +1,451 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.xulrunner.browser;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Listener;
+import org.jboss.tools.vpe.xulrunner.XPCOM;
+import org.jboss.tools.vpe.xulrunner.XulRunnerException;
+import org.mozilla.interfaces.nsIComponentManager;
+import org.mozilla.interfaces.nsIPrefService;
+import org.mozilla.interfaces.nsIRequest;
+import org.mozilla.interfaces.nsIServiceManager;
+import org.mozilla.interfaces.nsISupports;
+import org.mozilla.interfaces.nsITooltipListener;
+import org.mozilla.interfaces.nsIURI;
+import org.mozilla.interfaces.nsIWebBrowser;
+import org.mozilla.interfaces.nsIWebBrowserChrome;
+import org.mozilla.interfaces.nsIWebBrowserSetup;
+import org.mozilla.interfaces.nsIWebNavigation;
+import org.mozilla.interfaces.nsIWebProgress;
+import org.mozilla.interfaces.nsIWebProgressListener;
+import org.mozilla.xpcom.GREVersionRange;
+import org.mozilla.xpcom.Mozilla;
+import org.mozilla.xpcom.XPCOMException;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ * @author Sergey Vasilyev (svasilyev(a)exadel.com)
+ *
+ */
+
+public class XulRunnerBrowser implements nsIWebBrowserChrome,
+ nsIWebProgressListener, nsITooltipListener {
+ private static final String XULRUNNER_LOWER_VERSION = "1.9.1.0"; //$NON-NLS-1$
+ private static final String XULRUNNER_HIGHER_VERSION = "1.9.1.9"; //$NON-NLS-1$
+ // TODO Sergey Vasilyev Think. May be XULRUNNER_BUNDLE shouldn't be final?
+ private static final String XULRUNNER_BUNDLE;
+ private static final String XULRUNNER_ENTRY = "/xulrunner"; //$NON-NLS-1$
+
+ // TEMPORARY CODE (@see org.eclipse.swt.browser.Mozilla)
+ static final String XULRUNNER_INITIALIZED = "org.eclipse.swt.browser.XULRunnerInitialized"; //$NON-NLS-1$
+ static final String XULRUNNER_PATH = "org.eclipse.swt.browser.XULRunnerPath"; //$NON-NLS-1$
+
+ private static final String ROOT_BRANCH_NAME = ""; //$NON-NLS-1$
+
+ private static final String PREFERENCE_DISABLEOPENDURINGLOAD = "dom.disable_open_during_load"; //$NON-NLS-1$
+ private static final String PREFERENCE_DISABLEWINDOWSTATUSCHANGE = "dom.disable_window_status_change"; //$NON-NLS-1$
+
+ private static final Mozilla mozilla;
+ private Browser browser = null;
+ private nsIWebBrowser webBrowser = null;
+ private long chrome_flags = nsIWebBrowserChrome.CHROME_ALL;
+ protected static final long NS_ERROR_FAILURE = 0x80004005L;
+
+ static {
+ XULRUNNER_BUNDLE = (new StringBuffer("org.mozilla.xulrunner")) //$NON-NLS-1$
+ .append(".").append(Platform.getWS()) //$NON-NLS-1$
+ .append(".").append(Platform.getOS()) //$NON-NLS-1$
+ .append(Platform.OS_MACOSX.equals(Platform.getOS()) ? "" : (new StringBuffer(".")).append(Platform.getOSArch()).toString()) //$NON-NLS-1$ //$NON-NLS-2$
+ .toString();
+
+ mozilla = Mozilla.getInstance();
+ }
+
+ public XulRunnerBrowser(Composite parent) throws XulRunnerException {
+ initXulRunner();
+
+ browser = new Browser(parent, SWT.MOZILLA);
+
+ webBrowser = (nsIWebBrowser) browser.getWebBrowser();
+ if (webBrowser == null) {
+ throw new XulRunnerException("nsIWebBrowser is not available"); //$NON-NLS-1$
+ }
+
+ setBoolRootPref(PREFERENCE_DISABLEOPENDURINGLOAD, true);
+ setBoolRootPref(PREFERENCE_DISABLEWINDOWSTATUSCHANGE, true);
+
+ nsIWebBrowserSetup setup = (nsIWebBrowserSetup) webBrowser
+ .queryInterface(nsIWebBrowserSetup.NS_IWEBBROWSERSETUP_IID);
+ setup.setProperty(nsIWebBrowserSetup.SETUP_IS_CHROME_WRAPPER, 1);
+
+ // JBIDE-1329 Solution was contributed by Snjezana Peco
+// webBrowser.addWebBrowserListener(this,
+// nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
+ nsIServiceManager serviceManager = mozilla.getServiceManager();
+ nsIWebProgress webProgress = (nsIWebProgress) serviceManager
+ .getServiceByContractID("@mozilla.org/docloaderservice;1", //$NON-NLS-1$
+ nsIWebProgress.NS_IWEBPROGRESS_IID);
+ webProgress.addProgressListener(this, nsIWebProgress.NOTIFY_STATE_ALL);
+ webBrowser.addWebBrowserListener(this,
+ nsITooltipListener.NS_ITOOLTIPLISTENER_IID);
+ }
+
+ public synchronized void initXulRunner() throws XulRunnerException {
+ String xulRunnerPath = getXulRunnerPath();
+
+ if (!"true".equals(System.getProperty(XULRUNNER_INITIALIZED))) { //$NON-NLS-1$
+ File file = new File(xulRunnerPath);
+ mozilla.initialize(file);
+ mozilla.initEmbedding(file, file, new AppFileLocProvider(file));
+ System.setProperty(XULRUNNER_INITIALIZED, "true"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Decorate Widget.getDisplay()
+ */
+ public Display getDisplay() {
+ return browser.getDisplay();
+ }
+
+ /**
+ * Decorate Control.setCursor(org.eclipse.swt.graphics.Cursor)
+ */
+ public void setCursor(Cursor cursor) {
+ browser.setCursor(cursor);
+ }
+
+ /**
+ * Decorate Composite.setFocus()
+ */
+ public boolean setFocus() {
+ return browser.setFocus();
+ }
+
+ /**
+ * Decorate Control.setLayoutData(Object)
+ */
+ public void setLayoutData(Object layoutData) {
+ browser.setLayoutData(layoutData);
+ }
+
+ /**
+ * Decorate Widget.addListener(int eventType, Listener listener)
+ */
+ public void addListener(int eventType, Listener listener) {
+ browser.addListener(eventType, listener);
+ }
+
+ public void removeListener(int eventType, Listener listener) {
+ browser.removeListener(eventType, listener);
+ }
+
+ /**
+ * Decorate Widget.dispose()
+ */
+ public void dispose() {
+ //added by mareshkau, here we remove listener.
+ //if we hasn't do it, listener will be continue work even after close browser
+ nsIServiceManager serviceManager = mozilla.getServiceManager();
+ nsIWebProgress webProgress = (nsIWebProgress) serviceManager
+ .getServiceByContractID("@mozilla.org/docloaderservice;1", //$NON-NLS-1$
+ nsIWebProgress.NS_IWEBPROGRESS_IID);
+ try {
+ webProgress.removeProgressListener(this);
+ } catch(XPCOMException xpcomException) {
+
+ //this exception throws when progress listener already has been deleted,
+ //so just ignore if error code NS_ERROR_FAILURE
+ if(xpcomException.errorcode!=XulRunnerBrowser.NS_ERROR_FAILURE) {
+ throw xpcomException;
+ }
+ }
+ browser.dispose();
+ browser = null;
+ }
+
+ public static String getXulRunnerBundle() {
+ return XULRUNNER_BUNDLE;
+ }
+
+ public synchronized static String getXulRunnerPath() throws XulRunnerException {
+ //this function should be call
+ String xulRunnerPath = System.getProperty(XULRUNNER_PATH);
+ if (xulRunnerPath == null) {
+
+ GREVersionRange[] greRanges = {new GREVersionRange(XULRUNNER_LOWER_VERSION, true, XULRUNNER_HIGHER_VERSION, true)};
+ File xulRunnerFile = null;
+
+ // JBIDE-1222 begin
+ /*try {
+ if(!XULRUNNER_LOADING_INDICATOR) {
+
+ XULRUNNER_LOADING_INDICATOR=true;
+ //this function should be call
+ xulRunnerFile = Mozilla.getGREPathWithProperties(greRanges, null);
+ } else {
+
+ xulRunnerFile = null;
+ }
+ } catch (FileNotFoundException fnfe) {
+ // Ignre this exception. Will try to get XULRunner from plugin
+ }*/
+ // JBIDE-1222 end
+
+
+ Bundle xulRunnerBundle = Platform.getBundle(getXulRunnerBundle());
+ if (xulRunnerBundle == null) {
+ throw new XulRunnerException("Bundle " + getXulRunnerBundle() + " is not found."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String xulRunnerVersion = (String) xulRunnerBundle.getHeaders().get("Bundle-Version"); //$NON-NLS-1$
+ if (!greRanges[0].check(xulRunnerVersion)) {
+ throw new XulRunnerException("the version of the bundled XULRunner must be >= " + XulRunnerBrowser.XULRUNNER_LOWER_VERSION //$NON-NLS-1$
+ + " and <= " + XulRunnerBrowser.XULRUNNER_HIGHER_VERSION); //$NON-NLS-1$
+ }
+
+
+ URL url = xulRunnerBundle.getEntry(XULRUNNER_ENTRY);
+ if (url == null) {
+ throw new XulRunnerException("Bundle " + getXulRunnerBundle() + " doesn't contain " + XULRUNNER_ENTRY); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ try {
+ URL url1 = FileLocator.resolve(url);
+ xulRunnerFile = new File(FileLocator.toFileURL(url1).getFile());
+ } catch (IOException ioe) {
+ throw new XulRunnerException("Cannot get path to XULRunner from bundle " + getXulRunnerBundle(), ioe); //$NON-NLS-1$
+ }
+
+ xulRunnerPath = xulRunnerFile.getAbsolutePath();
+ System.setProperty(XULRUNNER_PATH, xulRunnerPath);
+ }
+
+
+ return xulRunnerPath;
+ }
+
+ public nsIServiceManager getServiceManager() {
+ return mozilla.getServiceManager();
+ }
+
+ public nsIComponentManager getComponentManager() {
+ return mozilla.getComponentManager();
+ }
+
+ public void setURL(String url) {
+ nsIWebNavigation webNavigation = (nsIWebNavigation) webBrowser.queryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
+ webNavigation.loadURI(url, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
+ }
+
+ public String getURL() {
+ nsIWebNavigation webNavigation = (nsIWebNavigation) webBrowser.queryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
+ return webNavigation.getCurrentURI().getSpec();
+ }
+
+ public void stop() {
+ nsIWebNavigation webNavigation = (nsIWebNavigation) webBrowser.queryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
+ webNavigation.stop(nsIWebNavigation.STOP_ALL);
+ }
+
+ public void reload() {
+ nsIWebNavigation webNavigation = (nsIWebNavigation) webBrowser.queryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
+ webNavigation.reload(nsIWebNavigation.LOAD_FLAGS_NONE);
+ }
+
+ public void goBack() {
+ nsIWebNavigation webNavigation = (nsIWebNavigation) webBrowser.queryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
+ webNavigation.goBack();
+ }
+
+ public void goForward() {
+ nsIWebNavigation webNavigation = (nsIWebNavigation) webBrowser.queryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
+ webNavigation.goForward();
+ }
+
+ public void onLoadWindow() {
+ }
+
+ public nsIPrefService getPrefService() {
+ return (nsIPrefService) getServiceManager().getServiceByContractID(XPCOM.NS_PREFSERVICE_CONTRACTID, nsIPrefService.NS_IPREFSERVICE_IID);
+ }
+
+
+ public void setBoolRootPref(String aPrefName, boolean aValue) {
+ getPrefService().getBranch(ROOT_BRANCH_NAME).setBoolPref(aPrefName, aValue ? 1 : 0);
+ }
+
+
+ public void setCharRootPref(String aPrefName, String aValue) {
+ getPrefService().getBranch(ROOT_BRANCH_NAME).setCharPref(aPrefName, aValue);
+ }
+
+
+ public void setComplexRootValue(String aPrefName, String aType, nsISupports aValue) {
+ getPrefService().getBranch(ROOT_BRANCH_NAME).setComplexValue(aPrefName, aType, aValue);
+ }
+
+ public void setIntRootPref(String aPrefName, int aValue) {
+ getPrefService().getBranch(ROOT_BRANCH_NAME).setIntPref(aPrefName, aValue);
+ }
+
+ public boolean getBoolRootPref(String aPrefName) {
+ return getPrefService().getBranch(ROOT_BRANCH_NAME).getBoolPref(aPrefName);
+ }
+
+ public String getCharRootPref(String aPrefName) {
+ return getPrefService().getBranch(ROOT_BRANCH_NAME).getCharPref(aPrefName);
+ }
+
+ public nsISupports getComplextRootPref(String aPrefName, String aType) {
+ return getPrefService().getBranch(ROOT_BRANCH_NAME).getComplexValue(aPrefName, aType);
+ }
+
+ public int getIntRootf(String aPrefName) {
+ return getPrefService().getBranch(ROOT_BRANCH_NAME).getIntPref(aPrefName);
+ }
+
+ /*
+ * nsISupports
+ *
+ * @see org.mozilla.interfaces.nsISupports#queryInterface(java.lang.String)
+ */
+ public nsISupports queryInterface(String arg0) {
+ return Mozilla.queryInterface(this, arg0);
+ }
+
+ /*
+ * nsIWebBrowserChrome
+ *
+ * @see org.mozilla.interfaces.nsIWebBrowserChrome
+ */
+ public void destroyBrowserWindow() {
+ // TODO Sergey Vasilyev implement
+ throw new RuntimeException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void exitModalEventLoop(long arg0) {
+ throw new RuntimeException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public long getChromeFlags() {
+ return chrome_flags;
+ }
+
+ public nsIWebBrowser getWebBrowser() {
+ return webBrowser;
+ }
+
+ public boolean isWindowModal() {
+ // TODO Sergey Vasilyev implement
+ return false;
+ }
+
+ public void setChromeFlags(long arg0) {
+ chrome_flags = arg0;
+ }
+
+ public void setStatus(long arg0, String arg1) {
+ // TODO Sergey Vasilyev implement
+ throw new RuntimeException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void setWebBrowser(nsIWebBrowser arg0) {
+ webBrowser = arg0;
+ }
+
+ public void showAsModal() {
+ // TODO Sergey Vasilyev implement
+ throw new RuntimeException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void sizeBrowserTo(int arg0, int arg1) {
+ // TODO Sergey Vasilyev implement
+ throw new RuntimeException("Not implemented"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.mozilla.interfaces.nsIWebProgressListener#onLocationChange(org.mozilla.interfaces.nsIWebProgress, org.mozilla.interfaces.nsIRequest, org.mozilla.interfaces.nsIURI)
+ */
+ public void onLocationChange(nsIWebProgress arg0, nsIRequest arg1,
+ nsIURI arg2) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.mozilla.interfaces.nsIWebProgressListener#onProgressChange(org.mozilla.interfaces.nsIWebProgress, org.mozilla.interfaces.nsIRequest, int, int, int, int)
+ */
+ public void onProgressChange(nsIWebProgress arg0, nsIRequest arg1,
+ int arg2, int arg3, int arg4, int arg5) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.mozilla.interfaces.nsIWebProgressListener#onSecurityChange(org.mozilla.interfaces.nsIWebProgress, org.mozilla.interfaces.nsIRequest, long)
+ */
+ public void onSecurityChange(nsIWebProgress arg0, nsIRequest arg1, long arg2) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.mozilla.interfaces.nsIWebProgressListener#onStateChange(org.mozilla.interfaces.nsIWebProgress, org.mozilla.interfaces.nsIRequest, long, long)
+ */
+ public void onStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, long aStateFlags, long aStstus) {
+ if ((aStateFlags & nsIWebProgressListener.STATE_IS_WINDOW) != 0
+ && (aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) {
+ onLoadWindow();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.mozilla.interfaces.nsIWebProgressListener#onStatusChange(org.mozilla.interfaces.nsIWebProgress, org.mozilla.interfaces.nsIRequest, long, java.lang.String)
+ */
+ public void onStatusChange(nsIWebProgress arg0, nsIRequest arg1, long aStatus, String message) {
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.mozilla.interfaces.nsITooltipListener#onHideTooltip()
+ */
+ public void onHideTooltip() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.mozilla.interfaces.nsITooltipListener#onShowTooltip(int, int, java.lang.String)
+ */
+ public void onShowTooltip(int aXCoords, int aYCoords, String aTipText) {
+ }
+
+ /**
+ * @return the browser
+ */
+ public Browser getBrowser() {
+ return browser;
+ }
+
+ protected void onDispose() {
+
+ }
+
+ public void setText(String html) {
+ browser.setText(html);
+ }
+}
14 years, 8 months
JBoss Tools SVN: r17892 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-10-05 09:00:01 -0400 (Mon, 05 Oct 2009)
New Revision: 17892
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-498 - renaming the image first_seam50.png to first_seam15.png;
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2009-10-05 12:58:28 UTC (rev 17891)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2009-10-05 13:00:01 UTC (rev 17892)
@@ -276,7 +276,7 @@
<para>Now you just need to start the server by clicking on the Start the server icon (
<inlinemediaobject>
<imageobject>
- <imagedata fileref="images/first_seam/first_seam50.png"/>
+ <imagedata fileref="images/first_seam/first_seam15.png"/>
</imageobject>
</inlinemediaobject> ) in the
JBoss Server View.</para>
14 years, 8 months
JBoss Tools SVN: r17889 - trunk/documentation/guides/GettingStartedGuide/en/images/manage.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-10-05 07:55:06 -0400 (Mon, 05 Oct 2009)
New Revision: 17889
Removed:
trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_10.png
trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_12.png
trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_13.png
trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_14.png
trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_2.png
trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_5.png
trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_7.png
Log:
https://jira.jboss.org/jira/browse/JBDS-498 - deleting unused image;
Deleted: trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_10.png
===================================================================
(Binary files differ)
Deleted: trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_12.png
===================================================================
(Binary files differ)
Deleted: trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_13.png
===================================================================
(Binary files differ)
Deleted: trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_14.png
===================================================================
(Binary files differ)
Deleted: trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_2.png
===================================================================
(Binary files differ)
Deleted: trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_5.png
===================================================================
(Binary files differ)
Deleted: trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_7.png
===================================================================
(Binary files differ)
14 years, 8 months
JBoss Tools SVN: r17887 - workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences.
by jbosstools-commits@lists.jboss.org
Author: yzhishko
Date: 2009-10-05 07:40:29 -0400 (Mon, 05 Oct 2009)
New Revision: 17887
Modified:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/PreferencesTestCase.java
Log:
Messages fixed for Preferences dialog.
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/PreferencesTestCase.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/PreferencesTestCase.java 2009-10-05 10:58:26 UTC (rev 17886)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/PreferencesTestCase.java 2009-10-05 11:40:29 UTC (rev 17887)
@@ -21,7 +21,7 @@
protected static final String SHOW_RESOURCE_BUNDLES = "Show resource bundles usage as EL expressions";
protected static final String ASK_FOR_ATTRIBUTES = "Ask for tag attributes during tag insert";
protected static final String ASK_FOR_CONFIRM = "Ask for confirmation when closing Selection Bar";
- protected static final String SELECT_DEFAULT_TAB = "Select the default active editor's tab for files that haven't been previously opened in the VPE";
+ protected static final String SELECT_DEFAULT_TAB = "Select the default active editor's tab";
protected static final String EDITOR_SPLITTING = "Visual/Source editors splitting";
protected static final String SHOW_TEXY_FORMAT = "Show text formatting bar";
protected static final String PREF_TOOLTIP = "Preferences";
@@ -90,7 +90,7 @@
void setPreferencesToDefault() throws WidgetNotFoundException{
SWTBotCheckBox checkBox = bot.checkBox(SHOW_BORDER_FOR_UNKNOWN_TAGS);
- if (checkBox.isChecked()) {
+ if (!checkBox.isChecked()) {
checkBox.click();
}
checkBox = bot.checkBox(SHOW_NON_VISUAL_TAGS);
@@ -117,9 +117,9 @@
if (!checkBox.isChecked()) {
checkBox.click();
}
- SWTBotCombo combo = bot.comboBoxWithLabel("Select the default active editor's tab for files that haven't been previously opened in the VPE");
+ SWTBotCombo combo = bot.comboBoxWithLabel(SELECT_DEFAULT_TAB);
combo.setSelection("Visual/Source");
- combo = bot.comboBoxWithLabel("Visual/Source editors splitting");
+ combo = bot.comboBoxWithLabel(EDITOR_SPLITTING);
combo.setSelection("Vertical splitting with Source Editor on the top");
}
14 years, 8 months
JBoss Tools SVN: r17886 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-10-05 06:58:26 -0400 (Mon, 05 Oct 2009)
New Revision: 17886
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4872
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2009-10-05 10:05:59 UTC (rev 17885)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2009-10-05 10:58:26 UTC (rev 17886)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Copyright (c) 2008-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,
@@ -39,6 +39,7 @@
import org.hibernate.FetchMode;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Mappings;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefEntityInfo;
@@ -181,8 +182,7 @@
entry.setValue(subclass);
}
} catch (JavaModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ HibernateConsolePlugin.getDefault().log(e);
}
}
return pcCopy.values();
@@ -248,8 +248,8 @@
Table table = new Table(className.toUpperCase());
RootClass rootClass = new RootClass();
rootClass.setEntityName( className );
- rootClass.setClassName( entryInfo.getFullyQualifiedName() );
- rootClass.setProxyInterfaceName( className );
+ rootClass.setClassName( entryInfo.getFullyQualifiedName() );
+ rootClass.setProxyInterfaceName( entryInfo.getFullyQualifiedName() );
rootClass.setLazy(true);
rootClass.setTable(table);
rootClass.setAbstract(entryInfo.isAbstractFlag());//abstract or interface
@@ -406,7 +406,7 @@
key.addColumn(new Column(entityInfo.getPrimaryIdName().toUpperCase()));
}
array.setKey(key);
- array.setFetchMode(FetchMode.SELECT);
+ array.setFetchMode(FetchMode.JOIN);
SimpleValue index = new SimpleValue();
//add default index
@@ -511,7 +511,7 @@
Column column = new Column(varName.toUpperCase());
sValue.addColumn(column);
sValue.setTypeName(tb.getBinaryName());
- sValue.setFetchMode(FetchMode.SELECT);
+ sValue.setFetchMode(FetchMode.JOIN);
sValue.setReferencedEntityName(ref.fullyQualifiedName);
buildProperty(sValue);
prop.setCascade("none");//$NON-NLS-1$
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java 2009-10-05 10:05:59 UTC (rev 17885)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java 2009-10-05 10:58:26 UTC (rev 17886)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2008-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.hibernate.eclipse.jdt.ui.wizards;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -22,7 +32,13 @@
import org.eclipse.swt.widgets.Composite;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
+@SuppressWarnings("restriction")
public class NewHibernateMappingElementsSelectionPage extends WizardPage {
+
+ // sizing constants
+ private static final int SIZING_SELECTION_PANE_WIDTH = 320;
+
+ private static final int SIZING_SELECTION_PANE_HEIGHT = 300;
// the current selection
private IStructuredSelection fCurrentSelection;
@@ -37,8 +53,13 @@
}
public void createControl(Composite parent) {
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = SIZING_SELECTION_PANE_WIDTH;
+ gd.heightHint = SIZING_SELECTION_PANE_HEIGHT;
+ parent.setLayoutData(gd);
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
+
createTreeViewer(composite);
fViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
setControl(composite);
@@ -54,7 +75,7 @@
}
protected TreeViewer createTreeViewer(Composite composite) {
- int style = SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
+ int style = SWT.BORDER | SWT.V_SCROLL | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
fViewer = new TreeViewer(composite, style);
fViewer.setContentProvider(new StandardJavaElementContentProvider());
fViewer.setLabelProvider(new JavaElementLabelProvider());
14 years, 8 months