JBoss Tools SVN: r26716 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-18 10:51:42 -0500 (Thu, 18 Nov 2010)
New Revision: 26716
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
Log:
[JBIDE-7628] cleanup (code is just to nested to understand what's being initialized at what moment)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-11-18 15:51:04 UTC (rev 26715)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-11-18 15:51:42 UTC (rev 26716)
@@ -15,6 +15,7 @@
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -69,12 +70,6 @@
private InstanceViewLabelAndContentProvider contentProvider;
- private InstanceView parentView;
-
- public InstanceView() {
- parentView = this;
- }
-
private ModifyListener cloudModifyListener = new ModifyListener() {
@Override
@@ -83,9 +78,9 @@
if (index < 0) {
return;
}
-
+
if (currCloud != null) {
- currCloud.removeInstanceListListener(parentView);
+ currCloud.removeInstanceListListener(InstanceView.this);
}
currCloud = clouds[index];
storeSelectedCloud();
@@ -94,7 +89,7 @@
@Override
public void run() {
viewer.setInput(currCloud);
- currCloud.addInstanceListListener(parentView);
+ currCloud.addInstanceListListener(InstanceView.this);
viewer.refresh();
}
@@ -111,6 +106,8 @@
}
};
+ private Label cloudSelectorLabel;
+
private class ColumnListener extends SelectionAdapter {
private int column;
@@ -152,8 +149,11 @@
layout.marginWidth = 0;
container.setLayout(layout);
- Label cloudSelectorLabel = createCloudSelector();
+ clouds = DeltaCloudManager.getDefault().getClouds();
+ createCloudSelector();
+ initCloudSelector(getLastSelectedCloud(), cloudSelector, clouds);
+
filterLabel = new Label(container, SWT.NULL);
filterLabel.setText(CVMessages.getString(FILTERED_LABEL));
filterLabel.setToolTipText(CVMessages.getString(FILTERED_TOOLTIP));
@@ -161,14 +161,11 @@
Composite tableArea = new Composite(container, SWT.NULL);
viewer = createTableViewer(tableArea);
- if (currCloud != null) {
- currCloud.removeInstanceListListener(parentView);
- viewer.setInput(currCloud);
- currCloud.addInstanceListListener(parentView);
- IInstanceFilter filter = currCloud.getInstanceFilter();
- filterLabel.setVisible(!filter.toString().equals(IInstanceFilter.ALL_STRING));
- }
+ currCloud = getCurrentCloud(cloudSelector.getSelectionIndex(), clouds);
+ initCurrentCloud(currCloud, viewer);
+ setFilterLabelVisible(currCloud, filterLabel);
+
Point p1 = cloudSelectorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point p2 = cloudSelector.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int centering = (p2.y - p1.y + 1) / 2;
@@ -203,6 +200,38 @@
DeltaCloudManager.getDefault().addCloudManagerListener(this);
}
+ private void setFilterLabelVisible(DeltaCloud currentCloud, Label filterLabel) {
+ if (currentCloud == null) {
+ filterLabel.setVisible(false);
+ return;
+ }
+
+ IInstanceFilter filter = currentCloud.getInstanceFilter();
+ filterLabel.setVisible(!filter.toString().equals(IInstanceFilter.ALL_STRING));
+ }
+
+ private void initCurrentCloud(DeltaCloud currentCloud, Viewer viewer) {
+ if (currentCloud != null) {
+ currentCloud.removeInstanceListListener(this);
+ viewer.setInput(currentCloud);
+ currentCloud.addInstanceListListener(this);
+ }
+ }
+
+ private DeltaCloud getCurrentCloud(int selectedCloudIndex, DeltaCloud[] clouds) {
+ if (selectedCloudIndex < 0) {
+ return null;
+ }
+
+ return clouds[selectedCloudIndex];
+ }
+
+ private String getLastSelectedCloud() {
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String lastSelectedCloud = prefs.get(IDeltaCloudPreferenceConstants.LAST_CLOUD_INSTANCE_VIEW, "");
+ return lastSelectedCloud;
+ }
+
private TableViewer createTableViewer(Composite tableArea) {
TableColumnLayout tableLayout = new TableColumnLayout();
tableArea.setLayout(tableLayout);
@@ -237,12 +266,11 @@
}
}
- private Label createCloudSelector() {
- Label cloudSelectorLabel = new Label(container, SWT.NULL);
+ private void createCloudSelector() {
+ this.cloudSelectorLabel = new Label(container, SWT.NULL);
cloudSelectorLabel.setText(CVMessages.getString(CLOUD_SELECTOR_LABEL));
- cloudSelector = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
- initializeCloudSelector();
+ this.cloudSelector = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
cloudSelector.addModifyListener(cloudModifyListener);
// Following is a kludge so that on Linux the Combo is read-only but
// has a white background.
@@ -252,7 +280,6 @@
e.doit = false;
}
});
- return cloudSelectorLabel;
}
private void hookContextMenu(Control control) {
@@ -260,23 +287,17 @@
UIUtils.registerContributionManager(UIUtils.getContextMenuId(ID), contextMenu, control);
}
- private void initializeCloudSelector() {
- int defaultIndex = 0;
- clouds = DeltaCloudManager.getDefault().getClouds();
+ private void initCloudSelector(String cloudToSelect, Combo cloudSelector, DeltaCloud[] clouds) {
+ int selectedIndex = 0;
String[] cloudNames = new String[clouds.length];
- // If we have saved the last cloud used from a previous session,
- // default to using that cloud to start unless it no longer exists
- Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
- String lastCloudUsed = prefs.get(IDeltaCloudPreferenceConstants.LAST_CLOUD_INSTANCE_VIEW, "");
for (int i = 0; i < clouds.length; ++i) {
cloudNames[i] = clouds[i].getName();
- if (cloudNames[i].equals(lastCloudUsed))
- defaultIndex = i;
+ if (cloudNames[i].equals(cloudToSelect))
+ selectedIndex = i;
}
- cloudSelector.setItems(cloudNames);
- if (clouds.length > 0) {
- cloudSelector.setText(cloudNames[defaultIndex]);
- currCloud = clouds[defaultIndex];
+ if (cloudNames.length > 0) {
+ cloudSelector.setItems(cloudNames);
+ cloudSelector.setText(cloudNames[selectedIndex]);
}
}
@@ -315,16 +336,16 @@
public void listChanged(DeltaCloud cloud, final DeltaCloudInstance[] instances) {
// Run following under Display thread since this can be
// triggered by a non-display thread notifying listeners.
- if (cloud != null
+ if (cloud != null
&& currCloud != null
&& cloud.getName().equals(currCloud.getName())) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- currCloud.removeInstanceListListener(parentView);
+ currCloud.removeInstanceListListener(InstanceView.this);
viewer.setInput(instances);
- currCloud.addInstanceListListener(parentView);
+ currCloud.addInstanceListListener(InstanceView.this);
viewer.refresh();
refreshToolbarCommandStates();
}
15 years, 5 months
JBoss Tools SVN: r26715 - in trunk/common/plugins/org.jboss.tools.common.ui.sidebyside: META-INF and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-11-18 10:51:04 -0500 (Thu, 18 Nov 2010)
New Revision: 26715
Added:
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/SideBySideActivator.java
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/handlers/
Removed:
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/sidebyside/handlers/
Modified:
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/plugin.xml
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/handlers/SideBySideHandler.java
Log:
https://jira.jboss.org/browse/JBIDE-6083
Modified: trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/META-INF/MANIFEST.MF 2010-11-18 15:49:29 UTC (rev 26714)
+++ trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/META-INF/MANIFEST.MF 2010-11-18 15:51:04 UTC (rev 26715)
@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NewEditorSideBySide
-Bundle-SymbolicName: org.jboss.tools.neweditor.sidebyside;singleton:=true
+Bundle-SymbolicName: org.jboss.tools.common.ui.sidebyside;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.jboss.tools.sidebyside.SideBySideActivator
+Bundle-Activator: org.jboss.tools.common.ui.sidebyside.SideBySideActivator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Modified: trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/plugin.xml 2010-11-18 15:49:29 UTC (rev 26714)
+++ trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/plugin.xml 2010-11-18 15:51:04 UTC (rev 26715)
@@ -14,7 +14,7 @@
point="org.eclipse.ui.handlers">
<handler
commandId="org.jboss.tools.sidebyside.newEditor"
- class="org.jboss.tools.sidebyside.handlers.SideBySideHandler">
+ class="org.jboss.tools.common.ui.sidebyside.handlers.SideBySideHandler">
<enabledWhen>
<with
variable="activeEditor">
Copied: trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/SideBySideActivator.java (from rev 26710, trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/SideBySideActivator.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/SideBySideActivator.java 2010-11-18 15:51:04 UTC (rev 26715)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.common.ui.sidebyside;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SideBySideActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.sidebyside"; //$NON-NLS-1$
+
+ // The shared instance
+ private static SideBySideActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public SideBySideActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static SideBySideActivator getDefault() {
+ return plugin;
+ }
+
+
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/SideBySideActivator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/handlers (from rev 26710, trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/sidebyside/handlers)
Modified: trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/handlers/SideBySideHandler.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/sidebyside/handlers/SideBySideHandler.java 2010-11-18 14:32:35 UTC (rev 26710)
+++ trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/common/ui/sidebyside/handlers/SideBySideHandler.java 2010-11-18 15:51:04 UTC (rev 26715)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.sidebyside.handlers;
+package org.jboss.tools.common.ui.sidebyside.handlers;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
Deleted: trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java 2010-11-18 15:49:29 UTC (rev 26714)
+++ trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java 2010-11-18 15:51:04 UTC (rev 26715)
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 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.sidebyside;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class SideBySideActivator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.sidebyside"; //$NON-NLS-1$
-
- // The shared instance
- private static SideBySideActivator plugin;
-
- /**
- * The constructor
- */
- public SideBySideActivator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static SideBySideActivator getDefault() {
- return plugin;
- }
-
-
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
15 years, 5 months
JBoss Tools SVN: r26714 - trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-11-18 10:49:29 -0500 (Thu, 18 Nov 2010)
New Revision: 26714
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
Log:
JBIDE-7616
https://jira.jboss.org/browse/JBIDE-7616
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2010-11-18 15:12:25 UTC (rev 26713)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2010-11-18 15:49:29 UTC (rev 26714)
@@ -49,6 +49,7 @@
import org.jboss.tools.seam.internal.core.scanner.lib.ClassPath;
import org.jboss.tools.seam.internal.core.scanner.lib.LibraryScanner;
import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.TestProjectProvider;
public class ScannerTest extends TestCase {
@@ -68,7 +69,9 @@
project = provider.getProject();
}
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ JobUtils.waitForIdle();
this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ JobUtils.waitForIdle();
}
private ISeamProject getSeamProject() {
15 years, 5 months
JBoss Tools SVN: r26713 - in trunk/vpe/plugins: org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2010-11-18 10:12:25 -0500 (Thu, 18 Nov 2010)
New Revision: 26713
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/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
https://jira.jboss.org/browse/JBIDE-7308 : VPE Part should not show exceptions but readable explanation why it cannot be loaded.
- the issue fixing
- code refactoring
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2010-11-18 15:09:43 UTC (rev 26712)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2010-11-18 15:12:25 UTC (rev 26713)
@@ -80,6 +80,7 @@
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.resref.core.VpeResourcesDialog;
import org.jboss.tools.vpe.xulrunner.XulRunnerException;
+import org.jboss.tools.vpe.xulrunner.browser.XulRunnerBrowser;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.jboss.tools.vpe.xulrunner.util.XPCOM;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -701,7 +702,7 @@
*/
protected void showXulRunnerError(Composite parent,
Throwable originalThrowable) {
- Throwable throwable = wrapIfItIsXulRunnerError(originalThrowable);
+ Throwable throwable = wrapXulRunnerError(originalThrowable);
String errorMessage = MessageFormat.format(
VpeUIMessages.MOZILLA_LOADING_ERROR, throwable.getMessage());
VpePlugin.getPluginLog().logError(errorMessage, throwable);
@@ -756,28 +757,43 @@
}
/**
- * This is a workaround method for JBIDE-7601 (Show XULRunner exception only once).
- * <P>
+ * Wraps instances of {@code SWTError} generated by XULRunner
+ * into a {@code XulRunnerException}. All other throwables are
+ * returned as is. In certain cases, error's messages may be
+ * substituted by messages that are more clear to the user.
+ */
+ /* There is a workaround for JBIDE-7601 (Show XULRunner exception only once).
+ *
* The problem is that the method {@code VpePlugin.getPluginLog().logError(...)}
* shows pop-ups for instances of {@code SWTError} because it considers
* them as {@code fatal}. To workaround of it, these errors are wrapped
- * to an {@code Exception}.
+ * to an {@code XulRunnerException}.
*
* @see org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler#isFatal(StatusAdapter)
* @see org.eclipse.swt.browser.Mozilla
*/
- private Throwable wrapIfItIsXulRunnerError(Throwable originalThrowable) {
+ private Throwable wrapXulRunnerError(Throwable originalThrowable) {
Throwable throwable = originalThrowable;
if (throwable instanceof SWTError && throwable.getMessage() != null) {
String message = throwable.getMessage();
if(message.contains("XPCOM error ") //$NON-NLS-1$
|| message.contains(" [Failed to use detected XULRunner: ") //$NON-NLS-1$
- || message.contains(" [Could not detect registered XULRunner to use]") //$NON-NLS-1$
|| message.contains(" [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]") //$NON-NLS-1$
|| message.contains(" [Mozilla GTK2 required (GTK1.2 detected)]") //$NON-NLS-1$
|| message.contains(" [MOZILLA_FIVE_HOME='") //$NON-NLS-1$
|| message.contains(" [MOZILLA_FIVE_HOME may not point at an embeddable GRE] [NS_InitEmbedding ")) { //$NON-NLS-1$
throwable = new XulRunnerException(originalThrowable);
+ } else if (message.contains(" [Could not detect registered XULRunner to use]")) {//$NON-NLS-1$
+ if (System.getProperty(XulRunnerBrowser.XULRUNNER_PATH) == null
+ && !XulRunnerBrowser.isCurrentPlatformOfficiallySupported()) {
+ throwable = new XulRunnerException(
+ MessageFormat.format(
+ VpeUIMessages.CURRENT_PLATFORM_IS_NOT_SUPPORTED,
+ XulRunnerBrowser.CURRENT_PLATFORM_ID),
+ originalThrowable);
+ } else {
+ throwable = new XulRunnerException(originalThrowable);
+ }
}
}
return throwable;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2010-11-18 15:09:43 UTC (rev 26712)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2010-11-18 15:12:25 UTC (rev 26713)
@@ -163,5 +163,6 @@
public static String LIST_IS_EMPTY;
public static String COULD_NOT_OPEN_VPE_RESOURCES_DIALOG;
+ public static String CURRENT_PLATFORM_IS_NOT_SUPPORTED;
public static String VPE_PREFERENCES_MENU_LABEL;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2010-11-18 15:09:43 UTC (rev 26712)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2010-11-18 15:12:25 UTC (rev 26713)
@@ -6,7 +6,8 @@
PREFERENCES=Preferences
REFRESH=Refresh
PAGE_DESIGN_OPTIONS=Page Design Options
-MOZILLA_LOADING_ERROR=Could not open the Visual Page Editor: {0}
+MOZILLA_LOADING_ERROR=Could not open the Visual Page Editor:\n{0}
+CURRENT_PLATFORM_IS_NOT_SUPPORTED=Current platform ''{0}'' is not supported.
MOZILLA_LOADING_ERROR_LINK_TEXT=See JBoss Tools Visual Editor FAQ
# START NON-TRANSLATABLE
MOZILLA_LOADING_ERROR_LINK=http://www.jboss.org/community/docs/DOC-10862
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 2010-11-18 15:09:43 UTC (rev 26712)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2010-11-18 15:12:25 UTC (rev 26713)
@@ -15,6 +15,9 @@
import java.io.IOException;
import java.net.URL;
import java.text.MessageFormat;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
@@ -36,7 +39,6 @@
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;
@@ -57,31 +59,42 @@
private static final String XULRUNNER_HIGHER_VERSION = "1.9.2.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$
+ public 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;
public static final long NS_ERROR_FAILURE = 0x80004005L;
-
+ private static final String XULRUNNER_ENTRY = "/xulrunner"; //$NON-NLS-1$
+
+ public static final Set<String> OFFICIALLY_SUPPORTED_PLATFORM_IDS = new HashSet<String>();
static {
- StringBuffer buff = new StringBuffer("org.mozilla.xulrunner");
- buff.append(".").append(Platform.getWS()) //$NON-NLS-1$
- .append(".").append(Platform.getOS()); //$NON-NLS-1$
+ Collections.addAll(OFFICIALLY_SUPPORTED_PLATFORM_IDS,
+ "carbon.macosx", //$NON-NLS-1$
+ "cocoa.macosx", //$NON-NLS-1$
+ "gtk.linux.x86", //$NON-NLS-1$
+ "gtk.linux.x86_64", //$NON-NLS-1$
+ "win32.win32.x86"); //$NON-NLS-1$
+ }
+ public static final String CURRENT_PLATFORM_ID;
+ private static final Mozilla mozilla;
+ static {
+ StringBuffer buff = new StringBuffer();
+ buff.append(Platform.getWS())
+ .append('.').append(Platform.getOS());
if(! Platform.OS_MACOSX.equals(Platform.getOS())) {
- buff.append(".").append(Platform.getOSArch());
+ buff.append('.').append(Platform.getOSArch());
}
- XULRUNNER_BUNDLE = buff.toString();
+ CURRENT_PLATFORM_ID = buff.toString();
+ XULRUNNER_BUNDLE = "org.mozilla.xulrunner." + CURRENT_PLATFORM_ID; //$NON-NLS-1$
mozilla = Mozilla.getInstance();
}
@@ -460,4 +473,16 @@
}
}
+ /**
+ * Return {@code true} if and only if the current
+ * platform is officially supported in JBoss Tools.
+ * But {@code false} does not necessary mean that XULRunner
+ * cannot be run on the system.
+ *
+ * @see #CURRENT_PLATFORM_ID
+ * @see #OFFICIALLY_SUPPORTED_PLATFORM_IDS
+ */
+ public static boolean isCurrentPlatformOfficiallySupported() {
+ return OFFICIALLY_SUPPORTED_PLATFORM_IDS.contains(CURRENT_PLATFORM_ID);
+ }
}
15 years, 5 months
JBoss Tools SVN: r26712 - trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-11-18 10:09:43 -0500 (Thu, 18 Nov 2010)
New Revision: 26712
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Rabbit.java
Log:
JBIDE-7616
https://jira.jboss.org/browse/JBIDE-7616
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Rabbit.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Rabbit.java 2010-11-18 14:34:15 UTC (rev 26711)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Rabbit.java 2010-11-18 15:09:43 UTC (rev 26712)
@@ -3,6 +3,6 @@
import org.jboss.seam.annotations.Name;
@Name("animal.tame.Rabbit")
-public class A {
+public class Rabbit {
}
15 years, 5 months
JBoss Tools SVN: r26711 - in trunk/seam/tests/org.jboss.tools.seam.core.test: projects/TestScanner/JavaSource/one and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-11-18 09:34:15 -0500 (Thu, 18 Nov 2010)
New Revision: 26711
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Hare.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Rabbit.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Animals.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Wild.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/package-info.java
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
Log:
JBIDE-7616
https://jira.jboss.org/browse/JBIDE-7616
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Hare.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Hare.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Hare.java 2010-11-18 14:34:15 UTC (rev 26711)
@@ -0,0 +1,8 @@
+package one;
+
+import org.jboss.seam.annotations.Name;
+
+@Name("animal.wild.Hare")
+public class Hare {
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Hare.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Rabbit.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Rabbit.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Rabbit.java 2010-11-18 14:34:15 UTC (rev 26711)
@@ -0,0 +1,8 @@
+package one;
+
+import org.jboss.seam.annotations.Name;
+
+@Name("animal.tame.Rabbit")
+public class A {
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/one/Rabbit.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Animals.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Animals.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Animals.java 2010-11-18 14:34:15 UTC (rev 26711)
@@ -0,0 +1,10 @@
+package two;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Import;
+
+@Name("animals.all")
+@Import({"animal.tame"})
+public class Animals {
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Animals.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Wild.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Wild.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Wild.java 2010-11-18 14:34:15 UTC (rev 26711)
@@ -0,0 +1,8 @@
+package two;
+
+import org.jboss.seam.annotations.Name;
+
+@Name("animals.wild")
+public class Wild {
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/Wild.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/package-info.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/package-info.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/package-info.java 2010-11-18 14:34:15 UTC (rev 26711)
@@ -0,0 +1,4 @@
+@Import({"animal.wild"})
+package two;
+import org.jboss.seam.annotations.Import;
+
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/JavaSource/two/package-info.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2010-11-18 14:32:35 UTC (rev 26710)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2010-11-18 14:34:15 UTC (rev 26711)
@@ -29,6 +29,7 @@
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamComponentMethod;
+import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ISeamFactory;
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
@@ -537,6 +538,25 @@
assertTrue("Location should not point to 0", location.getStartPosition() > 0 && location.getLength() > 0);
}
+ public void testImportAnnotatation() throws Exception {
+ ISeamProject seamProject = getSeamProject();
+
+ ISeamComponent c = seamProject.getComponent("animals.all");
+ ISeamJavaComponentDeclaration d = c.getJavaDeclaration();
+ Set<ISeamContextVariable> vs = d.getVariablesByName("Hare");
+ assertTrue("Cannot find Hare among all animals, import 'animal.wild' is ignored", vs != null && !vs.isEmpty());
+
+ vs = d.getVariablesByName("Rabbit");
+ assertTrue("Cannot find Rabbit among all animals, import 'animal.tame' is ignored", vs != null && !vs.isEmpty());
+
+ c = seamProject.getComponent("animals.wild");
+ vs = d.getVariablesByName("Hare");
+ assertTrue("Cannot find Hare among wild animals, import 'animal.wild' is ignored", vs != null && !vs.isEmpty());
+
+ vs = d.getVariablesByName("Rabbit");
+ assertFalse("Foundd Rabbit among wild animals, import 'animal.tame' is illegally added", vs != null && !vs.isEmpty());
+ }
+
@Override
protected void tearDown() throws Exception {
if(provider!=null) {
15 years, 5 months
JBoss Tools SVN: r26710 - in trunk: jst/plugins and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-11-18 09:32:35 -0500 (Thu, 18 Nov 2010)
New Revision: 26710
Added:
trunk/common/plugins/org.jboss.tools.common.ui.sidebyside/
Removed:
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/
Log:
https://jira.jboss.org/browse/JBIDE-6083, renaming plugin and moving to another package
Copied: trunk/common/plugins/org.jboss.tools.common.ui.sidebyside (from rev 26705, trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside)
15 years, 5 months
JBoss Tools SVN: r26709 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-11-18 09:32:05 -0500 (Thu, 18 Nov 2010)
New Revision: 26709
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
Log:
https://jira.jboss.org/browse/JBIDE-6575
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-11-18 14:25:46 UTC (rev 26708)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-11-18 14:32:05 UTC (rev 26709)
@@ -182,9 +182,9 @@
- bean class is deployed in two different bean archives (Non-Portable behavior) - (JBT: let's ignore this rule so far since we don't have any good tool to recognize such components)
-
Deployment problems
+
5.2.1. Unsatisfied and ambiguous dependencies
- If an unsatisfied or unresolvable ambiguous dependency exists, the container automatically detects the problem and
treats it as a deployment problem.
@@ -195,8 +195,8 @@
and treats it as a deployment problem.
+ Beans.xml (all of them are deployment problems)
-Beans.xml
5.1.1. Declaring selected alternatives for a bean archive
- Each child <class> element must specify the name of an alternative bean class. If there is no class with the specified
@@ -220,4 +220,27 @@
the class with the specified name is not an interceptor class, the container automatically detects the problem and treats it as
a deployment problem.
- If the same class is listed twice under the <interceptors> element, the container automatically detects the problem and treats it as
- a deployment problem.
\ No newline at end of file
+ a deployment problem.
+
+
+
+ Unimplemented:
+
+5.1.3. Inconsistent specialization
+- Suppose an enabled bean X specializes a second bean Y. If there is another enabled bean that specializes Y we say that inconsistent
+ specialization exists. The container automatically detects inconsistent specialization and treats it as a deployment problem.
+
+5.3.1. Ambiguous EL names
+- All unresolvable ambiguous EL names are detected by the container when the application is initialized. Suppose two beans are both available for injection in a certain war, and either:
+ • the two beans have the same EL name and the name is not resolvable, or
+ • the EL name of one bean is of the form x.y, where y is a valid bean EL name, and x is the EL name of the other bean,
+ the container automatically detects the problem and treats it as a deployment problem.
+
+5.4.1. Unproxyable bean types
+- If an injection point whose declared type cannot be proxied by the container resolves to a bean with a normal scope,
+ the container automatically detects the problem and treats it as a deployment problem.
+
+8.3. Decorator resolution
+- If a decorator matches a managed bean, and the managed bean class is declared final, the container automatically detects
+ the problem and treats it as a deployment problem.
+
15 years, 5 months
JBoss Tools SVN: r26708 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2010-11-18 09:25:46 -0500 (Thu, 18 Nov 2010)
New Revision: 26708
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
Log:
swtbot ext: formatting, swtbot.test.properties.mutli.file property is deprecated now
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-11-18 14:22:24 UTC (rev 26707)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-11-18 14:25:46 UTC (rev 26708)
@@ -2,11 +2,13 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import java.util.Map.Entry;
import java.util.Properties;
import org.apache.log4j.Logger;
@@ -46,64 +48,84 @@
public static TestConfiguration currentConfig;
static {
boolean loadDefault = true;
-
+
try {
// try to load from file first
String propFile = System.getProperty(SWTBOT_TEST_PROPERTIES_FILE,
null);
- String propMultiFile = System.getProperty(SWTBOT_TEST_PROPERTIES_MULTI_FILE,
- null);
- if (propMultiFile!=null) {
+ String propMultiFile = System.getProperty(
+ SWTBOT_TEST_PROPERTIES_MULTI_FILE, null);
+ if (propMultiFile != null) {
if (new File(propMultiFile).exists()) {
- log
- .info("Loading exeternaly provided multi-configuration file '"
+ log.info("Loading exeternaly provided multi-configuration file '"
+ propMultiFile + "'");
+ log.warn("Property name '"
+ + SWTBOT_TEST_PROPERTIES_MULTI_FILE
+ + "' is deprecated and will be removed soon, use '"
+ + SWTBOT_TEST_PROPERTIES_FILE
+ + "' property instead, file type is now auto-detected by content.");
multiProperties.load(new FileInputStream(propMultiFile));
loadDefault = false;
+ } else {
+ throw new IOException(SWTBOT_TEST_PROPERTIES_MULTI_FILE
+ + " " + propMultiFile + " does not exist!");
}
- else {
- throw new IOException(SWTBOT_TEST_PROPERTIES_MULTI_FILE + " "
- + propMultiFile + " does not exist!");
- }
- }
- else if (propFile!=null) {
+ } else if (propFile != null) {
if (new File(propFile).exists()) {
- log
- .info("Loading exeternaly configuration file '"
+ log.info("Loading exeternaly configuration file '"
+ propFile + "'");
- multiProperties.put("Default", propFile);
- loadDefault = false;
- }
- else {
+ if (isMultiPropertiesFile(propFile)) {
+ log.info(" * loading multi-configuration");
+ multiProperties.load(new FileInputStream(propFile));
+ }
+ else {
+ log.info(" * loading single-configuration");
+ multiProperties.put("Default", propFile);
+ }
+
+ loadDefault = false;
+ } else {
throw new IOException(SWTBOT_TEST_PROPERTIES_FILE + " "
+ propFile + " does not exist!");
}
- }
- else {
+ } else {
log.info("No configuration property passed, using default");
- multiProperties.put(SWTBOT_TEST_PROPERTIES_FILE, "");
+ multiProperties.put(SWTBOT_TEST_PROPERTIES_FILE, "");
}
} catch (Exception ex) {
ex.printStackTrace();
}
-
+
if (loadDefault) {
// load default config by default
try {
log.info(" * Loading default configuration first");
currentConfig = new TestConfiguration("default", "");
-
+
} catch (Exception e) {
- // log only message, nothing
+ // log only message, nothing
log.error(e.getMessage());
- }
- finally {
+ } finally {
log.info(" * Defaults loaded");
}
}
}
+ public static boolean isMultiPropertiesFile(String propFile) {
+ Properties props = new Properties();
+ try {
+ props.load(new FileInputStream(propFile));
+ for (Entry<Object,Object> e : props.entrySet()) {
+ if (e.getValue()!=null && e.getValue().toString().endsWith(".properties")) {
+ return true;
+ }
+ }
+ return false;
+ } catch (Exception e) {
+ return false;
+ }
+ }
/**
* returns null when given Server annotation does not match global test
* configuration (e.g. Test wants Server type EAP but we are running on
@@ -115,7 +137,8 @@
*/
private static RequirementBase getServerRequirement(Server s) {
// tests omitting server must run even when server not configured
- if (ServerState.Disabled.equals(s.state()) && currentConfig.getServer() == null) {
+ if (ServerState.Disabled.equals(s.state())
+ && currentConfig.getServer() == null) {
return RequirementBase.createRemoveServer();
}
if (!s.required() || currentConfig.getServer() == null) {
@@ -123,36 +146,39 @@
}
if (!s.type().equals(ServerType.ALL)) {
if (s.type().equals(ServerType.EAP)
- && !currentConfig.getServer().type.equals(Values.SERVER_TYPE_EAP)) {
+ && !currentConfig.getServer().type
+ .equals(Values.SERVER_TYPE_EAP)) {
return null;
}
if (s.type().equals(ServerType.JbossAS)
- && !currentConfig.getServer().type.equals(Values.SERVER_TYPE_JBOSSAS)) {
+ && !currentConfig.getServer().type
+ .equals(Values.SERVER_TYPE_JBOSSAS)) {
return null;
}
if (s.type().equals(ServerType.EPP)
- && !currentConfig.getServer().type.equals(Values.SERVER_TYPE_EPP)) {
+ && !currentConfig.getServer().type
+ .equals(Values.SERVER_TYPE_EPP)) {
return null;
}
if (s.type().equals(ServerType.SOA)
- && !currentConfig.getServer().type.equals(Values.SERVER_TYPE_SOA)) {
+ && !currentConfig.getServer().type
+ .equals(Values.SERVER_TYPE_SOA)) {
return null;
}
}
- if (!matches(currentConfig.getServer().version, s.operator(), s.version())) {
+ if (!matches(currentConfig.getServer().version, s.operator(),
+ s.version())) {
return null;
}
if (ServerState.Disabled.equals(s.state())) {
RequirementBase removeServer = RequirementBase.createRemoveServer();
removeServer.getDependsOn().add(RequirementBase.createStopServer());
return removeServer;
- }
- else if (ServerState.NotRunning.equals(s.state())) {
+ } else if (ServerState.NotRunning.equals(s.state())) {
RequirementBase stopServer = RequirementBase.createStopServer();
stopServer.getDependsOn().add(RequirementBase.createAddServer());
return stopServer;
- }
- else if (ServerState.Present.equals(s.state())) {
+ } else if (ServerState.Present.equals(s.state())) {
return RequirementBase.createAddServer();
}
return RequirementBase.createStartServer();
@@ -185,9 +211,9 @@
}
return RequirementBase.createAddESB();
}
-
+
private static RequirementBase getJBPMRequirement(JBPM j) {
- if (!j.required() || currentConfig.getJBPM() == null ) {
+ if (!j.required() || currentConfig.getJBPM() == null) {
return null;
}
if (!matches(currentConfig.getJBPM().version, j.operator(), j.version())) {
@@ -195,7 +221,7 @@
}
return RequirementBase.createAddJBPM();
}
-
+
private static RequirementBase getDBRequirement(DB d) {
if (!d.required() || currentConfig.getDB() == null) {
return null;
@@ -257,7 +283,7 @@
}
reqs.add(req);
}
-
+
if (!"".equals(requies.perspective())) {
reqs.add(RequirementBase.createSwitchPerspective(requies
.perspective()));
@@ -319,10 +345,10 @@
private static int versionToNumber(String version) {
version = version.replaceAll("\\.", "");
- int addZeros = 4-version.length();
- if (addZeros>0) {
- while (addZeros>0) {
- version+="0";
+ int addZeros = 4 - version.length();
+ if (addZeros > 0) {
+ while (addZeros > 0) {
+ version += "0";
addZeros--;
}
}
15 years, 5 months