Author: yradtsevich
Date: 2011-06-17 14:32:11 -0400 (Fri, 17 Jun 2011)
New Revision: 32164
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/VpeXulrunnerMessages.java
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/messages.properties
trunk/vpe/plugins/org.jboss.tools.xulrunner.initializer/src/org/eclipse/swt/browser/XULRunnerInitializer.java
Log:
JBIDE-9188: add system property to allow explicit disabling of the visual page in VPE
- introduced a command line parameter, that disables VPE
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/VpeXulrunnerMessages.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/VpeXulrunnerMessages.java 2011-06-17
15:18:08 UTC (rev 32163)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/VpeXulrunnerMessages.java 2011-06-17
18:32:11 UTC (rev 32164)
@@ -9,6 +9,7 @@
public static String XulRunnerBrowser_cannotGetPathToXulrunner;
public static String XulRunnerBrowser_notAvailable;
public static String XulRunnerBrowser_wrongVersion;
+ public static String XulRunnerBrowser_embeddedXulRunnerIsDisabledByOption;
public static String CURRENT_PLATFORM_IS_NOT_SUPPORTED;
static {
// initialize resource bundle
Modified:
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 2011-06-17
15:18:08 UTC (rev 32163)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2011-06-17
18:32:11 UTC (rev 32164)
@@ -67,7 +67,12 @@
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 String PREFERENCE_DISABLEWINDOWSTATUSCHANGE =
"dom.disable_window_status_change"; //$NON-NLS-1$
+
+ /* XXX: yradtsevich: these constants are duplicated
+ * in XULRunnerInitializer, see JBIDE-9188 */
+ private static final String LOAD_XULRUNNER_SYSTEM_PROPERTY =
"org.jboss.tools.vpe.loadxulrunner";//$NON-NLS-1$
+ private static boolean EMBEDDED_XULRUNNER_ENABLED =
!"false".equals(System.getProperty(LOAD_XULRUNNER_SYSTEM_PROPERTY));
//$NON-NLS-1$
private Browser browser = null;
private nsIWebBrowser webBrowser = null;
@@ -103,7 +108,8 @@
}
public XulRunnerBrowser(Composite parent) throws XulRunnerException {
-// initXulRunner();
+ ensureEmbeddedXulRunnerEnabled();
+
if(Platform.OS_MACOSX.equals(Platform.getOS())){
getXulRunnerPath();
}
@@ -135,17 +141,6 @@
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()
*/
@@ -201,6 +196,7 @@
}
public synchronized static String getXulRunnerPath() throws XulRunnerException {
+ ensureEmbeddedXulRunnerEnabled();
//this function should be call
String xulRunnerPath = System.getProperty(XULRUNNER_PATH);
if (xulRunnerPath == null) {
@@ -263,6 +259,19 @@
return xulRunnerPath;
}
+
+ /**
+ * Check if embedded XULRunner is not disabled by {@link #EMBEDDED_XULRUNNER_ENABLED}
+ * system property. If it is, then throws a {@link XulRunnerException}.
+ *
+ * @see <a
href="https://issues.jboss.org/browse/JBIDE-9188">JBIDE-9188...
+ */
+ private static void ensureEmbeddedXulRunnerEnabled() throws XulRunnerException {
+ if (!EMBEDDED_XULRUNNER_ENABLED) {
+ throw new XulRunnerException(MessageFormat.format(
+ VpeXulrunnerMessages.XulRunnerBrowser_embeddedXulRunnerIsDisabledByOption,
LOAD_XULRUNNER_SYSTEM_PROPERTY));
+ }
+ }
public nsIServiceManager getServiceManager() {
return mozilla.getServiceManager();
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/messages.properties
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/messages.properties 2011-06-17
15:18:08 UTC (rev 32163)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/messages.properties 2011-06-17
18:32:11 UTC (rev 32164)
@@ -3,4 +3,5 @@
XulRunnerBrowser_cannotGetPathToXulrunner=Cannot get path to XULRunner from bundle {0}
XulRunnerBrowser_notAvailable=nsIWebBrowser is not available
XulRunnerBrowser_wrongVersion=the version of the bundled XULRunner {0} must be >= {1}
and <= {2}
-CURRENT_PLATFORM_IS_NOT_SUPPORTED=Current platform ''{0}'' is not
supported.
+XulRunnerBrowser_embeddedXulRunnerIsDisabledByOption=Embedded XULRunner is disabled by
the option ''-D{0}=false''
+CURRENT_PLATFORM_IS_NOT_SUPPORTED=Current platform ''{0}'' is not
supported.
\ No newline at end of file
Modified:
trunk/vpe/plugins/org.jboss.tools.xulrunner.initializer/src/org/eclipse/swt/browser/XULRunnerInitializer.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.xulrunner.initializer/src/org/eclipse/swt/browser/XULRunnerInitializer.java 2011-06-17
15:18:08 UTC (rev 32163)
+++
trunk/vpe/plugins/org.jboss.tools.xulrunner.initializer/src/org/eclipse/swt/browser/XULRunnerInitializer.java 2011-06-17
18:32:11 UTC (rev 32164)
@@ -13,8 +13,19 @@
private static final String XULRUNNER_PATH =
"org.eclipse.swt.browser.XULRunnerPath"; //$NON-NLS-1$
private static final String XULRUNNER_ENTRY = "/xulrunner"; //$NON-NLS-1$
+
+ /* XXX: yradtsevich: these constants are duplicated
+ * in XulRunnerBrowser, see JBIDE-9188 */
+ private static final String LOAD_XULRUNNER_SYSTEM_PROPERTY =
"org.jboss.tools.vpe.loadxulrunner";//$NON-NLS-1$
+ private static boolean EMBEDDED_XULRUNNER_ENABLED =
!"false".equals(System.getProperty(LOAD_XULRUNNER_SYSTEM_PROPERTY));
//$NON-NLS-1$ //$NON-NLS-2$
static {
+ if (EMBEDDED_XULRUNNER_ENABLED) {
+ initializeXULRunner();
+ }
+ }
+
+ private static void initializeXULRunner() {
String xulrunnerPath = System.getProperty(XULRUNNER_PATH);
if (xulrunnerPath != null) {
File xulrunnerFile = new File(xulrunnerPath);