JBoss Tools SVN: r38770 - in trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim: resources and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2012-02-15 14:58:40 -0500 (Wed, 15 Feb 2012)
New Revision: 38770
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/SkinMap.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/back-disabled.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/back-selected.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/back.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/forward-disabled.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/forward-selected.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/forward.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/01.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/02.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/03.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/04.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/05.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/06.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/07.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/08.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/10.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/11.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/12.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/13.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/14.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/15.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/16.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/17.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/18.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/19.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/20.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/21.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/22.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/23.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/24.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/25.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/01.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/02.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/03.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/04.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/05.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/06.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/07.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/08.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/14.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/21.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/22.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/23.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/24.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/25.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/26.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/27.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/28.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/29.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/30.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/31.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-1.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-2.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-3.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-4.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-5.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/refresh-selected.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/refresh.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop-selected.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-1.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-2.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-3.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-4.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-5.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhoneComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ButtonDescriptor.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOsTimeComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IPhoneSkinDescriptor.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ImageButtonComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ImageDescriptor.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/WidgetDescriptor.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/Device.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/DevicesList.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/DevicesListStorage.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/config/devices.cfg
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/EditDeviceDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/ManageDevicesDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ImageList.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java
Log:
https://issues.jboss.org/browse/JBIDE-10431 : browsersim should be sexy
- created resizable iPhone 3 skin
- changed format of config file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/Device.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/Device.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/Device.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.vpe.browsersim.model;
-import org.jboss.tools.vpe.browsersim.ui.skin.AppleIPhone3Skin;
-import org.jboss.tools.vpe.browsersim.ui.skin.BrowserSimSkin;
-import org.jboss.tools.vpe.browsersim.ui.skin.NativeSkin;
/**
* @author Yahor Radtsevich (yradtsevich)
@@ -24,13 +21,14 @@
private int width;
private int height;
private String userAgent;
- private Class<? extends BrowserSimSkin> skinClass;
+ private String skinId;
- public Device(String name, int width, int height, String userAgent) {
+ public Device(String name, int width, int height, String userAgent, String skinId) {
this.name = name;
this.width = width;
this.height = height;
this.userAgent = userAgent;
+ this.skinId = skinId;
}
public int getWidth() {
@@ -49,12 +47,7 @@
return name;
}
- public Class<? extends BrowserSimSkin> getSkinClass() {
- //XXX
- if (name != null && name.equals("Apple iPhone 3 (skinned!)")) {
- return AppleIPhone3Skin.class;
- } else {
- return NativeSkin.class;
- }
+ public String getSkinId() {
+ return skinId;
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/DevicesList.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/DevicesList.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/DevicesList.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -21,6 +21,7 @@
public class DevicesList extends Observable {
private List<Device> devices;
private int selectedDeviceIndex;
+ private boolean useSkins = true;
public DevicesList(List<Device> devices, int selectedDeviceIndex) {
this.devices = devices;
@@ -41,4 +42,15 @@
setChanged();
}
}
+
+ public boolean getUseSkins() {
+ return useSkins;
+ }
+
+ public void setUseSkins(boolean useSkins) {
+ if (this.useSkins != useSkins) {
+ this.useSkins = useSkins;
+ setChanged();
+ }
+ }
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/DevicesListStorage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/DevicesListStorage.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/DevicesListStorage.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -33,6 +33,7 @@
private static final String DEFAULT_PREFERENCES_RESOURCE = "config/devices.cfg";
private static final String USER_PREFERENCES_FOLDER = "org.jboss.tools.vpe.browsersim";
private static final String USER_PREFERENCES_FILE = "devices.cfg";
+ private static final int CURRENT_CONFIG_VERSION = 2;
public static void saveUserDefinedDevicesList(DevicesList devicesList) {
File configFolder = new File(USER_PREFERENCES_FOLDER);
@@ -61,23 +62,29 @@
}
public static DevicesList loadDefaultDevicesList() {
- DevicesList devicesList;
+ DevicesList devicesList = null;
try {
devicesList = loadDevicesList(ResourcesUtil.getResourceAsStream(
DEFAULT_PREFERENCES_RESOURCE));
} catch (IOException e) {
e.printStackTrace();
- devicesList = new DevicesList(new ArrayList<Device>(), 0);
}
+ if (devicesList == null) {
+ Device device = new Device("Default", 1024, 768, null, null);
+ List<Device> devices = new ArrayList<Device>();
+ devices.add(device);
+ devicesList = new DevicesList(devices, 0);
+ }
+
return devicesList;
}
private static void saveDevicesList(DevicesList devicesList, File file) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
- writer.write(String.valueOf(devicesList.getSelectedDeviceIndex()));
- writer.write('\n');
+ writer.write("ConfigVersion=" + String.valueOf(CURRENT_CONFIG_VERSION) + "\n");
+ writer.write("SelectedDeviceIndex=" + String.valueOf(devicesList.getSelectedDeviceIndex()) + "\n");
for (Device device : devicesList.getDevices()) {
writer.write( encode(device.getName() ));
@@ -85,10 +92,14 @@
writer.write(encode( String.valueOf(device.getWidth()) ));
writer.write('\t');
writer.write(encode( String.valueOf(device.getHeight()) ));
+ writer.write('\t');
if (device.getUserAgent() != null) {
- writer.write('\t');
writer.write( encode(device.getUserAgent() ));
}
+ writer.write('\t');
+ if (device.getSkinId() != null) {
+ writer.write( encode(device.getSkinId() ));
+ }
writer.write('\n');
}
@@ -103,31 +114,58 @@
private static DevicesList loadDevicesList(InputStream inputStream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
- String nextLine = reader.readLine();
+ List<Device> devices = null;
int selectedDeviceIndex = 0;
- if (nextLine != null) {
- selectedDeviceIndex = Integer.parseInt(nextLine);
- }
- Pattern devicePattern = Pattern.compile("^(.*)\\t(\\-?[0-9]*)\\t(\\-?[0-9]*)(\\t(.*))?$");
-
- List<Device> devices = new ArrayList<Device>();
- while ((nextLine = reader.readLine()) != null) {
- Matcher deviceMatcher = devicePattern.matcher(nextLine);
- if (deviceMatcher.matches()) {
- devices.add(new Device(
- decode(deviceMatcher.group(1)),
- Integer.parseInt(deviceMatcher.group(2)),
- Integer.parseInt(deviceMatcher.group(3)),
- deviceMatcher.group(5) != null
- ? decode(deviceMatcher.group(5))
- : null
- ));
+ try {
+ String nextLine;
+
+ int configVersion = 0;
+ if ((nextLine = reader.readLine()) != null) {
+ Pattern pattern = Pattern.compile("ConfigVersion=([0-9]+)");
+ Matcher matcher = pattern.matcher(nextLine);
+ if (matcher.matches()) {
+ configVersion = Integer.parseInt(matcher.group(1));
+ }
}
+
+ if (configVersion == CURRENT_CONFIG_VERSION) {
+ if ((nextLine = reader.readLine()) != null) {
+ Pattern pattern = Pattern.compile("SelectedDeviceIndex=([0-9]+)");
+ Matcher matcher = pattern.matcher(nextLine);
+ if (matcher.matches()) {
+ selectedDeviceIndex = Integer.parseInt(matcher.group(1));
+ }
+ }
+
+ Pattern devicePattern = Pattern.compile("^(.*)\\t(\\-?[0-9]+)\\t(\\-?[0-9]+)\\t(.+)?\\t(.+)?$");
+
+ devices = new ArrayList<Device>();
+ while ((nextLine = reader.readLine()) != null) {
+ Matcher deviceMatcher = devicePattern.matcher(nextLine);
+ if (deviceMatcher.matches()) {
+ devices.add(new Device(
+ decode(deviceMatcher.group(1)),
+ Integer.parseInt(deviceMatcher.group(2)),
+ Integer.parseInt(deviceMatcher.group(3)),
+ deviceMatcher.group(4) != null
+ ? decode(deviceMatcher.group(4))
+ : null,
+ deviceMatcher.group(5) != null
+ ? decode(deviceMatcher.group(5))
+ : null
+ ));
+ }
+ }
+ }
+ } finally {
+ reader.close();
}
- reader.close();
-
- return new DevicesList(devices, selectedDeviceIndex);
+ if (devices == null || devices.size() <= selectedDeviceIndex) {
+ return null;
+ } else {
+ return new DevicesList(devices, selectedDeviceIndex);
+ }
}
private static String encode(String string) {
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/SkinMap.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/SkinMap.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/model/SkinMap.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,41 @@
+package org.jboss.tools.vpe.browsersim.model;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.tools.vpe.browsersim.ui.skin.BrowserSimSkin;
+import org.jboss.tools.vpe.browsersim.ui.skin.NativeSkin;
+import org.jboss.tools.vpe.browsersim.ui.skin.ios.AppleIPhone3ResizableSkin;
+
+public class SkinMap {
+ public static final Class<? extends BrowserSimSkin> DEFAULT_SKIN_CLASS = NativeSkin.class;
+ private static SkinMap instance;
+ private Map<String, Class<? extends BrowserSimSkin>> map;
+
+ private SkinMap(){
+ map = new HashMap<String, Class<? extends BrowserSimSkin>>();
+
+ map.put("Apple iPhone 3", AppleIPhone3ResizableSkin.class);
+ }
+
+ public static SkinMap getInstance() {
+ if (instance == null) {
+ instance = new SkinMap();
+ }
+ return instance;
+ }
+
+ public Class<? extends BrowserSimSkin> getSkinClass(String skinId) {
+ Class<? extends BrowserSimSkin> skinClass = map.get(skinId);
+ if (skinClass == null) {
+ skinClass = DEFAULT_SKIN_CLASS;
+ }
+ return skinClass;
+ }
+
+ public Set<String> getSkinIds() {
+ return map.keySet();
+ }
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/config/devices.cfg
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/config/devices.cfg 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/config/devices.cfg 2012-02-15 19:58:40 UTC (rev 38770)
@@ -1,10 +1,10 @@
-4
-Desktop (Default User-Agent) 1024 768
-Apple iPad 2 768 1024 Mozilla/5.0 (iPad; U; CPU OS 4_3_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8G4 Safari/6533.18.5
-Apple iPhone 3 320 480 Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7
-Apple iPhone 3 (skinned!) 320 480 Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7
-Apple iPhone 4 640 960 Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7
-RIM BlackBerry Bold Touch 9900 640 480 Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+
-Samsung Galaxy S 480 800 Mozilla/5.0 (Linux; U; Android 2.3.3; en-us; GT-I9000 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
-Samsung Galaxy S II 480 800 Mozilla/5.0 (Linux; U; Android 2.3; en-us; GT-I9100 Build/GRH78) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
-Samsung Galaxy Tab 10.1 800 1280 Mozilla/5.0 (Linux; U; Android 3.0.1; en-us; GT-P7100 Build/HRI83) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 MobileSafari/534.13
+ConfigVersion=2
+SelectedDeviceIndex=2
+Desktop (Default User-Agent) 1024 768
+Apple iPad 2 768 1024 Mozilla/5.0 (iPad; U; CPU OS 4_3_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8G4 Safari/6533.18.5 Apple iPhone 3
+Apple iPhone 3 320 480 Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7 Apple iPhone 3
+Apple iPhone 4 640 960 Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7 Apple iPhone 3
+RIM BlackBerry Bold Touch 9900 640 480 Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+
+Samsung Galaxy S 480 800 Mozilla/5.0 (Linux; U; Android 2.3.3; en-us; GT-I9000 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
+Samsung Galaxy S II 480 800 Mozilla/5.0 (Linux; U; Android 2.3; en-us; GT-I9100 Build/GRH78) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
+Samsung Galaxy Tab 10.1 800 1280 Mozilla/5.0 (Linux; U; Android 3.0.1; en-us; GT-P7100 Build/HRI83) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 MobileSafari/534.13
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/back-disabled.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/back-disabled.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/back-selected.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/back-selected.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/back.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/back.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/forward-disabled.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/forward-disabled.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/forward-selected.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/forward-selected.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/forward.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/forward.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/01.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/01.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/02.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/02.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/03.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/03.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/04.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/04.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/05.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/05.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/06.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/06.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/07.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/07.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/08.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/08.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/10.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/10.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/11.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/11.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/12.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/12.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/13.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/13.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/14.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/14.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/15.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/15.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/16.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/17.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/17.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/18.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/18.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/19.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/19.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/20.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/20.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/21.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/21.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/22.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/22.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/23.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/23.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/24.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/24.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/25.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/horizontal/25.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/01.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/01.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/02.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/02.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/03.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/03.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/04.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/04.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/05.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/05.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/06.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/06.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/07.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/07.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/08.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/08.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/14.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/14.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/21.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/21.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/22.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/22.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/23.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/23.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/24.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/24.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/25.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/25.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/26.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/26.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/27.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/27.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/28.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/28.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/29.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/29.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/30.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/30.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/31.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/iphone3/vertical/31.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-1.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-1.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-2.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-2.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-3.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-3.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-4.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-4.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-5.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/nav-5.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/refresh-selected.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/refresh-selected.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/refresh.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/refresh.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop-selected.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop-selected.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-1.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-1.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-2.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-2.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-3.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-3.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-4.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-4.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-5.png
===================================================================
(Binary files differ)
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/time-5.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -22,6 +22,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.BrowserFunction;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.browser.ProgressEvent;
@@ -34,10 +35,13 @@
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
import org.jboss.tools.vpe.browsersim.browser.BrowserSimBrowser;
import org.jboss.tools.vpe.browsersim.browser.WebKitBrowserFactory;
@@ -46,15 +50,14 @@
import org.jboss.tools.vpe.browsersim.model.DevicesList;
import org.jboss.tools.vpe.browsersim.model.DevicesListHolder;
import org.jboss.tools.vpe.browsersim.model.DevicesListStorage;
+import org.jboss.tools.vpe.browsersim.model.SkinMap;
import org.jboss.tools.vpe.browsersim.ui.skin.BrowserSimSkin;
-import org.jboss.tools.vpe.browsersim.ui.skin.NativeSkin;
/**
* @author Yahor Radtsevich (yradtsevich)
*/
public class BrowserSim {
private static final String DEFAULT_URL = "about:blank"; //"http://www.w3schools.com/js/tryit_view.asp?filename=try_nav_useragent"; //$NON-NLS-1$
- private static final Class<? extends BrowserSimSkin> DEFAULT_SKIN_CLASS = NativeSkin.class;
private Display display;
private String homeUrl;
private DevicesListHolder devicesListHolder;
@@ -85,7 +88,7 @@
Device defaultDevice = devicesList.getDevices().get(devicesList.getSelectedDeviceIndex());
Display display = new Display();
BrowserSim browserSim = new BrowserSim(display, homeUrl);
- browserSim.initSkin(defaultDevice);
+ browserSim.initSkin(getSkinClass(defaultDevice, devicesList.getUseSkins()));
browserSim.initDevicesListHolder();
browserSim.devicesListHolder.setDevicesList(devicesList);
browserSim.devicesListHolder.notifyObservers();
@@ -103,12 +106,7 @@
this.homeUrl = homeUrl;
}
- public void initSkin(Device device) {
- Class<? extends BrowserSimSkin> skinClass = device.getSkinClass();
- if (skinClass == null) {
- skinClass = DEFAULT_SKIN_CLASS;
- }
-
+ public void initSkin(Class<? extends BrowserSimSkin> skinClass) {
try {
skin = skinClass.newInstance();//new AppleIPhone3Skin();//new NativeSkin();
} catch (InstantiationException e1) {
@@ -154,7 +152,7 @@
}
Menu contextMenu = new Menu(shell);
- shell.setMenu(contextMenu);
+ skin.setContextMenu(contextMenu);
createMenuItemsForContextMenu(contextMenu);
browser.addProgressListener(new ProgressListener() {
@@ -194,6 +192,39 @@
public void changing(LocationEvent event) {
}
});
+
+ browser.addLocationListener(new LocationListener() {
+ private BrowserFunction scrollListener = null;
+ public void changed(LocationEvent event) {
+ if (scrollListener != null) {
+ scrollListener.dispose();
+ }
+ scrollListener = new BrowserFunction(((Browser)event.widget), "_browserSim_scrollListener") {
+ public Object function(Object[] arguments) {
+ double pageYOffset = (Double) arguments[0];
+ if (pageYOffset > 0.0) {
+ skin.setAddressBarVisible(false);
+ }
+ return null;
+ }
+ };
+
+ ((Browser)event.widget).execute(
+ "(function() {" +
+ "var scrollListener = function(e){" +
+ "window._browserSim_scrollListener(window.pageYOffset)" +
+ "};" +
+ "window.addEventListener('scroll', scrollListener);" +
+ "window.addEventListener('beforeunload', function(e){" +
+ "window.removeEventListener('scroll', scrollListener);" +
+ "delete window._browserSim_scrollListener;" +
+ "})" +
+ "})();");
+ }
+ public void changing(LocationEvent event) {
+ skin.setAddressBarVisible(true);
+ }
+ });
}
private void initDevicesListHolder() {
@@ -203,11 +234,11 @@
DevicesListHolder devicesManager = (DevicesListHolder) o;
DevicesList devicesList = devicesManager.getDevicesList();
if (devicesList.getSelectedDeviceIndex() < devicesList.getDevices().size()) {
- setDevice(devicesList.getDevices().get(devicesList.getSelectedDeviceIndex()));
+ setSelectedDevice(devicesList);
}
devicesList.addObserver(new Observer() {
public void update(Observable o, Object arg) {
- setDevice(((DevicesList)o).getDevices().get(((DevicesList)o).getSelectedDeviceIndex()));
+ setSelectedDevice((DevicesList)o);
}
});
}
@@ -264,6 +295,18 @@
}
}
});
+
+ MenuItem useSkinsMenuItem = new MenuItem(devicesMenu, SWT.CHECK);
+ useSkinsMenuItem.setText("Use Skins");
+ useSkinsMenuItem.setSelection(devicesListHolder.getDevicesList().getUseSkins());
+ useSkinsMenuItem.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ MenuItem menuItem = (MenuItem) e.widget;
+ DevicesList devicesList = devicesListHolder.getDevicesList();
+ devicesList.setUseSkins(menuItem.getSelection());
+ devicesList.notifyObservers();
+ }
+ });
}
private void addFileMenuItems(Menu menu) {
@@ -361,34 +404,39 @@
return dropdown;
}
- public void setDevice(final Device device) {
+ public void setSelectedDevice(DevicesList devicesList) {
+ final Device device = devicesList.getDevices().get(devicesList.getSelectedDeviceIndex());
+ Class<? extends BrowserSimSkin> newSkinClass = getSkinClass(device, devicesList.getUseSkins());
String oldSkinUrl = null;
- if (device.getSkinClass() != skin.getClass()
- || (device.getSkinClass() == null && skin.getClass() != DEFAULT_SKIN_CLASS)) {
+ if (newSkinClass != skin.getClass()) {
oldSkinUrl = skin.getBrowser().getUrl();
skin.getBrowser().getShell().dispose();//XXX
- initSkin(device);
+ initSkin(newSkinClass);
}
- skin.setBrowserSize(device.getWidth(), device.getHeight());
deviceOrientation = new DeviceOrientation(device.getWidth() < device.getHeight()
? DeviceOrientation.PORTRAIT
: DeviceOrientation.LANDSCAPE);
+ Rectangle clientArea = getMonitorClientArea();
+ skin.setOrientationAndSize(new Point(clientArea.width, clientArea.height),
+ deviceOrientation.getOrientationAngle(),
+ new Point(device.getWidth(), device.getHeight()));
+ fixShellLocation(clientArea);
deviceOrientation.addObserver(new Observer() {
public void update(Observable o, Object arg) {
int orientationAngle = ((DeviceOrientation) o).getOrientationAngle();
int minSize = Math.min(device.getWidth(), device.getHeight());
int maxSize = Math.max(device.getWidth(), device.getHeight());
-
+ Point browserSize;
if (orientationAngle == DeviceOrientation.LANDSCAPE
|| orientationAngle == DeviceOrientation.LANDSCAPE_INVERTED) {
- skin.setBrowserSize(maxSize, minSize);
+ browserSize = new Point(maxSize, minSize);
} else {
- skin.setBrowserSize(minSize, maxSize);
+ browserSize = new Point(minSize, maxSize);
}
- fireOrientationChangeEvent(orientationAngle);
+ fireOrientationChangeEvent(orientationAngle, browserSize);
}
});
@@ -400,14 +448,20 @@
skin.getBrowser().refresh(); // only user agent and size of the browser is changed
}
}
+
+ private static Class<? extends BrowserSimSkin> getSkinClass(Device device, boolean useSkins) {
+ return SkinMap.getInstance().getSkinClass(useSkins ? device.getSkinId() : null);
+ }
private void initOrientation(int orientation) {
skin.getBrowser().execute("window.onorientationchange = null;"
+ "window.orientation = " + orientation + ";");
}
- private void fireOrientationChangeEvent(int orientation) {
- skin.setOrientation(orientation);
+ private void fireOrientationChangeEvent(int orientation, Point browserSize) {
+ Rectangle clientArea = getMonitorClientArea();
+ skin.setOrientationAndSize(new Point(clientArea.width, clientArea.height), orientation, browserSize);
+ fixShellLocation(clientArea);
skin.getBrowser().execute("window.orientation = " + orientation + ";"
+ "(function(){"
+ "var event = document.createEvent('Event');"
@@ -420,6 +474,45 @@
);
}
+ private void fixShellLocation(Rectangle clientArea) {
+ Shell shell = skin.getShell();
+ Point shellLocation = shell.getLocation();
+ Point shellSize = shell.getSize();
+ int bottomOverlap = shellLocation.y + shellSize.y - (clientArea.y + clientArea.height);
+ if (bottomOverlap > 0) {
+ if (shellLocation.y > bottomOverlap) {
+ shellLocation.y -= bottomOverlap;
+ } else {
+ shellLocation.y = 0;
+ }
+ }
+
+ int rightOverlap = shellLocation.x + shellSize.x - (clientArea.x + clientArea.width);
+ if (rightOverlap > 0) {
+ if (shellLocation.x > rightOverlap) {
+ shellLocation.x -= rightOverlap;
+ } else {
+ shellLocation.x = 0;
+ }
+ }
+
+ shell.setLocation(shellLocation);
+ }
+
+ private Rectangle getMonitorClientArea() {
+ Monitor monitor = skin.getShell().getMonitor();
+ Rectangle clientArea = monitor.getClientArea();
+
+ /* on Linux returned monitor client area may be bigger
+ * than the monitor bounds when multiple monitors are used.
+ * The following code fixes this */
+ Rectangle bounds = monitor.getBounds();
+ clientArea.width = Math.min(clientArea.width, bounds.width);
+ clientArea.height = Math.min(clientArea.height, bounds.height);
+
+ return clientArea;
+ }
+
protected void rotateDevice(boolean counterclockwise) {
deviceOrientation.turnDevice(counterclockwise);
deviceOrientation.notifyObservers();
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/EditDeviceDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/EditDeviceDialog.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/EditDeviceDialog.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -145,7 +145,8 @@
resultDevice = new Device(textName.getText(),
checkButtonWidth.getSelection() ? Integer.valueOf("0" + textWidth.getText()) : Device.DEFAULT_SIZE,
checkButtonHeight.getSelection() ? Integer.valueOf("0" + textHeight.getText()) : Device.DEFAULT_SIZE,
- checkButtonUserAgent.getSelection() ? textUserAgent.getText() : null);
+ checkButtonUserAgent.getSelection() ? textUserAgent.getText() : null,
+ null);
shell.close();
}
});
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/ManageDevicesDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/ManageDevicesDialog.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/ManageDevicesDialog.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -118,7 +118,7 @@
buttonAdd.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Device newDevice = new EditDeviceDialog(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM,
- new Device(Messages.ManageDevicesDialog_NEW_DEVICE, 480, 800, Messages.ManageDevicesDialog_NEW_USER_AGENT)).open();
+ new Device(Messages.ManageDevicesDialog_NEW_DEVICE, 480, 800, Messages.ManageDevicesDialog_NEW_USER_AGENT, null)).open();
if (newDevice != null) {
devices.add(newDevice);
selectedDeviceIndex = devices.size() - 1;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -12,9 +12,6 @@
import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.BrowserFunction;
-import org.eclipse.swt.browser.LocationEvent;
-import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.PaintEvent;
@@ -60,7 +57,7 @@
private static final Point[] REFRESH_LOCATION = {new Point(290, 28), new Point(447, 28)};
private static final Point[] STOP_LOCATION = {new Point(261, 33), new Point(412, 33)};
- private static final int[][] VISIBLE_REGION = {{
+ public static final int[][] VISIBLE_REGION = {{
62, 3, 257, 3, 258, 2, 258, 0, 320, 0, 320, 2, 321, 3, 330, 3, 331, 4, 334, 4, 335, 5, 338, 5, 339, 6, 341, 6,
342, 7, 344, 7, 345, 8, 347, 8, 348, 9, 349, 9, 350, 10, 351, 10, 353, 12, 354, 12, 355, 13, 356, 13, 359, 16,
360, 16, 368, 24, 368, 25, 371, 28, 371, 29, 373, 31, 373, 32, 374, 33, 374, 34, 375, 35, 375, 36, 376, 37,
@@ -116,7 +113,6 @@
private int currentOrientationIndex;
private CompositeImageDecorator addressBarDecorator;
private ImageList imageList;
- private BrowserFunction scrollListener = null;
@Override
public void setBrowserFactory(IBrowserSimBrowserFactory browserFactory) {
@@ -251,37 +247,6 @@
// Label showAddressBarLabel = new Label(shell, SWT.NONE);
// showAddressBarLabel.setBounds(new Rectangle(33, 126, 320, 18));
browser = browserFactory.createBrowser(shell, SWT.NONE);
- browser.addLocationListener(new LocationListener() {
- public void changed(LocationEvent event) {
- if (scrollListener != null) {
- scrollListener.dispose();
- }
- scrollListener = new BrowserFunction(browser, "_browserSim_scrollListener") {
- public Object function(Object[] arguments) {
- double pageYOffset = (Double) arguments[VERTICAL];
- if (pageYOffset > 0.0) {
- setAddressBarVisible(false);
- }
- return null;
- }
- };
-
- browser.execute(
- "(function() {" +
- "var scrollListener = function(e){" +
- "window._browserSim_scrollListener(window.pageYOffset)" +
- "};" +
- "window.addEventListener('scroll', scrollListener);" +
- "window.addEventListener('beforeunload', function(e){" +
- "window.removeEventListener('scroll', scrollListener);" +
- "delete window._browserSim_scrollListener;" +
- "})" +
- "})();");
- }
- public void changing(LocationEvent event) {
- setAddressBarVisible(true);
- }
- });
locationText.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event e) {
@@ -294,7 +259,7 @@
shell.open();
}
- private void setAddressBarVisible(boolean visible) {
+ public void setAddressBarVisible(boolean visible) {
Rectangle browserBounds;
if (visible) {
browserBounds = BROWSER_RECTANGLE[currentOrientationIndex];
@@ -356,11 +321,6 @@
}
@Override
- public void setBrowserSize(int width, int height) {
- // TODO Auto-generated method stub
- }
-
- @Override
public void locationChanged(String location, boolean backEnabled, boolean forwardEnabled) {
locationText.setText(location);
backCompositeDecorator.setVisible(backEnabled);
@@ -380,11 +340,14 @@
@Override
public void statusTextChanged(String newStatusText) {
- // TODO Auto-generated method stub
+ // not supported
}
+
@Override
- public void setOrientation(int orientation) {
+ public void setOrientationAndSize(Point maximumShellSize, int orientation, Point browserSize) {
+ // browserSize is ignored by this skin
+
if ((this.orientation == DeviceOrientation.PORTRAIT || this.orientation == DeviceOrientation.PORTRAIT_INVERTED) &&
(orientation == DeviceOrientation.LANDSCAPE || orientation == DeviceOrientation.LANDSCAPE_INVERTED)) {
//changed from portrait to landscape
@@ -398,5 +361,10 @@
this.orientation = orientation;
}
+
+ @Override
+ public void setContextMenu(Menu contextMenu) {
+ shell.setMenu(contextMenu);
+ }
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.vpe.browsersim.ui.skin;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
@@ -27,10 +28,11 @@
Shell getShell();
Menu getMenuBar();
void setControlHandler(ControlHandler controlHandler);
- void setBrowserSize(int width, int height);
void locationChanged(String newLocation, boolean backEnabled, boolean forwardEnabled);
void progressChanged(int percents); // -1 for completed
void statusTextChanged(String newStatusText);
- void setOrientation(int orientation);
+ void setOrientationAndSize(Point maximumShellSize, int orientation, Point browserSize);
+ void setAddressBarVisible(boolean visible);
+ void setContextMenu(Menu contextMenu);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ImageList.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ImageList.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ImageList.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -25,7 +25,7 @@
*
* @author Yahor Radtsevich (yradtsevich)
*/
-class ImageList {
+public class ImageList {
private Widget disposable;
private Map<String, Image> imageMap = new HashMap<String, Image>();
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java 2012-02-15 19:21:33 UTC (rev 38769)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -15,7 +15,6 @@
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -228,62 +227,28 @@
return toolbar;
}
- public void setBrowserSize(int width, int height) {
+ @Override
+ public void setOrientationAndSize(Point maximumShellSize, int orientation, Point browserSize) {
GridData data = (GridData) browser.getLayoutData();
- Rectangle clientArea = getMonitorClientArea();
int shellWidthHint = SWT.DEFAULT;
- if (width != Device.DEFAULT_SIZE) {
- data.widthHint = width;
+ if (browserSize.x != Device.DEFAULT_SIZE) {
+ data.widthHint = browserSize.x;
} else if (data.widthHint == SWT.DEFAULT) {
- shellWidthHint = clientArea.width;
+ shellWidthHint = maximumShellSize.x;
}
int shellHeightHint = SWT.DEFAULT;
- if (height != Device.DEFAULT_SIZE) {
- data.heightHint = height;
+ if (browserSize.y != Device.DEFAULT_SIZE) {
+ data.heightHint = browserSize.y;
} else if (data.heightHint == SWT.DEFAULT) {
- shellHeightHint = clientArea.height;
+ shellHeightHint = maximumShellSize.y;
}
Point shellSize = shell.computeSize(shellWidthHint, shellHeightHint);
- shellSize.x = Math.min(shellSize.x, clientArea.width);
- shellSize.y = Math.min(shellSize.y, clientArea.height);
+ shellSize.x = Math.min(shellSize.x, maximumShellSize.x);
+ shellSize.y = Math.min(shellSize.y, maximumShellSize.y);
shell.setSize(shellSize);
-
- Rectangle shellBounds = shell.getBounds();
- int bottomOverlap = shellBounds.y + shellBounds.height - (clientArea.y + clientArea.height);
- if (bottomOverlap > 0) {
- if (shellBounds.y > bottomOverlap) {
- shellBounds.y -= bottomOverlap;
- } else {
- shellBounds.y = 0;
- }
- }
-
- int rightOverlap = shellBounds.x + shellBounds.width - (clientArea.x + clientArea.width);
- if (rightOverlap > 0) {
- if (shellBounds.x > rightOverlap) {
- shellBounds.x -= rightOverlap;
- } else {
- shellBounds.x = 0;
- }
- }
-
- shell.setBounds(shellBounds);
}
- private Rectangle getMonitorClientArea() {
- Rectangle clientArea = skinComposite.getMonitor().getClientArea();
-
- /* on Linux returned monitor client area may be bigger
- * than the monitor bounds when multiple monitors are used.
- * The following code fixes this */
- Rectangle bounds = skinComposite.getMonitor().getBounds();
- clientArea.width = Math.min(clientArea.width, bounds.width);
- clientArea.height = Math.min(clientArea.height, bounds.height);
-
- return clientArea;
- }
-
@Override
public BrowserSimBrowser getBrowser() {
return browser;
@@ -324,8 +289,12 @@
}
@Override
- public void setOrientation(int orientation) {
- // do nothing, only browser size should change it should
- // be done by calling setBrowserSize(int width, int height)
+ public void setAddressBarVisible(boolean visible) {
+ // not supported
}
+
+ @Override
+ public void setContextMenu(Menu contextMenu) {
+ // not supported
+ }
}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,323 @@
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.ProgressBar;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.vpe.browsersim.browser.BrowserSimBrowser;
+import org.jboss.tools.vpe.browsersim.browser.IBrowserSimBrowserFactory;
+import org.jboss.tools.vpe.browsersim.model.Device;
+import org.jboss.tools.vpe.browsersim.model.DeviceOrientation;
+import org.jboss.tools.vpe.browsersim.ui.ControlHandler;
+import org.jboss.tools.vpe.browsersim.ui.skin.BrowserSimSkin;
+
+public class AppleIPhone3ResizableSkin implements BrowserSimSkin {
+ private static final Point VERTICAL_BORDERS_SIZE = new Point(384 - 320, 727 - 480);
+ private static final Point HORIZONTAL_BORDERS_SIZE = new Point(VERTICAL_BORDERS_SIZE.y, VERTICAL_BORDERS_SIZE.x);
+ private static final IPhoneSkinDescriptor VERTICAL_IPHONE3_DESCRIPTOR;
+ static {
+ String bd = "ios/iphone3/vertical/";
+ ImageDescriptor iOsDescriptor = new ImageDescriptor(null, 5, 3, SWT.VERTICAL | SWT.HORIZONTAL);
+ ImageDescriptor[] bodyGridImageDescriptors = {
+ new ImageDescriptor(bd + "01.png"), new ImageDescriptor(bd + "02.png"), new ImageDescriptor(bd + "03.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(bd + "04.png"), new ImageDescriptor(bd + "05.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(bd + "06.png"), new ImageDescriptor(bd + "07.png"),
+ new ImageDescriptor(bd + "08.png"), iOsDescriptor, new ImageDescriptor(bd + "14.png"),
+ new ImageDescriptor(bd + "21.png", 1, 1, SWT.VERTICAL), new ImageDescriptor(bd + "22.png", 1, 1, SWT.VERTICAL),
+ new ImageDescriptor(bd + "23.png"), new ImageDescriptor(bd + "24.png"),
+ new ImageDescriptor(bd + "25.png"), new ImageDescriptor(bd + "26.png"), new ImageDescriptor(bd + "27.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(bd + "28.png"), new ImageDescriptor(bd + "29.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(bd + "30.png"), new ImageDescriptor(bd + "31.png"),
+ };
+ int bodyGridSize = 7;
+
+ String bd2 = "ios/";
+ ButtonDescriptor backButtonDescriptor;
+ {
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(0, 52);
+ formData.bottom = new FormAttachment(100, -132);
+ backButtonDescriptor = new ButtonDescriptor(formData, bd2 + "back.png", bd2 + "back-disabled.png", bd2 + "back-selected.png");
+ }
+
+ ButtonDescriptor forwardButtonDescriptor;
+ {
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(0, 115);
+ formData.bottom = new FormAttachment(100, -132);
+ forwardButtonDescriptor = new ButtonDescriptor(formData, bd2 + "forward.png", bd2 + "forward-disabled.png", bd2 + "forward-selected.png");
+ }
+ VERTICAL_IPHONE3_DESCRIPTOR = new IPhoneSkinDescriptor(bodyGridSize, bodyGridImageDescriptors, iOsDescriptor, backButtonDescriptor, forwardButtonDescriptor);
+ }
+ private static final IPhoneSkinDescriptor HORIZONTAL_IPHONE3_DESCRIPTOR;
+ static {
+ String bd = "ios/iphone3/horizontal/";
+ ImageDescriptor iOsDescriptor = new ImageDescriptor(null, 5, 5, SWT.VERTICAL | SWT.HORIZONTAL);
+ ImageDescriptor[] bodyGridImageDescriptors = {
+ new ImageDescriptor(bd + "01.png"), new ImageDescriptor(bd + "02.png"), new ImageDescriptor(bd + "03.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(bd + "04.png"), new ImageDescriptor(bd + "05.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(bd + "06.png"), new ImageDescriptor(bd + "07.png"),
+ new ImageDescriptor(bd + "08.png"), iOsDescriptor, new ImageDescriptor(bd + "10.png"),
+ new ImageDescriptor(bd + "11.png", 1, 1, SWT.VERTICAL), new ImageDescriptor(bd + "12.png", 1, 1, SWT.VERTICAL),
+ new ImageDescriptor(bd + "13.png"), new ImageDescriptor(bd + "14.png"),
+ new ImageDescriptor(bd + "15.png", 1, 1, SWT.VERTICAL), new ImageDescriptor(bd + "16.png", 1, 1, SWT.VERTICAL),
+ new ImageDescriptor(bd + "17.png"), new ImageDescriptor(bd + "18.png"),
+ new ImageDescriptor(bd + "19.png"), new ImageDescriptor(bd + "20.png"), new ImageDescriptor(bd + "21.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(bd + "22.png"), new ImageDescriptor(bd + "23.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(bd + "24.png"), new ImageDescriptor(bd + "25.png"),
+ };
+ int bodyGridSize = 7;
+ String bd2 = "ios/";
+ ButtonDescriptor backButtonDescriptor;
+ {
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(0, 145);
+ formData.bottom = new FormAttachment(100, -36);
+ backButtonDescriptor = new ButtonDescriptor(formData, bd2 + "back.png", bd2 + "back-disabled.png", bd2 + "back-selected.png");
+ }
+
+ ButtonDescriptor forwardButtonDescriptor;
+ {
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(0, 247);
+ formData.bottom = new FormAttachment(100, -36);
+ forwardButtonDescriptor = new ButtonDescriptor(formData, bd2 + "forward.png", bd2 + "forward-disabled.png", bd2 + "forward-selected.png");
+ }
+ HORIZONTAL_IPHONE3_DESCRIPTOR = new IPhoneSkinDescriptor(bodyGridSize, bodyGridImageDescriptors, iOsDescriptor, backButtonDescriptor, forwardButtonDescriptor);
+ }
+
+ private IBrowserSimBrowserFactory browserFactory;
+ private boolean vertical;
+ private Display display;
+ private Shell shell;
+ private BrowserSimBrowser browser;
+ private ControlHandler controlHandler;
+ private AppleIPhoneComposite iPhoneComposite;
+
+ @Override
+ public void setBrowserFactory(IBrowserSimBrowserFactory browserFactory) {
+ this.browserFactory = browserFactory;
+ }
+
+ @Override
+ public void createControls(Display display) {
+ this.display = display;
+ shell = new Shell(display, SWT.NO_TRIM | SWT.NO_BACKGROUND);
+ shell.setLayout(new FillLayout());
+
+ iPhoneComposite = new AppleIPhoneComposite(shell, VERTICAL_IPHONE3_DESCRIPTOR);
+ vertical = true;
+ bindIPhoneCompositeControls();
+ Composite browserContainer = iPhoneComposite.getBrowserContainer();
+ browserContainer.setLayout(new FillLayout());
+ browser = browserFactory.createBrowser(browserContainer, SWT.NONE);
+
+ shell.setSize(/*shell.computeSize(SWT.DEFAULT, SWT.DEFAULT)*/ 384, 727);
+ shell.open();
+ setShellRegion();
+ }
+
+ private void setShellRegion() {
+ shell.setRegion(null);
+ display.asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ Region region = new Region();
+// shellRegion.add(AppleIPhone3Skin.VISIBLE_REGION[0]);
+ GC gc = new GC(shell);
+ final Image screenshot = new Image(display, shell.getBounds());
+ gc.copyArea(screenshot, 0, 0);
+ gc.dispose();
+ ImageData imageData = screenshot.getImageData();
+ region.add(0, 0, imageData.width, imageData.height);
+ int firstPixel = imageData.getPixel(0, 0);
+ for (int i = 0; i < imageData.height; i++) {
+ for (int j = 0; j < imageData.width; j++) {
+ if (imageData.getPixel(j, i) == firstPixel) {
+ region.subtract(j, i, 1, 1);
+ }
+ }
+ }
+ screenshot.dispose();
+ shell.setRegion(region);
+ region.dispose();
+ }
+ });
+ }
+
+ private void bindIPhoneCompositeControls() {
+ iPhoneComposite.getBackButtonComposite().addMouseListener(new MouseAdapter() {
+ public void mouseDown(MouseEvent e) {
+ if (e.button == 1) {
+ controlHandler.goBack();
+ }
+ }
+ });
+ iPhoneComposite.getForwardButtonComposite().addMouseListener(new MouseAdapter() {
+ public void mouseDown(MouseEvent e) {
+ if (e.button == 1) {
+ controlHandler.goForward();
+ }
+ }
+ });
+ iPhoneComposite.getStopButtonComposite().addMouseListener(new MouseAdapter() {
+ public void mouseDown(MouseEvent e) {
+ if (e.button == 1) {
+ controlHandler.stop();
+ }
+ }
+ });
+ iPhoneComposite.getRefreshButtonComposite().addMouseListener(new MouseAdapter() {
+ public void mouseDown(MouseEvent e) {
+ if (e.button == 1) {
+ controlHandler.refresh();
+ }
+ }
+ });
+ iPhoneComposite.getUrlText().addListener(SWT.DefaultSelection, new Listener() {
+ public void handleEvent(Event e) {
+ controlHandler.goToAddress(((Text)e.widget).getText());
+ }
+ });
+
+
+ Listener l = new Listener() {
+ Point origin;
+ Point shellOrigin;
+
+ public void handleEvent(Event e) {
+ if ((e.stateMask & SWT.BUTTON1) != 0 || e.button == 1) { // left mouse Composite
+ switch (e.type) {
+ case SWT.MouseDown:
+ origin = AppleIPhone3ResizableSkin.this.display.map(shell, null, e.x, e.y);
+ shellOrigin = shell.getLocation();
+ break;
+ case SWT.MouseUp:
+ origin = null;
+ break;
+ case SWT.MouseMove:
+ if (origin != null) {
+ Point p = AppleIPhone3ResizableSkin.this.display.map(shell, null, e.x, e.y);
+ shell.setLocation(shellOrigin.x + p.x - origin.x, shellOrigin.y + p.y - origin.y);
+ }
+ break;
+ }
+ }
+ }
+ };
+ iPhoneComposite.addListener(SWT.MouseDown, l);
+ iPhoneComposite.addListener(SWT.MouseUp, l);
+ iPhoneComposite.addListener(SWT.MouseMove, l);
+ }
+
+ @Override
+ public BrowserSimBrowser getBrowser() {
+ return browser;
+ }
+
+ @Override
+ public Shell getShell() {
+ return shell;
+ }
+
+ @Override
+ public Menu getMenuBar() {
+ return display.getMenuBar();
+ }
+
+ @Override
+ public void setControlHandler(ControlHandler controlHandler) {
+ this.controlHandler = controlHandler;
+ }
+
+ @Override
+ public void locationChanged(String newLocation, boolean backEnabled,
+ boolean forwardEnabled) {
+ iPhoneComposite.getUrlText().setText(newLocation);
+ iPhoneComposite.getBackButtonComposite().setEnabled(backEnabled);
+ iPhoneComposite.getForwardButtonComposite().setEnabled(forwardEnabled);
+ }
+
+ @Override
+ public void progressChanged(int percents) {
+ ProgressBar progressBar = iPhoneComposite.getProgressBar();
+ if (percents > 0) {
+ progressBar.setVisible(true);
+ progressBar.setSelection(percents);
+ } else {
+ progressBar.setVisible(false);
+ progressBar.setSelection(0);
+ }
+ }
+
+ @Override
+ public void statusTextChanged(String newStatusText) {
+ // not supported
+ }
+
+ @Override
+ public void setOrientationAndSize(Point maximumShellSize, int orientation, Point browserSize) {
+ vertical = (orientation == DeviceOrientation.PORTRAIT || orientation == DeviceOrientation.PORTRAIT_INVERTED);
+ String urlTextText = iPhoneComposite.getUrlText().getText();
+ boolean backEnabled = iPhoneComposite.getBackButtonComposite().getEnabled();
+ boolean forwardEnabled = iPhoneComposite.getForwardButtonComposite().getEnabled();
+ boolean navBarVisible = iPhoneComposite.isNavBarCompositeVisible();
+ Menu contextMenu = iPhoneComposite.getMenu();
+ iPhoneComposite.setMenu(null);
+
+ AppleIPhoneComposite oldIPhoneComposite = iPhoneComposite;
+ IPhoneSkinDescriptor skinDescriptor;
+ if (vertical) {
+ skinDescriptor = VERTICAL_IPHONE3_DESCRIPTOR;
+ } else {
+ skinDescriptor = HORIZONTAL_IPHONE3_DESCRIPTOR;
+ }
+ iPhoneComposite = new AppleIPhoneComposite(shell, skinDescriptor);
+ bindIPhoneCompositeControls();
+ Composite browserContainer = iPhoneComposite.getBrowserContainer();
+ browserContainer.setLayout(new FillLayout());
+ browser.setParent(browserContainer);
+ oldIPhoneComposite.dispose();
+ Point bordersSize = vertical ? VERTICAL_BORDERS_SIZE : HORIZONTAL_BORDERS_SIZE;
+ int shellWidth;
+ if (browserSize.x == SWT.DEFAULT) {
+ shellWidth = SWT.DEFAULT;
+ } else {
+ shellWidth = Math.min(bordersSize.x + browserSize.x, maximumShellSize.x);
+ }
+ int shellHeight;
+ if (browserSize.y == SWT.DEFAULT) {
+ shellHeight = SWT.DEFAULT;
+ } else {
+ shellHeight = Math.min(bordersSize.y + browserSize.y, maximumShellSize.y);
+ }
+
+ shell.setSize(shell.computeSize(shellWidth, shellHeight));
+ shell.layout(true);
+ setShellRegion();
+
+ iPhoneComposite.getUrlText().setText(urlTextText);
+ iPhoneComposite.getBackButtonComposite().setEnabled(backEnabled);
+ iPhoneComposite.getForwardButtonComposite().setEnabled(forwardEnabled);
+ iPhoneComposite.setNavBarCompositeVisible(navBarVisible);
+ iPhoneComposite.setMenu(contextMenu);
+ }
+
+ @Override
+ public void setAddressBarVisible(boolean visible) {
+ iPhoneComposite.setNavBarCompositeVisible(visible);
+ }
+
+ @Override
+ public void setContextMenu(Menu contextMenu) {
+ iPhoneComposite.setMenu(contextMenu);
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhoneComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhoneComposite.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhoneComposite.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,187 @@
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+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.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.ProgressBar;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.vpe.browsersim.ui.skin.ImageList;
+
+
+public class AppleIPhoneComposite extends Composite {
+ private ImageList imageList;
+ private Composite iOsCompositeContainer;
+
+// ImageDescriptor I_OS_DESCRIPTOR = new ImageDescriptor(null, 5, 3, SWT.VERTICAL | SWT.HORIZONTAL);
+// ImageDescriptor[] BODY_DESCRIPTOR = {
+// new ImageDescriptor("01.png"), new ImageDescriptor("02.png"), new ImageDescriptor("03.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor("04.png"), new ImageDescriptor("05.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor("06.png"), new ImageDescriptor("07.png"),
+// new ImageDescriptor("08.png"), I_OS_DESCRIPTOR, new ImageDescriptor("14.png"),
+// new ImageDescriptor("21.png", 1, 1, SWT.VERTICAL), new ImageDescriptor("22.png", 1, 1, SWT.VERTICAL),
+// new ImageDescriptor("23.png"), new ImageDescriptor("24.png"),
+// new ImageDescriptor("25.png"), new ImageDescriptor("26.png"), new ImageDescriptor("27.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor("28.png"), new ImageDescriptor("29.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor("30.png"), new ImageDescriptor("31.png"),
+// };
+
+ private Composite browserContainer;
+ private IOSNavBarComposite navBarComposite;
+ private ImageButtonComposite forwardButtonComposite;
+ private ImageButtonComposite backButtonComposite;
+
+ private Composite bodyComposite;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param skinDescriptor
+ * @param style
+ */
+ public AppleIPhoneComposite(Composite parent, IPhoneSkinDescriptor skinDescriptor) {
+ super(parent, SWT.NONE);
+
+ imageList = new ImageList(this);
+ setLayout(new FormLayout());
+
+ backButtonComposite = new ImageButtonComposite(this, imageList, skinDescriptor.getBackButton());
+ forwardButtonComposite = new ImageButtonComposite(this, imageList, skinDescriptor.getForwardButton());
+
+ bodyComposite = new Composite(this, SWT.NONE);
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(0);
+ formData.top = new FormAttachment(0);
+ formData.right = new FormAttachment(100);
+ formData.bottom = new FormAttachment(100);
+ bodyComposite.setLayoutData(formData);
+
+ GridLayout gridLayout = new GridLayout(skinDescriptor.getBodyGridSize(), false);
+ gridLayout.verticalSpacing = 0;
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ bodyComposite.setLayout(gridLayout);
+
+ for (ImageDescriptor descriptor : skinDescriptor.getBodyGridImageDescriptors()) {
+ Composite composite = descriptor.createWidget(bodyComposite, imageList);
+ if (descriptor == skinDescriptor.getiOSDescriptor()) {
+ iOsCompositeContainer = composite;
+ }
+ }
+
+ gridLayout = new GridLayout(1, false);
+ gridLayout.verticalSpacing = 0;
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ iOsCompositeContainer.setLayout(gridLayout);
+ IOsTimeComposite timeComposite = new IOsTimeComposite(iOsCompositeContainer, imageList);
+ GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 1, 1);
+ timeComposite.setLayoutData(gridData);
+
+ navBarComposite = new IOSNavBarComposite(iOsCompositeContainer, imageList);
+ gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 1, 1);
+ navBarComposite.setLayoutData(gridData);
+
+ browserContainer = new Composite(iOsCompositeContainer, SWT.NONE);
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+ browserContainer.setLayoutData(gridData);
+
+ timeComposite.addMouseListener(new MouseAdapter() {
+ public void mouseDown(MouseEvent e) {
+ if (e.button == 1) {
+ setNavBarCompositeVisible(!isNavBarCompositeVisible());
+ }
+ }
+ });
+ }
+
+ public ImageButtonComposite getBackButtonComposite() {
+ return backButtonComposite;
+ }
+
+ public ImageButtonComposite getForwardButtonComposite() {
+ return forwardButtonComposite;
+ }
+
+ public Composite getBrowserContainer() {
+ return browserContainer;
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public void setNavBarCompositeVisible(boolean visible) {
+ GridData gridData = (GridData) navBarComposite.getLayoutData();
+ if (visible) {
+ gridData.heightHint = SWT.DEFAULT;
+ } else {
+ gridData.heightHint = 0;
+ }
+ iOsCompositeContainer.layout();
+ }
+
+ public boolean isNavBarCompositeVisible() {
+ GridData gridData = (GridData) navBarComposite.getLayoutData();
+ return gridData.heightHint != 0;
+ }
+
+ public ImageButtonComposite getStopButtonComposite() {
+ return navBarComposite.getStopButtonComposite();
+ }
+
+ public ImageButtonComposite getRefreshButtonComposite() {
+ return navBarComposite.getRefreshButtonComposite();
+ }
+
+ public Text getUrlText() {
+ return navBarComposite.getUrlText();
+ }
+
+ public ProgressBar getProgressBar() {
+ return navBarComposite.getProgressBar();
+ }
+
+ @Override
+ public void addListener(int eventType, Listener listener) {
+ super.addListener(eventType, listener);
+ switch (eventType) {
+ case SWT.MouseDown:
+ case SWT.MouseUp:
+ case SWT.MouseMove:
+ bodyComposite.addListener(eventType, listener);
+ for (Control child : bodyComposite.getChildren()) {
+ child.addListener(eventType, listener);
+ }
+ }
+ }
+
+ @Override
+ public void removeListener(int eventType, Listener listener) {
+ super.removeListener(eventType, listener);
+ switch (eventType) {
+ case SWT.MouseDown:
+ case SWT.MouseUp:
+ case SWT.MouseMove:
+ bodyComposite.removeListener(eventType, listener);
+ for (Control child :bodyComposite.getChildren()) {
+ child.removeListener(eventType, listener);
+ }
+ }
+ }
+
+ @Override
+ public void setMenu(Menu menu) {
+ super.setMenu(menu);
+ bodyComposite.setMenu(menu);
+ for (Control child :bodyComposite.getChildren()) {
+ child.setMenu(menu);
+ }
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ButtonDescriptor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ButtonDescriptor.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ButtonDescriptor.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,34 @@
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+
+import org.eclipse.swt.layout.FormData;
+
+public class ButtonDescriptor {
+ private String enabledImageName;
+ private String disabledImageName;
+ private String selectedImageName;
+
+ /** the width and height fields are ignored*/
+ private FormData formData;
+
+ /** the width and height fields of formData are ignored*/
+ public ButtonDescriptor(FormData formData, String enabledImageName,
+ String disabledImageName, String selectedImageName) {
+ this.formData = formData;
+ this.enabledImageName = enabledImageName;
+ this.disabledImageName = disabledImageName;
+ this.selectedImageName = selectedImageName;
+ }
+
+ public String getEnabledImageName() {
+ return enabledImageName;
+ }
+ public String getDisabledImageName() {
+ return disabledImageName;
+ }
+ public String getSelectedImageName() {
+ return selectedImageName;
+ }
+ public FormData getFormData() {
+ return formData;
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,110 @@
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ProgressBar;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.vpe.browsersim.ui.skin.ImageList;
+
+
+public class IOSNavBarComposite extends Composite {
+ private final String BD = "ios/";
+ private final ImageDescriptor[] BODY_DESCRIPTOR = {
+ new ImageDescriptor(BD + "nav-1.png"), new ImageDescriptor(BD + "nav-2.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(BD + "nav-3.png"), new ImageDescriptor(BD + "nav-4.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(BD + "nav-5.png")
+ };
+ private ImageButtonComposite stopButtonComposite;
+ private ImageButtonComposite refreshButtonComposite;
+ private Text urlText;
+ private ProgressBar progressBar;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public IOSNavBarComposite(Composite parent, ImageList imageList) {
+ super(parent, SWT.NONE);
+
+ this.setLayout(new FormLayout());
+
+ urlText = new Text(this, SWT.SINGLE);
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(0, 12);
+ formData.right = new FormAttachment(100, -62);
+ formData.top = new FormAttachment(0, 33);
+ formData.bottom = new FormAttachment(100, -8);
+ urlText.setLayoutData(formData);
+
+ refreshButtonComposite = new ImageButtonComposite(this, imageList.getImage(BD + "refresh.png"), imageList.getImage(BD + "refresh.png"), imageList.getImage(BD + "refresh-selected.png"));
+ formData = new FormData();
+ Rectangle refreshImageBounds = imageList.getImage(BD + "refresh.png").getBounds();
+ formData.right = new FormAttachment(100, -8);
+ formData.bottom = new FormAttachment(100, -7);
+ formData.width = refreshImageBounds.width;
+ formData.height = refreshImageBounds.height;
+ refreshButtonComposite.setLayoutData(formData);
+
+ stopButtonComposite = new ImageButtonComposite(this, imageList.getImage(BD + "stop.png"), imageList.getImage(BD + "stop.png"), imageList.getImage(BD + "stop-selected.png"));
+ formData = new FormData();
+ Rectangle stopImageBounds = imageList.getImage(BD + "stop.png").getBounds();
+ formData.right = new FormAttachment(100, -42);
+ formData.bottom = new FormAttachment(100, -11);
+ formData.width = stopImageBounds.width;
+ formData.height = stopImageBounds.height;
+ stopButtonComposite.setLayoutData(formData);
+
+ progressBar = new ProgressBar(this, SWT.NONE);
+ progressBar.setVisible(false);
+ formData = new FormData();
+ formData.left = new FormAttachment(0, 7);
+ formData.right = new FormAttachment(100, -36);
+ formData.bottom = new FormAttachment(100, -1);
+ formData.height = 5;
+ progressBar.setLayoutData(formData);
+
+ Composite imagesComposite = new Composite(this, SWT.NONE);
+ formData = new FormData();
+ formData.left = new FormAttachment(0);
+ formData.right = new FormAttachment(100);
+ formData.top = new FormAttachment(0);
+ formData.bottom = new FormAttachment(100);
+ imagesComposite.setLayoutData(formData);
+
+ GridLayout gridLayout = new GridLayout(5, false);
+ gridLayout.verticalSpacing = 0;
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+
+ imagesComposite.setLayout(gridLayout);
+
+ for (ImageDescriptor descriptor : BODY_DESCRIPTOR) {
+ descriptor.createWidget(imagesComposite, imageList);
+ }
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ public ImageButtonComposite getStopButtonComposite() {
+ return stopButtonComposite;
+ }
+
+ public ImageButtonComposite getRefreshButtonComposite() {
+ return refreshButtonComposite;
+ }
+
+ public Text getUrlText() {
+ return urlText;
+ }
+
+ public ProgressBar getProgressBar() {
+ return progressBar;
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOsTimeComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOsTimeComposite.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOsTimeComposite.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,65 @@
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Listener;
+import org.jboss.tools.vpe.browsersim.ui.skin.ImageList;
+
+
+public class IOsTimeComposite extends Composite {
+ private final String BD = "ios/";
+ private final ImageDescriptor[] BODY_DESCRIPTOR = {
+ new ImageDescriptor(BD + "time-1.png"), new ImageDescriptor(BD + "time-2.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(BD + "time-3.png"), new ImageDescriptor(BD + "time-4.png", 1, 1, SWT.HORIZONTAL), new ImageDescriptor(BD + "time-5.png")
+ };
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public IOsTimeComposite(Composite parent, ImageList imageList) {
+ super(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(5, false);
+ gridLayout.verticalSpacing = 0;
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ setLayout(gridLayout);
+
+ for (ImageDescriptor descriptor : BODY_DESCRIPTOR) {
+ descriptor.createWidget(this, imageList);
+ }
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ @Override
+ public void addListener(int eventType, Listener listener) {
+ super.addListener(eventType, listener);
+ switch (eventType) {
+ case SWT.MouseDown:
+ case SWT.MouseUp:
+ case SWT.MouseMove:
+ for (Control child : getChildren()) {
+ child.addListener(eventType, listener);
+ }
+ }
+ }
+
+ @Override
+ public void removeListener(int eventType, Listener listener) {
+ super.removeListener(eventType, listener);
+ switch (eventType) {
+ case SWT.MouseDown:
+ case SWT.MouseUp:
+ case SWT.MouseMove:
+ for (Control child : getChildren()) {
+ child.removeListener(eventType, listener);
+ }
+ }
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IPhoneSkinDescriptor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IPhoneSkinDescriptor.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IPhoneSkinDescriptor.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,40 @@
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+
+public class IPhoneSkinDescriptor {
+ private int bodyGridSize;
+ private ImageDescriptor[] bodyGridImageDescriptors;
+ private ImageDescriptor iOSDescriptor;
+ private ButtonDescriptor backButton;
+ private ButtonDescriptor forwardButton;
+
+ public IPhoneSkinDescriptor(int bodyGridSize,
+ ImageDescriptor[] bodyGridImageDescriptors,
+ ImageDescriptor iOSDescriptor, ButtonDescriptor backButton,
+ ButtonDescriptor forwardButton) {
+ this.bodyGridSize = bodyGridSize;
+ this.bodyGridImageDescriptors = bodyGridImageDescriptors;
+ this.iOSDescriptor = iOSDescriptor;
+ this.backButton = backButton;
+ this.forwardButton = forwardButton;
+ }
+
+ public int getBodyGridSize() {
+ return bodyGridSize;
+ }
+
+ public ImageDescriptor[] getBodyGridImageDescriptors() {
+ return bodyGridImageDescriptors;
+ }
+
+ public ImageDescriptor getiOSDescriptor() {
+ return iOSDescriptor;
+ }
+
+ public ButtonDescriptor getBackButton() {
+ return backButton;
+ }
+
+ public ButtonDescriptor getForwardButton() {
+ return forwardButton;
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ImageButtonComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ImageButtonComposite.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ImageButtonComposite.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,95 @@
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.vpe.browsersim.ui.skin.ImageList;
+
+
+public class ImageButtonComposite extends Composite {
+
+ private MouseTrackListener mouseTrackListener;
+ private Image enabledImage;
+ private Image disabledImage;
+ private Image selectedImage;
+ protected boolean enabled;
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public ImageButtonComposite(Composite parent, Image enabledImage, Image disabledImage, Image selectedImage) {
+ super(parent, SWT.NONE);
+ this.enabledImage = enabledImage;
+ this.disabledImage = disabledImage;
+ this.selectedImage = selectedImage;
+ setEnabled(true);
+ addMouseTrackListener(getMouseTrackListener());
+ }
+
+ public ImageButtonComposite(Composite parent, ImageList imageList, ButtonDescriptor buttonDescriptor) {
+ this( parent, imageList.getImage(buttonDescriptor.getEnabledImageName()),
+ imageList.getImage(buttonDescriptor.getDisabledImageName()),
+ imageList.getImage(buttonDescriptor.getSelectedImageName()) );
+
+ FormData formData = buttonDescriptor.getFormData();
+ FormData actualFormData = new FormData();
+ actualFormData.left = formData.left;
+ actualFormData.top = formData.top;
+ actualFormData.right = formData.right;
+ actualFormData.bottom = formData.bottom;
+
+ Rectangle size = enabledImage.getBounds();
+ actualFormData.width = size.width;
+ actualFormData.height = size.height;
+
+ this.setLayoutData(actualFormData);
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ if (enabled) {
+ setBackgroundImage(enabledImage);
+ } else {
+ setBackgroundImage(disabledImage);
+ }
+ }
+
+ public boolean getEnabled() {
+ return enabled;
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ private MouseTrackListener getMouseTrackListener() {
+ if (mouseTrackListener == null) {
+ mouseTrackListener = new MouseTrackListener() {
+ @Override
+ public void mouseHover(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseExit(MouseEvent e) {
+ if (enabled) {
+ setBackgroundImage(enabledImage);
+ }
+ }
+
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ if (enabled) {
+ setBackgroundImage(selectedImage);
+ }
+ }
+ };
+ }
+ return mouseTrackListener;
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ImageDescriptor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ImageDescriptor.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/ImageDescriptor.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,55 @@
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+import org.jboss.tools.vpe.browsersim.ui.skin.ImageList;
+import org.jboss.tools.vpe.browsersim.ui.skin.ios.WidgetDescriptor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+
+class ImageDescriptor extends WidgetDescriptor {
+ protected String imageName;
+
+ public ImageDescriptor(String imageName, int horizontalSpan, int verticalSpan, int stretching) {
+ super(horizontalSpan, verticalSpan, stretching);
+ this.imageName = imageName;
+ }
+ public ImageDescriptor(String imageName, int horizontalSpan, int verticalSpan) {
+ this(imageName, horizontalSpan, verticalSpan, SWT.NONE);
+ }
+ public ImageDescriptor(String imageName) {
+ this(imageName, 1, 1);
+ }
+
+ public Composite createWidget(Composite parent, ImageList imageList) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ boolean fillHorizontal = (getStretching() & SWT.HORIZONTAL) != 0;
+ boolean fillVertical = (getStretching() & SWT.VERTICAL) != 0;
+ GridData gridData = new GridData(
+ fillHorizontal ? SWT.FILL: SWT.CENTER,
+ fillVertical ? SWT.FILL: SWT.CENTER,
+ fillHorizontal, fillVertical,
+ getHorizontalSpan(), getVerticalSpan());
+
+ String imageName = getImageName();
+ if (imageName != null) {
+ Image image = imageList.getImage(imageName);
+ composite.setBackgroundImage(image);
+ Rectangle bounds = image.getBounds();
+ gridData.widthHint = fillHorizontal ? SWT.DEFAULT : bounds.width;
+ gridData.heightHint = fillVertical ? SWT.DEFAULT : bounds.height;
+ } else {
+ composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ }
+
+ composite.setLayoutData(gridData);
+
+ return composite;
+ }
+
+ public String getImageName() {
+ return imageName;
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/WidgetDescriptor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/WidgetDescriptor.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/WidgetDescriptor.java 2012-02-15 19:58:40 UTC (rev 38770)
@@ -0,0 +1,31 @@
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+import org.eclipse.swt.SWT;
+
+class WidgetDescriptor {
+ protected int horizontalSpan;
+ protected int verticalSpan;
+ protected int stretching;
+
+ public WidgetDescriptor(int horizontalSpan, int verticalSpan, int stretching) {
+ this.verticalSpan = verticalSpan;
+ this.horizontalSpan = horizontalSpan;
+ this.stretching = stretching;
+ }
+
+ public WidgetDescriptor(int horizontalSpan, int verticalSpan) {
+ this(horizontalSpan, verticalSpan, SWT.NONE);
+ }
+ public WidgetDescriptor() {
+ this(1, 1);
+ }
+
+ public int getHorizontalSpan() {
+ return horizontalSpan;
+ }
+ public int getVerticalSpan() {
+ return verticalSpan;
+ }
+ public int getStretching() {
+ return stretching;
+ }
+}
14 years, 1 month
JBoss Tools SVN: r38769 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-02-15 14:21:33 -0500 (Wed, 15 Feb 2012)
New Revision: 38769
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java
Log:
Wizard 'Specify CDI Bean for the Injection Point' does not compute correctly condition 'can finish' https://issues.jboss.org/browse/JBIDE-10637
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java 2012-02-15 19:11:28 UTC (rev 38768)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java 2012-02-15 19:21:33 UTC (rev 38769)
@@ -11,7 +11,6 @@
package org.jboss.tools.cdi.internal.core.refactoring;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -28,7 +27,6 @@
import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
import org.eclipse.text.edits.InsertEdit;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
@@ -146,75 +144,6 @@
return list;
}
- private static void addQualifiersToParameter(ICompilationUnit compilationUnit, IInjectionPoint injectionPoint, List<ValuedQualifier> declarations, MultiTextEdit rootEdit){
- HashMap<IQualifier, Boolean> duplicants = new HashMap<IQualifier, Boolean>();
- if(!(injectionPoint instanceof IInjectionPointParameter))
- return;
- try{
- for(ValuedQualifier declaration : declarations){
- String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
- boolean duplicant = false;
- if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) &&
- !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
- duplicant = addImport(qualifierName, compilationUnit, rootEdit);
- }
- duplicants.put(declaration.getQualifier(), new Boolean(duplicant));
- }
-
- String paramName = ((IInjectionPointParameter)injectionPoint).getName();
- IMethod method = ((IInjectionPointParameter)injectionPoint).getBeanMethod().getMethod();
- IType type = method.getDeclaringType();
- IType t = compilationUnit.getType(type.getElementName());
- IMethod m = t.getMethod(method.getElementName(), method.getParameterTypes());
-
- IBuffer buffer = compilationUnit.getBuffer();
-
- ILocalVariable[] parameters = m.getParameters();
- for(int index = 0; index < parameters.length; index++){
- if(parameters[index].getElementName().equals(paramName)){
- StringBuffer b = new StringBuffer();
- if(index > 0)
- b.append(SPACE);
- for(ValuedQualifier declaration : declarations){
- String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
- String value = declaration.getValue();
-
- if(!value.isEmpty())
- value = "("+value+")";
-
- if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
- boolean duplicant = duplicants.get(declaration.getQualifier()).booleanValue();
- String annotation = getShortName(qualifierName);
- if(duplicant)
- annotation = qualifierName;
- b.append(AT+annotation+value+SPACE);
- }
- }
- b.append(Signature.getSignatureSimpleName(parameters[index].getTypeSignature())+SPACE);
- b.append(parameters[index].getElementName());
-
- String newValue = b.toString();
-
- if(!parameters[index].getSource().equals(newValue)){
- if(rootEdit != null){
- TextEdit edit = new ReplaceEdit(parameters[index].getSourceRange().getOffset(), parameters[index].getSourceRange().getLength(), b.toString());
- rootEdit.addChild(edit);
- }else{
- buffer.replace(parameters[index].getSourceRange().getOffset(), parameters[index].getSourceRange().getLength(), b.toString());
-
- synchronized(compilationUnit) {
- compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
- }
- }
- }
- }
- }
-
- }catch(JavaModelException ex){
- CDICorePlugin.getDefault().logError(ex);
- }
- }
-
public static ISourceRange getParameterRegion(IInjectionPointParameter injectionParameter){
try{
String paramName = injectionParameter.getName();
@@ -233,28 +162,24 @@
public static void addQualifiersToInjectionPoint(List<ValuedQualifier> deployed, IInjectionPoint injectionPoint, ICompilationUnit compilationUnit, MultiTextEdit edit){
try{
- if(injectionPoint instanceof IInjectionPointParameter){
- addQualifiersToParameter(compilationUnit, injectionPoint, deployed, edit);
- }else{
- IJavaElement element = getInjectedJavaElement(compilationUnit, injectionPoint);
- if(element == null || !element.exists())
- return;
-
- // delete unneeded qualifiers
- List<IQualifier> toDelete = findQualifiersToDelete(injectionPoint, deployed);
-
- for(IQualifier qualifier : toDelete){
- deleteAnnotation(qualifier.getSourceType().getFullyQualifiedName(), compilationUnit, element, edit);
+ IJavaElement element = getInjectedJavaElement(compilationUnit, injectionPoint);
+ if(element == null || !element.exists())
+ return;
+
+ // delete unneeded qualifiers
+ List<IQualifier> toDelete = findQualifiersToDelete(injectionPoint, deployed);
+
+ for(IQualifier qualifier : toDelete){
+ deleteAnnotation(qualifier.getSourceType().getFullyQualifiedName(), compilationUnit, element, edit);
+ }
+
+ for(ValuedQualifier declaration : deployed){
+ String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
+ String value = declaration.getValue();
+ if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
+ addQualifier(qualifierName, value, compilationUnit, element, edit);
+ updateQualifier(qualifierName, value, compilationUnit, element, edit);
}
-
- for(ValuedQualifier declaration : deployed){
- String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
- String value = declaration.getValue();
- if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
- addQualifier(qualifierName, value, compilationUnit, element, edit);
- updateQualifier(qualifierName, value, compilationUnit, element, edit);
- }
- }
}
}catch(CoreException ex){
CDICorePlugin.getDefault().logError(ex);
@@ -312,7 +237,7 @@
return false;
}
- private static IJavaElement getInjectedJavaElement(ICompilationUnit compilationUnit, IInjectionPoint injectionPoint){
+ private static IJavaElement getInjectedJavaElement(ICompilationUnit compilationUnit, IInjectionPoint injectionPoint) throws JavaModelException{
if(injectionPoint instanceof IInjectionPointField){
IField field = ((IInjectionPointField)injectionPoint).getField();
IType type = field.getDeclaringType();
@@ -325,8 +250,11 @@
IType type = method.getDeclaringType();
IType t = compilationUnit.getType(type.getElementName());
IMethod m = t.getMethod(method.getElementName(), method.getParameterTypes());
- // Why method? Why not Java element for parameter?
- return m;
+ for(ILocalVariable parameter : m.getParameters()){
+ if(parameter.getElementName().equals(((IInjectionPointParameter) injectionPoint).getName())){
+ return parameter;
+ }
+ }
}
return null;
}
14 years, 1 month
JBoss Tools SVN: r38768 - trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-15 14:11:28 -0500 (Wed, 15 Feb 2012)
New Revision: 38768
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF/MANIFEST.MF
Log:
[JBIDE-10896] upgraded the required egit verison to 1.2 since a plugin compiled against egit 1.2 is not running with egit 1.2
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF/MANIFEST.MF 2012-02-15 18:35:11 UTC (rev 38767)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF/MANIFEST.MF 2012-02-15 19:11:28 UTC (rev 38768)
@@ -6,9 +6,9 @@
Bundle-Activator: org.jboss.tools.openshift.egit.core.internal.EGitCoreActivator
Require-Bundle: org.jboss.ide.eclipse.as.core;bundle-version="2.3.0",
org.eclipse.jgit;bundle-version="[1.0.0,2.1.0)",
- org.eclipse.egit;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.egit;bundle-version="[1.2.0,2.0.0)",
com.jcraft.jsch;bundle-version="0.1.44",
- org.eclipse.egit.core;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.egit.core;bundle-version="[1.2.0,2.0.0)",
org.eclipse.team.core;bundle-version="[3.6.0,4.0.0)",
org.eclipse.wst.server.core;bundle-version="[1.1.302,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.7.100,4.0.0)",
14 years, 1 month
JBoss Tools SVN: r38767 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-02-15 13:35:11 -0500 (Wed, 15 Feb 2012)
New Revision: 38767
Added:
trunk/build/build-DEPRECATED.xml
Removed:
trunk/build/build.xml
Log:
rename build.xml to build-DEPRECATED.xml and post reason in the file (JBIDE-10690)
Copied: trunk/build/build-DEPRECATED.xml (from rev 38766, trunk/build/build.xml)
===================================================================
--- trunk/build/build-DEPRECATED.xml (rev 0)
+++ trunk/build/build-DEPRECATED.xml 2012-02-15 18:35:11 UTC (rev 38767)
@@ -0,0 +1,2064 @@
+<project default="run" basedir="." name="build.xml to wrap maven">
+<!--
+ This file is deprecated per JBIDE-10690 - if nothing breaks after renaming this file, it will be safe to delete.
+ Note that the "init" target has been reimplemented in build/results/build.xml and build/aggregate/build.xml, and that the
+ "collect.test.results.for.hudson" target has moved to build/results/collect-test-results.xml
+-->
+
+ <!-- ****************************** Configuration ****************************** -->
+
+ <!-- default maven version -->
+ <property name="maven.version" value="3.0.4" />
+
+ <!-- set name of component(s) to build+test, IN ORDER; if no subcomponents, use "." -->
+ <property name="COMPONENTS"
+ value="tests,common;
+ flow,jbpm;
+ jmx,archives,as;
+ bpel,smooks,freemarker,profiler,portlet,modeshape;
+ xulrunner,jst,vpe,jsf;
+ drools,esb,ws;
+ cdi,struts,hibernatetools,seam;
+ examples,birt;
+ maven"
+ />
+
+ <!-- svn root, including trunk or branch path -->
+ <property name="svn.root" value="http://anonsvn.jboss.org/repos/jbosstools/trunk" />
+
+ <!-- if true, use -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository; if false, use default ~/.m2/repository; or set another path if preferred -->
+ <property name="maven.repo.local" value="true" />
+
+ <!-- name/version we're building -->
+ <property name="product.name" value="JBoss Tools" />
+ <property name="product.id" value="JBossTools" />
+ <property name="product.version" value="3.2.0-beta-1" />
+ <!--
+ <property name="product.name" value="JBoss Developer Studio"/>
+ <property name="product.id" value="JBDS"/>
+ <property name="product.version" value="3.1.0-beta-1"/>
+ -->
+
+ <!-- TODO: connect build type (snapshot, milestone, release) to update site description (nightly, milestone, stable) -->
+ <!-- update site description :: not used if site.xml already present -->
+ <property name="update.site.description" value="Nightly Build" />
+
+ <!-- ****************************** Usage Instructions ****************************** -->
+ <target name="help" description="Usage Instructions" depends="init">
+ <echo>
+To run this script in Eclipse:
+ Run As > Ant Build
+
+To run this script via commandline (build default modules + run tests, then collect test results and build per-component + overall update site zips):
+ cd /path/to/checked/out/source/tree; ant
+
+or, to build everything but not *run* the tests:
+ ant -DMAVEN_FLAGS="clean install -Dmaven.test.skip"
+ or
+ ant -Dnotests=true
+
+or, to purge the local repo (or purge then build):
+ ant purge -q
+ or
+ ant clean-run
+
+or, to rebuild even if sources have not changed:
+ ant -Dbuild.if.sources.unchanged=true
+
+or, to fetch fresh sources, then build anew:
+ ant -Dclean.sources=true
+
+or, to (re-)run tests w/o (re-)building first:
+ ant -DMAVEN_FLAGS="osgi-test:test -B -fn"
+
+or, to build, test, and install 1 or more specific module(s):
+ ant -DCOMPONENTS=tests,common,flow,jbpm
+
+or, to re-build a single component's update site w/o building, testing, and installing it into the m2 repo:
+ ant -DCOMPONENT=jmx create.update.site
+
+or, to re-build the overall update site w/o building first (no applicable when COMPONENTS=.):
+ ant create.overall.update.site -Dbuild.if.sources.unchanged=true
+
+To have hudson manage sources (rather than having this script checkout/update them) use:
+ -Dhudson.managed.sources=true
+
+Note: if tests stall on Linux, install Xvfb and this script will use that to run Maven, unless use:
+ -DnoXvfb=true
+
+Here is the order in which components must be built:
+</echo>
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=";">
+ <sequential>
+ <echo message=" @{COMPONENT}," />
+ </sequential>
+ </for>
+ </target>
+
+ <!-- ******************* MAIN ENTRY TARGETS ******************* -->
+ <target name="clean-run" description="purge m2 repo, then run build" depends="purge, run" />
+
+ <target name="purge" depends="init">
+ <antcall target="genPomXml">
+ <param name="COMPONENT" value="purge" />
+ <param name="packaging" value="pom" />
+ </antcall>
+ <antcall target="mvn">
+ <param name="COMPONENT" value="purge" />
+ <param name="MAVEN_DIR" value="${WORKINGDIR}/purge/site" />
+ <param name="MAVEN_FLAGS" value="dependency:purge-local-repository -e -U -q -B -fae" />
+ <param name="noXvfb" value="true" />
+ </antcall>
+ <delete dir="${WORKINGDIR}/purge" includeemptydirs="true" quiet="true" />
+ <delete dir="${COMMON_TOOLS}/m2-repository/org/jboss/tools" includeemptydirs="true" quiet="true" />
+ </target>
+
+ <target name="run"
+ description="run a build, collect test results, generate overall update site"
+ depends="build, collect.all.test.results, create.overall.update.site, collect.update.site.results"
+ />
+
+ <target name="build"
+ description="run a build"
+ depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build"
+ />
+
+ <target name="test"
+ description="run tests w/o first getting sources + list of components to build; assumes an upstream build job was already run"
+ depends="init, get.bootstrap.scripts, get.all.components, run.build, collect.all.test.results"
+ />
+
+ <!-- ******************* MAIN ENTRY TARGETS ******************* -->
+
+ <!-- override for local build -->
+ <condition property="isInHudson" value="true">
+ <or>
+ <contains string="${user.dir}" substring="hudson" />
+ <contains string="${user.name}" substring="hudson" />
+ <contains string="${user.home}" substring="hudson" />
+ </or>
+ </condition>
+ <target name="local" unless="isInHudson">
+ <property name="WORKINGDIR" value="${basedir}" />
+ <property name="COMMON_TOOLS" value="${java.io.tmpdir}" />
+ </target>
+
+ <target name="get.ant-contrib" unless="ant-contrib.jar.exists">
+ <property name="ANTCONTRIB_MIRROR" value="http://downloads.sourceforge.net/ant-contrib/" />
+ <get usetimestamp="true"
+ dest="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip"
+ src="${ANTCONTRIB_MIRROR}/ant-contrib-1.0b2-bin.zip"
+ />
+ <touch file="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip" />
+ <mkdir dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_" />
+ <unzip src="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip"
+ dest="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_"
+ overwrite="true"
+ />
+ <copy file="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_/ant-contrib/lib/ant-contrib.jar"
+ tofile="${COMMON_TOOLS}/ant-contrib.jar"
+ failonerror="true"
+ />
+ <delete dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_" includeemptydirs="true" quiet="true" />
+ </target>
+
+ <target name="get.svnant" unless="svnant.jar.exists">
+ <echo level="debug">${os.name}, ${os.arch}, ${os.version}, ${osgi.os}</echo>
+ <property name="SVNANT_MIRROR" value="http://www.tigris.org/files/documents/906/46267" />
+ <if>
+ <istrue value="${isWindows}" />
+ <then>
+ <var name="svnant.enabled" unset="true" />
+ <var name="svnant.enabled" value="false" />
+ </then>
+ <else>
+ <exec executable="wget" dir="${COMMON_TOOLS}">
+ <arg line="${SVNANT_MIRROR}/svnant-1.3.0.zip --no-clobber" />
+ </exec>
+ </else>
+ </if>
+
+ <if>
+ <istrue value="${svnant.enabled}" />
+ <then>
+ <if>
+ <available file="${COMMON_TOOLS}/svnant-1.3.0.zip" type="file" />
+ <then>
+ <touch file="${COMMON_TOOLS}/svnant-1.3.0.zip" />
+ <mkdir dir="${java.io.tmpdir}/svnant-1.3.0.zip_" />
+ <unzip src="${COMMON_TOOLS}/svnant-1.3.0.zip"
+ dest="${java.io.tmpdir}/svnant-1.3.0.zip_"
+ overwrite="true"
+ />
+ <copy todir="${COMMON_TOOLS}" failonerror="true">
+ <fileset dir="${java.io.tmpdir}/svnant-1.3.0.zip_/svnant-1.3.0/lib/" includes="*.jar" />
+ </copy>
+ <delete dir="${java.io.tmpdir}/svnant-1.3.0.zip_" includeemptydirs="true" quiet="true" />
+ </then>
+ <elseif>
+ <or>
+ <not>
+ <available file="${COMMON_TOOLS}/svnant.jar" type="file" />
+ </not>
+ <not>
+ <available file="${COMMON_TOOLS}/svnkit.jar" type="file" />
+ </not>
+ <not>
+ <available file="${COMMON_TOOLS}/svnClientAdapter.jar" type="file" />
+ </not>
+ </or>
+ <then>
+ <fail>Error!
+Build cannot proceed!
+ Must install svnant.jar, svnkit.jar + svnClientAdapter.jar from
+ ${SVNANT_MIRROR}/svnant-1.3.0.zip
+ into ${COMMON_TOOLS}/.
+</fail>
+ </then>
+ </elseif>
+ </if>
+ </then>
+ <else>
+ <echo level="warning">Warning!
+Svnant unavailable. Will use Maven to fetch sources.
+</echo>
+ </else>
+ </if>
+ </target>
+
+ <target name="get.maven" unless="maven.exists">
+ <property name="MAVEN_MIRROR" value="http://mirror.csclub.uwaterloo.ca/apache/maven/binaries" />
+ <get usetimestamp="true"
+ dest="${COMMON_TOOLS}/apache-maven-${maven.version}-bin.tar.gz"
+ src="${MAVEN_MIRROR}/apache-maven-${maven.version}-bin.tar.gz"
+ />
+ <untar compression="gzip"
+ overwrite="false"
+ dest="${COMMON_TOOLS}"
+ src="${COMMON_TOOLS}/apache-maven-${maven.version}-bin.tar.gz"
+ />
+ <chmod perm="755" file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn" />
+ </target>
+
+ <target name="init" depends="local">
+ <macrodef name="now">
+ <attribute name="level" default="warning" />
+ <text name="info" optional="true" />
+ <sequential>
+ <var name="now" unset="true" />
+ <tstamp>
+ <format property="now" pattern="hh:mm:ss" />
+ </tstamp>
+ <echo level="@{level}">${now} @{info}</echo>
+ </sequential>
+ </macrodef>
+
+ <condition property="isWindows" value="true" else="false">
+ <or>
+ <os family="windows" />
+ <contains string="${os.name}" substring="windows" casesensitive="false" />
+ </or>
+ </condition>
+
+ <!-- https://jira.jboss.org/jira/browse/JBQA-3313 Use static, shared space outside workspace, instead of working directly in the workspace -->
+ <condition property="WORKINGDIR" value="/home/hudson/static_build_env/jbds/tools/sources" else="${basedir}">
+ <available file="/home/hudson/static_build_env/jbds" type="dir" />
+ </condition>
+ <mkdir dir="${WORKINGDIR}" />
+ <echo level="info">WORKINGDIR = ${WORKINGDIR}</echo>
+
+ <condition property="COMMON_TOOLS"
+ value="/home/hudson/static_build_env/jbds/tools"
+ else="${WORKINGDIR}/../tools"
+ >
+ <available file="/home/hudson/static_build_env/jbds" type="dir" />
+ </condition>
+ <mkdir dir="${COMMON_TOOLS}" />
+ <echo level="info">COMMON_TOOLS = ${COMMON_TOOLS}</echo>
+
+ <available file="${COMMON_TOOLS}/ant-contrib.jar" type="file" property="ant-contrib.jar.exists" />
+ <antcall target="get.ant-contrib" />
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath>
+ <pathelement location="${COMMON_TOOLS}/ant-contrib.jar" />
+ </classpath>
+ </taskdef>
+
+ <property name="svnant.enabled" value="true" />
+ <available file="${COMMON_TOOLS}/svnant.jar" type="file" property="svnant.jar.exists" />
+ <antcall target="get.svnant" />
+ <taskdef resource="org/tigris/subversion/svnant/svnantlib.xml">
+ <classpath>
+ <pathelement location="${COMMON_TOOLS}/svnant.jar" />
+ <pathelement location="${COMMON_TOOLS}/svnkit.jar" />
+ <pathelement location="${COMMON_TOOLS}/svnClientAdapter.jar" />
+ </classpath>
+ </taskdef>
+
+ <available file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn" type="file" property="maven.exists" />
+ <antcall target="get.maven" />
+ </target>
+
+ <target name="get.sources" description="if sources not already on disk, fetch them" unless="hudson.managed.sources">
+ <property name="clean.sources" value="false" />
+ <property name="svn.recurse" value="true" />
+
+ <!-- = = = = = = = = = = = = = = = = =
+ COMPONENT: component to fetch or update
+ op: up (update) or co (checkout)
+ = = = = = = = = = = = = = = = = = -->
+ <macrodef name="svn.fetch">
+ <attribute name="component" />
+ <attribute name="op" />
+ <sequential>
+ <!-- check out or update -->
+ <if>
+ <equals arg1="@{op}" arg2="up" />
+ <then>
+ <now level="info">Update '@{COMPONENT}'</now>
+ <if>
+ <istrue value="${svnant.enabled}" />
+ <then>
+ <!-- remove generated site/ folder?
+ <if>
+ <not>
+ <equals arg1="@{component}" arg2="." />
+ </not>
+ <then>
+ <delete dir="${WORKINGDIR}/@{component}/site"
+ includeemptydirs="true"
+ quiet="true"
+ />
+ </then>
+ -->
+ <!--
+ <svn javahl="false" svnkit="true" failonerror="false">
+ <revert recurse="${svn.recurse}" dir="@{component}" />
+ </svn>
+ -->
+ <svn javahl="false" svnkit="true" failonerror="false">
+ <update recurse="${svn.recurse}" dir="@{component}" />
+ </svn>
+ </then>
+ <else>
+ <antcall target="mvn">
+ <param name="MAVEN_DIR" value="${WORKINGDIR}" />
+ <param name="MAVEN_FLAGS"
+ value="scm:update -f ${WORKINGDIR}/parent-pom.xml -e -q -B -fae -Dmaven.test.skip -DworkingDirectory=${WORKINGDIR}/@{component} -DconnectionUrl=scm:svn:${svn.root}/@{component} -DdeveloperConnectionUrl=scm:svn:${svn.root}/@{component}"
+ />
+ <param name="noXvfb" value="true" />
+ </antcall>
+ </else>
+ </if>
+ </then>
+ <else>
+ <now level="info">Fetch sources from ${svn.root}/@{component} into ${WORKINGDIR}/@{component}</now>
+ <if>
+ <istrue value="${svnant.enabled}" />
+ <then>
+ <svn javahl="false" svnkit="true" failonerror="true">
+ <checkout recurse="${svn.recurse}"
+ url="${svn.root}/@{component}"
+ destpath="${WORKINGDIR}/@{component}"
+ />
+ </svn>
+ </then>
+ <else>
+ <antcall target="mvn">
+ <param name="MAVEN_DIR" value="${WORKINGDIR}" />
+ <param name="MAVEN_FLAGS"
+ value="scm:checkout -f ${WORKINGDIR}/parent-pom.xml -e -q -B -fae -Dmaven.test.skip -DskipCheckoutIfExists=true -DcheckoutDirectory=${WORKINGDIR}/@{component} -DworkingDirectory=${WORKINGDIR}/@{component} -DconnectionUrl=scm:svn:${svn.root}/@{component} -DdeveloperConnectionUrl=scm:svn:${svn.root}/@{component}"
+ />
+ <param name="noXvfb" value="true" />
+ </antcall>
+ </else>
+ </if>
+ </else>
+ </if>
+
+ <!-- Store svn info so we can compare it later and thus not need to update or checkout every time -->
+ <if>
+ <istrue value="${svnant.enabled}" />
+ <then>
+ <svn javahl="false" svnkit="true" failonerror="false">
+ <info target="${WORKINGDIR}/@{component}"
+ propprefix="svn.info.@{component}"
+ verbose="false"
+ />
+ </svn>
+ </then>
+ </if>
+ <if>
+ <isset property="svn.info.(a){component}.rev" />
+ <then>
+ <echo file="${WORKINGDIR}/svn.info-(a){component}.txt">svn.info.(a){component}.rev = ${svn.info.(a){component}.rev}
+</echo>
+ </then>
+ </if>
+ <echo file="${WORKINGDIR}/build.cfg" message="@{component}," append="true" />
+ </sequential>
+ </macrodef>
+
+ <!-- only reset the file if we don't already have a value for COMPONENTS.to.build; thus when called later for "site" component build, append instead of overwriting -->
+ <if>
+ <not>
+ <isset property="COMPONENTS.to.build" />
+ </not>
+ <then>
+ <echo file="${WORKINGDIR}/build.cfg" message="COMPONENTS.to.build = " />
+ </then>
+ </if>
+ <!-- check for each component dir in ${WORKINGDIR}; if not found, fetch -->
+ <if>
+ <and>
+ <isset property="COMPONENT" />
+ <not>
+ <equals arg1="${COMPONENT}" arg2="" />
+ </not>
+ </and>
+ <then>
+ <var name="COMPONENTS" unset="true" />
+ <var name="COMPONENTS" value="${COMPONENT}" />
+ </then>
+ </if>
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=",;
+ ">
+ <sequential>
+ <if>
+ <equals arg1="${clean.sources}" arg2="true" />
+ <then>
+ <delete dir="${WORKINGDIR}/@{COMPONENT}" includeemptydirs="true" quiet="true" />
+ </then>
+ </if>
+ <if>
+ <not>
+ <available file="${WORKINGDIR}/@{COMPONENT}" type="dir" />
+ </not>
+ <then>
+ <svn.fetch component="@{COMPONENT}" op="co" />
+ </then>
+ <else>
+ <if>
+ <available file="${WORKINGDIR}/svn.info-(a){COMPONENT}.txt" type="file" />
+ <then>
+ <property file="${WORKINGDIR}/svn.info-(a){COMPONENT}.txt" />
+ <!-- check svn info; if new version found, svn up -->
+ <if>
+ <istrue value="${svnant.enabled}" />
+ <then>
+ <svn javahl="false" svnkit="true" failonerror="false">
+ <info target="${WORKINGDIR}/@{COMPONENT}"
+ propprefix="svn.info.(a){COMPONENT}.check"
+ verbose="false"
+ />
+ </svn>
+ </then>
+ </if>
+ <if>
+ <or>
+ <not>
+ <isset property="svn.info.(a){COMPONENT}.rev" />
+ </not>
+ <not>
+ <isset property="svn.info.(a){COMPONENT}.check.rev" />
+ </not>
+ <not>
+ <equals arg1="${svn.info.(a){COMPONENT}.rev}"
+ arg2="${svn.info.(a){COMPONENT}.check.rev}"
+ />
+ </not>
+ </or>
+ <then>
+ <svn.fetch component="@{COMPONENT}" op="up" />
+ </then>
+ <else>
+ <if>
+ <and>
+ <isset property="build.if.sources.unchanged" />
+ <istrue value="${build.if.sources.unchanged}" />
+ </and>
+ <then>
+ <svn.fetch component="@{COMPONENT}" op="up" />
+ </then>
+ </if>
+ </else>
+ </if>
+ </then>
+ <else>
+ <svn.fetch component="@{COMPONENT}" op="up" />
+ </else>
+ </if>
+ </else>
+ </if>
+ </sequential>
+ </for>
+
+ </target>
+
+ <target name="get.bootstrap.scripts">
+ <!-- also get files required to bootstrap the build -->
+ <get src="${svn.root}/parent-pom.xml" dest="${WORKINGDIR}/parent-pom.xml" usetimestamp="true" />
+ <get src="${svn.root}/genpom.xml" dest="${WORKINGDIR}/genpom.xml" usetimestamp="true" />
+ </target>
+
+ <target name="get.all.components">
+ <var name="COMPONENTS.to.build" unset="true" />
+ <var name="COMPONENTS.to.build" value="" />
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter="; ">
+ <sequential>
+ <var name="COMPONENTS.to.build" value="${COMPONENTS.to.build}@{COMPONENT}," />
+ </sequential>
+ </for>
+ </target>
+
+ <target name="get.components.to.build">
+ <if>
+ <available file="${WORKINGDIR}/build.cfg" type="file" />
+ <then>
+ <property file="${WORKINGDIR}/build.cfg" />
+ <if>
+ <equals arg1="${COMPONENTS.to.build}" arg2="" />
+ <then>
+ <echo level="warning">All components up to date: nothing to do!
+To force a build of unchanged components, use -Dbuild.if.sources.unchanged=true</echo>
+
+ <antcall target="create.empty.test.results.file" />
+ <property name="no.tests.run" value="true" />
+ <property name="no.overall" value="true" />
+ </then>
+ <elseif>
+ <not>
+ <equals arg1="${COMPONENTS.to.build}" arg2=".," />
+ </not>
+ <then>
+ <echo level="warning">The following components' sources have changed and will be built:
+ COMPONENTS.to.build = ${COMPONENTS.to.build}
+</echo>
+ </then>
+ </elseif>
+ <elseif>
+ <equals arg1="${COMPONENTS.to.build}" arg2=".," />
+ <then>
+ <property name="no.overall" value="true" />
+ </then>
+ </elseif>
+ </if>
+ </then>
+ <else>
+ <antcallback target="get.all.components" return="COMPONENTS.to.build" />
+ </else>
+ </if>
+ </target>
+
+ <!--
+ To run this after a maven build in Hudson, set these properties:
+ basedir=${WORKSPACE}/sources
+ WORKINGDIR=${WORKSPACE}/sources
+ COMPONENT=.
+ move.test.results=true
+ -->
+ <target name="collect.test.results.for.hudson"
+ depends="init"
+ if="isInHudson"
+ description="collect test results after a pure maven build so Hudson has something to see"
+ >
+ <property name="basedir" value="${WORKSPACE}/sources" />
+ <property name="WORKINGDIR" value="${WORKSPACE}/sources" />
+ <property name="COMPONENT" value="." />
+ <property name="move.test.results" value="true" />
+ <var name="tests.results.found" value="false" />
+ <echo level="debug">basedir = ${basedir}
+WORKINGDIR = ${WORKINGDIR}
+COMPONENT = ${COMPONENT}</echo>
+ <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
+ <for param="test.xml.files" delimiter=",
+ ">
+ <path>
+ <fileset dir="${WORKINGDIR}"
+ includes="**/target/surefire-reports/TEST-*.xml, **/**/target/surefire-reports/TEST-*.xml"
+ excludes="**/TEST-*NoTestsRun.xml, **/**/TEST-*NoTestsRun.xml"
+ />
+ </path>
+ <sequential>
+ <var name="tests.results.found" value="true" />
+ </sequential>
+ </for>
+ <if>
+ <equals arg1="${tests.results.found}" arg2="true" />
+ <then>
+ <antcall target="collect.test.results">
+ <param name="COMPONENT" value="." />
+ </antcall>
+ <antcall target="collect.all.test.results" />
+ </then>
+ <else>
+ <antcall target="create.empty.test.results.file" />
+ <property name="no.tests.run" value="true" />
+ </else>
+ </if>
+ </target>
+
+ <target name="create.empty.test.results.file">
+ <!-- create fake test result file to avoid Hudson failure -->
+ <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
+ <mkdir dir="${basedir}/surefire-reports/NoTestsRun" />
+ <echo file="${basedir}/surefire-reports/NoTestsRun/TEST-org.jboss.tools.NoTestsRun.xml"><?xml version="1.0" encoding="UTF-8" ?>
+<testsuite failures="0" time="0.001" errors="0" skipped="0" tests="1" name="org.jboss.tools.NoTestsRun">
+<testcase time="0.001" classname="org.jboss.tools.NoTestsRun" name="NoTestsRun"/>
+</testsuite>
+</echo>
+ </target>
+
+ <target name="run.build">
+ <!-- could set -Dmaven.test.skip to skip tests, or use osgi-test:test to just (re-)run tests w/o first building -->
+ <property name="MAVEN_FLAGS" value="clean install -B -fn -q -U -e" />
+
+ <!-- commandline overrides to suppress doing tests -->
+ <if>
+ <or>
+ <isset property="notest" />
+ <isset property="notests" />
+ <isset property="skiptest" />
+ <isset property="skiptests" />
+ </or>
+ <then>
+ <property name="noXvfb" value="true" />
+ <if>
+ <not>
+ <contains string="${MAVEN_FLAGS}" substring="-Dmaven.test.skip" />
+ </not>
+ <then>
+ <var name="MAVEN_FLAGS" value="${MAVEN_FLAGS} -Dmaven.test.skip" />
+ </then>
+ </if>
+ </then>
+ </if>
+
+ <for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
+ ">
+ <sequential>
+ <if>
+ <equals arg1="@{COMPONENT}" arg2="site" />
+ <then>
+ <now level="warning">Build overall update @{COMPONENT}</now>
+ </then>
+ <else>
+ <now level="warning">Build '@{COMPONENT}' component</now>
+ </else>
+ </if>
+ <!-- TODO if needed: optional extra instructions to do before a maven build -->
+ <loadfile property="@{COMPONENT}.pom.xml" srcfile="${WORKINGDIR}/(a){COMPONENT}/pom.xml" />
+ <if>
+ <and>
+ <!-- if pom.xml does not call custom build.xml directly -->
+ <not>
+ <contains string="${(a){COMPONENT}.pom.xml}"
+ substring="<ant antfile="build.xml" />"
+ />
+ </not>
+ <available file="${WORKINGDIR}/(a){COMPONENT}/build.xml" type="file" />
+ <not>
+ <equals arg1="@{COMPONENT}" arg2="." />
+ </not>
+ </and>
+ <then>
+ <echo>Run custom '@{COMPONENT}/build.xml'</echo>
+ <ant antfile="${WORKINGDIR}/(a){COMPONENT}/build.xml">
+ <property name="COMPONENT" value="@{COMPONENT}" />
+ <property name="basedir" value="${WORKINGDIR}/@{COMPONENT}" />
+ <property name="build.xml" value="${ant.file}" />
+ </ant>
+ </then>
+ </if>
+
+ <!-- If poms already exist, DO NOT OVERWRITE unless -Doverwrite.existing.pom.xml=true -->
+ <ant antfile="genpom.xml" target="run" dir="${WORKINGDIR}">
+ <property name="COMPONENT" value="@{COMPONENT}" />
+ </ant>
+
+ <antcall target="mvn">
+ <param name="COMPONENT" value="@{COMPONENT}" />
+ </antcall>
+
+ <!-- don't collect test results if there are no test results to collect! -->
+ <if>
+ <not>
+ <contains string="${MAVEN_FLAGS}" substring="-Dmaven.test.skip" />
+ </not>
+ <then>
+ <antcall target="collect.test.results">
+ <param name="COMPONENT" value="@{COMPONENT}" />
+ </antcall>
+ </then>
+ <else>
+ <property name="no.tests.run" value="true" />
+ </else>
+ </if>
+
+ <!-- prevent recursion: overall site component is built with create.overall.update.site, not simpler create.update.site; also, don't rebuild the site if it's already been done by "." component -->
+ <if>
+ <and>
+ <not>
+ <equals arg1="@{COMPONENT}" arg2="site" />
+ </not>
+ <not>
+ <equals arg1="@{COMPONENT}" arg2="." />
+ </not>
+ </and>
+ <then>
+ <!-- only do this if the component's aggregate pom doesn't reference the site/ folder, and therefore hasn't already build it -->
+ <loadfile property="component.pom.xml" srcfile="${WORKINGDIR}/(a){COMPONENT}/pom.xml" />
+ <if>
+ <not>
+ <contains string="${component.pom.xml}" substring="<module>site</module>" />
+ </not>
+ <then>
+ <antcall target="create.update.site">
+ <param name="COMPONENT" value="@{COMPONENT}" />
+ </antcall>
+ </then>
+ </if>
+ </then>
+ </if>
+ </sequential>
+ </for>
+ <now level="info">Builds done</now>
+ </target>
+
+ <target name="mvn">
+ <var name="mvnExe" value="mvn" />
+ <antcallback target="getMvnExe" return="mvnExe" />
+ <echo level="verbose">Exe: ${COMMON_TOOLS}/apache-maven-${maven.version}/bin/${mvnExe}</echo>
+ <echo level="verbose">Pom: ${WORKINGDIR}/${COMPONENT}/pom.xml</echo>
+ <property name="MAVEN_DIR" value="${WORKINGDIR}/${COMPONENT}" />
+ <!-- support using true/false/other path values of maven.repo.local -->
+ <if>
+ <isset property="maven.repo.local" />
+ <then>
+ <if>
+ <isfalse value="${maven.repo.local}" />
+ <then>
+ <var name="maven.repo.local" value="" />
+ </then>
+ <elseif>
+ <istrue value="${maven.repo.local}" />
+ <then>
+ <var name="maven.repo.local" value=" -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository" />
+ </then>
+ </elseif>
+ <else>
+ <var name="maven.repo.local" value=" -Dmaven.repo.local=${maven.repo.local}" />
+ </else>
+ </if>
+ </then>
+ <else>
+ <var name="maven.repo.local" value=" -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository" />
+ </else>
+ </if>
+ <!-- 3 hr timeout = 10800000ms -->
+ <echo level="info">${mvnExe} ${MAVEN_FLAGS} ${maven.repo.local}</echo>
+ <exec executable="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/${mvnExe}"
+ dir="${MAVEN_DIR}"
+ failifexecutionfails="true"
+ failonerror="true"
+ timeout="10800000"
+ >
+ <env key="M2_HOME" value="${COMMON_TOOLS}/apache-maven-${maven.version}" />
+ <env key="MAVEN_OPTS" value="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m" />
+ <!-- more debug output with <env key="MAVEN_OPTS" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/> -->
+ <!-- <arg line="-o -Dmaven.test.skip" /> -->
+ <arg line="${MAVEN_FLAGS} ${maven.repo.local}" />
+ </exec>
+ </target>
+
+ <!-- Use Xvfb wrapper for maven when invoking UI tests -->
+ <target name="getMvnExe" unless="noXvfb">
+ <if>
+ <available file="/usr/bin/Xvfb" type="file" />
+ <then>
+ <if>
+ <not>
+ <available file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvnWithXvfb" type="file" />
+ </not>
+ <then>
+ <echo file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvnWithXvfb">#!/bin/bash
+if [[ -f /tmp/.X3-lock ]]; then
+kill -9 `cat /tmp/.X3-lock`
+rm -fr /tmp/.X3-lock
+fi
+/usr/bin/Xvfb :3 -ac 2>&1 1>/dev/null &
+DISPLAY=:3 /opt/maven3/bin/mvn $*
+kill -9 `cat /tmp/.X3-lock`
+rm -fr /tmp/.X3-lock
+</echo>
+ <chmod perm="755" file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvnWithXvfb" />
+ </then>
+ </if>
+ <var name="mvnExe" value="mvnWithXvfb" />
+ </then>
+ </if>
+ </target>
+
+ <target name="collect.test.results">
+ <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
+ <property name="COMPONENT" value="" />
+ <!-- collect test results by copying ${WORKINGDIR}/${COMPONENT}/**/target/surefire-reports/*.xml into ${basedir}/surefire-reports/${COMPONENT} -->
+ <delete dir="${basedir}/surefire-reports/${COMPONENT}" includeemptydirs="true" />
+ <mkdir dir="${basedir}/surefire-reports/${COMPONENT}" />
+ <copy todir="${basedir}/surefire-reports/${COMPONENT}"
+ flatten="true"
+ preservelastmodified="true"
+ overwrite="true"
+ >
+ <fileset dir="${WORKINGDIR}/${COMPONENT}" includes="**/target/surefire-reports/TEST-*.xml" />
+ </copy>
+ <if>
+ <isset property="move.test.results" />
+ <then>
+ <delete dir="${WORKINGDIR}/${COMPONENT}" includes="**/target/surefire-reports" />
+ </then>
+ </if>
+ </target>
+
+ <target name="collect.all.test.results" unless="no.tests.run">
+ <var name="test.results.all" value="" />
+ <var name="test.results.errors.failures.skipped" value="" />
+
+ <!-- Parse this: <testsuite errors="0" skipped="0" tests="10" time="0.042" failures="0" name="org.jboss.tools.jmx.ui.JMXUIAllTests"> -->
+ <for param="testresultfile" delimiter=",
+ ">
+ <path>
+ <fileset dir="${basedir}/surefire-reports/" includes="**/TEST-*.xml" />
+ </path>
+ <sequential>
+ <var name="testsuite.name" unset="true" />
+ <var name="testsuite.tests" unset="true" />
+ <var name="testsuite.time" unset="true" />
+ <var name="testsuite.skipped" unset="true" />
+ <var name="testsuite.errors" unset="true" />
+ <var name="testsuite.failures" unset="true" />
+ <xmlproperty file="@{testresultfile}" keepRoot="true" collapseAttributes="true" />
+ <for param="ts" list="testsuite.skipped, testsuite.errors, testsuite.failures" delimiter=", ">
+ <sequential>
+ <propertyregex override="true"
+ property="ts.label"
+ defaultvalue="@{ts}"
+ input="@{ts}"
+ regexp="testsuite\.(.+)"
+ replace="\1"
+ />
+ <if>
+ <isset property="@{ts}" />
+ <then>
+ <if>
+ <equals arg1="${@{ts}}" arg2="0" />
+ <then>
+ <var name="@{ts}" value="" />
+ </then>
+ <else>
+ <var name="@{ts}" value="; ${@{ts}} ${ts.label}" />
+ </else>
+ </if>
+ </then>
+ </if>
+
+ </sequential>
+ </for>
+ <if>
+ <or>
+ <not>
+ <equals arg1="${testsuite.skipped}" arg2="" />
+ </not>
+ <not>
+ <equals arg1="${testsuite.errors}" arg2="" />
+ </not>
+ <not>
+ <equals arg1="${testsuite.failures}" arg2="" />
+ </not>
+ </or>
+ <then>
+ <var name="test.results.errors.failures.skipped"
+ value="${test.results.errors.failures.skipped}${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}${line.separator}"
+ />
+ </then>
+ </if>
+ <if>
+ <isset property="testsuite.name" />
+ <then>
+ <var name="test.results.all"
+ value="${test.results.all}${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}${line.separator}"
+ />
+ </then>
+ </if>
+ <var name="testsuite.name" unset="true" />
+ <var name="testsuite.tests" unset="true" />
+ <var name="testsuite.time" unset="true" />
+ <var name="testsuite.skipped" unset="true" />
+ <var name="testsuite.errors" unset="true" />
+ <var name="testsuite.failures" unset="true" />
+ </sequential>
+ </for>
+ <echo level="verbose">-------------------------------------------------------
+ A L L T E S T R E S U L T S
+-------------------------------------------------------
+${test.results.all}
+-------------------------------------------------------
+
+</echo>
+ <if>
+ <and>
+ <isset property="test.results.errors.failures.skipped" />
+ <not>
+ <equals arg1="${test.results.errors.failures.skipped}" arg2="" />
+ </not>
+ </and>
+ <then>
+ <echo level="error">-------------------------------------------------------
+ T E S T R E S U L T S
+-------------------------------------------------------
+${test.results.errors.failures.skipped}
+-------------------------------------------------------
+
+</echo>
+ </then>
+ </if>
+ </target>
+
+ <!-- collect names, dates, and contained features in all generated update site zips, including the overall one -->
+ <target name="collect.update.site.results" depends="init">
+ <var name="COMPONENTS.to.check" unset="" />
+ <if>
+ <isset property="COMPONENTS.to.build" />
+ <then>
+ <var name="COMPONENTS.to.check" value="${COMPONENTS.to.build}" />
+ </then>
+ <else>
+ <var name="COMPONENTS.to.check" value="${COMPONENTS}" />
+ </else>
+ </if>
+ <if>
+ <and>
+ <not>
+ <equals arg1="${COMPONENTS.to.check}" arg2="." />
+ </not>
+ <not>
+ <contains string="${COMPONENTS.to.check}" substring=",site" />
+ </not>
+ </and>
+ <then>
+ <var name="COMPONENTS.to.check" value="${COMPONENTS.to.check},site" />
+ </then>
+ </if>
+ <for param="COMPONENT" list="${COMPONENTS.to.check}" delimiter=",;
+ ">
+ <sequential>
+ <!-- rename any leftover site.zip files -->
+ <for param="updateZip">
+ <path>
+ <fileset dir="${WORKINGDIR}/@{COMPONENT}" includes="**/site.zip" />
+ </path>
+ <sequential>
+ <if>
+ <equals arg1="@{COMPONENT}" arg2="site" />
+ <then>
+ <var name="destinationZip"
+ value="${WORKINGDIR}/(a){COMPONENT}/site/target/jbosstools-ALL-Update-SNAPSHOT.zip"
+ />
+ </then>
+ <else>
+ <var name="COMPONENT.name" value="" />
+ <if>
+ <equals arg1="@{COMPONENT}" arg2="." />
+ <then>
+ <var name="COMPONENT.name" value="${product.id}" />
+ </then>
+ <else>
+ <var name="COMPONENT.name" value="@{COMPONENTS}" />
+ </else>
+ </if>
+ <var name="destinationZip"
+ value="${WORKINGDIR}/(a){COMPONENT}/site/target/jbosstools-${COMPONENT.name}-Update-SNAPSHOT.zip"
+ />
+ </else>
+ </if>
+ <!-- rename resulting update site zip -->
+ <move file="${WORKINGDIR}/(a){COMPONENT}/site/target/site.zip"
+ tofile="${destinationZip}"
+ overwrite="true"
+ preservelastmodified="false"
+ />
+ </sequential>
+ </for>
+
+ <for param="updateZip">
+ <path>
+ <fileset dir="${WORKINGDIR}/@{COMPONENT}" includes="**/jbosstools*Update*.zip" />
+ </path>
+ <sequential>
+ <propertyregex property="updateZip"
+ defaultvalue="@{updateZip}"
+ input="@{updateZip}"
+ regexp=".+/site/target/([^/]+.+\.zip)"
+ replace="\1"
+ override="true"
+ />
+ <exec executable="unzip" outputproperty="zip.contents">
+ <arg line="-l @{updateZip}" />
+ </exec>
+ <if>
+ <and>
+ <isset property="zip.contents" />
+ <contains string="${zip.contents}" substring="plugins/" />
+ <contains string="${zip.contents}" substring=".jar" />
+ </and>
+ <then>
+ <echo level="info">@{COMPONENT} :: ${updateZip}</echo>
+ <for param="featureJar" list="${zip.contents}" delimiter="
+">
+ <sequential>
+ <if>
+ <and>
+ <contains string="@{featureJar}" substring="features/" />
+ <contains string="@{featureJar}" substring=".jar" />
+ </and>
+ <then>
+ <echo level="info"> :: @{featureJar}</echo>
+ </then>
+ </if>
+ </sequential>
+ </for>
+ </then>
+ <else>
+ <echo level="warn">@{COMPONENT} :: ${updateZip}</echo>
+ </else>
+ </if>
+ </sequential>
+ </for>
+ <if>
+ <not>
+ <isset property="zip.contents" />
+ </not>
+ <then>
+ <echo level="warn">No update site found for @{COMPONENT}.</echo>
+ </then>
+ </if>
+ <var name="zip.contents" unset="true" />
+ <var name="zip.features" unset="true" />
+ <echo level="info">
+ </echo>
+ </sequential>
+ </for>
+ </target>
+
+ <!-- Used to build the overall update site for all components; requires a custom site.xml (generated from category.*.xml) and previously checked in pom.xml -->
+ <target name="create.overall.update.site" depends="init" unless="no.overall">
+ <if>
+ <isset property="no.overall" />
+ <then>
+ <echo>All components up to date: nothing to do!
+To force a build of unchanged components, use -Dbuild.if.sources.unchanged=true</echo>
+ </then>
+ <else>
+ <property name="update.site.path" value="site" />
+
+ <!-- Fetch fresh sources (checkout or update) -->
+ <antcall target="get.sources">
+ <param name="COMPONENT" value="site" />
+ </antcall>
+
+ <!-- Get correct version of site.xml + resolve variables -->
+ <loadfile property="site.xml.transformed"
+ srcfile="${WORKINGDIR}/${update.site.path}/category.${product.id}.xml"
+ >
+ <filterchain>
+ <expandproperties />
+ </filterchain>
+ </loadfile>
+ <echo file="${WORKINGDIR}/${update.site.path}/site.xml" message="${site.xml.transformed}" />
+ <var name="site.xml.transformed" unset="true" />
+
+ <!-- Build update site -->
+ <antcall target="build.update.site">
+ <param name="COMPONENTS.to.build" value="site" />
+ <param name="update.site.path" value="${update.site.path}" />
+ </antcall>
+
+ <!-- Copy overall site into workspace so it can be archived by Hudson -->
+ <if>
+ <not>
+ <equals arg1="${basedir}" arg2="${WORKINGDIR}" />
+ </not>
+ <then>
+ <mkdir dir="${basedir}/${update.site.path}/target" />
+ <copy todir="${basedir}/${update.site.path}/target" overwrite="true">
+ <fileset dir="${WORKINGDIR}/${update.site.path}/target/site" />
+ </copy>
+ </then>
+ </if>
+ </else>
+ </if>
+ </target>
+
+ <target name="build.update.site">
+ <property name="update.site.path" value="site" />
+ <!-- without deleting previous target dir, update sites may end up missing all plugins and features! -->
+ <delete dir="${WORKINGDIR}/${update.site.path}/target" includeemptydirs="true" quiet="true" />
+
+ <if>
+ <equals arg1="${update.site.path}" arg2="site" />
+ <then>
+ <var name="destinationZip"
+ value="${WORKINGDIR}/${update.site.path}/target/jbosstools-ALL-Update-SNAPSHOT.zip"
+ />
+ </then>
+ <else>
+ <var name="COMPONENT.name" value="" />
+ <if>
+ <equals arg1="${COMPONENT}" arg2="." />
+ <then>
+ <var name="COMPONENT.name" value="${product.id}" />
+ </then>
+ <else>
+ <var name="COMPONENT.name" value="${COMPONENTS.to.build}" />
+ </else>
+ </if>
+ <var name="destinationZip"
+ value="${WORKINGDIR}/${update.site.path}/target/jbosstools-${COMPONENT.name}-Update-SNAPSHOT.zip"
+ />
+ </else>
+ </if>
+ <delete file="${destinationZip}" quiet="true" />
+
+ <if>
+ <equals arg1="${COMPONENTS.to.build}" arg2="site" />
+ <then>
+ <!-- Call maven to generate pom.xml, then build site from site.xml -->
+ <antcall target="run.build">
+ <param name="COMPONENTS.to.build" value="${COMPONENTS.to.build}" />
+ <param name="MAVEN_FLAGS" value="verify -e -q -B -fae -Dmaven.test.skip" />
+ <param name="noXvfb" value="true" />
+ </antcall>
+ </then>
+ <else>
+ <!-- Or just call maven to build site -->
+ <antcall target="mvn">
+ <param name="MAVEN_DIR" value="${WORKINGDIR}/${update.site.path}" />
+ <param name="MAVEN_FLAGS" value="verify -e -q -B -fae -Dmaven.test.skip" />
+ <param name="noXvfb" value="true" />
+ </antcall>
+ </else>
+ </if>
+
+ <if>
+ <and>
+ <available file="${WORKINGDIR}/${update.site.path}/target/site/plugins" type="dir" />
+ <available file="${WORKINGDIR}/${update.site.path}/target/site/features" type="dir" />
+ </and>
+ <then>
+ <!-- rename resulting update site zip -->
+ <move file="${WORKINGDIR}/${update.site.path}/target/site.zip"
+ tofile="${destinationZip}"
+ overwrite="true"
+ preservelastmodified="false"
+ />
+
+ <!-- Create real update site zip, including web UI -->
+ <copy todir="${WORKINGDIR}/${update.site.path}/target/site">
+ <fileset dir="${WORKINGDIR}/${update.site.path}" includes="web/*, index.html" />
+ </copy>
+ <zip destfile="${destinationZip}"
+ basedir="${WORKINGDIR}/${update.site.path}/target/site"
+ update="true"
+ includes="web/*, index.html"
+ />
+
+ <!-- Copy zip into workspace so it can be archived by Hudson -->
+ <if>
+ <not>
+ <equals arg1="${basedir}" arg2="${WORKINGDIR}" />
+ </not>
+ <then>
+ <mkdir dir="${basedir}/${update.site.path}/target" />
+ <copy todir="${basedir}/${update.site.path}/target"
+ flatten="true"
+ preservelastmodified="true"
+ overwrite="true"
+ >
+ <fileset dir="${WORKINGDIR}/${update.site.path}/target" includes="*Update*.zip" />
+ </copy>
+ </then>
+ </if>
+ </then>
+ <else>
+ <delete file="${WORKINGDIR}/${update.site.path}/target/site.zip" quiet="true" />
+ <if>
+ <equals arg1="${update.site.path}" arg2="site" />
+ <then>
+ <fail>Overall update site zip contains no features!</fail>
+ </then>
+ <else>
+ <echo level="info"> [ERROR] Update site zip for ${COMPONENTS.to.build} contains no features!</echo>
+ </else>
+ </if>
+ </else>
+ </if>
+ </target>
+
+ <!-- Used to build the update site of a component; requires a site.xml and pom.xml be generated first, if not already checked in -->
+ <target name="create.update.site" depends="init">
+ <var name="site.pom.exists" unset="true" />
+ <condition property="site.pom.exists">
+ <available file="${WORKINGDIR}/${COMPONENT}/site/pom.xml" type="file" />
+ </condition>
+ <antcall target="genPomXml" />
+
+ <var name="site.sitexml.exists" unset="true" />
+ <condition property="site.sitexml.exists">
+ <available file="${WORKINGDIR}/${COMPONENT}/site/site.xml" type="file" />
+ </condition>
+ <antcall target="genSiteXml" />
+
+ <antcall target="build.update.site">
+ <param name="COMPONENTS.to.build" value="${COMPONENT}" />
+ <param name="update.site.path" value="${COMPONENT}/site" />
+ </antcall>
+ </target>
+
+ <target name="genPomXml" description="Generate a pom.xml" unless="site.pom.exists">
+ <property name="pomDir" value="${WORKINGDIR}/${COMPONENT}/site" />
+ <property name="COMPONENT" value="${COMPONENT}" />
+ <property name="packaging" value="eclipse-update-site" />
+ <mkdir dir="${pomDir}" />
+ <echo file="${pomDir}/pom.xml"><project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <relativePath>../../parent-pom.xml</relativePath>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>${COMPONENT}.site</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>${packaging}</packaging>
+</project>
+</echo>
+
+ </target>
+
+ <target name="genSiteXml"
+ description="Generate a site.xml to contain the features in a category"
+ unless="site.sitexml.exists"
+ >
+ <property name="updateSiteJarDir" value="${WORKINGDIR}/${COMPONENT}/site" />
+ <property name="COMPONENT" value="${COMPONENT}" />
+ <property name="category.name" value="${product.name} ${COMPONENT} ${update.site.description} Update Site" />
+
+ <mkdir dir="${updateSiteJarDir}" />
+ <echo file="${updateSiteJarDir}/site.xml"><?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <description>To install these features, point Eclipse at this site.</description>
+ <!-- ${category.name} -->
+ <category-def label="${category.name}" name="${category.name}">
+ <description>${category.name}: contains all features in this build.</description>
+ </category-def>
+</echo>
+
+ <mkdir dir="${updateSiteJarDir}/../features" />
+ <if>
+ <!-- special case: for tests component, we WANT test features; for everyone else, test features shouldn't be on the site -->
+ <equals arg1="${COMPONENT}" arg2="tests" />
+ <then>
+ <path id="featureJars">
+ <fileset dir="${updateSiteJarDir}/../features" includes="**/target/*.jar" />
+ </path>
+ </then>
+ <else>
+ <path id="featureJars">
+ <fileset dir="${updateSiteJarDir}/../features"
+ includes="**/target/*.jar"
+ excludes="**/*test*"
+ id=""
+ />
+ </path>
+ </else>
+ </if>
+ <for param="featureJar">
+ <path refid="featureJars" />
+ <sequential>
+ <var name="feature.jarfile" unset="true" />
+ <var name="feature.id" unset="true" />
+ <antcallback target="get.feature.id" return="feature.id">
+ <property name="featureJar" value="@{featureJar}" />
+ </antcallback>
+ <echo append="true" file="${updateSiteJarDir}/site.xml"> <feature url="features/${feature.id}_0.0.0.jar" id="${feature.id}" version="0.0.0">
+ <category name="${category.name}"/>
+ </feature>
+</echo>
+ <var name="feature.jarfile" unset="true" />
+ <var name="feature.id" unset="true" />
+ </sequential>
+ </for>
+ <echo append="true" file="${updateSiteJarDir}/site.xml">
+</site>
+</echo>
+ </target>
+
+ <target name="get.feature.id">
+ <antcallback target="get.artifact.id" return="artifact.id">
+ <param name="regexp.path" value=".+/features/[^/]+/target/([^/]+feature.+\.jar)" />
+ <param name="artifactJar" value="${featureJar}" />
+ </antcallback>
+ <var name="feature.id" value="${artifact.id}" />
+ </target>
+
+ <target name="get.plugin.id">
+ <antcallback target="get.artifact.id" return="artifact.id">
+ <param name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
+ <param name="artifactJar" value="${pluginJar}" />
+ </antcallback>
+ <var name="plugin.id" value="${artifact.id}" />
+ </target>
+
+ <target name="get.artifact.id">
+ <!-- for a feature: regexp=".+/features/[^/]+/target/([^/]+feature.+\.jar)"
+ for a plugin: regexp=".+/plugins/([^/]+.+\.jar)" -->
+ <property name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
+
+ <propertyregex property="artifact.jarfile"
+ defaultvalue="${artifactJar}"
+ input="${artifactJar}"
+ regexp="${regexp.path}"
+ replace="\1"
+ override="true"
+ />
+ <propertyregex property="artifact.id"
+ defaultvalue="${artifact.jarfile}"
+ input="${artifact.jarfile}"
+ regexp="([^_]+)_(\d+\.\d+\.\d+)\.jar"
+ replace="\1"
+ override="true"
+ />
+ <propertyregex property="artifact.id"
+ defaultvalue="${artifact.id}"
+ input="${artifact.id}"
+ regexp="([^_]+)-(\d+\.\d+\.\d+.+)\.jar"
+ replace="\1"
+ override="true"
+ />
+ <propertyregex property="artifact.id"
+ defaultvalue="${artifact.id}"
+ input="${artifact.id}"
+ regexp="([^_]+)-(\d+\.\d+\.\d+.SNAPSHOT)\.jar"
+ replace="\1"
+ override="true"
+ />
+ <propertyregex property="artifact.id"
+ defaultvalue="${artifact.id}"
+ input="${artifact.id}"
+ regexp="([^_]+)_(\d+\.\d+\.\d+)\.jar"
+ replace="\1"
+ override="true"
+ />
+ <propertyregex property="artifact.id"
+ defaultvalue="${artifact.id}"
+ input="${artifact.id}"
+ regexp="([^_]+)_(\d+\.\d+\.\d+.SNAPSHOT)\.jar"
+ replace="\1"
+ override="true"
+ />
+ <!-- <echo level="debug">artifact.id = ${artifact.id}</echo> -->
+ <propertyregex property="artifact.id"
+ defaultvalue="${artifact.id}"
+ input="${artifact.id}"
+ regexp="([^_]+)_(\d+\.\d+\.\d+\.\d+)\.jar"
+ replace="\1"
+ override="true"
+ />
+ <echo level="verbose">artifact.id = ${artifact.id}</echo>
+ <var name="artifactJar" unset="true" />
+ </target>
+
+ <!-- unpack previously built & jarred plugin jars -->
+ <target name="unjarPlugins">
+ <for param="artifactJar">
+ <path>
+ <fileset dir="${WORKINGDIR}/${COMPONENT}/plugins/" includes="*.jar" />
+ </path>
+ <sequential>
+ <antcallback target="get.artifact.id" return="artifact.id">
+ <property name="artifactJar" value="@{artifactJar}" />
+ <property name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
+ </antcallback>
+ <echo level="verbose">Unzip @{artifactJar} into ${WORKINGDIR}/${COMPONENT}/plugins/${artifact.id}</echo>
+ <unzip src="@{artifactJar}" dest="${WORKINGDIR}/${COMPONENT}/plugins/${artifact.id}" overwrite="true" />
+ <var name="artifact.id" unset="true" />
+ </sequential>
+ </for>
+ </target>
+
+ <!-- rename previously built & unpacked feature dirs -->
+ <target name="renameFeatures">
+ <echo level="debug">${WORKINGDIR}/${COMPONENT}/features</echo>
+ <for param="artifactJar">
+ <path>
+ <dirset dir="${WORKINGDIR}/${COMPONENT}/features" includes="*feature_*" />
+ </path>
+ <sequential>
+ <antcallback target="get.artifact.id" return="artifact.id">
+ <property name="artifactJar" value="@{artifactJar}" />
+ <property name="regexp.path" value=".+/features/([^/]+feature)_\d+.+" />
+ </antcallback>
+ <move file="@{artifactJar}"
+ tofile="${WORKINGDIR}/${COMPONENT}/features/${artifact.id}"
+ overwrite="true"
+ />
+ <var name="artifact.id" unset="true" />
+ </sequential>
+ </for>
+ </target>
+
+ <!-- for a given ${COMPONENT} dir, switch all plugin/feature manifests from .SNAPSHOT to .qualifier -->
+ <target name="snapshot2qualifier">
+ <property name="COMPONENT" value="" />
+ <for param="artifactManifest">
+ <path>
+ <fileset dir="${WORKINGDIR}/${COMPONENT}"
+ excludes="**/target/**"
+ includes="**/plugins/**/**/MANIFEST.MF, **/features/**/feature.xml"
+ />
+ </path>
+ <sequential>
+ <loadfile property="artifact.file" srcfile="@{artifactManifest}">
+ <filterchain>
+ <replaceregex pattern="([0-9]+).SNAPSHOT" replace="\1.qualifier" />
+ </filterchain>
+ </loadfile>
+ <echo file="@{artifactManifest}" message="${artifact.file}" />
+ <var name="artifact.file" unset="true" />
+ </sequential>
+ </for>
+ </target>
+
+ <!-- include a build.properties file if one not provided -->
+ <target name="genBuildProperties">
+ <for param="artifactDir">
+ <path>
+ <dirset dir="${WORKINGDIR}/${COMPONENT}/features/" excludes="." includes="*" />
+ <dirset dir="${WORKINGDIR}/${COMPONENT}/plugins/" excludes="." includes="*" />
+ </path>
+ <sequential>
+ <if>
+ <not>
+ <available file="@{artifactDir}/build.properties" type="file" />
+ </not>
+ <then>
+ <echo file="@{artifactDir}/build.properties">bin.includes = feature.*, ., plugin.*, about.*, META-INF/, .options/, lib/, help/, icons/, org/, src/
+</echo>
+ </then>
+ </if>
+ </sequential>
+ </for>
+ </target>
+
+ <!-- TODO: figure out why this fails with error:
+ insecure -e option not allowed.
+ This account is restricted by rssh.
+ Allowed commands: scp sftp rsync
+ -->
+ <target name="deploy" if="isInHudson" depends="init, get.bootstrap.scripts">
+ <!-- default destinations -->
+ <property name="DESTINATION.jbosstools" value="tools@filemgmt.jboss.org:/downloads_htdocs/tools/repository" />
+ <property name="DESTINATION.jbds" value="/qa/services/http/binaries/RHDS/repository" />
+
+ <!-- values for this deployment -->
+ <property name="deployDir" value="${DESTINATION.jbosstools}/SNAPSHOT" />
+ <property name="sourceDir" value="${WORKINGDIR}" />
+ <property name="synchMethodParam" value=" --delete" />
+
+ <echo level="debug">Promote build in ${sourceDir} ...</echo>
+ <!-- rsync or scp build dir ${sourceDir} into ${deployDir}/ -->
+ <if>
+ <available file="/usr/bin/rsync" type="file" />
+ <then>
+ <var name="deployCmd"
+ value="/usr/bin/rsync -arz --delete --include=*/*/*/target/ --include=*.xml --include=svn.info*.txt --include=${WORKINGDIR}/build.cfg --exclude=eclipse/ ${sourceDir} ${deployDir}/"
+ />
+ </then>
+ <elseif>
+ <available file="/usr/bin/scp" type="file" />
+ <then>
+ <var name="deployCmd" value="/usr/bin/scp -r ${sourceDir} ${deployDir}/" />
+ </then>
+ </elseif>
+ <else>
+ <fail>ERROR!
+Cannot deploy - please install scp or rsync on this server and try again.
+</fail>
+ </else>
+ </if>
+ <if>
+ <available file="${sourceDir}" type="dir" />
+ <then>
+ <echo message="${deployCmd}" />
+ <exec executable="bash" failonerror="true">
+ <arg line=" -c "${deployCmd}"" />
+ </exec>
+ </then>
+ <else>
+ <fail>ERROR!
+Cannot deploy - sourceDir not found in
+ ${sourceDir}
+</fail>
+ </else>
+ </if>
+
+ </target>
+
+ <!-- ************************************ TESTS ************************************ -->
+
+ <target name="test.expected.values">
+ <property name="ant.enable.asserts" value="true" />
+
+ <!-- expected values for get.sources.* tests -->
+ <property name="get.sources.expected.dirs" value="tests,common,xulrunner," />
+ <property name="get.sources.expected.files" value="${WORKINGDIR}/build.cfg" />
+
+ <!-- expected values for test.get.sources.build.updated.only tests -->
+ <property name="get.components.to.build.expected.2" value="tests,common,xulrunner," />
+ <property name="get.components.to.build.expected.4" value="tests,xulrunner," />
+ <property name="get.components.to.build.expected.6" value="" />
+
+ <!-- expected values for test.get.sources.build.all tests -->
+ <property name="get.components.to.build.expected.2.all" value="tests,common,xulrunner," />
+ <property name="get.components.to.build.expected.4.all" value="tests,common,xulrunner," />
+ <property name="get.components.to.build.expected.6.all" value="tests,common,xulrunner," />
+
+ <!-- expected values for test.get.all.components -->
+ <property name="get.all.components.expected"
+ value="tests,common,flow,jbpm,jmx,archives,as,drools,bpel,smooks,freemarker,profiler,portlet,xulrunner,jst,vpe,jsf,esb,ws,cdi,struts,hibernatetools,seam,examples,birt,maven,"
+ />
+
+ <!-- expected values for test.get.feature.id -->
+ <property name="get.artifact.id.expected.tests/features/org.jboss.tools.test.feature/target/org.jboss.tools.test.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.test.feature"
+ />
+ <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.all.feature/target/org.jboss.tools.common.all.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.common.all.feature"
+ />
+ <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.all.tests.feature/target/org.jboss.tools.common.all.tests.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.common.all.tests.feature"
+ />
+ <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.core.feature/target/org.jboss.tools.common.core.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.common.core.feature"
+ />
+ <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.feature/target/org.jboss.tools.common.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.common.feature"
+ />
+ <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.text.ext.feature/target/org.jboss.tools.common.text.ext.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.common.text.ext.feature"
+ />
+ <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.ui.feature/target/org.jboss.tools.common.ui.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.common.ui.feature"
+ />
+ <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.verification.feature/target/org.jboss.tools.common.verification.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.common.verification.feature"
+ />
+ <property name="get.artifact.id.expected.flow/features/org.jboss.tools.flow.common.feature/target/org.jboss.tools.flow.common.feature-4.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.flow.common.feature"
+ />
+ <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.flow.jpdl4.feature/target/org.jboss.tools.flow.jpdl4.feature-4.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.flow.jpdl4.feature"
+ />
+ <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm.common.feature/target/org.jboss.tools.jbpm.common.feature-4.3.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jbpm.common.feature"
+ />
+ <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm.convert.feature/target/org.jboss.tools.jbpm.convert.feature-1.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jbpm.convert.feature"
+ />
+ <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm3.feature/target/org.jboss.tools.jbpm3.feature-3.2.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jbpm3.feature"
+ />
+ <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm3.tests.feature/target/org.jboss.tools.jbpm3.tests.feature-3.2.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jbpm3.tests.feature"
+ />
+ <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm4.feature/target/org.jboss.tools.jbpm4.feature-4.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jbpm4.feature"
+ />
+ <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm4.tests.feature/target/org.jboss.tools.jbpm4.tests.feature-4.3.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jbpm4.tests.feature"
+ />
+ <property name="get.artifact.id.expected.jbpm/features/org.jbpm.gd.jpdl.feature/target/org.jbpm.gd.jpdl.feature-3.2.0-SNAPSHOT.jar"
+ value="org.jbpm.gd.jpdl.feature"
+ />
+ <property name="get.artifact.id.expected.jmx/features/org.jboss.tools.jmx.feature/target/org.jboss.tools.jmx.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jmx.feature"
+ />
+ <property name="get.artifact.id.expected.jmx/features/org.jboss.tools.jmx.tests.feature/target/org.jboss.tools.jmx.tests.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jmx.tests.feature"
+ />
+ <property name="get.artifact.id.expected.archives/features/org.jboss.ide.eclipse.archives.feature/target/org.jboss.ide.eclipse.archives.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.ide.eclipse.archives.feature"
+ />
+ <property name="get.artifact.id.expected.archives/features/org.jboss.ide.eclipse.archives.test.feature/target/org.jboss.ide.eclipse.archives.test.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.ide.eclipse.archives.test.feature"
+ />
+ <property name="get.artifact.id.expected.as/features/org.jboss.ide.eclipse.as.test.feature/target/org.jboss.ide.eclipse.as.test.feature-2.1.0-SNAPSHOT.jar"
+ value="org.jboss.ide.eclipse.as.test.feature"
+ />
+ <property name="get.artifact.id.expected.bpel/features/org.jboss.tools.bpel.feature/target/org.jboss.tools.bpel.feature-1.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.bpel.feature"
+ />
+ <property name="get.artifact.id.expected.bpel/features/org.jboss.tools.bpel.tests.feature/target/org.jboss.tools.bpel.tests.feature-1.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.bpel.tests.feature"
+ />
+ <property name="get.artifact.id.expected.smooks/features/org.jboss.tools.smooks.feature/target/org.jboss.tools.smooks.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.smooks.feature"
+ />
+ <property name="get.artifact.id.expected.smooks/features/org.jboss.tools.smooks.test.feature/target/org.jboss.tools.smooks.test.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.smooks.test.feature"
+ />
+ <property name="get.artifact.id.expected.freemarker/features/org.jboss.ide.eclipse.freemarker.feature/target/org.jboss.ide.eclipse.freemarker.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.ide.eclipse.freemarker.feature"
+ />
+ <property name="get.artifact.id.expected.freemarker/features/org.jboss.ide.eclipse.freemarker.test.feature/target/org.jboss.ide.eclipse.freemarker.test.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.ide.eclipse.freemarker.test.feature"
+ />
+ <property name="get.artifact.id.expected.profiler/features/org.jboss.tools.profiler.feature/target/org.jboss.tools.profiler.feature-1.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.profiler.feature"
+ />
+ <property name="get.artifact.id.expected.portlet/features/org.jboss.tools.portlet.feature/target/org.jboss.tools.portlet.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.portlet.feature"
+ />
+ <property name="get.artifact.id.expected.portlet/features/org.jboss.tools.portlet.test.feature/target/org.jboss.tools.portlet.test.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.portlet.test.feature"
+ />
+ <property name="get.artifact.id.expected.jst/features/org.jboss.tools.jst.feature/target/org.jboss.tools.jst.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jst.feature"
+ />
+ <property name="get.artifact.id.expected.jst/features/org.jboss.tools.jst.web.tiles.feature/target/org.jboss.tools.jst.web.tiles.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jst.web.tiles.feature"
+ />
+ <property name="get.artifact.id.expected.vpe/features/org.jboss.tools.vpe.feature/target/org.jboss.tools.vpe.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.vpe.feature"
+ />
+ <property name="get.artifact.id.expected.vpe/features/org.jboss.tools.xulrunner.feature/target/org.jboss.tools.xulrunner.feature-1.9.1.2.jar"
+ value="org.jboss.tools.xulrunner.feature"
+ />
+ <property name="get.artifact.id.expected.jsf/features/org.jboss.tools.jsf.feature/target/org.jboss.tools.jsf.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.jsf.feature"
+ />
+ <property name="get.artifact.id.expected.jsf/features/org.jboss.tools.richfaces.feature/target/org.jboss.tools.richfaces.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.richfaces.feature"
+ />
+ <property name="get.artifact.id.expected.esb/features/org.jboss.tools.esb.feature/target/org.jboss.tools.esb.feature-1.3.0-SNAPSHOT.jar"
+ value="org.jboss.tools.esb.feature"
+ />
+ <property name="get.artifact.id.expected.esb/features/org.jboss.tools.esb.test.feature/target/org.jboss.tools.esb.test.feature-1.3.0-SNAPSHOT.jar"
+ value="org.jboss.tools.esb.test.feature"
+ />
+ <property name="get.artifact.id.expected.ws/features/org.jboss.tools.ws.feature/target/org.jboss.tools.ws.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.ws.feature"
+ />
+ <property name="get.artifact.id.expected.ws/features/org.jboss.tools.ws.jaxrs.feature/target/org.jboss.tools.ws.jaxrs.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.ws.jaxrs.feature"
+ />
+ <property name="get.artifact.id.expected.cdi/features/org.jboss.tools.cdi.feature/target/org.jboss.tools.cdi.feature-1.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.cdi.feature"
+ />
+ <property name="get.artifact.id.expected.struts/features/org.jboss.tools.struts.feature/target/org.jboss.tools.struts.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.struts.feature"
+ />
+ <property name="get.artifact.id.expected.hibernatetools/features/org.hibernate.eclipse.feature/target/org.hibernate.eclipse.feature-3.3.0-SNAPSHOT.jar"
+ value="org.hibernate.eclipse.feature"
+ />
+ <property name="get.artifact.id.expected.hibernatetools/features/org.hibernate.eclipse.test.feature/target/org.hibernate.eclipse.test.feature-3.3.0-SNAPSHOT.jar"
+ value="org.hibernate.eclipse.test.feature"
+ />
+ <property name="get.artifact.id.expected.seam/features/org.jboss.tools.seam.feature/target/org.jboss.tools.seam.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.seam.feature"
+ />
+ <property name="get.artifact.id.expected.seam/features/org.jboss.tools.seam.test.feature/target/org.jboss.tools.seam.test.feature-3.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.seam.test.feature"
+ />
+ <property name="get.artifact.id.expected.examples/features/org.jboss.tools.community.project.examples.feature/target/org.jboss.tools.community.project.examples.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.community.project.examples.feature"
+ />
+ <property name="get.artifact.id.expected.examples/features/org.jboss.tools.project.examples.feature/target/org.jboss.tools.project.examples.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.project.examples.feature"
+ />
+ <property name="get.artifact.id.expected.examples/features/org.jboss.tools.project.examples.test.feature/target/org.jboss.tools.project.examples.test.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.project.examples.test.feature"
+ />
+ <property name="get.artifact.id.expected.birt/features/org.jboss.tools.birt.feature/target/org.jboss.tools.birt.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.birt.feature"
+ />
+ <property name="get.artifact.id.expected.birt/features/org.jboss.tools.birt.test.feature/target/org.jboss.tools.birt.test.feature-1.1.0-SNAPSHOT.jar"
+ value="org.jboss.tools.birt.test.feature"
+ />
+ <property name="get.artifact.id.expected.maven/features/org.jboss.tools.maven.feature/target/org.jboss.tools.maven.feature-1.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.maven.feature"
+ />
+ <property name="get.artifact.id.expected.maven/features/org.jboss.tools.maven.seam.feature/target/org.jboss.tools.maven.seam.feature-1.0.0-SNAPSHOT.jar"
+ value="org.jboss.tools.maven.seam.feature"
+ />
+
+ <property name="get.artifact.id.expected.as/features/org.jboss.ide.eclipse.as.feature/target/org.jboss.ide.eclipse.as.feature-2.1.0-SNAPSHOT.jar"
+ value="org.jboss.ide.eclipse.as.feature"
+ />
+ <property name="get.artifact.id.expected.xulrunner/features/org.mozilla.xpcom.feature/target/org.mozilla.xpcom.feature-1.9.1.2a.jar"
+ value="org.mozilla.xpcom.feature"
+ />
+ <property name="get.artifact.id.expected.xulrunner/features/org.mozilla.xulrunner.feature/target/org.mozilla.xulrunner.feature-1.9.1.2.jar"
+ value="org.mozilla.xulrunner.feature"
+ />
+
+ <!-- expected values for test.get.plugin.id -->
+ <property name="get.artifact.id.expected.drools/plugins/org.eclipse.webdav_3.0.101.jar"
+ value="org.eclipse.webdav"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.guvnor.tools_5.1.0.SNAPSHOT.jar"
+ value="org.guvnor.tools"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse_5.1.0.SNAPSHOT.jar"
+ value="org.drools.eclipse"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse.task_5.1.0.SNAPSHOT.jar"
+ value="org.drools.eclipse.task"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.guvnor.tools_5.1.0.jar"
+ value="org.guvnor.tools"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse_5.1.0.jar"
+ value="org.drools.eclipse"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse.task_5.1.0.jar"
+ value="org.drools.eclipse.task"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse.task_5.2.0.201101062302.jar"
+ value="org.drools.eclipse.task"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse_5.2.0.201101062302.jar"
+ value="org.drools.eclipse"
+ />
+ <property name="get.artifact.id.expected.drools/plugins/org.guvnor.tools_5.2.0.201101062302.jar"
+ value="org.guvnor.tools"
+ />
+ </target>
+
+ <target name="test.all">
+ <antcall target="test.get.sources.build.all" />
+ <antcall target="test.get.sources" />
+ <antcall target="test.get.feature.id" />
+ <antcall target="test.get.plugin.id.drools" />
+ </target>
+
+ <!-- simpler tests, run faster -->
+ <target name="test.get.feature.id.vpe">
+ <antcall target="test.get.feature.id">
+ <param name="COMPONENTS" value="vpe" />
+ </antcall>
+ </target>
+ <target name="test.get.plugin.id.drools">
+ <antcall target="test.get.plugin.id">
+ <param name="COMPONENTS" value="drools" />
+ </antcall>
+ </target>
+
+ <!-- test all feature.id fetches -->
+ <target name="test.get.feature.id" depends="init, test.expected.values">
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=";,
+ ">
+ <sequential>
+ <echo level="info">Test feature.ids for @{COMPONENT}</echo>
+ <for param="artifactJar" delimiter=", ">
+ <path>
+ <fileset dir="${basedir}/@{COMPONENT}" includes="**/features/**/target/*.jar" />
+ </path>
+ <sequential>
+ <echo level="verbose">Test @{artifactJar}</echo>
+ <antcallback target="get.artifact.id" return="artifact.id">
+ <property name="artifactJar" value="@{artifactJar}" />
+ <param name="regexp.path" value=".+/features/[^/]+/target/([^/]+feature.+\.jar)" />
+ </antcallback>
+ <propertyregex override="true"
+ property="artifact.id.expected.name"
+ defaultvalue="@{artifactJar}"
+ input="@{artifactJar}"
+ regexp="${basedir}\/(.+)"
+ replace="get.artifact.id.expected.\1"
+ />
+ <!-- <echo><property name="get.artifact.id.expected.@{artifactJar}" value="${artifact.id}"/> </echo> -->
+ <propertycopy name="artifact.id.expected" from="${artifact.id.expected.name}" />
+ <assert failonerror="true" message="Expected: ${artifact.id.expected}; got: ${artifact.id}">
+ <bool>
+ <equals arg1="${artifact.id.expected}" arg2="${artifact.id}" />
+ </bool>
+ </assert>
+ <var name="artifact.id.expected" unset="true" />
+ </sequential>
+ </for>
+ </sequential>
+ </for>
+ </target>
+
+ <!-- test all plugin.id fetches -->
+ <target name="test.get.plugin.id" depends="init, test.expected.values">
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=";,
+ ">
+ <sequential>
+ <echo level="info">Test plugin.ids for @{COMPONENT}</echo>
+ <for param="artifactJar" delimiter=", ">
+ <path>
+ <fileset dir="${basedir}/@{COMPONENT}" includes="**/plugins/*.jar" excludes="**/target/**" />
+ </path>
+ <sequential>
+ <echo level="verbose">[1] Test @{artifactJar}</echo>
+ <antcallback target="get.artifact.id" return="artifact.id">
+ <property name="artifactJar" value="@{artifactJar}" />
+ <property name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
+ </antcallback>
+ <propertyregex override="true"
+ property="artifact.id.expected.name"
+ defaultvalue="@{artifactJar}"
+ input="@{artifactJar}"
+ regexp="${basedir}\/(.+)"
+ replace="get.artifact.id.expected.\1"
+ />
+ <!-- <echo><property name="get.artifact.id.expected.@{artifactJar}" value="${artifact.id}"/> </echo> -->
+ <propertycopy name="artifact.id.expected" from="${artifact.id.expected.name}" />
+ <assert failonerror="true" message="Expected: ${artifact.id.expected}; got: ${artifact.id}">
+ <bool>
+ <equals arg1="${artifact.id.expected}" arg2="${artifact.id}" />
+ </bool>
+ </assert>
+ <var name="artifact.id.expected" unset="true" />
+ <var name="artifact.id" unset="true" />
+
+ <echo level="verbose">[2] Test @{artifactJar}</echo>
+ <antcallback target="get.plugin.id" return="plugin.id">
+ <property name="artifactJar" value="@{artifactJar}" />
+ <property name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
+ </antcallback>
+ <propertyregex override="true"
+ property="artifact.id.expected.name"
+ defaultvalue="@{artifactJar}"
+ input="@{artifactJar}"
+ regexp="${basedir}\/(.+)"
+ replace="get.artifact.id.expected.\1"
+ />
+ <!-- <echo><property name="get.artifact.id.expected.@{artifactJar}" value="${artifact.id}"/> </echo> -->
+ <propertycopy name="artifact.id.expected" from="${artifact.id.expected.name}" />
+ <assert failonerror="true" message="Expected: ${artifact.id.expected}; got: ${plugin.id}">
+ <bool>
+ <equals arg1="${artifact.id.expected}" arg2="${plugin.id}" />
+ </bool>
+ </assert>
+ <var name="artifact.id.expected" unset="true" />
+ <var name="artifact.id" unset="true" />
+ </sequential>
+ </for>
+ </sequential>
+ </for>
+ </target>
+
+ <target name="test.get.sources.build.all"
+ depends="init, test.expected.values"
+ description="verify get.sources works to fetch, then update; verify all components will be built"
+ >
+ <var name="build.if.sources.unchanged" value="true" />
+ <var name="get.components.to.build.expected.2" unset="true" />
+ <var name="get.components.to.build.expected.4" unset="true" />
+ <var name="get.components.to.build.expected.6" unset="true" />
+ <var name="get.components.to.build.expected.2" value="${get.components.to.build.expected.2.all}" />
+ <var name="get.components.to.build.expected.4" value="${get.components.to.build.expected.4.all}" />
+ <var name="get.components.to.build.expected.6" value="${get.components.to.build.expected.6.all}" />
+ <antcall target="test.get.sources" />
+ </target>
+
+ <target name="test.get.sources"
+ depends="init, test.expected.values"
+ description="verify get.sources works to fetch, then update; verify if components are not updated, they will not be built"
+ >
+ <var name="COMPONENTS" unset="true" />
+ <var name="COMPONENTS" value="${get.sources.expected.dirs}" />
+
+ <!-- for testing purposes, do not recurse (otherwise will have to download 100s of Mb of data -->
+ <var name="svn.recurse" unset="true" />
+ <var name="svn.recurse" value="false" />
+
+ <!-- cleanup before test -->
+ <for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
+ ">
+ <sequential>
+ <delete dir="${WORKINGDIR}/(a){expected.dir}" includeemptydirs="true" />
+ <delete file="${WORKINGDIR}/svn.info-(a){expected.dir}.txt" />
+ </sequential>
+ </for>
+ <for param="expected.file" list="${get.sources.expected.files}" delimiter=",
+ ">
+ <sequential>
+ <delete file="${WORKINGDIR}/(a){expected.file}" />
+ </sequential>
+ </for>
+
+ <echo level="info">----------------------------------</echo>
+ <echo level="info">
+1/6: Test checkout</echo>
+ <antcall target="get.sources" />
+ <for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.dir} not found!">
+ <bool>
+ <available file="${WORKINGDIR}/(a){expected.dir}" type="dir" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <for param="expected.file" list="${get.sources.expected.files}" delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.file} not found!">
+ <bool>
+ <available file="${WORKINGDIR}/(a){expected.file}" type="file" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+2/6: Test build.cfg</echo>
+ <var name="COMPONENTS.to.build" unset="true" />
+ <antcallback target="get.components.to.build" return="COMPONENTS.to.build" />
+ <assert failonerror="true"
+ message="expected: [${get.components.to.build.expected.2}] but got: [${COMPONENTS.to.build}]"
+ >
+ <bool>
+ <equals arg1="${get.components.to.build.expected.2}" arg2="${COMPONENTS.to.build}" />
+ </bool>
+ </assert>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+3/6: Test update</echo>
+ <delete file="${WORKINGDIR}/svn.info-tests.txt" />
+ <delete file="${WORKINGDIR}/svn.info-xulrunner.txt" />
+ <touch file="${WORKINGDIR}/common/pom.xml" />
+ <var name="COMPONENTS.to.build" unset="true" />
+ <antcall target="get.sources" />
+ <for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.dir} not found!">
+ <bool>
+ <available file="${WORKINGDIR}/(a){expected.dir}" type="dir" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <for param="expected.file" list="${get.sources.expected.files}" delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.file} not found!">
+ <bool>
+ <available file="${WORKINGDIR}/(a){expected.file}" type="file" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+4/6: Test build.cfg</echo>
+ <var name="COMPONENTS.to.build" unset="true" />
+ <antcallback target="get.components.to.build" return="COMPONENTS.to.build" />
+ <assert failonerror="true"
+ message="expected: [${get.components.to.build.expected.4}] but got: [${COMPONENTS.to.build}]"
+ >
+ <bool>
+ <equals arg1="${get.components.to.build.expected.4}" arg2="${COMPONENTS.to.build}" />
+ </bool>
+ </assert>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+5/6: Test info w/o update</echo>
+ <var name="COMPONENTS.to.build" unset="true" />
+ <antcall target="get.sources" />
+ <for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.dir} not found!">
+ <bool>
+ <available file="${WORKINGDIR}/(a){expected.dir}" type="dir" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <for param="expected.file" list="${get.sources.expected.files}" delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.file} not found!">
+ <bool>
+ <available file="${WORKINGDIR}/(a){expected.file}" type="file" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+6/6: Test build.cfg</echo>
+ <var name="COMPONENTS.to.build" unset="true" />
+ <antcallback target="get.components.to.build" return="COMPONENTS.to.build" />
+ <assert failonerror="true"
+ message="expected: [${get.components.to.build.expected.6}] but got: [${COMPONENTS.to.build}]"
+ >
+ <bool>
+ <equals arg1="${get.components.to.build.expected.6}" arg2="${COMPONENTS.to.build}" />
+ </bool>
+ </assert>
+ <echo level="info">----------------------------------</echo>
+ </target>
+
+ <!-- TODO: fixme: manual test; lacks something we can assert... maybe that deployDir exists? -->
+ <target name="test.deploy" depends="init">
+ <antcall target="deploy">
+ <param name="deployDir" value="tools@filemgmt.jboss.org:/downloads_htdocs/tools/repository/SNAPSHOT" />
+ <param name="sourceDir" value="${WORKINGDIR}/surefire-reports" />
+ </antcall>
+ </target>
+
+ <target name="test.now" depends="init">
+ <now>foobar!</now>
+ <now />
+ <now level="error">error!</now>
+ <now level="info">info!</now>
+ </target>
+
+ <target name="test.get.all.components" depends="init, test.expected.values">
+ <var name="COMPONENTS" unset="true" />
+ <var name="COMPONENTS"
+ value="tests,common;
+ flow,jbpm;
+ jmx,archives,as;
+ drools,bpel,smooks,freemarker,profiler,portlet;
+ xulrunner,jst,vpe,jsf;
+ esb,ws;
+ cdi,struts,hibernatetools,seam;
+ examples,birt;
+ maven"
+ />
+ <antcallback target="get.all.components" return="COMPONENTS.to.build" />
+ <assert failonerror="true"
+ message="expected: [${get.all.components.expected}] but got: [${COMPONENTS.to.build}]"
+ >
+ <bool>
+ <equals arg1="${get.all.components.expected}" arg2="${COMPONENTS.to.build}" />
+ </bool>
+ </assert>
+ </target>
+
+</project>
Deleted: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2012-02-15 16:49:59 UTC (rev 38766)
+++ trunk/build/build.xml 2012-02-15 18:35:11 UTC (rev 38767)
@@ -1,2058 +0,0 @@
-<project default="run" basedir="." name="build.xml to wrap maven">
- <!-- ****************************** Configuration ****************************** -->
-
- <!-- default maven version -->
- <property name="maven.version" value="3.0.4" />
-
- <!-- set name of component(s) to build+test, IN ORDER; if no subcomponents, use "." -->
- <property name="COMPONENTS"
- value="tests,common;
- flow,jbpm;
- jmx,archives,as;
- bpel,smooks,freemarker,profiler,portlet,modeshape;
- xulrunner,jst,vpe,jsf;
- drools,esb,ws;
- cdi,struts,hibernatetools,seam;
- examples,birt;
- maven"
- />
-
- <!-- svn root, including trunk or branch path -->
- <property name="svn.root" value="http://anonsvn.jboss.org/repos/jbosstools/trunk" />
-
- <!-- if true, use -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository; if false, use default ~/.m2/repository; or set another path if preferred -->
- <property name="maven.repo.local" value="true" />
-
- <!-- name/version we're building -->
- <property name="product.name" value="JBoss Tools" />
- <property name="product.id" value="JBossTools" />
- <property name="product.version" value="3.2.0-beta-1" />
- <!--
- <property name="product.name" value="JBoss Developer Studio"/>
- <property name="product.id" value="JBDS"/>
- <property name="product.version" value="3.1.0-beta-1"/>
- -->
-
- <!-- TODO: connect build type (snapshot, milestone, release) to update site description (nightly, milestone, stable) -->
- <!-- update site description :: not used if site.xml already present -->
- <property name="update.site.description" value="Nightly Build" />
-
- <!-- ****************************** Usage Instructions ****************************** -->
- <target name="help" description="Usage Instructions" depends="init">
- <echo>
-To run this script in Eclipse:
- Run As > Ant Build
-
-To run this script via commandline (build default modules + run tests, then collect test results and build per-component + overall update site zips):
- cd /path/to/checked/out/source/tree; ant
-
-or, to build everything but not *run* the tests:
- ant -DMAVEN_FLAGS="clean install -Dmaven.test.skip"
- or
- ant -Dnotests=true
-
-or, to purge the local repo (or purge then build):
- ant purge -q
- or
- ant clean-run
-
-or, to rebuild even if sources have not changed:
- ant -Dbuild.if.sources.unchanged=true
-
-or, to fetch fresh sources, then build anew:
- ant -Dclean.sources=true
-
-or, to (re-)run tests w/o (re-)building first:
- ant -DMAVEN_FLAGS="osgi-test:test -B -fn"
-
-or, to build, test, and install 1 or more specific module(s):
- ant -DCOMPONENTS=tests,common,flow,jbpm
-
-or, to re-build a single component's update site w/o building, testing, and installing it into the m2 repo:
- ant -DCOMPONENT=jmx create.update.site
-
-or, to re-build the overall update site w/o building first (no applicable when COMPONENTS=.):
- ant create.overall.update.site -Dbuild.if.sources.unchanged=true
-
-To have hudson manage sources (rather than having this script checkout/update them) use:
- -Dhudson.managed.sources=true
-
-Note: if tests stall on Linux, install Xvfb and this script will use that to run Maven, unless use:
- -DnoXvfb=true
-
-Here is the order in which components must be built:
-</echo>
- <for param="COMPONENT" list="${COMPONENTS}" delimiter=";">
- <sequential>
- <echo message=" @{COMPONENT}," />
- </sequential>
- </for>
- </target>
-
- <!-- ******************* MAIN ENTRY TARGETS ******************* -->
- <target name="clean-run" description="purge m2 repo, then run build" depends="purge, run" />
-
- <target name="purge" depends="init">
- <antcall target="genPomXml">
- <param name="COMPONENT" value="purge" />
- <param name="packaging" value="pom" />
- </antcall>
- <antcall target="mvn">
- <param name="COMPONENT" value="purge" />
- <param name="MAVEN_DIR" value="${WORKINGDIR}/purge/site" />
- <param name="MAVEN_FLAGS" value="dependency:purge-local-repository -e -U -q -B -fae" />
- <param name="noXvfb" value="true" />
- </antcall>
- <delete dir="${WORKINGDIR}/purge" includeemptydirs="true" quiet="true" />
- <delete dir="${COMMON_TOOLS}/m2-repository/org/jboss/tools" includeemptydirs="true" quiet="true" />
- </target>
-
- <target name="run"
- description="run a build, collect test results, generate overall update site"
- depends="build, collect.all.test.results, create.overall.update.site, collect.update.site.results"
- />
-
- <target name="build"
- description="run a build"
- depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build"
- />
-
- <target name="test"
- description="run tests w/o first getting sources + list of components to build; assumes an upstream build job was already run"
- depends="init, get.bootstrap.scripts, get.all.components, run.build, collect.all.test.results"
- />
-
- <!-- ******************* MAIN ENTRY TARGETS ******************* -->
-
- <!-- override for local build -->
- <condition property="isInHudson" value="true">
- <or>
- <contains string="${user.dir}" substring="hudson" />
- <contains string="${user.name}" substring="hudson" />
- <contains string="${user.home}" substring="hudson" />
- </or>
- </condition>
- <target name="local" unless="isInHudson">
- <property name="WORKINGDIR" value="${basedir}" />
- <property name="COMMON_TOOLS" value="${java.io.tmpdir}" />
- </target>
-
- <target name="get.ant-contrib" unless="ant-contrib.jar.exists">
- <property name="ANTCONTRIB_MIRROR" value="http://downloads.sourceforge.net/ant-contrib/" />
- <get usetimestamp="true"
- dest="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip"
- src="${ANTCONTRIB_MIRROR}/ant-contrib-1.0b2-bin.zip"
- />
- <touch file="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip" />
- <mkdir dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_" />
- <unzip src="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip"
- dest="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_"
- overwrite="true"
- />
- <copy file="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_/ant-contrib/lib/ant-contrib.jar"
- tofile="${COMMON_TOOLS}/ant-contrib.jar"
- failonerror="true"
- />
- <delete dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_" includeemptydirs="true" quiet="true" />
- </target>
-
- <target name="get.svnant" unless="svnant.jar.exists">
- <echo level="debug">${os.name}, ${os.arch}, ${os.version}, ${osgi.os}</echo>
- <property name="SVNANT_MIRROR" value="http://www.tigris.org/files/documents/906/46267" />
- <if>
- <istrue value="${isWindows}" />
- <then>
- <var name="svnant.enabled" unset="true" />
- <var name="svnant.enabled" value="false" />
- </then>
- <else>
- <exec executable="wget" dir="${COMMON_TOOLS}">
- <arg line="${SVNANT_MIRROR}/svnant-1.3.0.zip --no-clobber" />
- </exec>
- </else>
- </if>
-
- <if>
- <istrue value="${svnant.enabled}" />
- <then>
- <if>
- <available file="${COMMON_TOOLS}/svnant-1.3.0.zip" type="file" />
- <then>
- <touch file="${COMMON_TOOLS}/svnant-1.3.0.zip" />
- <mkdir dir="${java.io.tmpdir}/svnant-1.3.0.zip_" />
- <unzip src="${COMMON_TOOLS}/svnant-1.3.0.zip"
- dest="${java.io.tmpdir}/svnant-1.3.0.zip_"
- overwrite="true"
- />
- <copy todir="${COMMON_TOOLS}" failonerror="true">
- <fileset dir="${java.io.tmpdir}/svnant-1.3.0.zip_/svnant-1.3.0/lib/" includes="*.jar" />
- </copy>
- <delete dir="${java.io.tmpdir}/svnant-1.3.0.zip_" includeemptydirs="true" quiet="true" />
- </then>
- <elseif>
- <or>
- <not>
- <available file="${COMMON_TOOLS}/svnant.jar" type="file" />
- </not>
- <not>
- <available file="${COMMON_TOOLS}/svnkit.jar" type="file" />
- </not>
- <not>
- <available file="${COMMON_TOOLS}/svnClientAdapter.jar" type="file" />
- </not>
- </or>
- <then>
- <fail>Error!
-Build cannot proceed!
- Must install svnant.jar, svnkit.jar + svnClientAdapter.jar from
- ${SVNANT_MIRROR}/svnant-1.3.0.zip
- into ${COMMON_TOOLS}/.
-</fail>
- </then>
- </elseif>
- </if>
- </then>
- <else>
- <echo level="warning">Warning!
-Svnant unavailable. Will use Maven to fetch sources.
-</echo>
- </else>
- </if>
- </target>
-
- <target name="get.maven" unless="maven.exists">
- <property name="MAVEN_MIRROR" value="http://mirror.csclub.uwaterloo.ca/apache/maven/binaries" />
- <get usetimestamp="true"
- dest="${COMMON_TOOLS}/apache-maven-${maven.version}-bin.tar.gz"
- src="${MAVEN_MIRROR}/apache-maven-${maven.version}-bin.tar.gz"
- />
- <untar compression="gzip"
- overwrite="false"
- dest="${COMMON_TOOLS}"
- src="${COMMON_TOOLS}/apache-maven-${maven.version}-bin.tar.gz"
- />
- <chmod perm="755" file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn" />
- </target>
-
- <target name="init" depends="local">
- <macrodef name="now">
- <attribute name="level" default="warning" />
- <text name="info" optional="true" />
- <sequential>
- <var name="now" unset="true" />
- <tstamp>
- <format property="now" pattern="hh:mm:ss" />
- </tstamp>
- <echo level="@{level}">${now} @{info}</echo>
- </sequential>
- </macrodef>
-
- <condition property="isWindows" value="true" else="false">
- <or>
- <os family="windows" />
- <contains string="${os.name}" substring="windows" casesensitive="false" />
- </or>
- </condition>
-
- <!-- https://jira.jboss.org/jira/browse/JBQA-3313 Use static, shared space outside workspace, instead of working directly in the workspace -->
- <condition property="WORKINGDIR" value="/home/hudson/static_build_env/jbds/tools/sources" else="${basedir}">
- <available file="/home/hudson/static_build_env/jbds" type="dir" />
- </condition>
- <mkdir dir="${WORKINGDIR}" />
- <echo level="info">WORKINGDIR = ${WORKINGDIR}</echo>
-
- <condition property="COMMON_TOOLS"
- value="/home/hudson/static_build_env/jbds/tools"
- else="${WORKINGDIR}/../tools"
- >
- <available file="/home/hudson/static_build_env/jbds" type="dir" />
- </condition>
- <mkdir dir="${COMMON_TOOLS}" />
- <echo level="info">COMMON_TOOLS = ${COMMON_TOOLS}</echo>
-
- <available file="${COMMON_TOOLS}/ant-contrib.jar" type="file" property="ant-contrib.jar.exists" />
- <antcall target="get.ant-contrib" />
- <taskdef resource="net/sf/antcontrib/antlib.xml">
- <classpath>
- <pathelement location="${COMMON_TOOLS}/ant-contrib.jar" />
- </classpath>
- </taskdef>
-
- <property name="svnant.enabled" value="true" />
- <available file="${COMMON_TOOLS}/svnant.jar" type="file" property="svnant.jar.exists" />
- <antcall target="get.svnant" />
- <taskdef resource="org/tigris/subversion/svnant/svnantlib.xml">
- <classpath>
- <pathelement location="${COMMON_TOOLS}/svnant.jar" />
- <pathelement location="${COMMON_TOOLS}/svnkit.jar" />
- <pathelement location="${COMMON_TOOLS}/svnClientAdapter.jar" />
- </classpath>
- </taskdef>
-
- <available file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn" type="file" property="maven.exists" />
- <antcall target="get.maven" />
- </target>
-
- <target name="get.sources" description="if sources not already on disk, fetch them" unless="hudson.managed.sources">
- <property name="clean.sources" value="false" />
- <property name="svn.recurse" value="true" />
-
- <!-- = = = = = = = = = = = = = = = = =
- COMPONENT: component to fetch or update
- op: up (update) or co (checkout)
- = = = = = = = = = = = = = = = = = -->
- <macrodef name="svn.fetch">
- <attribute name="component" />
- <attribute name="op" />
- <sequential>
- <!-- check out or update -->
- <if>
- <equals arg1="@{op}" arg2="up" />
- <then>
- <now level="info">Update '@{COMPONENT}'</now>
- <if>
- <istrue value="${svnant.enabled}" />
- <then>
- <!-- remove generated site/ folder?
- <if>
- <not>
- <equals arg1="@{component}" arg2="." />
- </not>
- <then>
- <delete dir="${WORKINGDIR}/@{component}/site"
- includeemptydirs="true"
- quiet="true"
- />
- </then>
- -->
- <!--
- <svn javahl="false" svnkit="true" failonerror="false">
- <revert recurse="${svn.recurse}" dir="@{component}" />
- </svn>
- -->
- <svn javahl="false" svnkit="true" failonerror="false">
- <update recurse="${svn.recurse}" dir="@{component}" />
- </svn>
- </then>
- <else>
- <antcall target="mvn">
- <param name="MAVEN_DIR" value="${WORKINGDIR}" />
- <param name="MAVEN_FLAGS"
- value="scm:update -f ${WORKINGDIR}/parent-pom.xml -e -q -B -fae -Dmaven.test.skip -DworkingDirectory=${WORKINGDIR}/@{component} -DconnectionUrl=scm:svn:${svn.root}/@{component} -DdeveloperConnectionUrl=scm:svn:${svn.root}/@{component}"
- />
- <param name="noXvfb" value="true" />
- </antcall>
- </else>
- </if>
- </then>
- <else>
- <now level="info">Fetch sources from ${svn.root}/@{component} into ${WORKINGDIR}/@{component}</now>
- <if>
- <istrue value="${svnant.enabled}" />
- <then>
- <svn javahl="false" svnkit="true" failonerror="true">
- <checkout recurse="${svn.recurse}"
- url="${svn.root}/@{component}"
- destpath="${WORKINGDIR}/@{component}"
- />
- </svn>
- </then>
- <else>
- <antcall target="mvn">
- <param name="MAVEN_DIR" value="${WORKINGDIR}" />
- <param name="MAVEN_FLAGS"
- value="scm:checkout -f ${WORKINGDIR}/parent-pom.xml -e -q -B -fae -Dmaven.test.skip -DskipCheckoutIfExists=true -DcheckoutDirectory=${WORKINGDIR}/@{component} -DworkingDirectory=${WORKINGDIR}/@{component} -DconnectionUrl=scm:svn:${svn.root}/@{component} -DdeveloperConnectionUrl=scm:svn:${svn.root}/@{component}"
- />
- <param name="noXvfb" value="true" />
- </antcall>
- </else>
- </if>
- </else>
- </if>
-
- <!-- Store svn info so we can compare it later and thus not need to update or checkout every time -->
- <if>
- <istrue value="${svnant.enabled}" />
- <then>
- <svn javahl="false" svnkit="true" failonerror="false">
- <info target="${WORKINGDIR}/@{component}"
- propprefix="svn.info.@{component}"
- verbose="false"
- />
- </svn>
- </then>
- </if>
- <if>
- <isset property="svn.info.(a){component}.rev" />
- <then>
- <echo file="${WORKINGDIR}/svn.info-(a){component}.txt">svn.info.(a){component}.rev = ${svn.info.(a){component}.rev}
-</echo>
- </then>
- </if>
- <echo file="${WORKINGDIR}/build.cfg" message="@{component}," append="true" />
- </sequential>
- </macrodef>
-
- <!-- only reset the file if we don't already have a value for COMPONENTS.to.build; thus when called later for "site" component build, append instead of overwriting -->
- <if>
- <not>
- <isset property="COMPONENTS.to.build" />
- </not>
- <then>
- <echo file="${WORKINGDIR}/build.cfg" message="COMPONENTS.to.build = " />
- </then>
- </if>
- <!-- check for each component dir in ${WORKINGDIR}; if not found, fetch -->
- <if>
- <and>
- <isset property="COMPONENT" />
- <not>
- <equals arg1="${COMPONENT}" arg2="" />
- </not>
- </and>
- <then>
- <var name="COMPONENTS" unset="true" />
- <var name="COMPONENTS" value="${COMPONENT}" />
- </then>
- </if>
- <for param="COMPONENT" list="${COMPONENTS}" delimiter=",;
- ">
- <sequential>
- <if>
- <equals arg1="${clean.sources}" arg2="true" />
- <then>
- <delete dir="${WORKINGDIR}/@{COMPONENT}" includeemptydirs="true" quiet="true" />
- </then>
- </if>
- <if>
- <not>
- <available file="${WORKINGDIR}/@{COMPONENT}" type="dir" />
- </not>
- <then>
- <svn.fetch component="@{COMPONENT}" op="co" />
- </then>
- <else>
- <if>
- <available file="${WORKINGDIR}/svn.info-(a){COMPONENT}.txt" type="file" />
- <then>
- <property file="${WORKINGDIR}/svn.info-(a){COMPONENT}.txt" />
- <!-- check svn info; if new version found, svn up -->
- <if>
- <istrue value="${svnant.enabled}" />
- <then>
- <svn javahl="false" svnkit="true" failonerror="false">
- <info target="${WORKINGDIR}/@{COMPONENT}"
- propprefix="svn.info.(a){COMPONENT}.check"
- verbose="false"
- />
- </svn>
- </then>
- </if>
- <if>
- <or>
- <not>
- <isset property="svn.info.(a){COMPONENT}.rev" />
- </not>
- <not>
- <isset property="svn.info.(a){COMPONENT}.check.rev" />
- </not>
- <not>
- <equals arg1="${svn.info.(a){COMPONENT}.rev}"
- arg2="${svn.info.(a){COMPONENT}.check.rev}"
- />
- </not>
- </or>
- <then>
- <svn.fetch component="@{COMPONENT}" op="up" />
- </then>
- <else>
- <if>
- <and>
- <isset property="build.if.sources.unchanged" />
- <istrue value="${build.if.sources.unchanged}" />
- </and>
- <then>
- <svn.fetch component="@{COMPONENT}" op="up" />
- </then>
- </if>
- </else>
- </if>
- </then>
- <else>
- <svn.fetch component="@{COMPONENT}" op="up" />
- </else>
- </if>
- </else>
- </if>
- </sequential>
- </for>
-
- </target>
-
- <target name="get.bootstrap.scripts">
- <!-- also get files required to bootstrap the build -->
- <get src="${svn.root}/parent-pom.xml" dest="${WORKINGDIR}/parent-pom.xml" usetimestamp="true" />
- <get src="${svn.root}/genpom.xml" dest="${WORKINGDIR}/genpom.xml" usetimestamp="true" />
- </target>
-
- <target name="get.all.components">
- <var name="COMPONENTS.to.build" unset="true" />
- <var name="COMPONENTS.to.build" value="" />
- <for param="COMPONENT" list="${COMPONENTS}" delimiter="; ">
- <sequential>
- <var name="COMPONENTS.to.build" value="${COMPONENTS.to.build}@{COMPONENT}," />
- </sequential>
- </for>
- </target>
-
- <target name="get.components.to.build">
- <if>
- <available file="${WORKINGDIR}/build.cfg" type="file" />
- <then>
- <property file="${WORKINGDIR}/build.cfg" />
- <if>
- <equals arg1="${COMPONENTS.to.build}" arg2="" />
- <then>
- <echo level="warning">All components up to date: nothing to do!
-To force a build of unchanged components, use -Dbuild.if.sources.unchanged=true</echo>
-
- <antcall target="create.empty.test.results.file" />
- <property name="no.tests.run" value="true" />
- <property name="no.overall" value="true" />
- </then>
- <elseif>
- <not>
- <equals arg1="${COMPONENTS.to.build}" arg2=".," />
- </not>
- <then>
- <echo level="warning">The following components' sources have changed and will be built:
- COMPONENTS.to.build = ${COMPONENTS.to.build}
-</echo>
- </then>
- </elseif>
- <elseif>
- <equals arg1="${COMPONENTS.to.build}" arg2=".," />
- <then>
- <property name="no.overall" value="true" />
- </then>
- </elseif>
- </if>
- </then>
- <else>
- <antcallback target="get.all.components" return="COMPONENTS.to.build" />
- </else>
- </if>
- </target>
-
- <!--
- To run this after a maven build in Hudson, set these properties:
- basedir=${WORKSPACE}/sources
- WORKINGDIR=${WORKSPACE}/sources
- COMPONENT=.
- move.test.results=true
- -->
- <target name="collect.test.results.for.hudson"
- depends="init"
- if="isInHudson"
- description="collect test results after a pure maven build so Hudson has something to see"
- >
- <property name="basedir" value="${WORKSPACE}/sources" />
- <property name="WORKINGDIR" value="${WORKSPACE}/sources" />
- <property name="COMPONENT" value="." />
- <property name="move.test.results" value="true" />
- <var name="tests.results.found" value="false" />
- <echo level="debug">basedir = ${basedir}
-WORKINGDIR = ${WORKINGDIR}
-COMPONENT = ${COMPONENT}</echo>
- <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
- <for param="test.xml.files" delimiter=",
- ">
- <path>
- <fileset dir="${WORKINGDIR}"
- includes="**/target/surefire-reports/TEST-*.xml, **/**/target/surefire-reports/TEST-*.xml"
- excludes="**/TEST-*NoTestsRun.xml, **/**/TEST-*NoTestsRun.xml"
- />
- </path>
- <sequential>
- <var name="tests.results.found" value="true" />
- </sequential>
- </for>
- <if>
- <equals arg1="${tests.results.found}" arg2="true" />
- <then>
- <antcall target="collect.test.results">
- <param name="COMPONENT" value="." />
- </antcall>
- <antcall target="collect.all.test.results" />
- </then>
- <else>
- <antcall target="create.empty.test.results.file" />
- <property name="no.tests.run" value="true" />
- </else>
- </if>
- </target>
-
- <target name="create.empty.test.results.file">
- <!-- create fake test result file to avoid Hudson failure -->
- <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
- <mkdir dir="${basedir}/surefire-reports/NoTestsRun" />
- <echo file="${basedir}/surefire-reports/NoTestsRun/TEST-org.jboss.tools.NoTestsRun.xml"><?xml version="1.0" encoding="UTF-8" ?>
-<testsuite failures="0" time="0.001" errors="0" skipped="0" tests="1" name="org.jboss.tools.NoTestsRun">
-<testcase time="0.001" classname="org.jboss.tools.NoTestsRun" name="NoTestsRun"/>
-</testsuite>
-</echo>
- </target>
-
- <target name="run.build">
- <!-- could set -Dmaven.test.skip to skip tests, or use osgi-test:test to just (re-)run tests w/o first building -->
- <property name="MAVEN_FLAGS" value="clean install -B -fn -q -U -e" />
-
- <!-- commandline overrides to suppress doing tests -->
- <if>
- <or>
- <isset property="notest" />
- <isset property="notests" />
- <isset property="skiptest" />
- <isset property="skiptests" />
- </or>
- <then>
- <property name="noXvfb" value="true" />
- <if>
- <not>
- <contains string="${MAVEN_FLAGS}" substring="-Dmaven.test.skip" />
- </not>
- <then>
- <var name="MAVEN_FLAGS" value="${MAVEN_FLAGS} -Dmaven.test.skip" />
- </then>
- </if>
- </then>
- </if>
-
- <for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
- ">
- <sequential>
- <if>
- <equals arg1="@{COMPONENT}" arg2="site" />
- <then>
- <now level="warning">Build overall update @{COMPONENT}</now>
- </then>
- <else>
- <now level="warning">Build '@{COMPONENT}' component</now>
- </else>
- </if>
- <!-- TODO if needed: optional extra instructions to do before a maven build -->
- <loadfile property="@{COMPONENT}.pom.xml" srcfile="${WORKINGDIR}/(a){COMPONENT}/pom.xml" />
- <if>
- <and>
- <!-- if pom.xml does not call custom build.xml directly -->
- <not>
- <contains string="${(a){COMPONENT}.pom.xml}"
- substring="<ant antfile="build.xml" />"
- />
- </not>
- <available file="${WORKINGDIR}/(a){COMPONENT}/build.xml" type="file" />
- <not>
- <equals arg1="@{COMPONENT}" arg2="." />
- </not>
- </and>
- <then>
- <echo>Run custom '@{COMPONENT}/build.xml'</echo>
- <ant antfile="${WORKINGDIR}/(a){COMPONENT}/build.xml">
- <property name="COMPONENT" value="@{COMPONENT}" />
- <property name="basedir" value="${WORKINGDIR}/@{COMPONENT}" />
- <property name="build.xml" value="${ant.file}" />
- </ant>
- </then>
- </if>
-
- <!-- If poms already exist, DO NOT OVERWRITE unless -Doverwrite.existing.pom.xml=true -->
- <ant antfile="genpom.xml" target="run" dir="${WORKINGDIR}">
- <property name="COMPONENT" value="@{COMPONENT}" />
- </ant>
-
- <antcall target="mvn">
- <param name="COMPONENT" value="@{COMPONENT}" />
- </antcall>
-
- <!-- don't collect test results if there are no test results to collect! -->
- <if>
- <not>
- <contains string="${MAVEN_FLAGS}" substring="-Dmaven.test.skip" />
- </not>
- <then>
- <antcall target="collect.test.results">
- <param name="COMPONENT" value="@{COMPONENT}" />
- </antcall>
- </then>
- <else>
- <property name="no.tests.run" value="true" />
- </else>
- </if>
-
- <!-- prevent recursion: overall site component is built with create.overall.update.site, not simpler create.update.site; also, don't rebuild the site if it's already been done by "." component -->
- <if>
- <and>
- <not>
- <equals arg1="@{COMPONENT}" arg2="site" />
- </not>
- <not>
- <equals arg1="@{COMPONENT}" arg2="." />
- </not>
- </and>
- <then>
- <!-- only do this if the component's aggregate pom doesn't reference the site/ folder, and therefore hasn't already build it -->
- <loadfile property="component.pom.xml" srcfile="${WORKINGDIR}/(a){COMPONENT}/pom.xml" />
- <if>
- <not>
- <contains string="${component.pom.xml}" substring="<module>site</module>" />
- </not>
- <then>
- <antcall target="create.update.site">
- <param name="COMPONENT" value="@{COMPONENT}" />
- </antcall>
- </then>
- </if>
- </then>
- </if>
- </sequential>
- </for>
- <now level="info">Builds done</now>
- </target>
-
- <target name="mvn">
- <var name="mvnExe" value="mvn" />
- <antcallback target="getMvnExe" return="mvnExe" />
- <echo level="verbose">Exe: ${COMMON_TOOLS}/apache-maven-${maven.version}/bin/${mvnExe}</echo>
- <echo level="verbose">Pom: ${WORKINGDIR}/${COMPONENT}/pom.xml</echo>
- <property name="MAVEN_DIR" value="${WORKINGDIR}/${COMPONENT}" />
- <!-- support using true/false/other path values of maven.repo.local -->
- <if>
- <isset property="maven.repo.local" />
- <then>
- <if>
- <isfalse value="${maven.repo.local}" />
- <then>
- <var name="maven.repo.local" value="" />
- </then>
- <elseif>
- <istrue value="${maven.repo.local}" />
- <then>
- <var name="maven.repo.local" value=" -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository" />
- </then>
- </elseif>
- <else>
- <var name="maven.repo.local" value=" -Dmaven.repo.local=${maven.repo.local}" />
- </else>
- </if>
- </then>
- <else>
- <var name="maven.repo.local" value=" -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository" />
- </else>
- </if>
- <!-- 3 hr timeout = 10800000ms -->
- <echo level="info">${mvnExe} ${MAVEN_FLAGS} ${maven.repo.local}</echo>
- <exec executable="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/${mvnExe}"
- dir="${MAVEN_DIR}"
- failifexecutionfails="true"
- failonerror="true"
- timeout="10800000"
- >
- <env key="M2_HOME" value="${COMMON_TOOLS}/apache-maven-${maven.version}" />
- <env key="MAVEN_OPTS" value="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m" />
- <!-- more debug output with <env key="MAVEN_OPTS" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/> -->
- <!-- <arg line="-o -Dmaven.test.skip" /> -->
- <arg line="${MAVEN_FLAGS} ${maven.repo.local}" />
- </exec>
- </target>
-
- <!-- Use Xvfb wrapper for maven when invoking UI tests -->
- <target name="getMvnExe" unless="noXvfb">
- <if>
- <available file="/usr/bin/Xvfb" type="file" />
- <then>
- <if>
- <not>
- <available file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvnWithXvfb" type="file" />
- </not>
- <then>
- <echo file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvnWithXvfb">#!/bin/bash
-if [[ -f /tmp/.X3-lock ]]; then
-kill -9 `cat /tmp/.X3-lock`
-rm -fr /tmp/.X3-lock
-fi
-/usr/bin/Xvfb :3 -ac 2>&1 1>/dev/null &
-DISPLAY=:3 /opt/maven3/bin/mvn $*
-kill -9 `cat /tmp/.X3-lock`
-rm -fr /tmp/.X3-lock
-</echo>
- <chmod perm="755" file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvnWithXvfb" />
- </then>
- </if>
- <var name="mvnExe" value="mvnWithXvfb" />
- </then>
- </if>
- </target>
-
- <target name="collect.test.results">
- <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
- <property name="COMPONENT" value="" />
- <!-- collect test results by copying ${WORKINGDIR}/${COMPONENT}/**/target/surefire-reports/*.xml into ${basedir}/surefire-reports/${COMPONENT} -->
- <delete dir="${basedir}/surefire-reports/${COMPONENT}" includeemptydirs="true" />
- <mkdir dir="${basedir}/surefire-reports/${COMPONENT}" />
- <copy todir="${basedir}/surefire-reports/${COMPONENT}"
- flatten="true"
- preservelastmodified="true"
- overwrite="true"
- >
- <fileset dir="${WORKINGDIR}/${COMPONENT}" includes="**/target/surefire-reports/TEST-*.xml" />
- </copy>
- <if>
- <isset property="move.test.results" />
- <then>
- <delete dir="${WORKINGDIR}/${COMPONENT}" includes="**/target/surefire-reports" />
- </then>
- </if>
- </target>
-
- <target name="collect.all.test.results" unless="no.tests.run">
- <var name="test.results.all" value="" />
- <var name="test.results.errors.failures.skipped" value="" />
-
- <!-- Parse this: <testsuite errors="0" skipped="0" tests="10" time="0.042" failures="0" name="org.jboss.tools.jmx.ui.JMXUIAllTests"> -->
- <for param="testresultfile" delimiter=",
- ">
- <path>
- <fileset dir="${basedir}/surefire-reports/" includes="**/TEST-*.xml" />
- </path>
- <sequential>
- <var name="testsuite.name" unset="true" />
- <var name="testsuite.tests" unset="true" />
- <var name="testsuite.time" unset="true" />
- <var name="testsuite.skipped" unset="true" />
- <var name="testsuite.errors" unset="true" />
- <var name="testsuite.failures" unset="true" />
- <xmlproperty file="@{testresultfile}" keepRoot="true" collapseAttributes="true" />
- <for param="ts" list="testsuite.skipped, testsuite.errors, testsuite.failures" delimiter=", ">
- <sequential>
- <propertyregex override="true"
- property="ts.label"
- defaultvalue="@{ts}"
- input="@{ts}"
- regexp="testsuite\.(.+)"
- replace="\1"
- />
- <if>
- <isset property="@{ts}" />
- <then>
- <if>
- <equals arg1="${@{ts}}" arg2="0" />
- <then>
- <var name="@{ts}" value="" />
- </then>
- <else>
- <var name="@{ts}" value="; ${@{ts}} ${ts.label}" />
- </else>
- </if>
- </then>
- </if>
-
- </sequential>
- </for>
- <if>
- <or>
- <not>
- <equals arg1="${testsuite.skipped}" arg2="" />
- </not>
- <not>
- <equals arg1="${testsuite.errors}" arg2="" />
- </not>
- <not>
- <equals arg1="${testsuite.failures}" arg2="" />
- </not>
- </or>
- <then>
- <var name="test.results.errors.failures.skipped"
- value="${test.results.errors.failures.skipped}${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}${line.separator}"
- />
- </then>
- </if>
- <if>
- <isset property="testsuite.name" />
- <then>
- <var name="test.results.all"
- value="${test.results.all}${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}${line.separator}"
- />
- </then>
- </if>
- <var name="testsuite.name" unset="true" />
- <var name="testsuite.tests" unset="true" />
- <var name="testsuite.time" unset="true" />
- <var name="testsuite.skipped" unset="true" />
- <var name="testsuite.errors" unset="true" />
- <var name="testsuite.failures" unset="true" />
- </sequential>
- </for>
- <echo level="verbose">-------------------------------------------------------
- A L L T E S T R E S U L T S
--------------------------------------------------------
-${test.results.all}
--------------------------------------------------------
-
-</echo>
- <if>
- <and>
- <isset property="test.results.errors.failures.skipped" />
- <not>
- <equals arg1="${test.results.errors.failures.skipped}" arg2="" />
- </not>
- </and>
- <then>
- <echo level="error">-------------------------------------------------------
- T E S T R E S U L T S
--------------------------------------------------------
-${test.results.errors.failures.skipped}
--------------------------------------------------------
-
-</echo>
- </then>
- </if>
- </target>
-
- <!-- collect names, dates, and contained features in all generated update site zips, including the overall one -->
- <target name="collect.update.site.results" depends="init">
- <var name="COMPONENTS.to.check" unset="" />
- <if>
- <isset property="COMPONENTS.to.build" />
- <then>
- <var name="COMPONENTS.to.check" value="${COMPONENTS.to.build}" />
- </then>
- <else>
- <var name="COMPONENTS.to.check" value="${COMPONENTS}" />
- </else>
- </if>
- <if>
- <and>
- <not>
- <equals arg1="${COMPONENTS.to.check}" arg2="." />
- </not>
- <not>
- <contains string="${COMPONENTS.to.check}" substring=",site" />
- </not>
- </and>
- <then>
- <var name="COMPONENTS.to.check" value="${COMPONENTS.to.check},site" />
- </then>
- </if>
- <for param="COMPONENT" list="${COMPONENTS.to.check}" delimiter=",;
- ">
- <sequential>
- <!-- rename any leftover site.zip files -->
- <for param="updateZip">
- <path>
- <fileset dir="${WORKINGDIR}/@{COMPONENT}" includes="**/site.zip" />
- </path>
- <sequential>
- <if>
- <equals arg1="@{COMPONENT}" arg2="site" />
- <then>
- <var name="destinationZip"
- value="${WORKINGDIR}/(a){COMPONENT}/site/target/jbosstools-ALL-Update-SNAPSHOT.zip"
- />
- </then>
- <else>
- <var name="COMPONENT.name" value="" />
- <if>
- <equals arg1="@{COMPONENT}" arg2="." />
- <then>
- <var name="COMPONENT.name" value="${product.id}" />
- </then>
- <else>
- <var name="COMPONENT.name" value="@{COMPONENTS}" />
- </else>
- </if>
- <var name="destinationZip"
- value="${WORKINGDIR}/(a){COMPONENT}/site/target/jbosstools-${COMPONENT.name}-Update-SNAPSHOT.zip"
- />
- </else>
- </if>
- <!-- rename resulting update site zip -->
- <move file="${WORKINGDIR}/(a){COMPONENT}/site/target/site.zip"
- tofile="${destinationZip}"
- overwrite="true"
- preservelastmodified="false"
- />
- </sequential>
- </for>
-
- <for param="updateZip">
- <path>
- <fileset dir="${WORKINGDIR}/@{COMPONENT}" includes="**/jbosstools*Update*.zip" />
- </path>
- <sequential>
- <propertyregex property="updateZip"
- defaultvalue="@{updateZip}"
- input="@{updateZip}"
- regexp=".+/site/target/([^/]+.+\.zip)"
- replace="\1"
- override="true"
- />
- <exec executable="unzip" outputproperty="zip.contents">
- <arg line="-l @{updateZip}" />
- </exec>
- <if>
- <and>
- <isset property="zip.contents" />
- <contains string="${zip.contents}" substring="plugins/" />
- <contains string="${zip.contents}" substring=".jar" />
- </and>
- <then>
- <echo level="info">@{COMPONENT} :: ${updateZip}</echo>
- <for param="featureJar" list="${zip.contents}" delimiter="
-">
- <sequential>
- <if>
- <and>
- <contains string="@{featureJar}" substring="features/" />
- <contains string="@{featureJar}" substring=".jar" />
- </and>
- <then>
- <echo level="info"> :: @{featureJar}</echo>
- </then>
- </if>
- </sequential>
- </for>
- </then>
- <else>
- <echo level="warn">@{COMPONENT} :: ${updateZip}</echo>
- </else>
- </if>
- </sequential>
- </for>
- <if>
- <not>
- <isset property="zip.contents" />
- </not>
- <then>
- <echo level="warn">No update site found for @{COMPONENT}.</echo>
- </then>
- </if>
- <var name="zip.contents" unset="true" />
- <var name="zip.features" unset="true" />
- <echo level="info">
- </echo>
- </sequential>
- </for>
- </target>
-
- <!-- Used to build the overall update site for all components; requires a custom site.xml (generated from category.*.xml) and previously checked in pom.xml -->
- <target name="create.overall.update.site" depends="init" unless="no.overall">
- <if>
- <isset property="no.overall" />
- <then>
- <echo>All components up to date: nothing to do!
-To force a build of unchanged components, use -Dbuild.if.sources.unchanged=true</echo>
- </then>
- <else>
- <property name="update.site.path" value="site" />
-
- <!-- Fetch fresh sources (checkout or update) -->
- <antcall target="get.sources">
- <param name="COMPONENT" value="site" />
- </antcall>
-
- <!-- Get correct version of site.xml + resolve variables -->
- <loadfile property="site.xml.transformed"
- srcfile="${WORKINGDIR}/${update.site.path}/category.${product.id}.xml"
- >
- <filterchain>
- <expandproperties />
- </filterchain>
- </loadfile>
- <echo file="${WORKINGDIR}/${update.site.path}/site.xml" message="${site.xml.transformed}" />
- <var name="site.xml.transformed" unset="true" />
-
- <!-- Build update site -->
- <antcall target="build.update.site">
- <param name="COMPONENTS.to.build" value="site" />
- <param name="update.site.path" value="${update.site.path}" />
- </antcall>
-
- <!-- Copy overall site into workspace so it can be archived by Hudson -->
- <if>
- <not>
- <equals arg1="${basedir}" arg2="${WORKINGDIR}" />
- </not>
- <then>
- <mkdir dir="${basedir}/${update.site.path}/target" />
- <copy todir="${basedir}/${update.site.path}/target" overwrite="true">
- <fileset dir="${WORKINGDIR}/${update.site.path}/target/site" />
- </copy>
- </then>
- </if>
- </else>
- </if>
- </target>
-
- <target name="build.update.site">
- <property name="update.site.path" value="site" />
- <!-- without deleting previous target dir, update sites may end up missing all plugins and features! -->
- <delete dir="${WORKINGDIR}/${update.site.path}/target" includeemptydirs="true" quiet="true" />
-
- <if>
- <equals arg1="${update.site.path}" arg2="site" />
- <then>
- <var name="destinationZip"
- value="${WORKINGDIR}/${update.site.path}/target/jbosstools-ALL-Update-SNAPSHOT.zip"
- />
- </then>
- <else>
- <var name="COMPONENT.name" value="" />
- <if>
- <equals arg1="${COMPONENT}" arg2="." />
- <then>
- <var name="COMPONENT.name" value="${product.id}" />
- </then>
- <else>
- <var name="COMPONENT.name" value="${COMPONENTS.to.build}" />
- </else>
- </if>
- <var name="destinationZip"
- value="${WORKINGDIR}/${update.site.path}/target/jbosstools-${COMPONENT.name}-Update-SNAPSHOT.zip"
- />
- </else>
- </if>
- <delete file="${destinationZip}" quiet="true" />
-
- <if>
- <equals arg1="${COMPONENTS.to.build}" arg2="site" />
- <then>
- <!-- Call maven to generate pom.xml, then build site from site.xml -->
- <antcall target="run.build">
- <param name="COMPONENTS.to.build" value="${COMPONENTS.to.build}" />
- <param name="MAVEN_FLAGS" value="verify -e -q -B -fae -Dmaven.test.skip" />
- <param name="noXvfb" value="true" />
- </antcall>
- </then>
- <else>
- <!-- Or just call maven to build site -->
- <antcall target="mvn">
- <param name="MAVEN_DIR" value="${WORKINGDIR}/${update.site.path}" />
- <param name="MAVEN_FLAGS" value="verify -e -q -B -fae -Dmaven.test.skip" />
- <param name="noXvfb" value="true" />
- </antcall>
- </else>
- </if>
-
- <if>
- <and>
- <available file="${WORKINGDIR}/${update.site.path}/target/site/plugins" type="dir" />
- <available file="${WORKINGDIR}/${update.site.path}/target/site/features" type="dir" />
- </and>
- <then>
- <!-- rename resulting update site zip -->
- <move file="${WORKINGDIR}/${update.site.path}/target/site.zip"
- tofile="${destinationZip}"
- overwrite="true"
- preservelastmodified="false"
- />
-
- <!-- Create real update site zip, including web UI -->
- <copy todir="${WORKINGDIR}/${update.site.path}/target/site">
- <fileset dir="${WORKINGDIR}/${update.site.path}" includes="web/*, index.html" />
- </copy>
- <zip destfile="${destinationZip}"
- basedir="${WORKINGDIR}/${update.site.path}/target/site"
- update="true"
- includes="web/*, index.html"
- />
-
- <!-- Copy zip into workspace so it can be archived by Hudson -->
- <if>
- <not>
- <equals arg1="${basedir}" arg2="${WORKINGDIR}" />
- </not>
- <then>
- <mkdir dir="${basedir}/${update.site.path}/target" />
- <copy todir="${basedir}/${update.site.path}/target"
- flatten="true"
- preservelastmodified="true"
- overwrite="true"
- >
- <fileset dir="${WORKINGDIR}/${update.site.path}/target" includes="*Update*.zip" />
- </copy>
- </then>
- </if>
- </then>
- <else>
- <delete file="${WORKINGDIR}/${update.site.path}/target/site.zip" quiet="true" />
- <if>
- <equals arg1="${update.site.path}" arg2="site" />
- <then>
- <fail>Overall update site zip contains no features!</fail>
- </then>
- <else>
- <echo level="info"> [ERROR] Update site zip for ${COMPONENTS.to.build} contains no features!</echo>
- </else>
- </if>
- </else>
- </if>
- </target>
-
- <!-- Used to build the update site of a component; requires a site.xml and pom.xml be generated first, if not already checked in -->
- <target name="create.update.site" depends="init">
- <var name="site.pom.exists" unset="true" />
- <condition property="site.pom.exists">
- <available file="${WORKINGDIR}/${COMPONENT}/site/pom.xml" type="file" />
- </condition>
- <antcall target="genPomXml" />
-
- <var name="site.sitexml.exists" unset="true" />
- <condition property="site.sitexml.exists">
- <available file="${WORKINGDIR}/${COMPONENT}/site/site.xml" type="file" />
- </condition>
- <antcall target="genSiteXml" />
-
- <antcall target="build.update.site">
- <param name="COMPONENTS.to.build" value="${COMPONENT}" />
- <param name="update.site.path" value="${COMPONENT}/site" />
- </antcall>
- </target>
-
- <target name="genPomXml" description="Generate a pom.xml" unless="site.pom.exists">
- <property name="pomDir" value="${WORKINGDIR}/${COMPONENT}/site" />
- <property name="COMPONENT" value="${COMPONENT}" />
- <property name="packaging" value="eclipse-update-site" />
- <mkdir dir="${pomDir}" />
- <echo file="${pomDir}/pom.xml"><project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <relativePath>../../parent-pom.xml</relativePath>
- <groupId>org.jboss.tools</groupId>
- <artifactId>org.jboss.tools.parent.pom</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- </parent>
- <groupId>org.jboss.tools</groupId>
- <artifactId>${COMPONENT}.site</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>${packaging}</packaging>
-</project>
-</echo>
-
- </target>
-
- <target name="genSiteXml"
- description="Generate a site.xml to contain the features in a category"
- unless="site.sitexml.exists"
- >
- <property name="updateSiteJarDir" value="${WORKINGDIR}/${COMPONENT}/site" />
- <property name="COMPONENT" value="${COMPONENT}" />
- <property name="category.name" value="${product.name} ${COMPONENT} ${update.site.description} Update Site" />
-
- <mkdir dir="${updateSiteJarDir}" />
- <echo file="${updateSiteJarDir}/site.xml"><?xml version="1.0" encoding="UTF-8"?>
-<site>
- <description>To install these features, point Eclipse at this site.</description>
- <!-- ${category.name} -->
- <category-def label="${category.name}" name="${category.name}">
- <description>${category.name}: contains all features in this build.</description>
- </category-def>
-</echo>
-
- <mkdir dir="${updateSiteJarDir}/../features" />
- <if>
- <!-- special case: for tests component, we WANT test features; for everyone else, test features shouldn't be on the site -->
- <equals arg1="${COMPONENT}" arg2="tests" />
- <then>
- <path id="featureJars">
- <fileset dir="${updateSiteJarDir}/../features" includes="**/target/*.jar" />
- </path>
- </then>
- <else>
- <path id="featureJars">
- <fileset dir="${updateSiteJarDir}/../features"
- includes="**/target/*.jar"
- excludes="**/*test*"
- id=""
- />
- </path>
- </else>
- </if>
- <for param="featureJar">
- <path refid="featureJars" />
- <sequential>
- <var name="feature.jarfile" unset="true" />
- <var name="feature.id" unset="true" />
- <antcallback target="get.feature.id" return="feature.id">
- <property name="featureJar" value="@{featureJar}" />
- </antcallback>
- <echo append="true" file="${updateSiteJarDir}/site.xml"> <feature url="features/${feature.id}_0.0.0.jar" id="${feature.id}" version="0.0.0">
- <category name="${category.name}"/>
- </feature>
-</echo>
- <var name="feature.jarfile" unset="true" />
- <var name="feature.id" unset="true" />
- </sequential>
- </for>
- <echo append="true" file="${updateSiteJarDir}/site.xml">
-</site>
-</echo>
- </target>
-
- <target name="get.feature.id">
- <antcallback target="get.artifact.id" return="artifact.id">
- <param name="regexp.path" value=".+/features/[^/]+/target/([^/]+feature.+\.jar)" />
- <param name="artifactJar" value="${featureJar}" />
- </antcallback>
- <var name="feature.id" value="${artifact.id}" />
- </target>
-
- <target name="get.plugin.id">
- <antcallback target="get.artifact.id" return="artifact.id">
- <param name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
- <param name="artifactJar" value="${pluginJar}" />
- </antcallback>
- <var name="plugin.id" value="${artifact.id}" />
- </target>
-
- <target name="get.artifact.id">
- <!-- for a feature: regexp=".+/features/[^/]+/target/([^/]+feature.+\.jar)"
- for a plugin: regexp=".+/plugins/([^/]+.+\.jar)" -->
- <property name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
-
- <propertyregex property="artifact.jarfile"
- defaultvalue="${artifactJar}"
- input="${artifactJar}"
- regexp="${regexp.path}"
- replace="\1"
- override="true"
- />
- <propertyregex property="artifact.id"
- defaultvalue="${artifact.jarfile}"
- input="${artifact.jarfile}"
- regexp="([^_]+)_(\d+\.\d+\.\d+)\.jar"
- replace="\1"
- override="true"
- />
- <propertyregex property="artifact.id"
- defaultvalue="${artifact.id}"
- input="${artifact.id}"
- regexp="([^_]+)-(\d+\.\d+\.\d+.+)\.jar"
- replace="\1"
- override="true"
- />
- <propertyregex property="artifact.id"
- defaultvalue="${artifact.id}"
- input="${artifact.id}"
- regexp="([^_]+)-(\d+\.\d+\.\d+.SNAPSHOT)\.jar"
- replace="\1"
- override="true"
- />
- <propertyregex property="artifact.id"
- defaultvalue="${artifact.id}"
- input="${artifact.id}"
- regexp="([^_]+)_(\d+\.\d+\.\d+)\.jar"
- replace="\1"
- override="true"
- />
- <propertyregex property="artifact.id"
- defaultvalue="${artifact.id}"
- input="${artifact.id}"
- regexp="([^_]+)_(\d+\.\d+\.\d+.SNAPSHOT)\.jar"
- replace="\1"
- override="true"
- />
- <!-- <echo level="debug">artifact.id = ${artifact.id}</echo> -->
- <propertyregex property="artifact.id"
- defaultvalue="${artifact.id}"
- input="${artifact.id}"
- regexp="([^_]+)_(\d+\.\d+\.\d+\.\d+)\.jar"
- replace="\1"
- override="true"
- />
- <echo level="verbose">artifact.id = ${artifact.id}</echo>
- <var name="artifactJar" unset="true" />
- </target>
-
- <!-- unpack previously built & jarred plugin jars -->
- <target name="unjarPlugins">
- <for param="artifactJar">
- <path>
- <fileset dir="${WORKINGDIR}/${COMPONENT}/plugins/" includes="*.jar" />
- </path>
- <sequential>
- <antcallback target="get.artifact.id" return="artifact.id">
- <property name="artifactJar" value="@{artifactJar}" />
- <property name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
- </antcallback>
- <echo level="verbose">Unzip @{artifactJar} into ${WORKINGDIR}/${COMPONENT}/plugins/${artifact.id}</echo>
- <unzip src="@{artifactJar}" dest="${WORKINGDIR}/${COMPONENT}/plugins/${artifact.id}" overwrite="true" />
- <var name="artifact.id" unset="true" />
- </sequential>
- </for>
- </target>
-
- <!-- rename previously built & unpacked feature dirs -->
- <target name="renameFeatures">
- <echo level="debug">${WORKINGDIR}/${COMPONENT}/features</echo>
- <for param="artifactJar">
- <path>
- <dirset dir="${WORKINGDIR}/${COMPONENT}/features" includes="*feature_*" />
- </path>
- <sequential>
- <antcallback target="get.artifact.id" return="artifact.id">
- <property name="artifactJar" value="@{artifactJar}" />
- <property name="regexp.path" value=".+/features/([^/]+feature)_\d+.+" />
- </antcallback>
- <move file="@{artifactJar}"
- tofile="${WORKINGDIR}/${COMPONENT}/features/${artifact.id}"
- overwrite="true"
- />
- <var name="artifact.id" unset="true" />
- </sequential>
- </for>
- </target>
-
- <!-- for a given ${COMPONENT} dir, switch all plugin/feature manifests from .SNAPSHOT to .qualifier -->
- <target name="snapshot2qualifier">
- <property name="COMPONENT" value="" />
- <for param="artifactManifest">
- <path>
- <fileset dir="${WORKINGDIR}/${COMPONENT}"
- excludes="**/target/**"
- includes="**/plugins/**/**/MANIFEST.MF, **/features/**/feature.xml"
- />
- </path>
- <sequential>
- <loadfile property="artifact.file" srcfile="@{artifactManifest}">
- <filterchain>
- <replaceregex pattern="([0-9]+).SNAPSHOT" replace="\1.qualifier" />
- </filterchain>
- </loadfile>
- <echo file="@{artifactManifest}" message="${artifact.file}" />
- <var name="artifact.file" unset="true" />
- </sequential>
- </for>
- </target>
-
- <!-- include a build.properties file if one not provided -->
- <target name="genBuildProperties">
- <for param="artifactDir">
- <path>
- <dirset dir="${WORKINGDIR}/${COMPONENT}/features/" excludes="." includes="*" />
- <dirset dir="${WORKINGDIR}/${COMPONENT}/plugins/" excludes="." includes="*" />
- </path>
- <sequential>
- <if>
- <not>
- <available file="@{artifactDir}/build.properties" type="file" />
- </not>
- <then>
- <echo file="@{artifactDir}/build.properties">bin.includes = feature.*, ., plugin.*, about.*, META-INF/, .options/, lib/, help/, icons/, org/, src/
-</echo>
- </then>
- </if>
- </sequential>
- </for>
- </target>
-
- <!-- TODO: figure out why this fails with error:
- insecure -e option not allowed.
- This account is restricted by rssh.
- Allowed commands: scp sftp rsync
- -->
- <target name="deploy" if="isInHudson" depends="init, get.bootstrap.scripts">
- <!-- default destinations -->
- <property name="DESTINATION.jbosstools" value="tools@filemgmt.jboss.org:/downloads_htdocs/tools/repository" />
- <property name="DESTINATION.jbds" value="/qa/services/http/binaries/RHDS/repository" />
-
- <!-- values for this deployment -->
- <property name="deployDir" value="${DESTINATION.jbosstools}/SNAPSHOT" />
- <property name="sourceDir" value="${WORKINGDIR}" />
- <property name="synchMethodParam" value=" --delete" />
-
- <echo level="debug">Promote build in ${sourceDir} ...</echo>
- <!-- rsync or scp build dir ${sourceDir} into ${deployDir}/ -->
- <if>
- <available file="/usr/bin/rsync" type="file" />
- <then>
- <var name="deployCmd"
- value="/usr/bin/rsync -arz --delete --include=*/*/*/target/ --include=*.xml --include=svn.info*.txt --include=${WORKINGDIR}/build.cfg --exclude=eclipse/ ${sourceDir} ${deployDir}/"
- />
- </then>
- <elseif>
- <available file="/usr/bin/scp" type="file" />
- <then>
- <var name="deployCmd" value="/usr/bin/scp -r ${sourceDir} ${deployDir}/" />
- </then>
- </elseif>
- <else>
- <fail>ERROR!
-Cannot deploy - please install scp or rsync on this server and try again.
-</fail>
- </else>
- </if>
- <if>
- <available file="${sourceDir}" type="dir" />
- <then>
- <echo message="${deployCmd}" />
- <exec executable="bash" failonerror="true">
- <arg line=" -c "${deployCmd}"" />
- </exec>
- </then>
- <else>
- <fail>ERROR!
-Cannot deploy - sourceDir not found in
- ${sourceDir}
-</fail>
- </else>
- </if>
-
- </target>
-
- <!-- ************************************ TESTS ************************************ -->
-
- <target name="test.expected.values">
- <property name="ant.enable.asserts" value="true" />
-
- <!-- expected values for get.sources.* tests -->
- <property name="get.sources.expected.dirs" value="tests,common,xulrunner," />
- <property name="get.sources.expected.files" value="${WORKINGDIR}/build.cfg" />
-
- <!-- expected values for test.get.sources.build.updated.only tests -->
- <property name="get.components.to.build.expected.2" value="tests,common,xulrunner," />
- <property name="get.components.to.build.expected.4" value="tests,xulrunner," />
- <property name="get.components.to.build.expected.6" value="" />
-
- <!-- expected values for test.get.sources.build.all tests -->
- <property name="get.components.to.build.expected.2.all" value="tests,common,xulrunner," />
- <property name="get.components.to.build.expected.4.all" value="tests,common,xulrunner," />
- <property name="get.components.to.build.expected.6.all" value="tests,common,xulrunner," />
-
- <!-- expected values for test.get.all.components -->
- <property name="get.all.components.expected"
- value="tests,common,flow,jbpm,jmx,archives,as,drools,bpel,smooks,freemarker,profiler,portlet,xulrunner,jst,vpe,jsf,esb,ws,cdi,struts,hibernatetools,seam,examples,birt,maven,"
- />
-
- <!-- expected values for test.get.feature.id -->
- <property name="get.artifact.id.expected.tests/features/org.jboss.tools.test.feature/target/org.jboss.tools.test.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.test.feature"
- />
- <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.all.feature/target/org.jboss.tools.common.all.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.common.all.feature"
- />
- <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.all.tests.feature/target/org.jboss.tools.common.all.tests.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.common.all.tests.feature"
- />
- <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.core.feature/target/org.jboss.tools.common.core.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.common.core.feature"
- />
- <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.feature/target/org.jboss.tools.common.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.common.feature"
- />
- <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.text.ext.feature/target/org.jboss.tools.common.text.ext.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.common.text.ext.feature"
- />
- <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.ui.feature/target/org.jboss.tools.common.ui.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.common.ui.feature"
- />
- <property name="get.artifact.id.expected.common/features/org.jboss.tools.common.verification.feature/target/org.jboss.tools.common.verification.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.common.verification.feature"
- />
- <property name="get.artifact.id.expected.flow/features/org.jboss.tools.flow.common.feature/target/org.jboss.tools.flow.common.feature-4.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.flow.common.feature"
- />
- <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.flow.jpdl4.feature/target/org.jboss.tools.flow.jpdl4.feature-4.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.flow.jpdl4.feature"
- />
- <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm.common.feature/target/org.jboss.tools.jbpm.common.feature-4.3.0-SNAPSHOT.jar"
- value="org.jboss.tools.jbpm.common.feature"
- />
- <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm.convert.feature/target/org.jboss.tools.jbpm.convert.feature-1.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.jbpm.convert.feature"
- />
- <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm3.feature/target/org.jboss.tools.jbpm3.feature-3.2.0-SNAPSHOT.jar"
- value="org.jboss.tools.jbpm3.feature"
- />
- <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm3.tests.feature/target/org.jboss.tools.jbpm3.tests.feature-3.2.0-SNAPSHOT.jar"
- value="org.jboss.tools.jbpm3.tests.feature"
- />
- <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm4.feature/target/org.jboss.tools.jbpm4.feature-4.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.jbpm4.feature"
- />
- <property name="get.artifact.id.expected.jbpm/features/org.jboss.tools.jbpm4.tests.feature/target/org.jboss.tools.jbpm4.tests.feature-4.3.0-SNAPSHOT.jar"
- value="org.jboss.tools.jbpm4.tests.feature"
- />
- <property name="get.artifact.id.expected.jbpm/features/org.jbpm.gd.jpdl.feature/target/org.jbpm.gd.jpdl.feature-3.2.0-SNAPSHOT.jar"
- value="org.jbpm.gd.jpdl.feature"
- />
- <property name="get.artifact.id.expected.jmx/features/org.jboss.tools.jmx.feature/target/org.jboss.tools.jmx.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.jmx.feature"
- />
- <property name="get.artifact.id.expected.jmx/features/org.jboss.tools.jmx.tests.feature/target/org.jboss.tools.jmx.tests.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.jmx.tests.feature"
- />
- <property name="get.artifact.id.expected.archives/features/org.jboss.ide.eclipse.archives.feature/target/org.jboss.ide.eclipse.archives.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.ide.eclipse.archives.feature"
- />
- <property name="get.artifact.id.expected.archives/features/org.jboss.ide.eclipse.archives.test.feature/target/org.jboss.ide.eclipse.archives.test.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.ide.eclipse.archives.test.feature"
- />
- <property name="get.artifact.id.expected.as/features/org.jboss.ide.eclipse.as.test.feature/target/org.jboss.ide.eclipse.as.test.feature-2.1.0-SNAPSHOT.jar"
- value="org.jboss.ide.eclipse.as.test.feature"
- />
- <property name="get.artifact.id.expected.bpel/features/org.jboss.tools.bpel.feature/target/org.jboss.tools.bpel.feature-1.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.bpel.feature"
- />
- <property name="get.artifact.id.expected.bpel/features/org.jboss.tools.bpel.tests.feature/target/org.jboss.tools.bpel.tests.feature-1.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.bpel.tests.feature"
- />
- <property name="get.artifact.id.expected.smooks/features/org.jboss.tools.smooks.feature/target/org.jboss.tools.smooks.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.smooks.feature"
- />
- <property name="get.artifact.id.expected.smooks/features/org.jboss.tools.smooks.test.feature/target/org.jboss.tools.smooks.test.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.smooks.test.feature"
- />
- <property name="get.artifact.id.expected.freemarker/features/org.jboss.ide.eclipse.freemarker.feature/target/org.jboss.ide.eclipse.freemarker.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.ide.eclipse.freemarker.feature"
- />
- <property name="get.artifact.id.expected.freemarker/features/org.jboss.ide.eclipse.freemarker.test.feature/target/org.jboss.ide.eclipse.freemarker.test.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.ide.eclipse.freemarker.test.feature"
- />
- <property name="get.artifact.id.expected.profiler/features/org.jboss.tools.profiler.feature/target/org.jboss.tools.profiler.feature-1.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.profiler.feature"
- />
- <property name="get.artifact.id.expected.portlet/features/org.jboss.tools.portlet.feature/target/org.jboss.tools.portlet.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.portlet.feature"
- />
- <property name="get.artifact.id.expected.portlet/features/org.jboss.tools.portlet.test.feature/target/org.jboss.tools.portlet.test.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.portlet.test.feature"
- />
- <property name="get.artifact.id.expected.jst/features/org.jboss.tools.jst.feature/target/org.jboss.tools.jst.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.jst.feature"
- />
- <property name="get.artifact.id.expected.jst/features/org.jboss.tools.jst.web.tiles.feature/target/org.jboss.tools.jst.web.tiles.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.jst.web.tiles.feature"
- />
- <property name="get.artifact.id.expected.vpe/features/org.jboss.tools.vpe.feature/target/org.jboss.tools.vpe.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.vpe.feature"
- />
- <property name="get.artifact.id.expected.vpe/features/org.jboss.tools.xulrunner.feature/target/org.jboss.tools.xulrunner.feature-1.9.1.2.jar"
- value="org.jboss.tools.xulrunner.feature"
- />
- <property name="get.artifact.id.expected.jsf/features/org.jboss.tools.jsf.feature/target/org.jboss.tools.jsf.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.jsf.feature"
- />
- <property name="get.artifact.id.expected.jsf/features/org.jboss.tools.richfaces.feature/target/org.jboss.tools.richfaces.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.richfaces.feature"
- />
- <property name="get.artifact.id.expected.esb/features/org.jboss.tools.esb.feature/target/org.jboss.tools.esb.feature-1.3.0-SNAPSHOT.jar"
- value="org.jboss.tools.esb.feature"
- />
- <property name="get.artifact.id.expected.esb/features/org.jboss.tools.esb.test.feature/target/org.jboss.tools.esb.test.feature-1.3.0-SNAPSHOT.jar"
- value="org.jboss.tools.esb.test.feature"
- />
- <property name="get.artifact.id.expected.ws/features/org.jboss.tools.ws.feature/target/org.jboss.tools.ws.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.ws.feature"
- />
- <property name="get.artifact.id.expected.ws/features/org.jboss.tools.ws.jaxrs.feature/target/org.jboss.tools.ws.jaxrs.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.ws.jaxrs.feature"
- />
- <property name="get.artifact.id.expected.cdi/features/org.jboss.tools.cdi.feature/target/org.jboss.tools.cdi.feature-1.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.cdi.feature"
- />
- <property name="get.artifact.id.expected.struts/features/org.jboss.tools.struts.feature/target/org.jboss.tools.struts.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.struts.feature"
- />
- <property name="get.artifact.id.expected.hibernatetools/features/org.hibernate.eclipse.feature/target/org.hibernate.eclipse.feature-3.3.0-SNAPSHOT.jar"
- value="org.hibernate.eclipse.feature"
- />
- <property name="get.artifact.id.expected.hibernatetools/features/org.hibernate.eclipse.test.feature/target/org.hibernate.eclipse.test.feature-3.3.0-SNAPSHOT.jar"
- value="org.hibernate.eclipse.test.feature"
- />
- <property name="get.artifact.id.expected.seam/features/org.jboss.tools.seam.feature/target/org.jboss.tools.seam.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.seam.feature"
- />
- <property name="get.artifact.id.expected.seam/features/org.jboss.tools.seam.test.feature/target/org.jboss.tools.seam.test.feature-3.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.seam.test.feature"
- />
- <property name="get.artifact.id.expected.examples/features/org.jboss.tools.community.project.examples.feature/target/org.jboss.tools.community.project.examples.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.community.project.examples.feature"
- />
- <property name="get.artifact.id.expected.examples/features/org.jboss.tools.project.examples.feature/target/org.jboss.tools.project.examples.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.project.examples.feature"
- />
- <property name="get.artifact.id.expected.examples/features/org.jboss.tools.project.examples.test.feature/target/org.jboss.tools.project.examples.test.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.project.examples.test.feature"
- />
- <property name="get.artifact.id.expected.birt/features/org.jboss.tools.birt.feature/target/org.jboss.tools.birt.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.birt.feature"
- />
- <property name="get.artifact.id.expected.birt/features/org.jboss.tools.birt.test.feature/target/org.jboss.tools.birt.test.feature-1.1.0-SNAPSHOT.jar"
- value="org.jboss.tools.birt.test.feature"
- />
- <property name="get.artifact.id.expected.maven/features/org.jboss.tools.maven.feature/target/org.jboss.tools.maven.feature-1.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.maven.feature"
- />
- <property name="get.artifact.id.expected.maven/features/org.jboss.tools.maven.seam.feature/target/org.jboss.tools.maven.seam.feature-1.0.0-SNAPSHOT.jar"
- value="org.jboss.tools.maven.seam.feature"
- />
-
- <property name="get.artifact.id.expected.as/features/org.jboss.ide.eclipse.as.feature/target/org.jboss.ide.eclipse.as.feature-2.1.0-SNAPSHOT.jar"
- value="org.jboss.ide.eclipse.as.feature"
- />
- <property name="get.artifact.id.expected.xulrunner/features/org.mozilla.xpcom.feature/target/org.mozilla.xpcom.feature-1.9.1.2a.jar"
- value="org.mozilla.xpcom.feature"
- />
- <property name="get.artifact.id.expected.xulrunner/features/org.mozilla.xulrunner.feature/target/org.mozilla.xulrunner.feature-1.9.1.2.jar"
- value="org.mozilla.xulrunner.feature"
- />
-
- <!-- expected values for test.get.plugin.id -->
- <property name="get.artifact.id.expected.drools/plugins/org.eclipse.webdav_3.0.101.jar"
- value="org.eclipse.webdav"
- />
- <property name="get.artifact.id.expected.drools/plugins/org.guvnor.tools_5.1.0.SNAPSHOT.jar"
- value="org.guvnor.tools"
- />
- <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse_5.1.0.SNAPSHOT.jar"
- value="org.drools.eclipse"
- />
- <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse.task_5.1.0.SNAPSHOT.jar"
- value="org.drools.eclipse.task"
- />
- <property name="get.artifact.id.expected.drools/plugins/org.guvnor.tools_5.1.0.jar"
- value="org.guvnor.tools"
- />
- <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse_5.1.0.jar"
- value="org.drools.eclipse"
- />
- <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse.task_5.1.0.jar"
- value="org.drools.eclipse.task"
- />
- <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse.task_5.2.0.201101062302.jar"
- value="org.drools.eclipse.task"
- />
- <property name="get.artifact.id.expected.drools/plugins/org.drools.eclipse_5.2.0.201101062302.jar"
- value="org.drools.eclipse"
- />
- <property name="get.artifact.id.expected.drools/plugins/org.guvnor.tools_5.2.0.201101062302.jar"
- value="org.guvnor.tools"
- />
- </target>
-
- <target name="test.all">
- <antcall target="test.get.sources.build.all" />
- <antcall target="test.get.sources" />
- <antcall target="test.get.feature.id" />
- <antcall target="test.get.plugin.id.drools" />
- </target>
-
- <!-- simpler tests, run faster -->
- <target name="test.get.feature.id.vpe">
- <antcall target="test.get.feature.id">
- <param name="COMPONENTS" value="vpe" />
- </antcall>
- </target>
- <target name="test.get.plugin.id.drools">
- <antcall target="test.get.plugin.id">
- <param name="COMPONENTS" value="drools" />
- </antcall>
- </target>
-
- <!-- test all feature.id fetches -->
- <target name="test.get.feature.id" depends="init, test.expected.values">
- <for param="COMPONENT" list="${COMPONENTS}" delimiter=";,
- ">
- <sequential>
- <echo level="info">Test feature.ids for @{COMPONENT}</echo>
- <for param="artifactJar" delimiter=", ">
- <path>
- <fileset dir="${basedir}/@{COMPONENT}" includes="**/features/**/target/*.jar" />
- </path>
- <sequential>
- <echo level="verbose">Test @{artifactJar}</echo>
- <antcallback target="get.artifact.id" return="artifact.id">
- <property name="artifactJar" value="@{artifactJar}" />
- <param name="regexp.path" value=".+/features/[^/]+/target/([^/]+feature.+\.jar)" />
- </antcallback>
- <propertyregex override="true"
- property="artifact.id.expected.name"
- defaultvalue="@{artifactJar}"
- input="@{artifactJar}"
- regexp="${basedir}\/(.+)"
- replace="get.artifact.id.expected.\1"
- />
- <!-- <echo><property name="get.artifact.id.expected.@{artifactJar}" value="${artifact.id}"/> </echo> -->
- <propertycopy name="artifact.id.expected" from="${artifact.id.expected.name}" />
- <assert failonerror="true" message="Expected: ${artifact.id.expected}; got: ${artifact.id}">
- <bool>
- <equals arg1="${artifact.id.expected}" arg2="${artifact.id}" />
- </bool>
- </assert>
- <var name="artifact.id.expected" unset="true" />
- </sequential>
- </for>
- </sequential>
- </for>
- </target>
-
- <!-- test all plugin.id fetches -->
- <target name="test.get.plugin.id" depends="init, test.expected.values">
- <for param="COMPONENT" list="${COMPONENTS}" delimiter=";,
- ">
- <sequential>
- <echo level="info">Test plugin.ids for @{COMPONENT}</echo>
- <for param="artifactJar" delimiter=", ">
- <path>
- <fileset dir="${basedir}/@{COMPONENT}" includes="**/plugins/*.jar" excludes="**/target/**" />
- </path>
- <sequential>
- <echo level="verbose">[1] Test @{artifactJar}</echo>
- <antcallback target="get.artifact.id" return="artifact.id">
- <property name="artifactJar" value="@{artifactJar}" />
- <property name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
- </antcallback>
- <propertyregex override="true"
- property="artifact.id.expected.name"
- defaultvalue="@{artifactJar}"
- input="@{artifactJar}"
- regexp="${basedir}\/(.+)"
- replace="get.artifact.id.expected.\1"
- />
- <!-- <echo><property name="get.artifact.id.expected.@{artifactJar}" value="${artifact.id}"/> </echo> -->
- <propertycopy name="artifact.id.expected" from="${artifact.id.expected.name}" />
- <assert failonerror="true" message="Expected: ${artifact.id.expected}; got: ${artifact.id}">
- <bool>
- <equals arg1="${artifact.id.expected}" arg2="${artifact.id}" />
- </bool>
- </assert>
- <var name="artifact.id.expected" unset="true" />
- <var name="artifact.id" unset="true" />
-
- <echo level="verbose">[2] Test @{artifactJar}</echo>
- <antcallback target="get.plugin.id" return="plugin.id">
- <property name="artifactJar" value="@{artifactJar}" />
- <property name="regexp.path" value=".+/plugins/([^/]+.+\.jar)" />
- </antcallback>
- <propertyregex override="true"
- property="artifact.id.expected.name"
- defaultvalue="@{artifactJar}"
- input="@{artifactJar}"
- regexp="${basedir}\/(.+)"
- replace="get.artifact.id.expected.\1"
- />
- <!-- <echo><property name="get.artifact.id.expected.@{artifactJar}" value="${artifact.id}"/> </echo> -->
- <propertycopy name="artifact.id.expected" from="${artifact.id.expected.name}" />
- <assert failonerror="true" message="Expected: ${artifact.id.expected}; got: ${plugin.id}">
- <bool>
- <equals arg1="${artifact.id.expected}" arg2="${plugin.id}" />
- </bool>
- </assert>
- <var name="artifact.id.expected" unset="true" />
- <var name="artifact.id" unset="true" />
- </sequential>
- </for>
- </sequential>
- </for>
- </target>
-
- <target name="test.get.sources.build.all"
- depends="init, test.expected.values"
- description="verify get.sources works to fetch, then update; verify all components will be built"
- >
- <var name="build.if.sources.unchanged" value="true" />
- <var name="get.components.to.build.expected.2" unset="true" />
- <var name="get.components.to.build.expected.4" unset="true" />
- <var name="get.components.to.build.expected.6" unset="true" />
- <var name="get.components.to.build.expected.2" value="${get.components.to.build.expected.2.all}" />
- <var name="get.components.to.build.expected.4" value="${get.components.to.build.expected.4.all}" />
- <var name="get.components.to.build.expected.6" value="${get.components.to.build.expected.6.all}" />
- <antcall target="test.get.sources" />
- </target>
-
- <target name="test.get.sources"
- depends="init, test.expected.values"
- description="verify get.sources works to fetch, then update; verify if components are not updated, they will not be built"
- >
- <var name="COMPONENTS" unset="true" />
- <var name="COMPONENTS" value="${get.sources.expected.dirs}" />
-
- <!-- for testing purposes, do not recurse (otherwise will have to download 100s of Mb of data -->
- <var name="svn.recurse" unset="true" />
- <var name="svn.recurse" value="false" />
-
- <!-- cleanup before test -->
- <for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
- ">
- <sequential>
- <delete dir="${WORKINGDIR}/(a){expected.dir}" includeemptydirs="true" />
- <delete file="${WORKINGDIR}/svn.info-(a){expected.dir}.txt" />
- </sequential>
- </for>
- <for param="expected.file" list="${get.sources.expected.files}" delimiter=",
- ">
- <sequential>
- <delete file="${WORKINGDIR}/(a){expected.file}" />
- </sequential>
- </for>
-
- <echo level="info">----------------------------------</echo>
- <echo level="info">
-1/6: Test checkout</echo>
- <antcall target="get.sources" />
- <for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
- ">
- <sequential>
- <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.dir} not found!">
- <bool>
- <available file="${WORKINGDIR}/(a){expected.dir}" type="dir" />
- </bool>
- </assert>
- </sequential>
- </for>
- <for param="expected.file" list="${get.sources.expected.files}" delimiter=",
- ">
- <sequential>
- <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.file} not found!">
- <bool>
- <available file="${WORKINGDIR}/(a){expected.file}" type="file" />
- </bool>
- </assert>
- </sequential>
- </for>
- <echo level="info">----------------------------------</echo>
-
- <echo level="info">
-2/6: Test build.cfg</echo>
- <var name="COMPONENTS.to.build" unset="true" />
- <antcallback target="get.components.to.build" return="COMPONENTS.to.build" />
- <assert failonerror="true"
- message="expected: [${get.components.to.build.expected.2}] but got: [${COMPONENTS.to.build}]"
- >
- <bool>
- <equals arg1="${get.components.to.build.expected.2}" arg2="${COMPONENTS.to.build}" />
- </bool>
- </assert>
- <echo level="info">----------------------------------</echo>
-
- <echo level="info">
-3/6: Test update</echo>
- <delete file="${WORKINGDIR}/svn.info-tests.txt" />
- <delete file="${WORKINGDIR}/svn.info-xulrunner.txt" />
- <touch file="${WORKINGDIR}/common/pom.xml" />
- <var name="COMPONENTS.to.build" unset="true" />
- <antcall target="get.sources" />
- <for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
- ">
- <sequential>
- <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.dir} not found!">
- <bool>
- <available file="${WORKINGDIR}/(a){expected.dir}" type="dir" />
- </bool>
- </assert>
- </sequential>
- </for>
- <for param="expected.file" list="${get.sources.expected.files}" delimiter=",
- ">
- <sequential>
- <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.file} not found!">
- <bool>
- <available file="${WORKINGDIR}/(a){expected.file}" type="file" />
- </bool>
- </assert>
- </sequential>
- </for>
- <echo level="info">----------------------------------</echo>
-
- <echo level="info">
-4/6: Test build.cfg</echo>
- <var name="COMPONENTS.to.build" unset="true" />
- <antcallback target="get.components.to.build" return="COMPONENTS.to.build" />
- <assert failonerror="true"
- message="expected: [${get.components.to.build.expected.4}] but got: [${COMPONENTS.to.build}]"
- >
- <bool>
- <equals arg1="${get.components.to.build.expected.4}" arg2="${COMPONENTS.to.build}" />
- </bool>
- </assert>
- <echo level="info">----------------------------------</echo>
-
- <echo level="info">
-5/6: Test info w/o update</echo>
- <var name="COMPONENTS.to.build" unset="true" />
- <antcall target="get.sources" />
- <for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
- ">
- <sequential>
- <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.dir} not found!">
- <bool>
- <available file="${WORKINGDIR}/(a){expected.dir}" type="dir" />
- </bool>
- </assert>
- </sequential>
- </for>
- <for param="expected.file" list="${get.sources.expected.files}" delimiter=",
- ">
- <sequential>
- <assert failonerror="true" message="Dir ${WORKINGDIR}/(a){expected.file} not found!">
- <bool>
- <available file="${WORKINGDIR}/(a){expected.file}" type="file" />
- </bool>
- </assert>
- </sequential>
- </for>
- <echo level="info">----------------------------------</echo>
-
- <echo level="info">
-6/6: Test build.cfg</echo>
- <var name="COMPONENTS.to.build" unset="true" />
- <antcallback target="get.components.to.build" return="COMPONENTS.to.build" />
- <assert failonerror="true"
- message="expected: [${get.components.to.build.expected.6}] but got: [${COMPONENTS.to.build}]"
- >
- <bool>
- <equals arg1="${get.components.to.build.expected.6}" arg2="${COMPONENTS.to.build}" />
- </bool>
- </assert>
- <echo level="info">----------------------------------</echo>
- </target>
-
- <!-- TODO: fixme: manual test; lacks something we can assert... maybe that deployDir exists? -->
- <target name="test.deploy" depends="init">
- <antcall target="deploy">
- <param name="deployDir" value="tools@filemgmt.jboss.org:/downloads_htdocs/tools/repository/SNAPSHOT" />
- <param name="sourceDir" value="${WORKINGDIR}/surefire-reports" />
- </antcall>
- </target>
-
- <target name="test.now" depends="init">
- <now>foobar!</now>
- <now />
- <now level="error">error!</now>
- <now level="info">info!</now>
- </target>
-
- <target name="test.get.all.components" depends="init, test.expected.values">
- <var name="COMPONENTS" unset="true" />
- <var name="COMPONENTS"
- value="tests,common;
- flow,jbpm;
- jmx,archives,as;
- drools,bpel,smooks,freemarker,profiler,portlet;
- xulrunner,jst,vpe,jsf;
- esb,ws;
- cdi,struts,hibernatetools,seam;
- examples,birt;
- maven"
- />
- <antcallback target="get.all.components" return="COMPONENTS.to.build" />
- <assert failonerror="true"
- message="expected: [${get.all.components.expected}] but got: [${COMPONENTS.to.build}]"
- >
- <bool>
- <equals arg1="${get.all.components.expected}" arg2="${COMPONENTS.to.build}" />
- </bool>
- </assert>
- </target>
-
-</project>
14 years, 1 month
JBoss Tools SVN: r38766 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-15 11:49:59 -0500 (Wed, 15 Feb 2012)
New Revision: 38766
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
[JBIDE-10914] fixed the ability to change the embedded cartridges on an existing openshift app
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-02-15 16:48:43 UTC (rev 38765)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-02-15 16:49:59 UTC (rev 38766)
@@ -68,7 +68,6 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
@@ -237,11 +236,6 @@
IObservableValue useExistingApplication =
WidgetProperties.selection().observe(useExistingAppBtn);
- enableApplicationWidgets(
- pageModel.isUseExistingApplication()
- , newAppConfigurationGroup
- , existingAppNameText
- , browseAppsButton);
useExistingApplication.addValueChangeListener(
onUseExistingApplication(newAppConfigurationGroup, existingAppNameText,
@@ -342,9 +336,7 @@
if (!useExisting) {
resetExistingApplication();
}
- enableApplicationWidgets(
- useExisting, applicationConfigurationGroup, applicationNameText,
- applicationBrowseButton);
+ enableApplicationWidgets(useExisting);
}
}
@@ -368,17 +360,14 @@
* @param applicationNameText
* @param applicationBrowseButton
*/
- private void enableApplicationWidgets(final Boolean useExisting, final Group applicationConfigurationGroup,
- final Text applicationNameText, final Button applicationBrowseButton) {
- applicationNameText.setEnabled(useExisting);
- applicationBrowseButton.setEnabled(useExisting);
- UIUtils.doForAllChildren(new UIUtils.IWidgetVisitor() {
-
- @Override
- public void visit(Control control) {
- control.setEnabled(!useExisting);
- }
- }, applicationConfigurationGroup);
+ private void enableApplicationWidgets(final Boolean useExisting) {
+ existingAppNameText.setEnabled(useExisting);
+ browseAppsButton.setEnabled(useExisting);
+
+ newAppNameLabel.setEnabled(!useExisting);
+ newAppNameText.setEnabled(!useExisting);
+ newAppTypeLabel.setEnabled(!useExisting);
+ newAppCartridgeCombo.setEnabled(!useExisting);
}
private void fillCartridgesCombo(DataBindingContext dbc, Combo cartridgesCombo) {
@@ -664,11 +653,7 @@
Display.getDefault().asyncExec(new Runnable() {
public void run() {
loadOpenshiftResources(dbc);
- enableApplicationWidgets(
- pageModel.isUseExistingApplication()
- , newAppConfigurationGroup
- , existingAppNameText
- , browseAppsButton);
+ enableApplicationWidgets(pageModel.isUseExistingApplication());
}
});
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-02-15 16:48:43 UTC (rev 38765)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-02-15 16:49:59 UTC (rev 38766)
@@ -157,7 +157,6 @@
public void loadCartridges() throws OpenShiftException {
setCartridges(getUser().getCartridges());
- // setCartridges(OpenShiftUIActivator.getDefault().getUser().getCartridges());
}
public void setCartridges(List<ICartridge> cartridges) {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-15 16:48:43 UTC (rev 38765)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-15 16:49:59 UTC (rev 38766)
@@ -157,12 +157,13 @@
public boolean performFinish() {
boolean success = getWizardModel().isUseExistingApplication();
if (!success) {
- if (createApplication()) {
- success = addRemoveCartridges(
- getWizardModel().getApplication(), getWizardModel().getSelectedEmbeddableCartridges());
- }
+ success = createApplication();
}
if (success) {
+ success = addRemoveCartridges(
+ getWizardModel().getApplication(), getWizardModel().getSelectedEmbeddableCartridges());
+ }
+ if (success) {
success = importProject();
}
14 years, 1 month
JBoss Tools SVN: r38765 - in trunk/jst/tests/org.jboss.tools.jst.text.ext.test: src/org/jboss/tools/jst/text/ext/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-02-15 11:48:43 -0500 (Wed, 15 Feb 2012)
New Revision: 38765
Added:
trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/indexResolveSelector.html
trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/styleResolveSelector.css
Modified:
trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/indexWithSecondClassInRule.html
trunk/jst/tests/org.jboss.tools.jst.text.ext.test/src/org/jboss/tools/jst/text/ext/test/CSSStylesheetOpenOnTest.java
Log:
JBIDE-10127
Resolve selector in open-on of style class in VPE
org.jboss.tools.jst.text.ext.test.CSSStylesheetOpenOnTest.testCSSClassResolveSelectorOpenOn() JUnit Test Test Case is added due to verify the issue.
org.jboss.tools.jst.text.ext.test.CSSStylesheetOpenOnTest. testCSSClassOpenOnWithASecondRuleNameInARow() JUnit Test Case is fixed.
Added: trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/indexResolveSelector.html
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/indexResolveSelector.html (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/indexResolveSelector.html 2012-02-15 16:48:43 UTC (rev 38765)
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Hello!</title>
+ <link href="styleResolveSelector.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+ <p class="styleA">
+ .styleA {color: #FF0000}
+ </p>
+ <p class="styleA">
+ .styleA {color: #FF0000}
+ <br/>
+ <b class="styleB">.styleA .styleB {color: #FF8000}</b>
+ </p>
+ <div class="styleA">
+ div.styleA {color: #FF0080}
+ </div>
+ <div title="x" class="styleA">
+ div[title="x"].styleA {color: #0000FF}
+ </div>
+ <p>
+ <input type="button" class="styleA" value="p input.styleA {color: #CCAA00}"/>
+ </p>
+ <div>
+ <p>
+ <input type="button" class="styleA" value="div p input.styleA {color: #CC00FF}"/>
+ </p>
+ </div>
+ <div title="y">
+ <div>
+ <p>
+ <input type="button" class="styleA" value="[title='y'] div p input.styleA {color: #00CCFF}"/>
+ </p>
+ </div>
+ </div>
+</body>
+</html>
\ No newline at end of file
Property changes on: trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/indexResolveSelector.html
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/indexWithSecondClassInRule.html
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/indexWithSecondClassInRule.html 2012-02-15 16:44:11 UTC (rev 38764)
+++ trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/indexWithSecondClassInRule.html 2012-02-15 16:48:43 UTC (rev 38765)
@@ -5,8 +5,20 @@
<link rel="stylesheet" href="secondClassName.css" />
</head>
<body>
- <div class="event">aaa</div>
- <div class="evt_sub">bbb</div>
- <div class="style2">ccc</div>
+ <div class="event">
+ <div class="evt_sub">
+ <div class="style2">.event .evt_sub .style2</div>
+ </div>
+ </div>
+ <div class="event">
+ <div class="evt_sub">
+ <div class="style2"><span>.event .evt_sub .style2 span</span></div>
+ </div>
+ </div>
+ <div class="event">
+ <div class="evt_sub">
+ <div class="style2"><strong>.event .evt_sub .style2 strong</strong></div>
+ </div>
+ </div>
</body>
</html>
Added: trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/styleResolveSelector.css
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/styleResolveSelector.css (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/styleResolveSelector.css 2012-02-15 16:48:43 UTC (rev 38765)
@@ -0,0 +1,7 @@
+.styleA {color: #FF0000}
+.styleA .styleB {color: #FF8000}
+div.styleA {color: #FF0080}
+div[title="x"].styleA {color: #0000FF}
+p input.styleA {color: #CCAA00}
+div p input.styleA {color: #CC00FF}
+[title="y"] p input.styleA {color: #00CCFF}
\ No newline at end of file
Property changes on: trunk/jst/tests/org.jboss.tools.jst.text.ext.test/projects/OpenOnTest/WebContent/styleResolveSelector.css
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jst/tests/org.jboss.tools.jst.text.ext.test/src/org/jboss/tools/jst/text/ext/test/CSSStylesheetOpenOnTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.text.ext.test/src/org/jboss/tools/jst/text/ext/test/CSSStylesheetOpenOnTest.java 2012-02-15 16:44:11 UTC (rev 38764)
+++ trunk/jst/tests/org.jboss.tools.jst.text.ext.test/src/org/jboss/tools/jst/text/ext/test/CSSStylesheetOpenOnTest.java 2012-02-15 16:48:43 UTC (rev 38765)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2011-2012 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,
@@ -20,6 +20,7 @@
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -37,8 +38,8 @@
private static final String PAGE_NAME = PROJECT_NAME+"/WebContent/index.html";
private static final String MEDIA_PAGE_NAME = PROJECT_NAME+"/WebContent/indexWithMediaRules.html";
private static final String SECOND_IN_A_ROW_PAGE_NAME = PROJECT_NAME+"/WebContent/indexWithSecondClassInRule.html";
+ private static final String RESOLVE_SELECTOR_PAGE_NAME = PROJECT_NAME+"/WebContent/indexResolveSelector.html";
-
public IProject project = null;
protected void setUp() {
@@ -219,11 +220,9 @@
*/
public void testCSSClassOpenOnWithASecondRuleNameInARow() throws PartInitException, BadLocationException {
HashSet<IEditorPart> openedEditors = new HashSet<IEditorPart>();
- final String tagName = "<div";
- final String[] valuesToFind = {
- "event", "evt_sub", "style2"};
- final String[] editorNames = {
- "secondClassName.css", "secondClassName.css", "secondClassName.css"};
+ final String textToFind = "class=\"style2\"";
+ final String valueToFind = "style2";
+ final String editorName = "secondClassName.css";
final int[] editorSelectionOffsets = {
0, 0, 0};
final int[] editorSelectionLengths = {
@@ -237,18 +236,21 @@
ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
IDocument document = viewer.getDocument();
- for (int i = 0; i < valuesToFind.length; i++) {
- IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
- tagName, true, true, false, false);
- assertNotNull("Tag:"+tagName+" not found",reg);
-
+ int startFrom = 0;
+ for (int i = 0; i < editorSelectionOffsets.length; i++) {
+ IRegion reg = new FindReplaceDocumentAdapter(document).find(startFrom,
+ textToFind, true, true, false, false);
+ assertNotNull("Tag: <div "+textToFind+"/> not found",reg);
+
+ startFrom = reg.getOffset() + reg.getLength();
+
reg = new FindReplaceDocumentAdapter(document).find(reg.getOffset(),
- valuesToFind[i], true, true, false, false);
- assertNotNull("Value to find '"+valuesToFind[i]+"' not found",reg);
-
+ valueToFind, true, true, false, false);
+ assertNotNull("Tag: <div "+textToFind+"/> not found",reg);
+
IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, true); // new Region(reg.getOffset() + reg.getLength(), 0)
- assertTrue("Hyperlinks for value '"+valuesToFind[i]+"' are not found",(links != null && links.length > 0));
+ assertTrue("Hyperlinks for value '"+valueToFind+"' are not found",(links != null && links.length > 0));
boolean found = false;
for(IHyperlink link : links){
@@ -258,7 +260,7 @@
IEditorPart resultEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (resultEditor != null) openedEditors.add(resultEditor);
- if(editorNames[i].equals(resultEditor.getTitle())){
+ if(editorName.equals(resultEditor.getTitle())){
StructuredTextEditor stEditor = null;
if (resultEditor instanceof StructuredTextEditor) {
stEditor = (StructuredTextEditor)resultEditor;
@@ -277,14 +279,95 @@
}
}
}
- assertTrue("OpenOn have not opened "+editorNames[i]+" editor",found);
+ assertTrue("OpenOn have not opened "+editorName+" editor",found);
}
} finally {
closeEditors(openedEditors);
}
}
-
+ public void testCSSClassResolveSelectorOpenOn() throws PartInitException, BadLocationException {
+ HashSet<IEditorPart> openedEditors = new HashSet<IEditorPart>();
+
+ // CSS class names to be tested are placed one by one,
+ // so, for each next test we'll continue to search in document
+ // (We'll not search from beginning each time)
+ //
+ // Position to continue the search from
+ int startFrom = 0;
+
+ // 'class="' - is the string to search
+ final String TEXT_TO_SEARCH = "class=\"";
+
+ // Valid CSS Stylesheet to be opened
+ final String VALID_CSS_EDITOR_NAME = "styleResolveSelector.css";
+
+ // Valid values for Text Selection after the open on is performed
+ final String[] VALID_TEXT_SELECTIONS = new String[] {
+ ".styleA {color: #FF0000}",
+ ".styleA {color: #FF0000}",
+ ".styleA .styleB {color: #FF8000}",
+ "div.styleA {color: #FF0080}",
+ "div[title=\"x\"].styleA {color: #0000FF}",
+ "p input.styleA {color: #CCAA00}",
+ "div p input.styleA {color: #CC00FF}",
+ "[title=\"y\"] p input.styleA {color: #00CCFF}"
+ };
+
+ for (int i = 0; i < VALID_TEXT_SELECTIONS.length; i++) {
+ IEditorPart editor = WorkbenchUtils.openEditor(RESOLVE_SELECTOR_PAGE_NAME);
+ if (editor != null) openedEditors.add(editor);
+ try {
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IDocument document = viewer.getDocument();
+ IRegion reg = new FindReplaceDocumentAdapter(document).find(startFrom,
+ TEXT_TO_SEARCH, true, true, false, false);
+ assertNotNull("Attribute :" + TEXT_TO_SEARCH + " not found whyle search starting from " + startFrom, reg);
+
+ startFrom = reg.getOffset() + reg.getLength();
+
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, new Region(startFrom, 0), true); // new Region(reg.getOffset() + reg.getLength(), 0)
+
+ assertTrue("Hyperlinks not found for position " + startFrom,(links != null && links.length > 0));
+
+ boolean found = false;
+ for(IHyperlink link : links){
+ assertNotNull(link.toString());
+
+ link.open();
+
+ IEditorPart resultEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if (resultEditor != null) openedEditors.add(resultEditor);
+ if(VALID_CSS_EDITOR_NAME.equals(resultEditor.getTitle())){
+ StructuredTextEditor stEditor = null;
+ if (resultEditor instanceof StructuredTextEditor) {
+ stEditor = (StructuredTextEditor)resultEditor;
+ } else if (resultEditor instanceof JSPMultiPageEditor) {
+ stEditor = ((JSPMultiPageEditor)resultEditor).getSourceEditor();
+ }
+ assertNotNull("Unexpected Editor is openned: " + resultEditor.getTitle() + " [" + resultEditor.getClass().getName() + "]", stEditor);
+ ISelection selection = stEditor.getSelectionProvider().getSelection();
+ assertFalse("Required CSS Rule is not selected", selection.isEmpty());
+ if (selection instanceof TextSelection) {
+ TextSelection textSelection = (TextSelection)selection;
+ String selectionText = stEditor.getTextViewer().getDocument().get(textSelection.getOffset(), textSelection.getLength());
+ assertTrue("Required CSS Rule is not selected",
+ (VALID_TEXT_SELECTIONS[i].equalsIgnoreCase(selectionText)));
+ found = true;
+ break;
+ }
+ }
+ }
+ assertTrue("OpenOn have not opened a valid selection in " + VALID_CSS_EDITOR_NAME + " editor",found);
+ } finally {
+ closeEditors(openedEditors);
+ }
+ }
+ }
+
protected void closeEditors (HashSet<IEditorPart> editors) {
if (editors == null || editors.isEmpty())
return;
14 years, 1 month
JBoss Tools SVN: r38764 - trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-02-15 11:44:11 -0500 (Wed, 15 Feb 2012)
New Revision: 38764
Modified:
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
Log:
JBIDE-10127
Resolve selector in open-on of style class in VPE
Issue is fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2012-02-15 16:11:33 UTC (rev 38763)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2012-02-15 16:44:11 UTC (rev 38764)
@@ -11,6 +11,7 @@
package org.jboss.tools.jst.text.ext.hyperlink;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IContainer;
@@ -27,15 +28,22 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.internal.util.Sorter;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.StructuredSelectionHelper;
+import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.text.ext.JSTExtensionsPlugin;
import org.jboss.tools.jst.web.kb.ICSSContainerSupport;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageContextFactory.CSSStyleSheetDescriptor;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.css.CSSMediaRule;
import org.w3c.dom.css.CSSRule;
@@ -47,6 +55,7 @@
*/
@SuppressWarnings("restriction")
public class CSSClassHyperlink extends AbstractHyperlink {
+ CSSRuleDescriptorSorter SORTER = new CSSRuleDescriptorSorter();
public static final String[] STYLE_TAGS = new String[] { "style", "link" }; //$NON-NLS-1$//$NON-NLS-2$
public static final String LINK_TAG = "link"; //$NON-NLS-1$
@@ -64,32 +73,79 @@
cssContainerSupport = (ICSSContainerSupport)context;
List<CSSStyleSheetDescriptor> descrs = cssContainerSupport.getCSSStyleSheetDescriptors();
+ List<CSSRuleDescriptor> bestMatchDescriptors = new ArrayList<CSSRuleDescriptor>();
+
for (int i = (descrs == null) ? -1 : descrs.size() - 1; descrs != null && i >= 0; i--) {
CSSStyleSheetDescriptor descr = descrs.get(i);
CSSRuleList rules = descr.sheet.getCssRules();
for (int r = 0; rules != null && r < rules.getLength(); r++) {
- CSSRule rule = getMatchedRule(rules.item(r), getStyleName(region));
- if (rule != null) {
- IFile file = findFileForCSSStyleSheet(descr.getFilePath());
- if (file != null) {
- int startOffset = 0;
- if (descr.sheet.getOwnerNode() != null) {
- Node node = descr.sheet.getOwnerNode().getFirstChild();
- if (node instanceof IndexedRegion) {
- startOffset = ((IndexedRegion)node).getStartOffset();
- }
- }
- showRegion(
- file,
- new Region(startOffset + ((IndexedRegion)rule).getStartOffset(), ((IndexedRegion)rule).getLength()));
- return;
+ CSSRuleDescriptor match = getMatchedRuleDescriptor(rules.item(r), getStyleName(region));
+ if (match != null) {
+ match.stylesheetDescriptor = descr;
+ bestMatchDescriptors.add(match);
+ }
+ }
+ }
+
+ CSSRuleDescriptor[] sorted = orderCSSRuleDescriptors(
+ bestMatchDescriptors.toArray(new CSSRuleDescriptor[bestMatchDescriptors.size()]));
+
+ for (CSSRuleDescriptor d : sorted) {
+ CSSStyleSheetDescriptor descr = d.stylesheetDescriptor;
+ IFile file = findFileForCSSStyleSheet(descr.getFilePath());
+ if (file != null) {
+ int startOffset = 0;
+ if (descr.sheet.getOwnerNode() != null) {
+ Node node = descr.sheet.getOwnerNode().getFirstChild();
+ if (node instanceof IndexedRegion) {
+ startOffset = ((IndexedRegion)node).getStartOffset();
}
}
+ showRegion(
+ file,
+ new Region(startOffset + ((IndexedRegion)d.rule).getStartOffset(), ((IndexedRegion)d.rule).getLength()));
+ return;
}
}
+
openFileFailed();
}
+ protected CSSRuleDescriptor[] orderCSSRuleDescriptors(CSSRuleDescriptor[] descriptors) {
+ Object[] sorted = SORTER.sort(descriptors);
+ CSSRuleDescriptor[] sortedDescriptors = new CSSRuleDescriptor[sorted.length];
+ System.arraycopy(sorted, 0, sortedDescriptors, 0, sorted.length);
+ return sortedDescriptors;
+ }
+
+ class CSSRuleDescriptorSorter extends Sorter {
+
+ public boolean compare(Object descr1, Object descr2) {
+ CSSAxis[] a1 = ((CSSRuleDescriptor)descr1).axis;
+ CSSAxis[] a2 = ((CSSRuleDescriptor)descr2).axis;
+
+
+ if (a1.length == a2.length) {
+ for (int i = a1.length - 1; i >= 0; i--) {
+ if (a1[i].className != CSSAxis.CSS_ANY &&
+ !a1[i].className.equalsIgnoreCase(a2[i].className))
+ return true;
+
+ if (a1[i].attrName != CSSAxis.CSS_ANY &&
+ !a1[i].attrName.equalsIgnoreCase(a2[i].attrName))
+ return true;
+
+ if (a1[i].nodeName != CSSAxis.CSS_ANY &&
+ !a1[i].nodeName.equalsIgnoreCase(a2[i].nodeName))
+ return true;
+ }
+
+ return false;
+ }
+ return (a1.length > a2.length);
+ }
+ }
+
/*
* Finds a file representing the specified stylesheet
*
@@ -137,16 +193,16 @@
* @param styleName
* @return
*/
- protected CSSRule getMatchedRule(CSSRule cssRule, String styleName) {
-
+ protected CSSRuleDescriptor getMatchedRuleDescriptor(CSSRule cssRule, String styleName) {
if (cssRule instanceof CSSMediaRule) {
CSSMediaRule cssMediaRule = (CSSMediaRule)cssRule;
CSSRuleList rules = cssMediaRule.getCssRules();
for (int i = 0; rules != null && i < rules.getLength(); i++) {
CSSRule rule = rules.item(i);
- CSSRule match = getMatchedRule(rule, styleName);
- if (match != null)
- return match;
+ CSSRuleDescriptor descr = getMatchedRuleDescriptor(rule, styleName);
+ if (descr != null) {
+ return descr;
+ }
}
return null;
}
@@ -158,21 +214,204 @@
String selectorText = ((CSSStyleRule) cssRule).getSelectorText();
if (selectorText != null) {
- String styleNameToSearch = '.' + styleName.toLowerCase();
String styles[] = selectorText.trim().toLowerCase().split(","); //$NON-NLS-1$
for (String styleText : styles) {
String[] styleWords = styleText.trim().split(" "); //$NON-NLS-1$
+ CSSAxis[] styleAxis = new CSSAxis[styleWords == null ? 0 : styleWords.length];
+
if (styleWords != null) {
- for (String word : styleWords) {
- if (word.trim().toLowerCase().endsWith(styleNameToSearch))
- return cssRule;
+ for (int i = styleWords.length - 1; i >= 0; i--) {
+ String word = styleWords[i];
+ styleAxis[i] = getCSSAxis(word);
}
}
+
+ if (matchesRule(getHyperlinkRegion(), styleAxis)) {
+ return new CSSRuleDescriptor(cssRule, styleAxis);
+ }
}
}
return null;
}
+ boolean matchesRule(IRegion styleNameRegion, CSSAxis[] cssAxis) {
+ if (cssAxis == null || cssAxis.length == 0)
+ return false;
+
+ String classNameFromTheRegion = getStyleName(styleNameRegion);
+
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(getDocument());
+ Document xmlDocument = smw.getDocument();
+ if (xmlDocument == null) return false;
+ Node node = Utils.findNodeForOffset(xmlDocument, styleNameRegion.getOffset());
+
+ if (node instanceof Attr) {
+ Attr attr = (Attr)node;
+ node = attr.getOwnerElement();
+ }
+
+ for (int i = cssAxis.length - 1; i >= 0; i--) {
+ CSSAxis currentAxis = cssAxis[i];
+
+ do {
+ boolean classFound = currentAxis.className == CSSAxis.CSS_ANY;
+ boolean nodeFound = currentAxis.nodeName == CSSAxis.CSS_ANY;
+ boolean attrFound = currentAxis.attrName == CSSAxis.CSS_ANY;
+
+ if (!classFound) {
+ // For the top node's class name we have to use word from the styleNameRegion
+ String nodeClasses = (i == cssAxis.length - 1) ? classNameFromTheRegion : getNodeAttributeValue(node, "class"); //$NON-NLS-1$
+ String[] classes = nodeClasses == null ? null : nodeClasses.split(" "); //$NON-NLS-1$
+ if (classes != null) {
+ for (String cssClass : classes) {
+ if (currentAxis.className.equalsIgnoreCase(cssClass)) {
+ classFound = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!nodeFound) {
+ nodeFound = currentAxis.nodeName.equalsIgnoreCase(node.getNodeName());
+ }
+
+ if (!attrFound) {
+ attrFound = currentAxis.attrValue.equalsIgnoreCase(getNodeAttributeValue(node, currentAxis.attrName));
+ }
+
+ if (classFound && nodeFound && attrFound) {
+ // Proceed with next Axis
+ break;
+ }
+
+ // proceed with parent node
+ node = node.getParentNode();
+ } while (node instanceof Element);
+
+
+ // All three parts of the axis were found - proceed with next axis
+ // But do re-check that we still can proceed
+ if (!(node instanceof Element)) {
+ return false;
+ }
+ }
+
+ return true;
+ } finally {
+ smw.dispose();
+ }
+ }
+
+ String getNodeAttributeValue(Node node, String attrName) {
+ NamedNodeMap attrs = node.getAttributes();
+ if (attrs == null)
+ return null;
+ Node attr = attrs.getNamedItem(attrName);
+ if (attr == null)
+ return null;
+ return ((Attr)attr).getValue();
+ }
+
+ class CSSRuleDescriptor {
+ CSSRule rule;
+ CSSAxis[] axis;
+ CSSStyleSheetDescriptor stylesheetDescriptor;
+
+ CSSRuleDescriptor (CSSRule rule, CSSAxis[] axis) {
+ this.rule = rule;
+ this.axis = axis;
+ }
+ }
+
+ class CSSAxis {
+ static final String CSS_ANY = "*"; //$NON-NLS-1$
+ String className;
+ String nodeName;
+ String attrName;
+ String attrValue;
+
+ public CSSAxis(String className, String nodeName, String attrName, String attrValue) {
+ this.className = (className == null ? CSS_ANY : className);
+ this.nodeName = (nodeName == null ? CSS_ANY : nodeName);
+ this.attrName = (attrName == null ? CSS_ANY : attrName);
+ this.attrValue = (attrValue == null ? CSS_ANY : attrValue);
+ if (attrName == null || attrValue == null) {
+ this.attrName = this.attrValue = CSS_ANY;
+ }
+ }
+ }
+
+ CSSAxis getCSSAxis(String rule) {
+ String restOfRule = rule;
+
+ // There may be CSS class name at the end
+ String className = null;
+ int lastDot = rule.lastIndexOf('.');
+ if (lastDot != -1) {
+ className = rule.substring(lastDot + 1).trim();
+ if (!checkWord(className)) {
+ className = null;
+ }
+ restOfRule = restOfRule.substring(0, lastDot);
+ }
+
+ // there may be a node name at the beginning
+ String nodeName = null;
+ if (restOfRule.length() > 0) {
+ StringBuilder sb = new StringBuilder();
+ for (char ch : restOfRule.toCharArray()) {
+ if (!Character.isJavaIdentifierPart(ch))
+ break;
+ sb.append(ch);
+ }
+ if (sb.length() > 0) {
+ nodeName = sb.toString();
+ restOfRule = restOfRule.substring(sb.length());
+ }
+ }
+
+ // there may be node attribute/value inside square brackets
+ String attrName = null;
+ String attrValue = null;
+ if (restOfRule.startsWith("[") && restOfRule.endsWith("]")) {//$NON-NLS-1$ //$NON-NLS-2$
+ restOfRule = restOfRule.substring(1, restOfRule.length() - 1).trim();
+
+ // Get attr name
+ StringBuilder sb = new StringBuilder();
+ for (char ch : restOfRule.toCharArray()) {
+ if (!Character.isJavaIdentifierPart(ch))
+ break;
+ sb.append(ch);
+ }
+ if (sb.length() > 0) {
+ attrName = sb.toString();
+ restOfRule = restOfRule.substring(sb.length()).trim();
+ }
+ // There should be an equal sign between attr name and value
+ if (restOfRule.startsWith("=")) { //$NON-NLS-1$
+ restOfRule = restOfRule.substring(1).trim();
+ attrValue = Utils.trimQuotes(restOfRule).trim();
+ if (attrValue.trim().length() == 0) {
+ attrValue = null;
+ }
+ }
+ }
+
+ return new CSSAxis(className, nodeName, attrName, attrValue);
+ }
+
+ boolean checkWord(String word) {
+ for (char ch : word.toCharArray()) {
+ if (!Character.isJavaIdentifierPart(ch)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
/**
*
* @param styleRegion
@@ -205,7 +444,7 @@
protected String getStyleName(IRegion region) {
if(region != null) {
try {
- return getDocument().get(region.getOffset(), region.getLength());
+ return getDocument().get(region.getOffset(), region.getLength()).trim();
} catch (BadLocationException e) {
JSTExtensionsPlugin.getPluginLog().logError(e);
}
14 years, 1 month
JBoss Tools SVN: r38763 - branches/jbosstools-3.3.0.M5/build/results.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-02-15 11:11:33 -0500 (Wed, 15 Feb 2012)
New Revision: 38763
Added:
branches/jbosstools-3.3.0.M5/build/results/collect-test-results.xml
Log:
backport new collect-test-results.xml from trunk
Added: branches/jbosstools-3.3.0.M5/build/results/collect-test-results.xml
===================================================================
--- branches/jbosstools-3.3.0.M5/build/results/collect-test-results.xml (rev 0)
+++ branches/jbosstools-3.3.0.M5/build/results/collect-test-results.xml 2012-02-15 16:11:33 UTC (rev 38763)
@@ -0,0 +1,226 @@
+<project default="collect.test.results.for.hudson" basedir="." name="Generate test results even when no tests were run. Prevents build from failing if tests are disabled.">
+ <!-- ****************************** Configuration ****************************** -->
+
+ <!-- override for local build -->
+ <condition property="isInHudson" value="true">
+ <or>
+ <contains string="${user.dir}" substring="hudson" />
+ <contains string="${user.name}" substring="hudson" />
+ <contains string="${user.home}" substring="hudson" />
+ </or>
+ </condition>
+ <target name="local" unless="isInHudson">
+ <property name="WORKINGDIR" value="${basedir}" />
+ <property name="COMMON_TOOLS" value="${java.io.tmpdir}" />
+ </target>
+
+ <target name="get.ant-contrib" unless="ant-contrib.jar.exists">
+ <property name="ANTCONTRIB_MIRROR" value="http://downloads.sourceforge.net/ant-contrib/" />
+ <get usetimestamp="true" dest="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip" src="${ANTCONTRIB_MIRROR}/ant-contrib-1.0b2-bin.zip" />
+ <touch file="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip" />
+ <mkdir dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_" />
+ <unzip src="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip" dest="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_" overwrite="true" />
+ <copy file="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_/ant-contrib/lib/ant-contrib.jar" tofile="${COMMON_TOOLS}/ant-contrib.jar" failonerror="true" />
+ <delete dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_" includeemptydirs="true" quiet="true" />
+ </target>
+
+ <target name="init" depends="local">
+ <!-- https://jira.jboss.org/jira/browse/JBQA-3313 Use static, shared space outside workspace, instead of working directly in the workspace -->
+ <condition property="WORKINGDIR" value="/home/hudson/static_build_env/jbds/tools/sources" else="${basedir}">
+ <available file="/home/hudson/static_build_env/jbds" type="dir" />
+ </condition>
+ <mkdir dir="${WORKINGDIR}" />
+ <echo level="info">WORKINGDIR = ${WORKINGDIR}</echo>
+
+ <condition property="COMMON_TOOLS" value="/home/hudson/static_build_env/jbds/tools" else="${WORKINGDIR}/../tools">
+ <available file="/home/hudson/static_build_env/jbds" type="dir" />
+ </condition>
+ <mkdir dir="${COMMON_TOOLS}" />
+ <echo level="info">COMMON_TOOLS = ${COMMON_TOOLS}</echo>
+
+ <available file="${COMMON_TOOLS}/ant-contrib.jar" type="file" property="ant-contrib.jar.exists" />
+ <antcall target="get.ant-contrib" />
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath>
+ <pathelement location="${COMMON_TOOLS}/ant-contrib.jar" />
+ </classpath>
+ </taskdef>
+
+ </target>
+
+ <!-- ***** The methods below are used in Hudson/Jenkins jobs to generate test results even when no tests were run. Prevents build from failing if tests are disabled. ***** -->
+
+ <!--
+ To run this after a maven build in Hudson, set these properties:
+ basedir=${WORKSPACE}/sources
+ WORKINGDIR=${WORKSPACE}/sources
+ COMPONENT=.
+ move.test.results=true
+ -->
+ <target name="collect.test.results.for.hudson" depends="init" if="isInHudson" description="collect test results after a pure maven build so Hudson has something to see">
+ <property name="basedir" value="${WORKSPACE}/sources" />
+ <property name="WORKINGDIR" value="${WORKSPACE}/sources" />
+ <property name="COMPONENT" value="." />
+ <property name="move.test.results" value="true" />
+ <var name="tests.results.found" value="false" />
+ <echo level="debug">basedir = ${basedir}
+WORKINGDIR = ${WORKINGDIR}
+COMPONENT = ${COMPONENT}</echo>
+ <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
+ <for param="test.xml.files" delimiter=",
+ ">
+ <path>
+ <fileset dir="${WORKINGDIR}" includes="**/target/surefire-reports/TEST-*.xml, **/**/target/surefire-reports/TEST-*.xml" excludes="**/TEST-*NoTestsRun.xml, **/**/TEST-*NoTestsRun.xml" />
+ </path>
+ <sequential>
+ <var name="tests.results.found" value="true" />
+ </sequential>
+ </for>
+ <if>
+ <equals arg1="${tests.results.found}" arg2="true" />
+ <then>
+ <antcall target="collect.test.results">
+ <param name="COMPONENT" value="." />
+ </antcall>
+ <antcall target="collect.all.test.results" />
+ </then>
+ <else>
+ <antcall target="create.empty.test.results.file" />
+ <property name="no.tests.run" value="true" />
+ </else>
+ </if>
+ </target>
+
+ <target name="create.empty.test.results.file">
+ <!-- create fake test result file to avoid Hudson failure -->
+ <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
+ <mkdir dir="${basedir}/surefire-reports/NoTestsRun" />
+ <echo file="${basedir}/surefire-reports/NoTestsRun/TEST-org.jboss.tools.NoTestsRun.xml"><?xml version="1.0" encoding="UTF-8" ?>
+<testsuite failures="0" time="0.001" errors="0" skipped="0" tests="1" name="org.jboss.tools.NoTestsRun">
+<testcase time="0.001" classname="org.jboss.tools.NoTestsRun" name="NoTestsRun"/>
+</testsuite>
+</echo>
+ </target>
+
+ <target name="collect.test.results">
+ <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
+ <property name="COMPONENT" value="" />
+ <!-- collect test results by copying ${WORKINGDIR}/${COMPONENT}/**/target/surefire-reports/*.xml into ${basedir}/surefire-reports/${COMPONENT} -->
+ <delete dir="${basedir}/surefire-reports/${COMPONENT}" includeemptydirs="true" />
+ <mkdir dir="${basedir}/surefire-reports/${COMPONENT}" />
+ <copy todir="${basedir}/surefire-reports/${COMPONENT}" flatten="true" preservelastmodified="true" overwrite="true">
+ <fileset dir="${WORKINGDIR}/${COMPONENT}" includes="**/target/surefire-reports/TEST-*.xml" />
+ </copy>
+ <if>
+ <isset property="move.test.results" />
+ <then>
+ <delete dir="${WORKINGDIR}/${COMPONENT}" includes="**/target/surefire-reports" />
+ </then>
+ </if>
+ </target>
+
+ <target name="collect.all.test.results" unless="no.tests.run">
+ <var name="test.results.all" value="" />
+ <var name="test.results.errors.failures.skipped" value="" />
+
+ <!-- Parse this: <testsuite errors="0" skipped="0" tests="10" time="0.042" failures="0" name="org.jboss.tools.jmx.ui.JMXUIAllTests"> -->
+ <for param="testresultfile" delimiter=",
+ ">
+ <path>
+ <fileset dir="${basedir}/surefire-reports/" includes="**/TEST-*.xml" />
+ </path>
+ <sequential>
+ <var name="testsuite.name" unset="true" />
+ <var name="testsuite.tests" unset="true" />
+ <var name="testsuite.time" unset="true" />
+ <var name="testsuite.skipped" unset="true" />
+ <var name="testsuite.errors" unset="true" />
+ <var name="testsuite.failures" unset="true" />
+ <xmlproperty file="@{testresultfile}" keepRoot="true" collapseAttributes="true" />
+ <for param="ts" list="testsuite.skipped, testsuite.errors, testsuite.failures" delimiter=", ">
+ <sequential>
+ <propertyregex override="true"
+ property="ts.label"
+ defaultvalue="@{ts}"
+ input="@{ts}"
+ regexp="testsuite\.(.+)"
+ replace="\1"
+ />
+ <if>
+ <isset property="@{ts}" />
+ <then>
+ <if>
+ <equals arg1="${@{ts}}" arg2="0" />
+ <then>
+ <var name="@{ts}" value="" />
+ </then>
+ <else>
+ <var name="@{ts}" value="; ${@{ts}} ${ts.label}" />
+ </else>
+ </if>
+ </then>
+ </if>
+
+ </sequential>
+ </for>
+ <if>
+ <or>
+ <not>
+ <equals arg1="${testsuite.skipped}" arg2="" />
+ </not>
+ <not>
+ <equals arg1="${testsuite.errors}" arg2="" />
+ </not>
+ <not>
+ <equals arg1="${testsuite.failures}" arg2="" />
+ </not>
+ </or>
+ <then>
+ <var name="test.results.errors.failures.skipped"
+ value="${test.results.errors.failures.skipped}${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}${line.separator}"
+ />
+ </then>
+ </if>
+ <if>
+ <isset property="testsuite.name" />
+ <then>
+ <var name="test.results.all"
+ value="${test.results.all}${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}${line.separator}"
+ />
+ </then>
+ </if>
+ <var name="testsuite.name" unset="true" />
+ <var name="testsuite.tests" unset="true" />
+ <var name="testsuite.time" unset="true" />
+ <var name="testsuite.skipped" unset="true" />
+ <var name="testsuite.errors" unset="true" />
+ <var name="testsuite.failures" unset="true" />
+ </sequential>
+ </for>
+ <echo level="verbose">-------------------------------------------------------
+ A L L T E S T R E S U L T S
+-------------------------------------------------------
+${test.results.all}
+-------------------------------------------------------
+
+</echo>
+ <if>
+ <and>
+ <isset property="test.results.errors.failures.skipped" />
+ <not>
+ <equals arg1="${test.results.errors.failures.skipped}" arg2="" />
+ </not>
+ </and>
+ <then>
+ <echo level="error">-------------------------------------------------------
+ T E S T R E S U L T S
+-------------------------------------------------------
+${test.results.errors.failures.skipped}
+-------------------------------------------------------
+
+</echo>
+ </then>
+ </if>
+ </target>
+
+</project>
14 years, 1 month
JBoss Tools SVN: r38762 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-15 11:01:31 -0500 (Wed, 15 Feb 2012)
New Revision: 38762
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
Log:
[JBIDE-10907] fixing enablement states in application configuration page
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-02-15 15:57:46 UTC (rev 38761)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-02-15 16:01:31 UTC (rev 38762)
@@ -100,7 +100,14 @@
private Button useExistingAppBtn;
private Text existingAppNameText;
private Button browseAppsButton;
- private Group appConfigurationGroup;
+ private Group newAppConfigurationGroup;
+ private Label newAppNameLabel;
+ private Text newAppNameText;
+ private Label newAppTypeLabel;
+ private Combo newAppCartridgeCombo;
+ private Group newAppEmbeddableCartridgesGroup;
+ private Button checkAllButton;
+ private Button uncheckAllButton;
public ApplicationConfigurationWizardPage(IWizard wizard, OpenShiftExpressApplicationWizardModel wizardModel) {
super("Setup OpenShift Application", "Select an existing or create a new OpenShift Express Application.",
@@ -145,8 +152,8 @@
// existing app name
this.existingAppNameText = new Text(existingAppSelectionGroup, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false)
- .applyTo(existingAppNameText);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false).applyTo(existingAppNameText);
IObservableValue existingAppNameTextObservable =
WidgetProperties.text(SWT.Modify).observe(existingAppNameText);
IObservableValue existingAppNameModelObservable =
@@ -222,33 +229,33 @@
}
private void createApplicationConfigurationGroup(Composite parent, DataBindingContext dbc) {
- this.appConfigurationGroup = new Group(parent, SWT.NONE);
- appConfigurationGroup.setText("New application");
- GridLayoutFactory.fillDefaults().numColumns(2).margins(6, 6).applyTo(appConfigurationGroup);
+ this.newAppConfigurationGroup = new Group(parent, SWT.NONE);
+ newAppConfigurationGroup.setText("New application");
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(6, 6).applyTo(newAppConfigurationGroup);
GridDataFactory.fillDefaults()
- .grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(appConfigurationGroup);
+ .grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(newAppConfigurationGroup);
- IObservableValue useExistingApplication = BeanProperties
- .value(ApplicationConfigurationWizardPageModel.PROPERTY_USE_EXISTING_APPLICATION)
- .observe(pageModel);
+ IObservableValue useExistingApplication =
+ WidgetProperties.selection().observe(useExistingAppBtn);
enableApplicationWidgets(
pageModel.isUseExistingApplication()
- , appConfigurationGroup
+ , newAppConfigurationGroup
, existingAppNameText
, browseAppsButton);
useExistingApplication.addValueChangeListener(
- onUseExistingApplication(appConfigurationGroup, existingAppNameText, browseAppsButton));
+ onUseExistingApplication(newAppConfigurationGroup, existingAppNameText,
+ browseAppsButton));
- Label applicationNameLabel = new Label(appConfigurationGroup, SWT.NONE);
- applicationNameLabel.setText("Name:");
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(applicationNameLabel);
- Text newApplicationNameText = new Text(appConfigurationGroup, SWT.BORDER);
+ this.newAppNameLabel = new Label(newAppConfigurationGroup, SWT.NONE);
+ newAppNameLabel.setText("Name:");
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(newAppNameLabel);
+ this.newAppNameText = new Text(newAppConfigurationGroup, SWT.BORDER);
GridDataFactory.fillDefaults()
- .grab(true, false).align(SWT.FILL, SWT.FILL).applyTo(newApplicationNameText);
- UIUtils.selectAllOnFocus(newApplicationNameText);
- final ISWTObservableValue applicationNameTextObservable =
- WidgetProperties.text(SWT.Modify).observe(newApplicationNameText);
+ .grab(true, false).align(SWT.FILL, SWT.FILL).applyTo(newAppNameText);
+ UIUtils.selectAllOnFocus(newAppNameText);
+ final IObservableValue applicationNameTextObservable =
+ WidgetProperties.text(SWT.Modify).observe(newAppNameText);
final IObservableValue applicationNameModelObservable =
BeanProperties
.value(ApplicationConfigurationWizardPageModel.PROPERTY_APPLICATION_NAME)
@@ -258,15 +265,15 @@
.to(applicationNameModelObservable)
.in(dbc);
- Label applicationTypeLabel = new Label(appConfigurationGroup, SWT.NONE);
- applicationTypeLabel.setText("Type:");
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).applyTo(applicationTypeLabel);
- Combo cartridgesCombo = new Combo(appConfigurationGroup, SWT.BORDER | SWT.READ_ONLY);
+ this.newAppTypeLabel = new Label(newAppConfigurationGroup, SWT.NONE);
+ newAppTypeLabel.setText("Type:");
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).applyTo(newAppTypeLabel);
+ this.newAppCartridgeCombo = new Combo(newAppConfigurationGroup, SWT.BORDER | SWT.READ_ONLY);
GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false).applyTo(cartridgesCombo);
- fillCartridgesCombo(dbc, cartridgesCombo);
+ .align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false).applyTo(newAppCartridgeCombo);
+ fillCartridgesCombo(dbc, newAppCartridgeCombo);
final ISWTObservableValue selectedCartridgeComboObservable =
- WidgetProperties.selection().observe(cartridgesCombo);
+ WidgetProperties.selection().observe(newAppCartridgeCombo);
final IObservableValue selectedCartridgeModelObservable =
BeanProperties.value(NewApplicationWizardPageModel.PROPERTY_SELECTED_CARTRIDGE).observe(pageModel);
ValueBindingBuilder
@@ -289,12 +296,13 @@
new CustomControlDecorationUpdater());
// embeddable cartridges
- Group cartridgesGroup = new Group(appConfigurationGroup, SWT.NONE);
- cartridgesGroup.setText("Embeddable Cartridges");
- GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).span(2, 1).applyTo(cartridgesGroup);
- GridLayoutFactory.fillDefaults().numColumns(2).margins(6, 6).applyTo(cartridgesGroup);
+ this.newAppEmbeddableCartridgesGroup = new Group(newAppConfigurationGroup, SWT.NONE);
+ newAppEmbeddableCartridgesGroup.setText("Embeddable Cartridges");
+ GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).span(2, 1)
+ .applyTo(newAppEmbeddableCartridgesGroup);
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(6, 6).applyTo(newAppEmbeddableCartridgesGroup);
- Composite tableContainer = new Composite(cartridgesGroup, SWT.NONE);
+ Composite tableContainer = new Composite(newAppEmbeddableCartridgesGroup, SWT.NONE);
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.FILL).grab(true, true).span(1, 2).hint(400, 250).applyTo(tableContainer);
this.viewer = createTable(tableContainer);
@@ -303,25 +311,26 @@
BeanProperties.set(ApplicationConfigurationWizardPageModel.PROPERTY_SELECTED_EMBEDDABLE_CARTRIDGES)
.observe(pageModel));
- Button checkAllButton = new Button(cartridgesGroup, SWT.PUSH);
+ this.checkAllButton = new Button(newAppEmbeddableCartridgesGroup, SWT.PUSH);
checkAllButton.setText("&Select All");
GridDataFactory.fillDefaults().
hint(110, SWT.DEFAULT).grab(false, false).align(SWT.FILL, SWT.TOP).applyTo(checkAllButton);
checkAllButton.addSelectionListener(onCheckAll());
- Button uncheckAllButton = new Button(cartridgesGroup, SWT.PUSH);
+ this.uncheckAllButton = new Button(newAppEmbeddableCartridgesGroup, SWT.PUSH);
uncheckAllButton.setText("&Deselect All");
GridDataFactory.fillDefaults()
.hint(110, SWT.DEFAULT).grab(false, true).align(SWT.FILL, SWT.TOP).applyTo(uncheckAllButton);
uncheckAllButton.addSelectionListener(onUncheckAll());
// bottom filler
- Composite spacer = new Composite(appConfigurationGroup, SWT.NONE);
+ Composite spacer = new Composite(newAppConfigurationGroup, SWT.NONE);
GridDataFactory.fillDefaults()
.span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(spacer);
}
- private IValueChangeListener onUseExistingApplication(final Group applicationConfigurationGroup,
+ private IValueChangeListener onUseExistingApplication(final Group
+ applicationConfigurationGroup,
final Text applicationNameText, final Button applicationBrowseButton) {
return new IValueChangeListener() {
@@ -331,12 +340,22 @@
if (newValue instanceof Boolean) {
Boolean useExisting = (Boolean) newValue;
if (!useExisting) {
- pageModel.resetExistingApplication();
+ resetExistingApplication();
}
enableApplicationWidgets(
- useExisting, applicationConfigurationGroup, applicationNameText, applicationBrowseButton);
+ useExisting, applicationConfigurationGroup, applicationNameText,
+ applicationBrowseButton);
}
}
+
+ private void resetExistingApplication() {
+ try {
+ pageModel.resetExistingApplication();
+ } catch (OpenShiftException e) {
+ OpenShiftUIActivator.log(e);
+ }
+
+ }
};
}
@@ -647,7 +666,7 @@
loadOpenshiftResources(dbc);
enableApplicationWidgets(
pageModel.isUseExistingApplication()
- , appConfigurationGroup
+ , newAppConfigurationGroup
, existingAppNameText
, browseAppsButton);
}
@@ -752,19 +771,19 @@
class NewApplicationNameValidator extends MultiValidator {
- private final ISWTObservableValue useExistingAppBtnbservable;
- private final ISWTObservableValue applicationNameTextObservable;
+ private final IObservableValue useExistingAppbservable;
+ private final IObservableValue applicationNameObservable;
- public NewApplicationNameValidator(ISWTObservableValue useExistingAppBtnbservable,
- ISWTObservableValue applicationNameTextObservable) {
- this.useExistingAppBtnbservable = useExistingAppBtnbservable;
- this.applicationNameTextObservable = applicationNameTextObservable;
+ public NewApplicationNameValidator(IObservableValue useExistingAppObservable,
+ IObservableValue applicationNameObservable) {
+ this.useExistingAppbservable = useExistingAppObservable;
+ this.applicationNameObservable = applicationNameObservable;
}
@Override
protected IStatus validate() {
- final String applicationName = (String) applicationNameTextObservable.getValue();
- final boolean useExistingApp = (Boolean) useExistingAppBtnbservable.getValue();
+ final String applicationName = (String) applicationNameObservable.getValue();
+ final boolean useExistingApp = (Boolean) useExistingAppbservable.getValue();
if (useExistingApp) {
return ValidationStatus.ok();
}
@@ -774,9 +793,9 @@
}
if (!StringUtils.isAlphaNumeric(applicationName)) {
return OpenShiftUIActivator.createErrorStatus(
- "The application name must not contain spaces.");
+ "The name may only contain letters and numbers.");
}
- if (isExistingApplication(applicationName)) {
+ if (pageModel.isExistingApplication(applicationName)) {
return OpenShiftUIActivator.createErrorStatus(
"An application with the same name already exists on OpenShift.");
}
@@ -787,15 +806,6 @@
return ValidationStatus.ok();
}
- private boolean isExistingApplication(final String applicationName) {
- for (IApplication application : pageModel.getExistingApplications()) {
- if (application.getName().equalsIgnoreCase(applicationName)) {
- return true;
- }
- }
- return false;
- }
-
private boolean isExistingProject(String name) {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
return project.exists();
@@ -804,30 +814,30 @@
@Override
public IObservableList getTargets() {
WritableList targets = new WritableList();
- targets.add(applicationNameTextObservable);
+ targets.add(applicationNameObservable);
return targets;
}
}
class NewApplicationTypeValidator extends MultiValidator {
- private final ISWTObservableValue useExistingAppBtnbservable;
- private final ISWTObservableValue cartridgesComboObservable;
+ private final IObservableValue useExistingAppBtnbservable;
+ private final IObservableValue selectedCartridgeObservable;
- public NewApplicationTypeValidator(ISWTObservableValue useExistingAppBtnbservable,
- ISWTObservableValue cartridgesComboObservable) {
+ public NewApplicationTypeValidator(IObservableValue useExistingAppBtnbservable,
+ IObservableValue selectedCartridgeObservable) {
this.useExistingAppBtnbservable = useExistingAppBtnbservable;
- this.cartridgesComboObservable = cartridgesComboObservable;
+ this.selectedCartridgeObservable = selectedCartridgeObservable;
}
@Override
protected IStatus validate() {
final boolean useExistingApp = (Boolean) useExistingAppBtnbservable.getValue();
- final String cartridge = (String) cartridgesComboObservable.getValue();
+ final String cartridge = (String) selectedCartridgeObservable.getValue();
if (useExistingApp) {
return ValidationStatus.ok();
}
- if (cartridge == null || cartridge.isEmpty()) {
+ if (StringUtils.isEmpty(cartridge)) {
return OpenShiftUIActivator.createCancelStatus(
"Select an alphanumerical name and a type for the application to create.");
}
@@ -837,7 +847,7 @@
@Override
public IObservableList getTargets() {
WritableList targets = new WritableList();
- targets.add(cartridgesComboObservable);
+ targets.add(selectedCartridgeObservable);
return targets;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-02-15 15:57:46 UTC (rev 38761)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-02-15 16:01:31 UTC (rev 38762)
@@ -50,18 +50,12 @@
private List<IApplication> existingApplications = null;
private List<ICartridge> cartridges = new ArrayList<ICartridge>();
private List<IEmbeddableCartridge> embeddableCartridges = new ArrayList<IEmbeddableCartridge>();
- // private String applicationName;
- private ICartridge selectedCartridge;
private String existingApplicationName;
- // private boolean useExistingApplication;
-
- public ApplicationConfigurationWizardPageModel(OpenShiftExpressApplicationWizardModel wizardModel) throws OpenShiftException {
+ public ApplicationConfigurationWizardPageModel(OpenShiftExpressApplicationWizardModel wizardModel)
+ throws OpenShiftException {
this.wizardModel = wizardModel;
setExistingApplication(wizardModel.getApplication());
- // setUseExistingApplication(wizardModel.isExistingApplication());
- // setExistingApplicationName(wizardModel.getApplication() != null ?
- // wizardModel.getApplication().getName() : null);
}
/**
@@ -107,6 +101,10 @@
, wizardModel.setUseExistingApplication(useExistingApplication));
}
+ protected void setUseExistingApplication(IApplication application) {
+ setUseExistingApplication(application != null);
+ }
+
public String getExistingApplicationName() {
return existingApplicationName;
}
@@ -117,6 +115,14 @@
, this.existingApplicationName = applicationName);
}
+ protected void setExistingApplicationName(IApplication application) {
+ String applicationName = null;
+ if (application != null) {
+ applicationName = application.getName();
+ }
+ setExistingApplicationName(applicationName);
+ }
+
public void loadExistingApplications() throws OpenShiftException {
IUser user = getUser();
if (user != null) {
@@ -131,6 +137,15 @@
return existingApplications;
}
+ public boolean isExistingApplication(String applicationName) {
+ for (IApplication application : getExistingApplications()) {
+ if (application.getName().equalsIgnoreCase(applicationName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* @param existingApplications
* the existingApplications to set
@@ -154,14 +169,23 @@
}
public ICartridge getSelectedCartridge() {
- return selectedCartridge;
+ return wizardModel.getApplicationCartridge();
}
public void setSelectedCartridge(ICartridge cartridge) {
- wizardModel.setApplicationCartridge(cartridge);
- firePropertyChange(PROPERTY_SELECTED_CARTRIDGE, selectedCartridge, this.selectedCartridge = cartridge);
+ firePropertyChange(PROPERTY_SELECTED_CARTRIDGE
+ , wizardModel.getApplicationCartridge()
+ , wizardModel.setApplicationCartridge(cartridge));
}
+ protected void setSelectedCartridge(IApplication application) {
+ ICartridge applicationCartridge = null;
+ if (application != null) {
+ applicationCartridge = application.getCartridge();
+ }
+ setSelectedCartridge(applicationCartridge);
+ }
+
public List<IEmbeddableCartridge> loadEmbeddableCartridges() throws OpenShiftException {
// List<IEmbeddableCartridge> cartridges =
// OpenShiftUIActivator.getDefault().getUser().getEmbeddableCartridges();
@@ -171,33 +195,32 @@
}
public void setExistingApplication(IApplication application) throws OpenShiftException {
- if (application == null) {
- return;
- }
+ // setUseExistingApplication(application);
+ setExistingApplicationName(application);
+ setApplicationName(application);
+ setSelectedCartridge(application);
+ setSelectedEmbeddableCartridges(application);
wizardModel.setApplication(application);
- setExistingApplicationName(application.getName());
- setApplicationName(application.getName());
- setSelectedCartridge(application.getCartridge());
- Set<IEmbeddableCartridge> embeddedCartridges = new HashSet<IEmbeddableCartridge>();
- embeddedCartridges.addAll(application.getEmbeddedCartridges());
- setSelectedEmbeddableCartridges(embeddedCartridges);
}
- public void resetExistingApplication() {
- wizardModel.setApplication(null);
- setExistingApplicationName(null);
- setApplicationName(null);
- setSelectedCartridge(null);
- setSelectedEmbeddableCartridges(new HashSet<IEmbeddableCartridge>());
+ public void resetExistingApplication() throws OpenShiftException {
+ setExistingApplication(null);
}
public void setApplicationName(String applicationName) {
- wizardModel.setApplicationName(applicationName);
firePropertyChange(PROPERTY_APPLICATION_NAME
, wizardModel.getApplicationName()
, wizardModel.setApplicationName(applicationName));
}
+ protected void setApplicationName(IApplication application) {
+ String applicationName = null;
+ if (application != null) {
+ applicationName = application.getName();
+ }
+ setApplicationName(applicationName);
+ }
+
public String getApplicationName() {
return wizardModel.getApplicationName();
}
@@ -221,6 +244,14 @@
wizardModel.setSelectedEmbeddableCartridges(selectedEmbeddableCartridges));
}
+ protected void setSelectedEmbeddableCartridges(IApplication application) throws OpenShiftException {
+ HashSet<IEmbeddableCartridge> selectedEmbeddableCartridges = new HashSet<IEmbeddableCartridge>();
+ if (application != null) {
+ selectedEmbeddableCartridges.addAll(application.getEmbeddedCartridges());
+ }
+ setSelectedEmbeddableCartridges(selectedEmbeddableCartridges);
+ }
+
public boolean hasApplication(ICartridge cartridge) {
try {
return getUser().hasApplication(cartridge);
@@ -238,5 +269,4 @@
public IApplication createJenkinsApplication(String name, IProgressMonitor monitor) throws OpenShiftException {
return wizardModel.createApplication(name, ICartridge.JENKINS_14, monitor);
}
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java 2012-02-15 15:57:46 UTC (rev 38761)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java 2012-02-15 16:01:31 UTC (rev 38762)
@@ -17,11 +17,17 @@
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.validation.MultiValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -37,6 +43,9 @@
import org.jboss.tools.common.ui.databinding.InvertingBooleanConverter;
import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
+import org.jboss.tools.openshift.egit.core.EGitUtils;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
/**
* @author Andre Dietisheim
@@ -88,10 +97,10 @@
final Text repoPathText = new Text(cloneGroup, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
.applyTo(repoPathText);
- final IObservableValue repoPathTextObservable = WidgetProperties.text(SWT.Modify).observe(repoPathText);
+ final IObservableValue repoPathObservable = WidgetProperties.text(SWT.Modify).observe(repoPathText);
final IObservableValue repoPathModelObservable =
BeanProperties.value(GitCloningSettingsWizardPageModel.PROPERTY_REPO_PATH).observe(pageModel);
- ValueBindingBuilder.bind(repoPathTextObservable).to(repoPathModelObservable).in(dbc);
+ ValueBindingBuilder.bind(repoPathObservable).to(repoPathModelObservable).in(dbc);
Button browseRepoPathButton = new Button(cloneGroup, SWT.PUSH);
browseRepoPathButton.setText("Browse");
@@ -99,11 +108,11 @@
.align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseRepoPathButton);
browseRepoPathButton.addSelectionListener(onRepoPath());
- final IObservableValue useDefaultRepoButtonSelectionObservable =
+ final IObservableValue isDefaultRepoObservable =
WidgetProperties.selection().observe(useDefaultRepoPathButton);
final IObservableValue useDefaultRepoModelObservable = BeanProperties.value(
GitCloningSettingsWizardPageModel.PROPERTY_USE_DEFAULT_REPO_PATH).observe(pageModel);
- ValueBindingBuilder.bind(useDefaultRepoButtonSelectionObservable).to(useDefaultRepoModelObservable).in(dbc);
+ ValueBindingBuilder.bind(isDefaultRepoObservable).to(useDefaultRepoModelObservable).in(dbc);
ValueBindingBuilder.bind(WidgetProperties.enabled().observe(repoPathText))
.notUpdating(useDefaultRepoModelObservable).converting(new InvertingBooleanConverter()).in(dbc);
ValueBindingBuilder.bind(WidgetProperties.enabled().observe(browseRepoPathButton))
@@ -118,11 +127,14 @@
}
});
- IObservableValue repoPathValidityObservable = BeanProperties.value(
- GitCloningSettingsWizardPageModel.PROPERTY_CUSTOM_REPO_PATH_VALIDITY).observe(pageModel);
- dbc.addValidationStatusProvider(new RepoPathValidationStatusProvider(repoPathValidityObservable,
- repoPathTextObservable));
+// IObservableValue repoPathValidityObservable = BeanProperties.value(
+// GitCloningSettingsWizardPageModel.PROPERTY_CUSTOM_REPO_PATH_VALIDITY).observe(pageModel);
+// dbc.addValidationStatusProvider(
+// new RepoPathValidationStatusProvider(isDefaultRepoObservable, repoPathObservable));
+ dbc.addValidationStatusProvider(
+ new RepoPathValidationStatusProvider(isDefaultRepoObservable, repoPathObservable));
+
// Remote Name Management
useDefaultRemoteNameButton = new Button(cloneGroup, SWT.CHECK);
useDefaultRemoteNameButton.setText("Use default remote name");
@@ -142,13 +154,12 @@
BeanProperties.value(GitCloningSettingsWizardPageModel.PROPERTY_REMOTE_NAME).observe(pageModel);
ValueBindingBuilder.bind(remoteNameTextObservable).to(remoteNameModelObservable).in(dbc);
- final IObservableValue useDefaultRemoteNameButtonSelectionObservable =
+ final IObservableValue useDefaultRemoteNameObservable =
WidgetProperties.selection().observe(useDefaultRemoteNameButton);
final IObservableValue useDefaultRemoteNameModelObservable =
BeanProperties.value(GitCloningSettingsWizardPageModel.PROPERTY_USE_DEFAULT_REMOTE_NAME).observe(
pageModel);
-
- ValueBindingBuilder.bind(useDefaultRemoteNameButtonSelectionObservable).to(useDefaultRemoteNameModelObservable)
+ ValueBindingBuilder.bind(useDefaultRemoteNameObservable).to(useDefaultRemoteNameModelObservable)
.in(dbc);
ValueBindingBuilder
.bind(WidgetProperties.enabled().observe(remoteNameText))
@@ -156,11 +167,16 @@
// move focus to the project name text control when choosing the 'Use an
// existing project' option.
useDefaultRemoteNameButton.addSelectionListener(onDefaultRemoteNameUnchecked());
- IObservableValue remoteNameValidityObservable = BeanProperties.value(
- GitCloningSettingsWizardPageModel.PROPERTY_CUSTOM_REMOTE_NAME_VALIDITY).observe(pageModel);
- dbc.addValidationStatusProvider(new RemoteNameValidationStatusProvider(remoteNameValidityObservable,
- remoteNameTextObservable));
+ // IObservableValue remoteNameValidityObservable = BeanProperties.value(
+ // GitCloningSettingsWizardPageModel.PROPERTY_CUSTOM_REMOTE_NAME_VALIDITY).observe(pageModel);
+ // dbc.addValidationStatusProvider(new
+ // RemoteNameValidationStatusProvider(remoteNameValidityObservable,
+ // remoteNameTextObservable));
+ dbc.addValidationStatusProvider(
+ new RemoteNameValidationStatusProvider(
+ useDefaultRemoteNameObservable, remoteNameTextObservable));
+
Link sshPrefsLink = new Link(parent, SWT.NONE);
sshPrefsLink.setText("Make sure your SSH key used with the domain is listed in <a>SSH2 Preferences</a>.");
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).indent(10, 0)
@@ -218,7 +234,7 @@
// allow to enable a proj only for as7 openshift applications
// setTitle(NLS.bind("Import OpenShift application {0}",
// pageModel.getApplicationName()));
-// pageModel.resetRepositoryPath();
+ // pageModel.resetRepositoryPath();
pageModel.resetRemoteName();
if (pageModel.isNewProject()) {
useDefaultRepoPathButton.setEnabled(true);
@@ -247,66 +263,126 @@
*/
}
+ /**
+ * A multivalidator for the repo path. Validates the repo path on behalf of
+ * the selection to use the default repo path and the repo path value.
+ */
class RepoPathValidationStatusProvider extends MultiValidator {
- private final IObservableValue repoPathValidityObservable;
+ private final IObservableValue isDefaultRepoPathObservable;
+ private final IObservableValue repoPathObservable;
- private final IObservableValue repoPathTextObservable;
-
- public RepoPathValidationStatusProvider(IObservableValue repoPathValidityObservable,
- IObservableValue repoPathTextObservable) {
- this.repoPathValidityObservable = repoPathValidityObservable;
- this.repoPathTextObservable = repoPathTextObservable;
+ public RepoPathValidationStatusProvider(IObservableValue isDefaultRepoPathObservable,
+ IObservableValue repoPathObservable) {
+ this.isDefaultRepoPathObservable = isDefaultRepoPathObservable;
+ this.repoPathObservable = repoPathObservable;
}
@Override
protected IStatus validate() {
- final IStatus repoPathValidityStatus = (IStatus) repoPathValidityObservable.getValue();
+ Boolean isDefaultRepoPath = (Boolean) isDefaultRepoPathObservable.getValue();
+ String repoPath = (String) repoPathObservable.getValue();
- if (repoPathValidityStatus != null) {
- return repoPathValidityStatus;
+ // skip the validation if the user wants to create a new project.
+ // The
+ // name and state of the existing project do
+ // not matter...
+ String applicationName = pageModel.getApplicationName();
+ if (applicationName == null
+ || applicationName.length() == 0) {
+ return OpenShiftUIActivator
+ .createCancelStatus("You have to choose an application name / existing application");
}
+
+ if (isDefaultRepoPath == null
+ || !isDefaultRepoPath) {
+ final IPath repoResourcePath = new Path(repoPath);
+ if (repoResourcePath.isEmpty()
+ || !repoResourcePath.isAbsolute()
+ || !repoResourcePath.toFile().canWrite()) {
+ return OpenShiftUIActivator.createErrorStatus("The path does not exist or is not writeable.");
+ }
+ final IPath applicationPath = repoResourcePath.append(new Path(applicationName));
+ if (applicationPath.toFile().exists()) {
+ return OpenShiftUIActivator.createErrorStatus(
+ NLS.bind("The location \"{0}\" already contains a folder named \"{1}\"",
+ repoResourcePath.toOSString(), applicationName));
+ }
+ }
+
return ValidationStatus.ok();
}
@Override
public IObservableList getTargets() {
WritableList targets = new WritableList();
- targets.add(repoPathTextObservable);
+ targets.add(repoPathObservable);
return targets;
}
}
+ /**
+ * A multi validator that validates the remote name on behalf of the
+ * selection to use the default remote name and the remote name value.
+ */
class RemoteNameValidationStatusProvider extends MultiValidator {
- private final IObservableValue remoteNameValidityObservable;
+ private final IObservableValue isDefaultRemoteNameObservable;
+ private final IObservableValue remoteNameObservable;
- private final IObservableValue remoteNameTextObservable;
-
- public RemoteNameValidationStatusProvider(IObservableValue remoteNameValidityObservable,
+ public RemoteNameValidationStatusProvider(IObservableValue isDefaultRemoteName,
IObservableValue remoteNameTextObservable) {
- this.remoteNameValidityObservable = remoteNameValidityObservable;
- this.remoteNameTextObservable = remoteNameTextObservable;
+ this.isDefaultRemoteNameObservable = isDefaultRemoteName;
+ this.remoteNameObservable = remoteNameTextObservable;
}
@Override
protected IStatus validate() {
- final IStatus remoteNameValidityStatus = (IStatus) remoteNameValidityObservable.getValue();
+ IStatus status = Status.OK_STATUS;
+ Boolean isDefaultRemoteName = (Boolean) isDefaultRemoteNameObservable.getValue();
+ String remoteName = (String) remoteNameObservable.getValue();
- if (remoteNameValidityStatus != null) {
- return remoteNameValidityStatus;
+ // skip the validation if the user wants to create a new project.
+ // The name and state of the existing project do
+ // not matter...
+ if (isDefaultRemoteName == null
+ || !isDefaultRemoteName) {
+ if (StringUtils.isEmpty(remoteName)) {
+ return OpenShiftUIActivator.createErrorStatus(
+ "The custom remote name must not be empty.");
+ } else if (!remoteName.matches("\\S+")) {
+ return OpenShiftUIActivator.createErrorStatus(
+ "The custom remote name must not contain spaces.");
+ } else if (hasRemoteName(remoteName, pageModel.getProject())) {
+ return OpenShiftUIActivator.createErrorStatus(NLS.bind(
+ "The existing project already has a remote named {0}.", remoteName));
+ }
}
- return ValidationStatus.ok();
+ return status;
}
+ private boolean hasRemoteName(String remoteName, IProject project) {
+ try {
+ if (project == null
+ || !project.isAccessible()) {
+ return false;
+ }
+
+ Repository repository = EGitUtils.getRepository(project);
+ return EGitUtils.hasRemote(remoteName, repository);
+ } catch (Exception e) {
+ OpenShiftUIActivator.log(OpenShiftUIActivator.createErrorStatus(e.getMessage(), e));
+ return false;
+ }
+ }
+
@Override
public IObservableList getTargets() {
WritableList targets = new WritableList();
- targets.add(remoteNameTextObservable);
+ targets.add(remoteNameObservable);
return targets;
}
-
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-02-15 15:57:46 UTC (rev 38761)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-02-15 16:01:31 UTC (rev 38762)
@@ -15,16 +15,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.osgi.util.NLS;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import com.openshift.express.client.IApplication;
import com.openshift.express.client.ICartridge;
@@ -43,30 +35,12 @@
public static final String PROPERTY_REPO_PATH = "repositoryPath";
public static final String PROPERTY_REMOTE_NAME = "remoteName";
public static final String PROPERTY_LOADING = "loading";
-
- public static final String CREATE_SERVER = "createServer";
- public static final String MODE = "serverMode";
- public static final String MODE_SOURCE = "serverModeSource";
- public static final String MODE_BINARY = "serverModeBinary";
- public static final String SERVER_TYPE = "serverType";
-
public static final String PROPERTY_USE_DEFAULT_REPO_PATH = "useDefaultRepoPath";
-
- public static final String PROPERTY_CUSTOM_REPO_PATH_VALIDITY = "customRepoPathValidity";
-
public static final String PROPERTY_USE_DEFAULT_REMOTE_NAME = "useDefaultRemoteName";
- public static final String PROPERTY_CUSTOM_REMOTE_NAME_VALIDITY = "customRemoteNameValidity";
-
private IOpenShiftExpressWizardModel wizardModel;
private boolean loading;
-
private boolean useDefaultRepoPath = true;
-
- private IStatus customRepoPathValidity = null;
-
- private IStatus customRemoteNameValidity = null;
-
private boolean useDefaultRemoteName = true;
public GitCloningSettingsWizardPageModel(IOpenShiftExpressWizardModel wizardModel) {
@@ -135,8 +109,6 @@
public void setRepositoryPath(String repositoryPath) {
firePropertyChange(PROPERTY_REPO_PATH, wizardModel.getRepositoryPath(),
wizardModel.setRepositoryPath(repositoryPath));
- validateRepoPathProject();
-
}
// public void resetRepositoryPath() {
@@ -147,17 +119,21 @@
// }
public void resetRemoteName() {
- // if existing project and remote name is still 'origin' -> switch to
- // 'openshift'
- // (so, if existing project and remote name is not 'origin', leave as-is
- if (!wizardModel.isNewProject() && NEW_PROJECT_REMOTE_NAME_DEFAULT.equals(getRemoteName())) {
- setRemoteName(EXISTING_PROJECT_REMOTE_NAME_DEFAULT);
+ if (!wizardModel.isNewProject()) {
+ // if existing project and remote name is still 'origin'
+ // -> switch to 'openshift' (leave as is if existing project and
+ // remote name != 'origin')
+ if (NEW_PROJECT_REMOTE_NAME_DEFAULT.equals(getRemoteName())) {
+ setRemoteName(EXISTING_PROJECT_REMOTE_NAME_DEFAULT);
+ }
+ } else {
+ // if new project and remote name is not 'origin'
+ // -> restore 'origin'
+ if (!NEW_PROJECT_REMOTE_NAME_DEFAULT.equals(getRemoteName())) {
+ setUseDefaultRemoteName(true);
+ setRemoteName(NEW_PROJECT_REMOTE_NAME_DEFAULT);
+ }
}
- // if new project and remote name is not 'origin' -> restore 'origin'
- else if (wizardModel.isNewProject() && !NEW_PROJECT_REMOTE_NAME_DEFAULT.equals(getRemoteName())) {
- setUseDefaultRemoteName(true);
- setRemoteName(NEW_PROJECT_REMOTE_NAME_DEFAULT);
- }
}
private String getDefaultRepositoryPath() {
@@ -170,7 +146,6 @@
public void setRemoteName(String remoteName) {
firePropertyChange(PROPERTY_REMOTE_NAME, wizardModel.getRemoteName(), wizardModel.setRemoteName(remoteName));
- validateRemoteName();
}
public boolean isLoading() {
@@ -187,147 +162,34 @@
&& application.getCartridge().equals(cartridge);
}
- public static class GitUri {
-
- private String label;
- private String gitUri;
- private ICartridge cartridge;
-
- private GitUri(String label, String gitUri, ICartridge cartridge) {
- this.label = label;
- this.gitUri = gitUri;
- this.cartridge = cartridge;
- }
-
- public String getLabel() {
- return label;
- }
-
- public String getGitUri() {
- return gitUri;
- }
-
- public String toString() {
- return getLabel();
- }
-
- public ICartridge getCartridge() {
- return cartridge;
- }
-
- public boolean isCompatible(ICartridge cartridge) {
- return this.cartridge.equals(cartridge);
- }
- }
-
public void setUseDefaultRepoPath(boolean useDefaultRepoPath) {
- firePropertyChange(PROPERTY_USE_DEFAULT_REPO_PATH, useDefaultRepoPath,
- this.useDefaultRepoPath = useDefaultRepoPath);
- if (this.useDefaultRepoPath) {
+ firePropertyChange(PROPERTY_USE_DEFAULT_REPO_PATH
+ , this.useDefaultRepoPath
+ , this.useDefaultRepoPath = useDefaultRepoPath);
+ if (useDefaultRepoPath) {
setRepositoryPath(getDefaultRepositoryPath());
- } else {
-
}
- validateRepoPathProject();
}
public boolean isUseDefaultRepoPath() {
return useDefaultRepoPath;
}
- private IStatus validateRepoPathProject() {
- IStatus status = Status.OK_STATUS;
- // skip the validation if the user wants to create a new project. The
- // name and state of the existing project do
- // not matter...
- String applicationName = getApplicationName();
- if (applicationName == null
- || applicationName.length() == 0) {
- status = OpenShiftUIActivator
- .createCancelStatus("You have to choose an application name / existing application");
- } else {
- if (!isUseDefaultRepoPath()) {
- final IPath repoPath = new Path(getRepositoryPath());
- if (repoPath.isEmpty()
- || !repoPath.isAbsolute()
- || !repoPath.toFile().canWrite()) {
- status = OpenShiftUIActivator.createErrorStatus("The path does not exist or is not writeable.");
- } else {
- final IPath applicationPath = repoPath.append(new Path(getApplicationName()));
- if (applicationPath.toFile().exists()) {
- status = OpenShiftUIActivator.createErrorStatus(
- "The location '" + repoPath.toOSString() + "' already contains a folder named '"
- + getApplicationName() + "'.");
- }
- }
- }
- }
-
- setCustomRepoPathValidity(status);
- return status;
- }
-
- public void setCustomRepoPathValidity(IStatus status) {
- firePropertyChange(PROPERTY_CUSTOM_REPO_PATH_VALIDITY, this.customRepoPathValidity,
- this.customRepoPathValidity = status);
- }
-
- public IStatus getCustomRepoPathValidity() {
- return this.customRepoPathValidity;
- }
-
public void setUseDefaultRemoteName(boolean useDefaultRemoteName) {
firePropertyChange(PROPERTY_USE_DEFAULT_REMOTE_NAME, useDefaultRemoteName,
this.useDefaultRemoteName = useDefaultRemoteName);
if (useDefaultRemoteName) {
- setRemoteName(isNewProject() ? NEW_PROJECT_REMOTE_NAME_DEFAULT : EXISTING_PROJECT_REMOTE_NAME_DEFAULT);
+ // setRemoteName(isNewProject() ? NEW_PROJECT_REMOTE_NAME_DEFAULT :
+ // EXISTING_PROJECT_REMOTE_NAME_DEFAULT);
+ resetRemoteName();
}
- validateRemoteName();
}
public boolean isUseDefaultRemoteName() {
return useDefaultRemoteName;
}
- private IStatus validateRemoteName() {
- IStatus status = Status.OK_STATUS;
- // skip the validation if the user wants to create a new project. The
- // name and state of the existing project do
- // not matter...
- if (!isUseDefaultRemoteName()) {
- final String remoteName = getRemoteName();
- if (remoteName == null || remoteName.isEmpty()) {
- status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "The custom remote name must not be empty.");
- } else if (!remoteName.matches("\\S+")) {
- status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "The custom remote name must not contain spaces.");
- } else if (hasRemoteName(remoteName, getProject())) {
- status = new Status(IStatus.ERROR,
- OpenShiftUIActivator.PLUGIN_ID, NLS.bind(
- "The existing project already has a remote named {0}.", remoteName));
- }
- }
- setCustomRemoteNameValidity(status);
- return status;
- }
-
- private boolean hasRemoteName(String remoteName, IProject project) {
- try {
- if (project == null
- || !project.isAccessible()) {
- return false;
- }
-
- Repository repository = EGitUtils.getRepository(project);
- return EGitUtils.hasRemote(remoteName, repository);
- } catch (Exception e) {
- OpenShiftUIActivator.log(OpenShiftUIActivator.createErrorStatus(e.getMessage(), e));
- return false;
- }
- }
-
- private IProject getProject() {
+ public IProject getProject() {
String projectName = wizardModel.getProjectName();
if (projectName == null) {
return null;
@@ -336,13 +198,4 @@
return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
}
- public void setCustomRemoteNameValidity(IStatus status) {
- firePropertyChange(PROPERTY_CUSTOM_REMOTE_NAME_VALIDITY, this.customRemoteNameValidity,
- this.customRemoteNameValidity = status);
- }
-
- public IStatus getCustomRemoteNameValidity() {
- return this.customRemoteNameValidity;
- }
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java 2012-02-15 15:57:46 UTC (rev 38761)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java 2012-02-15 16:01:31 UTC (rev 38762)
@@ -139,7 +139,7 @@
public String getApplicationName();
- public void setApplicationCartridge(ICartridge cartridge);
+ public ICartridge setApplicationCartridge(ICartridge cartridge);
public ICartridge getApplicationCartridge();
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-02-15 15:57:46 UTC (rev 38761)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-02-15 16:01:31 UTC (rev 38762)
@@ -379,15 +379,15 @@
}
@Override
- public void setApplicationCartridge(ICartridge cartridge) {
- dataModel.put(APPLICATION_CARTRIDGE, cartridge);
+ public ICartridge setApplicationCartridge(ICartridge cartridge) {
+ return (ICartridge) dataModel.put(APPLICATION_CARTRIDGE, cartridge);
}
protected void setApplicationCartridge(IApplication application) {
if (application == null) {
return;
}
- dataModel.put(APPLICATION_CARTRIDGE, application.getCartridge());
+ setApplicationCartridge(application.getCartridge());
}
@Override
@@ -404,7 +404,7 @@
if (application == null) {
return;
}
- dataModel.put(APPLICATION_NAME, application.getName());
+ setApplicationName(application.getName());
}
@Override
14 years, 1 month
JBoss Tools SVN: r38760 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-02-15 10:51:46 -0500 (Wed, 15 Feb 2012)
New Revision: 38760
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
Log:
https://issues.jboss.org/browse/JBIDE-10913
Make execute and reset methods synchronized
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2012-02-15 14:37:20 UTC (rev 38759)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2012-02-15 15:51:46 UTC (rev 38760)
@@ -102,7 +102,7 @@
return prefs.getName();
}
- public Object execute(Command c) {
+ public synchronized Object execute(Command c) {
if (executionContext != null) {
return executionContext.execute(c);
}
@@ -116,7 +116,7 @@
* Reset configuration, session factory, class loader and execution context.
*
*/
- public boolean reset() {
+ public synchronized boolean reset() {
boolean resetted = false;
// resetting state
if (getHibernateExtension() != null ) {
14 years, 1 month